Skip to content
This repository was archived by the owner on Jun 15, 2019. It is now read-only.

Commit accf980

Browse files
committed
feat(build): The format and layout of built artifacts and deployment plans were changed
This change actually occurs in previous commits.
1 parent ecaf75c commit accf980

File tree

8 files changed

+83
-549
lines changed

8 files changed

+83
-549
lines changed

.releaserc.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
"plugins": [
33
"@semantic-release/commit-analyzer",
44
"@semantic-release/release-notes-generator",
5-
"@semantic-release/npm",
65
["@semantic-release/github", {
76
"assets": [
8-
{"path": "dist/bundle.umd.js", "label": "Suitable for use in browser via script tag: `<script src=\"...\">`"},
9-
{"path": "dist/bundle.umd.js.map", "label": "The source-map for `bundle.umd.js`"},
7+
{"path": "dist/bundle.umd.js", "label": "1. bundle.umd.js (Use it in browser and via script tag: <script src=\"...\">)"},
8+
{"path": "dist/bundle.umd.js.map", "label": "1. bundle.umd.js.map"},
109

11-
{"path": "dist/bundle.esm.js", "label": "Suitable for use in browser via ES6-module-import: `import TextWrapper from '...'` (or: `<script src=\"...\" type=\"module\">`)"},
12-
{"path": "dist/bundle.esm.js.map", "label": "The source-map for `bundle.esm.js`"},
10+
{"path": "dist/bundle.esm.js", "label": "2. bundle.esm.js (Use it in browser and via ES6-module-import-system: [import ... from '...'] (or: <script src=\"...\" type=\"module\">))"},
11+
{"path": "dist/bundle.esm.js.map", "label": "2. bundle.esm.js.map"},
1312

14-
{"path": "dist/main.umd.js", "label": "Suitable for Node.js projects (and any other UMD-compatible environment that can resolve dependencies)\nThis one has been published on [NPM](https://www.npmjs.com/package/@live-html-editor/text-wrap) and you can install it with `npm install ...`."},
15-
{"path": "dist/main.umd.js.map", "label": "The source-map for `main.umd.js`"}
13+
{"path": "dist/main.umd.js", "label": "3. main.umd.js (This is the one has been published on npm.js and you can install it with [npm install ...])"},
14+
{"path": "dist/main.umd.js.map", "label": "3. main.umd.js.map"}
1615
]
1716
}]
1817
]

.travis.yml

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,64 @@ cache: npm
55
jobs:
66
include:
77
- stage: "Unit Tests"
8+
89
name: "Unit Test (11)"
9-
if: type == push && tag !~ ^v\d+\.\d+\.\d+ && commit_message =~ /^(test|feat|fix|refactor|pref|revert)\(/
1010
node_js: "11"
11-
before_script: echo -e "BUILD_DIR = $TRAVIS_BUILD_DIR\nBUILD_ID = $TRAVIS_BUILD_ID\nBUILD_NUMBER = $TRAVIS_BUILD_NUMBER\nBUILD_WEB_URL = $TRAVIS_BUILD_WEB_URL\nCOMMIT = $TRAVIS_COMMIT\nCOMMIT_MESSAGE = $TRAVIS_COMMIT_MESSAGE\nCOMMIT_RANGE = $TRAVIS_COMMIT_RANGE\nDEBUG_MODE = $TRAVIS_DEBUG_MODE\nEVENT_TYPE = $TRAVIS_EVENT_TYPE\nJOB_ID = $TRAVIS_JOB_ID\nJOB_NAME = $TRAVIS_JOB_NAME\nJOB_NUMBER = $TRAVIS_JOB_NUMBER\nJOB_WEB_URL = $TRAVIS_JOB_WEB_URL\nOS_NAME = $TRAVIS_OS_NAME\nOSX_IMAGE = $TRAVIS_OSX_IMAGE\nPULL_REQUEST = $TRAVIS_PULL_REQUEST\nPULL_REQUEST_BRANCH= $TRAVIS_PULL_REQUEST_BRANCH\nPULL_REQUEST_SHA = $TRAVIS_PULL_REQUEST_SHA\nPULL_REQUEST_SLUG = $TRAVIS_PULL_REQUEST_SLUG\nSECURE_ENV_VARS = $TRAVIS_SECURE_ENV_VARS\nSUDO = $TRAVIS_SUDO\nTEST_RESULT = $TRAVIS_TEST_RESULT\nTAG = $TRAVIS_TAG\nBUILD_STAGE_NAME = $TRAVIS_BUILD_STAGE_NAME"
11+
12+
if: env(UNIT_TEST_11) && type == push && tag !~ ^v\d+\.\d+\.\d+ &&
13+
commit_message =~ /^(test|feat|fix|refactor|pref|revert)\(/
14+
1215
script: npm run test:unit:prod
16+
#--------------------------------------------------------------------------------------#
17+
1318
- name: "Unit Test (10) + Report Coverage"
14-
if: type == push && tag !~ ^v\d+\.\d+\.\d+ && commit_message =~ /^(test|feat|fix|refactor|pref|revert)\(/
1519
node_js: "10"
20+
21+
if: env(UNIT_TEST_10) && type == push && tag !~ ^v\d+\.\d+\.\d+ &&
22+
commit_message =~ /^(test|feat|fix|refactor|pref|revert)\(/
23+
24+
# For debug purposes:
25+
before_script: echo -e "BUILD_DIR = $TRAVIS_BUILD_DIR\nBUILD_ID = $TRAVIS_BUILD_ID\nBUILD_NUMBER = $TRAVIS_BUILD_NUMBER\nBUILD_WEB_URL = $TRAVIS_BUILD_WEB_URL\nCOMMIT = $TRAVIS_COMMIT\nCOMMIT_MESSAGE = $TRAVIS_COMMIT_MESSAGE\nCOMMIT_RANGE = $TRAVIS_COMMIT_RANGE\nDEBUG_MODE = $TRAVIS_DEBUG_MODE\nEVENT_TYPE = $TRAVIS_EVENT_TYPE\nJOB_ID = $TRAVIS_JOB_ID\nJOB_NAME = $TRAVIS_JOB_NAME\nJOB_NUMBER = $TRAVIS_JOB_NUMBER\nJOB_WEB_URL = $TRAVIS_JOB_WEB_URL\nOS_NAME = $TRAVIS_OS_NAME\nOSX_IMAGE = $TRAVIS_OSX_IMAGE\nPULL_REQUEST = $TRAVIS_PULL_REQUEST\nPULL_REQUEST_BRANCH= $TRAVIS_PULL_REQUEST_BRANCH\nPULL_REQUEST_SHA = $TRAVIS_PULL_REQUEST_SHA\nPULL_REQUEST_SLUG = $TRAVIS_PULL_REQUEST_SLUG\nSECURE_ENV_VARS = $TRAVIS_SECURE_ENV_VARS\nSUDO = $TRAVIS_SUDO\nTEST_RESULT = $TRAVIS_TEST_RESULT\nTAG = $TRAVIS_TAG\nBUILD_STAGE_NAME = $TRAVIS_BUILD_STAGE_NAME"
26+
1627
script: npm run test:unit:prod
17-
after_success: npx codecov
28+
after_success: >-
29+
if [ $CODECOV == true ]; then
30+
npx codecov;
31+
else
32+
echo CODECOV IS DISABLED;
33+
fi
34+
35+
########################################################################################
1836

1937
- stage: "Release"
38+
2039
name: "Build and Release"
21-
if: type == push && tag !~ ^v\d+\.\d+\.\d+ && branch == master &&
22-
commit_message =~ /^((feat|fix|refactor|pref|build|revert)\(|test\((?i)[\s\S]*?\b(E2E|END-TO-END|END2END)\b)/ # https://regex101.com/r/XWKT5J/1/
23-
script: npm run build:prod
24-
after_success: npm run test:e2e
2540
node_js: lts/*
41+
42+
if: env(BUILD_AND_RELEASE) && type == push && tag !~ ^v\d+\.\d+\.\d+ && branch == master &&
43+
commit_message =~ /^((feat|fix|refactor|pref|build|revert)\(|test\((?i)[\s\S]*?\b(E2E|END-TO-END|END2END)\b)/ # https://regex101.com/r/XWKT5J/1/
44+
45+
script: >-
46+
if [[ $E2E_TEST == true || $SEMANTIC_RELEASE == true ]]; then
47+
npm run build:prod && (
48+
if [ $E2E_TEST == true ]; then
49+
npm i -g puppeteer && npm link puppeteer && npm run test:e2e;
50+
else
51+
echo E2E-TEST IS DISABLED;
52+
fi
53+
);
54+
else
55+
echo ALL BUILD STEPS ARE DISABLED;
56+
fi
57+
2658
deploy:
2759
provider: script
2860
skip_cleanup: true
29-
script: npx semantic-release
61+
62+
# Sub-shell is required for the script in `deploy` section:
63+
script: bash -c "
64+
if [ $SEMANTIC_RELEASE == true ]; then
65+
npx semantic-release;
66+
else
67+
echo SEMANTIC-RELEASE IS DISABLED;
68+
fi"

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
<img src="https://david-dm.org/live-html-editor/textwrap/dev-status.svg" alt="devDependency Status">
2323
</a>
2424
<br>
25-
<a href="https://github.com/live-html-editor/TextWrap/blob/master/LICENSE">
26-
<img alt="GitHub" src="https://img.shields.io/github/license/live-html-editor/TextWrap.svg">
27-
</a>
2825
<a href="http://commitizen.github.io/cz-cli/">
2926
<img alt="Commitizen friendly" src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg">
3027
</a>
@@ -34,6 +31,10 @@
3431
<a href="https://github.com/live-html-editor/TextWrap">
3532
<img src="https://img.shields.io/github/stars/live-html-editor/TextWrap.svg?style=social" alt="GitHub stars">
3633
</a>
34+
<br>
35+
<a href="https://github.com/live-html-editor/TextWrap/blob/master/LICENSE">
36+
<img alt="GitHub" src="https://img.shields.io/github/license/live-html-editor/TextWrap.svg">
37+
</a>
3738
</p>
3839

3940
<h1 dir="auto">

jest/e2e/config/setup.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ const path = require('path')
99
const url = require('url')
1010
const http = require('http')
1111

12-
const puppeteer = require('puppeteer')
12+
// noinspection NpmUsedModulesInstalled
13+
const puppeteer = require('puppeteer') // Error: Cannot find module 'puppeteer' => See below note:
14+
15+
// Before run `test:e2e` you need to run `npm i -g puppeteer && npm link puppeteer` as a one-time-action.
16+
// Why it's not in devDependencies?
17+
// Regularly we install such packages locally (--save or --save-dev) but exceptionally I suggest installing `puppeteer`
18+
// globally, because of its extra installation step: [node install.js ---> Downloading Chromium r662092 - 140.3 Mb] and
19+
// because it just required for end-to-end tests.
20+
1321
const mkdirp = require('mkdirp')
1422

1523
const PORT = require('./options.js').listenPort

jest/unit/getVisualLength.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import TextWrapper from '../../src/TextWrap'
1+
import TextWrap from '../../src/TextWrap'
22

33
/**
44
* @author [S. Mahdi Mir-Ismaili](https://mirismaili.github.io)
55
* Created on 1398/2/30 (2019/5/20).
66
*/
77

8-
const obj = new TextWrapper()
8+
const obj = new TextWrap()
99

1010
describe('Test `getVisualLength()`:', () => {
1111
it('Check `getVisualLength()`', () => {

jest/unit/text-wrap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from 'fs'
22
import * as path from 'path'
33
import {sha256} from 'js-sha256'
4-
import TextWrapper from '../../src/TextWrap'
4+
import TextWrap from '../../src/TextWrap'
55

66
/**
77
* @author [S. Mahdi Mir-Ismaili](https://mirismaili.github.io)
@@ -16,7 +16,7 @@ const input = fs.readFileSync(path.resolve(__dirname, 'stub.txt'), 'utf8')
1616

1717
const indents = ''
1818
const maxLineLength = 50
19-
const textWrapper = new TextWrapper({wrapOn: maxLineLength})
19+
const textWrapper = new TextWrap({wrapOn: maxLineLength})
2020
const wrapResult = textWrapper.wrap(input, indents)
2121
const output = wrapResult.wrappedText
2222

0 commit comments

Comments
 (0)