-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* self-hosting * add `dist/readme.md` placeholder * new dist structure * follow @sokra-senpai's advice * bring back mjs to fix graphql * improve build output * bump version
- Loading branch information
Showing
355 changed files
with
720 additions
and
54,125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
node_modules | ||
* | ||
dist/**/*.js | ||
!scripts | ||
!src | ||
!test | ||
!dist/ | ||
!dist/ncc/ | ||
!dist/buildin/ | ||
!package.json | ||
!yarn.lock | ||
!.circleci | ||
!.*ignore | ||
!readme.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
* | ||
!index.js | ||
!cli.js | ||
!webpack | ||
!webpack/node_modules | ||
!scripts/cli.js | ||
!dist/**/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# About this directory | ||
|
||
This directory will contain the webpack built-ins, like | ||
`module.js`, so that they can be accessed by webpack when | ||
it's being executeed inside the bundled ncc file. | ||
|
||
These files are published to npm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# About this directory | ||
|
||
This directory will contain: | ||
|
||
- `index.js` the main ncc bundle | ||
- `cli.js` the CLI bundle, excluding the main ncc bundle | ||
|
||
These are generated by the `build` step defined in `../../package.json`. | ||
|
||
These files are published to npm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# About this directory | ||
|
||
This directory will contain: | ||
- `buildin`: the webpack `buildin/` folder, required at runtime | ||
- `ncc`: the output from the ncc build | ||
|
||
They are generated by the `build` script defined in `../package.json`. | ||
|
||
This directory is the only one published to npm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,3 @@ require('@zeit/ncc')('/path/to/input', { | |
console.log(bundle.code) | ||
}) | ||
``` | ||
|
||
## TODO | ||
|
||
- [ ] Make self-hosting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const ncc = require("../src/index.js"); | ||
const { statSync, writeFileSync } = require("fs"); | ||
const { promisify } = require("util"); | ||
const { relative } = require("path"); | ||
const copy = promisify(require("copy")); | ||
const glob = promisify(require("glob")); | ||
const bytes = require("bytes"); | ||
|
||
async function main() { | ||
const cli = await ncc(__dirname + "/../src/cli", { | ||
externals: ["./index.js"] | ||
}); | ||
const index = await ncc(__dirname + "/../src/index", { | ||
// we dont care about watching, so we don't want | ||
// to bundle it. even if we did want watching and a bigger | ||
// bundle, webpack (and therefore ncc) cannot currently bundle | ||
// chokidar, which is quite convenient | ||
externals: ["chokidar"] | ||
}); | ||
|
||
writeFileSync(__dirname + "/../dist/ncc/cli.js", cli); | ||
writeFileSync(__dirname + "/../dist/ncc/index.js", index); | ||
|
||
// copy webpack buildin | ||
await copy( | ||
__dirname + "/../node_modules/webpack/buildin/*.js", | ||
__dirname + "/../dist/buildin/" | ||
); | ||
|
||
for (const file of await glob(__dirname + "/../dist/**/*.js")) { | ||
console.log( | ||
`✓ ${relative(__dirname + "/../", file)} (${bytes( | ||
statSync(file).size | ||
)})` | ||
); | ||
} | ||
} | ||
|
||
// remove me when node.js makes this the default behavior | ||
process.on("unhandledRejection", e => { | ||
throw e; | ||
}); | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env node | ||
// we separate `src/cli` and `scripts/cli` so that we can launch `ncc` | ||
// against a pure-js file without the shebang. in the future, | ||
// ncc should support taking in an input with a shebang, | ||
// and preserving it in the output | ||
require('../dist/ncc/cli'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.