Skip to content

Commit

Permalink
Use ncc to build release bundle
Browse files Browse the repository at this point in the history
Releases will now ship all-in-one bundle without any external deps
Decreases install size from ~12mb to ~2.5mb
Closes #210
  • Loading branch information
yamalight committed Nov 7, 2019
1 parent b94021b commit 81d23fc
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exoframe-macos
exoframe-win.exe
.idea/
.DS_Store
dist/

package-lock.json
exoframe.json
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ script:

after_success:
- yarn coveralls
- yarn build
- yarn package

deploy:
Expand Down
46 changes: 26 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,33 @@
"name": "exoframe",
"version": "6.0.1-dev",
"description": "Exoframe is a self-hosted tool that allows simple one-command deployments using Docker",
"main": "index.js",
"main": "dist/index.js",
"repository": "git@github.com:exoframejs/exoframe.git",
"author": "Tim Ermilov <yamalight@gmail.com>",
"license": "MIT",
"bin": {
"exoframe": "bin/index.js"
"exoframe": "dist/index.js"
},
"files": [
"dist/locales/*",
"dist/index.js",
"dist/check.js",
"dist/xdg-open"
],
"scripts": {
"lint": "eslint src/ test/",
"test": "TZ=Greenland NODE_ENV=testing jest --coverage --silent --maxWorkers=2 --ci",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"build": "ncc build bin/index.js -o dist",
"package": "pkg --targets node12.2.0-linux-x64,node12.2.0-win-x64,node12.2.0-macos-x64 -o exoframe index.js"
},
"dependencies": {
"dependencies": {},
"devDependencies": {
"@zeit/ncc": "^0.20.5",
"apache-md5": "^1.1.2",
"boxen": "^4.1.0",
"babel-eslint": "^10.0.3",
"chalk": "^2.4.2",
"cli-table3": "^0.5.1",
"got": "^9.6.0",
"highland": "^2.13.5",
"inquirer": "^7.0.0",
"js-yaml": "^3.13.1",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.15",
"multimatch": "^4.0.0",
"open": "^7.0.0",
"ora": "^4.0.2",
"tar-fs": "^2.0.0",
"update-notifier": "^3.0.1",
"yargs": "^14.2.0"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"coveralls": "^3.0.7",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.5.0",
Expand All @@ -44,11 +38,23 @@
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"got": "^9.6.0",
"highland": "^2.13.5",
"inquirer": "^7.0.0",
"jest": "^24.9.0",
"js-yaml": "^3.13.1",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.15",
"multimatch": "^4.0.0",
"nock": "^11.7.0",
"open": "^7.0.0",
"ora": "^4.0.2",
"pkg": "^4.4.0",
"prettier": "^1.18.2",
"sinon": "^7.5.0"
"sinon": "^7.5.0",
"tar-fs": "^2.0.0",
"update-notifier": "^3.0.1",
"yargs": "^14.2.0"
},
"jest": {
"testEnvironment": "node"
Expand Down
22 changes: 9 additions & 13 deletions src/util/checkUpdate.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
// npm packages
const chalk = require('chalk');
const boxen = require('boxen');
const updateNotifier = require('update-notifier');

// boxen options
const boxenOpts = {
padding: 1,
margin: 1,
align: 'center',
borderColor: 'yellow',
borderStyle: 'round',
};
// packaged script path
const pkgPath = '/snapshot/exoframe-cli/src/util';

Expand All @@ -28,9 +19,14 @@ module.exports = pkg => {
const upNpmMsg = `Run ${chalk.cyan('npm i -g exoframe')} to update`;
const upPkgMsg = `Download from ${chalk.cyan('https://github.com/exoframejs/exoframe/releases')}`;
const upmsg = isPackaged ? upPkgMsg : upNpmMsg;
const message = `Update available ${chalk.dim(update.current)} ${chalk.reset(' → ')} ${chalk.green(
update.latest
)}\n${upmsg}`;
console.log(`\n${boxen(message, boxenOpts)}`);
const message = `Update available ${chalk.dim(update.current)} ${chalk.reset('→')} ${chalk.green(update.latest)}`;
console.log(`
┌───────────────────────────────────────┐
│ │
${message}
${upmsg}
│ │
└───────────────────────────────────────┘
`);
}
};
33 changes: 6 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@
dependencies:
"@types/yargs-parser" "*"

"@zeit/ncc@^0.20.5":
version "0.20.5"
resolved "https://registry.yarnpkg.com/@zeit/ncc/-/ncc-0.20.5.tgz#a41af6e6bcab4a58f4612bae6137f70bce0192e3"
integrity sha512-XU6uzwvv95DqxciQx+aOLhbyBx/13ky+RK1y88Age9Du3BlA4mMPCy13BGjayOrrumOzlq1XV3SD/BWiZENXlw==

abab@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f"
Expand Down Expand Up @@ -815,20 +820,6 @@ boxen@^3.0.0:
type-fest "^0.3.0"
widest-line "^2.0.0"

boxen@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/boxen/-/boxen-4.1.0.tgz#256f6b2eb09ba22ea558e5acc0a5ff637bf8ed03"
integrity sha512-Iwq1qOkmEsl0EVABa864Bbj3HCL4186DRZgFW/NrFs5y5GMM3ljsxzMLgOHdWISDRvcM8beh8q4tTNzXz+mSKg==
dependencies:
ansi-align "^3.0.0"
camelcase "^5.3.1"
chalk "^2.4.2"
cli-boxes "^2.2.0"
string-width "^4.1.0"
term-size "^2.1.0"
type-fest "^0.5.2"
widest-line "^3.1.0"

brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
Expand Down Expand Up @@ -4738,7 +4729,7 @@ string-width@^3.0.0, string-width@^3.1.0:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"

string-width@^4.0.0, string-width@^4.1.0:
string-width@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.1.0.tgz#ba846d1daa97c3c596155308063e075ed1c99aff"
integrity sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ==
Expand Down Expand Up @@ -4872,11 +4863,6 @@ term-size@^1.2.0:
dependencies:
execa "^0.7.0"

term-size@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.1.0.tgz#3aec444c07a7cf936e157c1dc224b590c3c7eef2"
integrity sha512-I42EWhJ+2aeNQawGx1VtpO0DFI9YcfuvAMNIdKyf/6sRbHJ4P+ZQ/zIT87tE+ln1ymAGcCJds4dolfSAS0AcNg==

test-exclude@^5.2.3:
version "5.2.3"
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0"
Expand Down Expand Up @@ -5237,13 +5223,6 @@ widest-line@^2.0.0:
dependencies:
string-width "^2.1.1"

widest-line@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca"
integrity sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==
dependencies:
string-width "^4.0.0"

wordwrap@~0.0.2:
version "0.0.3"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
Expand Down

0 comments on commit 81d23fc

Please sign in to comment.