Implements https://github.com/meteor/meteor/issues/6537#issuecomment-205954797
The setup.sh script was only sometimes written previously, so no existing
deployment logic should rely on it existing.
On the other hand, all apps built by `meteor build` require running
`npm install` in the programs/server/ directory, so the install hook I
added to programs/server/package.json will ensure npm-rebuild.js is
invoked reliably.
Using a pure Node script means this code will work just as well on Windows
as on Linux or Darwin, though Linux is by far the most common deployment
platform for Meteor apps.
TODO Remember to rebuild the dev bundle before the next release!
This reverts a change I made in 75f9214959.
I thought allowing partial paths would make files.pathRelative more
robust, but it had the unintended consequence of causing #6586.
For package dependencies, the node_modules directory immediately follows
the /package/ part of the path, but for plugins the name of the plugin
comes before the node_modules directory.
Because symlinking is impossible on Windows, and copying node_modules
files is too slow, we can't just symlink/copy all node_modules files into
.meteor/local/build/programs/server/npm like we do for other platforms, so
we have to search for them where they are.
Part of #6500.
Note that `export default` no longer modifies `module.exports`, but simply
defines `exports.default`, so these two import styles will work:
import DefaultExport from "./export-default-module.js"; // preferred
var DefaultExport = require("./export-default-module.js").default;
but this style will no longer work:
var DefaultExport = require("./export-default-module.js");
This adds `appId` to the `config.json` generated by the bundler, and uses that
in `boot.js` to initialize `process.env.APP_ID`. This is used by `autoupdate_server.js`
to set `__meteor_runtime_config__`.
Specific improvements:
- Parentheses are now stripped from commands that look like named classes
so that they will be treated as class declarations rather than as named
class expressions.
- When the `ecmascript` package is installed, `compileForShell` errors are
now exposed to the `evalCommand` callback.
- Instead of using `vm.runInThisContext` to parse and evaluate commands at
the same time, `evalCommand` now parses commands by creating a new
`vm.Script` and later evaluates them using `script.runInThisContext()`,
so that `SyntaxError`s can be reported immediately. Fixes#5131.