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

Commit

Permalink
total rename thebox->snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
igorklopov committed Apr 18, 2017
1 parent b755585 commit cfab090
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 209 deletions.
30 changes: 15 additions & 15 deletions lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,23 @@ During packaging process `pkg` collects project files and places
them into executable. At run time the packaged application has
internal virtual filesystem where all that files reside.

Packaged VFS files have `/thebox/` prefix in their paths (or
`C:\thebox\` in Windows). If you used `pkg /path/app.js` command line,
then `__filename` value will be likely `/thebox/path/app.js`
at run time. `__dirname` will be `/thebox/path` as well. Here is
Packaged VFS files have `/snapshot/` prefix in their paths (or
`C:\snapshot\` in Windows). If you used `pkg /path/app.js` command line,
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 | /thebox/project/app.js |
__dirname | /project | /thebox/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 | /deploy/app-x64 |
process.pkg.entrypoint | undefined | /thebox/project/app.js |
process.pkg.defaultEntrypoint | undefined | /thebox/project/app.js |
require.main.filename | /project/app.js | /thebox/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 | /deploy/app-x64 |
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 the file collected at packaging
time (pick up own JS plugin or serve an asset) you should take
Expand Down
6 changes: 3 additions & 3 deletions lib/packer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const STORE_STAT = common.STORE_STAT;

const isDotJS = common.isDotJS;
const isDotJSON = common.isDotJSON;
const theboxify = common.theboxify;
const snapshotify = common.snapshotify;

const bootstrapText = fs.readFileSync(
require.resolve('../prelude/bootstrap.js'), 'utf8'
Expand Down Expand Up @@ -67,7 +67,7 @@ function packer (opts, cb) {
if (!first1) write(',');
first1 = false;

write(JSON.stringify(theboxify(file, opts.slash)));
write(JSON.stringify(snapshotify(file, opts.slash)));
write(':[\n');

const record = records[file];
Expand Down Expand Up @@ -159,7 +159,7 @@ function packer (opts, cb) {
opts.records.some(function (record) {
if (record.entrypoint) {

write(JSON.stringify(theboxify(record.file, opts.slash)));
write(JSON.stringify(snapshotify(record.file, opts.slash)));
return true;

}
Expand Down
Loading

0 comments on commit cfab090

Please sign in to comment.