Commit Graph

24 Commits

Author SHA1 Message Date
Ben Newman
e299c86ecf Assume npx (as in meteor npx ...) is a valid command.
Sometimes, before dev_bundle/bin/.meteor-commands.json has been written, a
command like `./meteor npx tsc` can fail because `npx` is not blessed in
the same way `node` and `npm` are. Since `npx` is a core tool that we want
folks to be able to use without confusion, I think it makes sense to
include it in the list of known subcommands.
2019-07-15 12:32:49 -04:00
Ben Newman
f0192a82d9 Stop using mini-files.js in non-Babel-compiled code. 2019-04-23 19:21:57 -04:00
Ben Newman
38f570abc0 Ensure npm scripts find correct meteor executable. (#9941)
In my local development environment, the `meteor` command resolves to my
Meteor checkout, and I use `~/.meteor/meteor` explicitly when I want to run
a released version of Meteor.

If I run

  ~/.meteor/meteor npm test

and the `package.json` file defines an npm `test` script that refers to
`meteor`, in my environment this `meteor` won't be the same as the one I
used to run `~/.meteor/meteor npm test`, which can introduce weirdness
such as pinning the versions of packages in `meteor/packages/non-core`,
and all the usual Meteor version inconsistency risks.

This commit fixes that problem by prepending the directory that contains
the `meteor` (or `meteor.bat`) executable to the `PATH` before running
`meteor npm ...` commands.
2018-06-05 13:06:51 -04:00
Ben Newman
0fddc26a2e Adjust npm update notifier opt-out environment variable.
https://github.com/zkat/npx/issues/98#issuecomment-316936135
https://www.npmjs.com/package/update-notifier#user-settings
2017-10-23 19:37:44 -04:00
Ben Newman
dd5d7e2786 Merge branch 'release-1.5.2' into release-1.6 2017-08-22 22:04:03 -04:00
Ben Newman
67b76abc78 Make node-gyp look for headers in dev_bundle/include/node.
Thanks to @abernix for identifying this solution to the duplication
between dev_bundle/include/node and dev_bundle/.node-gyp/*/node.
2017-08-22 16:41:01 -04:00
Jesse Rosenberger
f68de59464 Stop setting NPM_CONFIG_PREFIX in getEnv.
This was causing problems with `npm@5`, but realistically it may not be
be necessary anymore since `npm@5` has a much smarter global,
self-healing `cacache`.
2017-08-15 14:16:53 -07:00
Ben Newman
ab4f54c49a Revert unnecessary npm_config_disturl overrides. 2017-06-15 09:40:11 -04:00
Ben Newman
92b6d48960 Set disturl safely for meteor npm and Meteor package .npm management. 2017-06-14 12:18:39 -04:00
Jesse Rosenberger
948ec2b05f Merge branch 'master' into devel 2017-04-07 18:50:17 +03:00
Ben Newman
acc98c7c15 Set NPM_CONFIG_PREFIX to dev_bundle by default. 2016-11-02 19:23:09 -04:00
Ben Newman
50528819cf Change terminology from METEOR_UNSAFE_PERM to METEOR_ALLOW_SUPERUSER.
The --unsafe-perm option is still supported but no longer advertised.
2016-10-28 16:11:29 -04:00
Ben Newman
e4acc36f63 Respect METEOR_UNSAFE_PERM in addition to --unsafe-perm.
This is important for `meteor npm`, since we don't parse or pass through
Meteor-specific command-line arguments when running `meteor npm`.

When METEOR_UNSAFE_PERM is set, its value is now propagated to any npm
commands via the NPM_CONFIG_UNSAFE_PERM variable.

Helps with #7959.
Follow-up to #7821.
2016-10-28 16:11:29 -04:00
Ben Newman
4300d261f3 Support meteor <command> for any dev_bundle/bin/<command> executable.
This will make it easier to use tools like https://yarnpkg.com/ with the
right version of Node, etc.

With this commit, here's all you have to do:

  meteor npm install -g yarnpkg

Then test that it works:

  meteor yarn info

Note that any commands registered by Meteor itself will not be honored.
2016-10-12 13:22:26 -04:00
Ben Newman
3313180a6f Always use dev_bundle/.npm as the cache for meteor npm ... commands.
I believe a strange interaction with the global cache (~/.npm on Unix
systems) may have been the root cause of the problem fixed by this commit:
https://github.com/meteor/meteor/pull/7668/commits/ad61a935146c34e7
2016-09-21 18:53:33 -04:00
Ben Newman
4bdc65919d Set $USERPROFILE to the dev bundle directory for meteor {node,npm}.
The node-gyp tool uses `process.env.HOME || process.env.USERPROFILE` to
determine where it should install the .node-gyp directory containing Node
headers and libraries, and we now preinstall that directory at
dev_bundle/.node-gyp/, so (with this change) no download should be
necessary.
2016-08-06 13:46:16 -04:00
Ben Newman
39851fc6b0 Use known dev_bundle path for internal npm commands. 2016-07-17 21:26:53 -04:00
Ben Newman
4e2615e3fc Use Buffer.concat instead of joining strings. 2016-07-17 13:08:37 -04:00
Ben Newman
0f49be5973 Don't pass custom env to python.exe in addWindowsVariables.
The env isn't necessary, and it seems to cause problems running python.exe
in some Windows environments.
2016-07-15 16:27:46 -04:00
Ben Newman
578d40a753 Use node-gyp to infer GYP_MSVS_VERSION when possible.
As a refinement of my previous commit, we will continue setting the
$GYP_MSVS_VERSION variable to "2015" except in cases where the Python
library behind node-gyp succeeds in inferring the correct version.

Note that the Python library will never infer "2015" by itself, even
though that's the version recommended by the node-gyp setup instructions:

  https://github.com/nodejs/node-gyp#installation.

Note also that the Windows machines used by `meteor admin get-machine` and
build.meteor.com have version "2010e", which can be inferred.

In other words, this commit allows the following groups of developers to
avoid setting $GYP_MSVS_VERSION manually:

  1. Developers who followed the node-gyp setup instructions.
  2. Package authors who run `meteor publish-for-arch` on build machines.
2016-07-15 15:57:31 -04:00
Ben Newman
3c06050a25 Stop setting process.env.GYP_MSVS_VERSION for meteor npm.
Setting GYP_MSVS_VERSION to 2015 when the Visual C++ 2015 build tools are
not (and/or cannot be) installed is (in my experience) the leading cause
of `npm rebuild` failures on older Windows machines.

Auto-detecting the appropriate version is something node-gyp ought to be
able to do as well as Meteor possibly could, at least according to
https://github.com/nodejs/node-gyp/blob/1dcf356ca7/gyp/pylib/gyp/MSVSVersion.py#L222-L223

When selecting a different version is important, you can always set the
GYP_MSVS_VERSION environment variable yourself. Specifically, if you're a
package author, and your package depends on npm packages that can only be
compiled with a newer version of MSBuild.exe, then you might need to run

  $env:GYP_MSVS_VERSION = "2015"
  meteor publish-for-arch name:package@x.y.z

I fully trust that the folks in that small category can handle that
additional burden.
2016-07-15 12:42:49 -04:00
Ben Newman
f812762353 Infer dev_bundle for meteor {npm,node} from .meteor/release.
Fixes #7338.
Fixes #7297.
2016-07-06 21:00:40 -04:00
Ben Newman
fdce895bba Make sure env.Path === env.PATH on Windows. 2016-05-16 18:21:09 -04:00
Ben Newman
d060ae9a2d Decompose a helper for cloning process.env for npm-related commands. 2016-05-16 18:21:09 -04:00