Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Set up and run Prettier over entire codebase. (#1076)
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie authored Mar 25, 2021
1 parent 31e8bf7 commit ddf5217
Show file tree
Hide file tree
Showing 866 changed files with 9,429 additions and 5,688 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/lib-es5
/test
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
test:

strategy:
fail-fast: false # prevent test to stop if one fails
matrix:
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib-es5/
81 changes: 44 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ This command line interface enables you to package your Node.js project into an

## Use Cases

* Make a commercial version of your application without sources
* Make a demo/evaluation/trial version of your app without sources
* Instantly make executables for other platforms (cross-compilation)
* Make some kind of self-extracting archive or installer
* No need to install Node.js and npm to run the packaged application
* No need to download hundreds of files via `npm install` to deploy
your application. Deploy it as a single file
* Put your assets inside the executable to make it even more portable
* Test your app against new Node.js version without installing it
- Make a commercial version of your application without sources
- Make a demo/evaluation/trial version of your app without sources
- Instantly make executables for other platforms (cross-compilation)
- Make some kind of self-extracting archive or installer
- No need to install Node.js and npm to run the packaged application
- No need to download hundreds of files via `npm install` to deploy
your application. Deploy it as a single file
- Put your assets inside the executable to make it even more portable
- Test your app against new Node.js version without installing it

## Usage

Expand All @@ -31,12 +31,12 @@ After installing it, run `pkg --help` without arguments to see list of options.

The entrypoint of your project is a mandatory CLI argument. It may be:

* Path to entry file. Suppose it is `/path/app.js`, then
packaged app will work the same way as `node /path/app.js`
* Path to `package.json`. `Pkg` will follow `bin` property of
the specified `package.json` and use it as entry file.
* Path to directory. `Pkg` will look for `package.json` in
the specified directory. See above.
- Path to entry file. Suppose it is `/path/app.js`, then
packaged app will work the same way as `node /path/app.js`
- Path to `package.json`. `Pkg` will follow `bin` property of
the specified `package.json` and use it as entry file.
- Path to directory. `Pkg` will look for `package.json` in
the specified directory. See above.

### Targets

Expand All @@ -45,9 +45,9 @@ time. You can specify a comma-separated list of targets via `--targets`
option. A canonical target consists of 3 elements, separated by
dashes, for example `node6-macos-x64` or `node4-linux-armv6`:

* **nodeRange** node${n} or latest
* **platform** freebsd, linux, alpine, macos, win
* **arch** x64, x86, armv6, armv7
- **nodeRange** node${n} or latest
- **platform** freebsd, linux, alpine, macos, win
- **arch** x64, x86, armv6, armv7

You may omit any element (and specify just `node6` for example).
The omitted elements will be taken from current platform or
Expand All @@ -65,23 +65,29 @@ don't need to specify anything manually. However your code
may have `require(variable)` calls (so called non-literal
argument to `require`) or use non-javascript files (for
example views, css, images etc).

```js
require('./build/' + cmd + '.js')
path.join(__dirname, 'views/' + viewName)
require('./build/' + cmd + '.js');
path.join(__dirname, 'views/' + viewName);
```

Such cases are not handled by `pkg`. So you must specify the
files - scripts and assets - manually in `pkg` property of
your `package.json` file.

```json
"pkg": {
"scripts": "build/**/*.js",
"assets": "views/**/*"
}
```

You may also specify arrays of globs:

```
"assets": [ "assets/**/*", "images/**/*" ]
```

Just be sure to call `pkg package.json` or `pkg .` to make use
of `scripts` and `assets` entries.

Expand Down Expand Up @@ -113,6 +119,7 @@ Node.js application can be called with runtime options
`node --v8-options`. You can "bake" these runtime options into
packaged application. The app will always run with the options
turned on. Just remove `--` from option name.

```sh
pkg app.js --options expose-gc
pkg app.js --options max_old_space_size=4096
Expand Down Expand Up @@ -143,11 +150,11 @@ requirements to compile original Node.js:

### Environment

| Var | Description |
| -------------- | --------------------------------------------------------------------------------------- |
| PKG_CACHE_PATH | Used to specify a custom path for node binaries cache folder. Default is `~/.pkg-cache` |
| Var | Description |
| -------------- | ----------------------------------------------------------------------------------------- |
| PKG_CACHE_PATH | Used to specify a custom path for node binaries cache folder. Default is `~/.pkg-cache` |
| PKG_IGNORE_TAG | Allows to ignore additional folder created on `PKG_CACHE_PATH` matching pkg-fetch version |
| MAKE_JOB_COUNT | Allow configuring number of processes used for compiling |
| MAKE_JOB_COUNT | Allow configuring number of processes used for compiling |

Examples

Expand Down Expand Up @@ -178,17 +185,17 @@ then `__filename` value will be likely `/snapshot/path/app.js`
at run time. `__dirname` will be `/snapshot/path` as well. Here is
the comparison table of path-related values:

value | with `node` | packaged | comments
-------------------------------|---------------------|----------------------------|-----------
__filename | /project/app.js | /snapshot/project/app.js |
__dirname | /project | /snapshot/project |
process.cwd() | /project | /deploy | suppose the app is called ...
process.execPath | /usr/bin/nodejs | /deploy/app-x64 | `app-x64` and run in `/deploy`
process.argv[0] | /usr/bin/nodejs | /deploy/app-x64 |
process.argv[1] | /project/app.js | /snapshot/project/app.js |
process.pkg.entrypoint | undefined | /snapshot/project/app.js |
process.pkg.defaultEntrypoint | undefined | /snapshot/project/app.js |
require.main.filename | /project/app.js | /snapshot/project/app.js |
| value | with `node` | packaged | comments |
| ----------------------------- | --------------- | ------------------------ | ------------------------------ |
| \_\_filename | /project/app.js | /snapshot/project/app.js |
| \_\_dirname | /project | /snapshot/project |
| process.cwd() | /project | /deploy | suppose the app is called ... |
| process.execPath | /usr/bin/nodejs | /deploy/app-x64 | `app-x64` and run in `/deploy` |
| process.argv[0] | /usr/bin/nodejs | /deploy/app-x64 |
| process.argv[1] | /project/app.js | /snapshot/project/app.js |
| process.pkg.entrypoint | undefined | /snapshot/project/app.js |
| process.pkg.defaultEntrypoint | undefined | /snapshot/project/app.js |
| require.main.filename | /project/app.js | /snapshot/project/app.js |

Hence, in order to make use of a file collected at packaging
time (`require` a javascript file or serve an asset) you should
Expand Down Expand Up @@ -243,7 +250,7 @@ with `.node` files.
a promise. For example:

```js
await exec([ 'app.js', '--target', 'host', '--output', 'app.exe' ])
await exec(['app.js', '--target', 'host', '--output', 'app.exe']);
// do something with app.exe, run, test, upload, deploy, etc
```

Expand Down Expand Up @@ -272,4 +279,4 @@ You could check on **Unix systems** (Linux/macOS) in `bash`:

```bash
$ printenv | grep NODE
```
```
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
environment:
nodejs_version: "12"
nodejs_version: '12'

install:
- ps: Install-Product node $env:nodejs_version x64
Expand Down
3 changes: 1 addition & 2 deletions dictionary/angular-bridge.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/any-promise.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/async.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
7 changes: 2 additions & 5 deletions dictionary/aws-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

module.exports = {
pkg: {
scripts: [
'apis/*.json',
'lib/services/*.js'
]
}
scripts: ['apis/*.json', 'lib/services/*.js'],
},
};
3 changes: 1 addition & 2 deletions dictionary/babel-core.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/batch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/bcrypt.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/bignum.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/bindings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
6 changes: 2 additions & 4 deletions dictionary/blessed.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// https://github.com/chjj/blessed/issues/298
module.exports = {
pkg: {
scripts: [
'lib/widgets/*.js'
]
}
scripts: ['lib/widgets/*.js'],
},
};
6 changes: 3 additions & 3 deletions dictionary/body-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module.exports = {
pkg: {
scripts: [
'lib/types/*.js' // for 1.4-1.13
]
}
'lib/types/*.js', // for 1.4-1.13
],
},
};
6 changes: 2 additions & 4 deletions dictionary/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module.exports = {
pkg: {
assets: [
'bin/*.txt'
]
}
assets: ['bin/*.txt'],
},
};
3 changes: 1 addition & 2 deletions dictionary/bson.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
6 changes: 2 additions & 4 deletions dictionary/buffermaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module.exports = {
pkg: {
scripts: [
'lib/*.js'
]
}
scripts: ['lib/*.js'],
},
};
9 changes: 3 additions & 6 deletions dictionary/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
module.exports = {
pkg: {
patches: {
'lib/bunyan.js': [
'mv = require(\'mv\' + \'\');',
'mv = require(\'mv\');'
]
}
}
'lib/bunyan.js': ["mv = require('mv' + '');", "mv = require('mv');"],
},
},
};
6 changes: 2 additions & 4 deletions dictionary/busboy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module.exports = {
pkg: {
scripts: [
'lib/types/*.js'
]
}
scripts: ['lib/types/*.js'],
},
};
3 changes: 1 addition & 2 deletions dictionary/bytes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/callsites.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/chokidar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
6 changes: 2 additions & 4 deletions dictionary/coffee-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module.exports = {
pkg: {
scripts: [
'lib/coffee-script/*.js'
]
}
scripts: ['lib/coffee-script/*.js'],
},
};
3 changes: 1 addition & 2 deletions dictionary/colors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/compression.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
6 changes: 2 additions & 4 deletions dictionary/compressjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module.exports = {
pkg: {
scripts: [
'lib/*.js'
]
}
scripts: ['lib/*.js'],
},
};
3 changes: 1 addition & 2 deletions dictionary/connect-mongo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/connect-mongodb.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
3 changes: 1 addition & 2 deletions dictionary/connect-redis.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

module.exports = {
};
module.exports = {};
Loading

0 comments on commit ddf5217

Please sign in to comment.