Skip to content

Commit

Permalink
fix: consider envinfo external in cli entry, reduce size by half (#94)
Browse files Browse the repository at this point in the history
* fix: consider envinfo external in cli entry, reduce size by half
* fix: add esm for appveyor src test
* fix: add esm for start command
* fix: nope, semver can’t be external 🤦
* fix: use require for envinfo, thanks sammy
* fix: use relative path
  • Loading branch information
tabrindle authored May 7, 2019
1 parent effe0c5 commit bd4b001
Show file tree
Hide file tree
Showing 8 changed files with 213 additions and 159 deletions.
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
environment:
nodejs_version: "8"
nodejs_version: '8'

install:
- ps: Install-Product node $env:nodejs_version
Expand All @@ -10,7 +10,7 @@ test_script:
- npm --version
- SET ENVINFO_DEBUG=trace
- npm run build
- node src/cli.js
- node -r esm src/cli.js
- node dist/cli.js
- SET ENVINFO_DEBUG=""
- npm test
Expand Down
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
[
'@babel/preset-env',
{
debug: true,
modules: 'commonjs',
targets: {
node: '4.9.1',
Expand Down
2 changes: 1 addition & 1 deletion dist/cli.js
100755 → 100644

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/envinfo.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"node": ">=4"
},
"scripts": {
"build": "webpack",
"build": "webpack --progress",
"check:format": "prettier -l src/*.js",
"compress": "gzexe envinfo-* && upx envinfo-win.exe",
"contributors:add": "all-contributors add",
Expand All @@ -29,7 +29,7 @@
"preversion": "npm run test && webpack && git add .",
"postversion": "npm run executable && npm run compress && npm run release",
"release": "github-release upload --owner=tabrindle --repo=envinfo --tag=${npm_package_version} 'envinfo-linux.tar.gz' 'envinfo-macos.tar.gz' 'envinfo-win.zip'",
"start": "node src/cli.js",
"start": "node -r esm src/cli.js",
"test": "jest --env=node && npm run lint && npm run check:format"
},
"keywords": [
Expand Down Expand Up @@ -69,14 +69,15 @@
"eslint-config-prettier": "^2.7.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-prettier": "^2.3.1",
"esm": "^3.2.22",
"github-release-cli": "^0.4.1",
"glob": "^7.1.2",
"jest": "^22.4.3",
"minimist": "^1.2.0",
"os-name": "^2.0.1",
"os-name": "^3.1.0",
"pkg": "^4.3.4",
"prettier-eslint-cli": "^4.1.1",
"webpack": "^4.25.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.1.2",
"which": "^1.2.14",
"yamlify-object": "^0.4.5"
Expand Down
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const envinfo = require('./envinfo.js');
const envinfo = require('./envinfo');
const argv = require('minimist')(process.argv.slice(2));
const version = global.__VERSION__ || ''; // eslint-disable-line

Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
},
],
},
externals: [/envinfo$/],
plugins: [
new webpack.BannerPlugin({
banner: `#!/usr/bin/env node
Expand Down
351 changes: 202 additions & 149 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit bd4b001

Please sign in to comment.