Commit Graph

6258 Commits

Author SHA1 Message Date
Ben Newman
20c33243ec Don't add tilde-constraints package explicitly to .meteor/packages.
Adding the tilde-dependent package should be enough, since its package.js
file calls api.use("tilde-constraints");

Backports: 1b65ef1726
2018-03-30 22:18:11 +03:00
Ben Newman
9b0cf92786 Support @~ version constraints and use them for core packages.
As discovered in #8947, creating an app with

  meteor create --release 1.4.4.1 new-app

does not actually constrain core packages to have the same minor versions
they had when Meteor 1.4.4.1 was published. Rather (as of Meteor 1.4.3),
the Meteor release only constrains core packages to have versions at least
as recent as the versions they had when the release was published, and to
have the same major version. Any later minor version is fair game.

What we need is a new kind of package version constraint, more like
semver's ~ range operator:
https://www.npmjs.com/package/semver#tilde-ranges-123-12-1

This commit implements that functionality, though it stops short of
supporting all possible semver range syntax.

Backports: b7645a4d1f
2018-03-30 22:18:10 +03:00
Ben Newman
2a3fd57303 Style tweaks and a small bug fix.
These checks should still happen when body is an empty string, which (for
better or worse) is falsy in JavaScript.
2017-05-22 16:40:48 -04:00
David Glasser
5f18c6e24a tools: fix Galaxy discovery
1a036553 in 1.4.4.2 expanded on the HTTP error checking added by 30aec9f in
1.4.2. Neither of these changes were aware that discoverGalaxy invokes
httpHelpers.request with json:true, resulting in a `body` that is a parsed JSON
object rather than a string or Buffer.  Before 1.4.4.2, this had no consequences
because body.length is undefined and `undefined < 90` is false, but the change
to Buffer.byteLength actually made the condition true.

It's safe to not check length in the JSON case because a truncated JSON object
is not legal JSON (unless the truncation just drops trailing whitespace, in
white case that's OK).

I check for both string and Buffer because some calls to this function pass in
an encoding option.  Buffer.byteLength works with both types.
2017-05-22 16:40:42 -04:00
Ben Newman
47496e9dba Call requestGarbageCollection in Isopack#_writeTool.
This method appears to be causing large spikes in memory consumption on
Circle CI during the `meteor --get-ready` preparation step, which often
leads to the test process being killed.

Also added a call in IsopackCache#_loadLocalPackage for good measure.

We're now calling requestGarbageCollection pretty frequently when
we run Node with --expose-gc, but that currently only happens during
Circle CI tests, so I don't think we need to implement the improvements
suggested in tools/utils/gc.js, yet.

Previously: 35f488e140, f6df21ff1e
2017-05-22 16:40:32 -04:00
Ben Newman
35386e49dd Re-run individual tests to avoid re-running the whole suite.
To deal with individual flaky tests, we often just re-run the entire test
suite, which feels like an enormous waste of shared computing resources.

This change automatically re-runs individual failed tests as many as two
more times, and considers the test successful if any of those attempts
succeeds.

cc @abernix @hwillson et al.
2017-05-22 16:40:32 -04:00
Bartosz Wojtkowiak
5a4d5035c3 Implement CORDOVA_COMPATIBILITY_VERSION_IOS/ANDROID and EXCLUDE (#8581)
* Implement CORDOVA_COMPATIBILITY_VERSION_EXCLUDE and CORDOVA_COMPATIBILITY_VERSION_IOS/ANDROID

CORDOVA_COMPATIBILITY_VERSION_IOS or CORDOVA_COMPATIBILITY_VERSION_ANDROID allows to override compatibility version for a specified platform.

CORDOVA_COMPATIBILITY_VERSION_EXCLUDE provides a way of excluding a certain plugin from compatibility version calculation. You can pass several plugin names with ';'. For example: `CORDOVA_COMPATIBILITY_VERSION_EXCLUDE='cordova-plugin-crosswalk-webview;cordova-plugin-device'`

* Changes after review
2017-04-26 13:23:22 -07:00
Ben Newman
1a036553c1 Fix faulty content-length comparison in utils/http-helpers.js.
Since body is a string, body.length is not necessarily the number of bytes
in the response body.
2017-04-25 16:11:29 -07:00
Jesse Rosenberger
99fffd8670 Fix disappearance of debug banner when running meteor debug.
This was broken due to a change in Node.js which enabled support for
using `--debug` in combination with IPv6 addresses.
2017-04-25 15:49:52 -07:00
Jesse Rosenberger
94f8c9d7ce Remove experimental trailing comma to avoid problems with jsdoc.
The comma in question: a trailing comma a rest-parameter, within a
function argument's parameter de-structuring:

	function a({
	  a = false,
	  ...b,
	}) {
	  // ...
	}

Espree, the parser used by `jsdoc` (used in Meteor docs) previously
allowed this with `experimentalObjectRestSpread` enabled but now throws
an error with the addition of 652990a7bf.

It might have been argued at one point that the trailing-comma could
allow for the easy, future addition of another parameter, ala:

	function a({
	  a = false,
	  ...b,
	  c = true,
	}) {
	  // ...
	}

Having the rest-parameter in the last position is certainly more clear
(it is the "rest", after-all, and there can be only one) but I'm not
going to have that discussion at the cost of docs not deploying!
2017-04-25 15:36:10 -07:00
Ben Newman
6055b49f8d Wait on removal of garbage directories.
This would have been a nice optimization if it had worked, but (in
addition to leaving garbage directories lying around sometimes if the
process was killed), it appears to have some unintended consequences for
meteorNpm.rebuildIfNonPortable and related functions, since the garbage
directories are easily confused for npm package directories.

Example stack trace:

  Error: ENOENT: no such file or directory, open '/home/travis/build/meteor/galaxy-server/node_modules/heapdump-garbage-1c2jqib/package.json'
      at Error (native)
   => awaited here:
      at Promise.await (/home/travis/.meteor/packages/less/.2.7.9.9fh5c1++os+web.browser+web.cordova/plugin.compileLessBatch.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:39:12)
      at copyFileHelper (/tools/fs/files.js:633:6)
      at Object.files.cp_r (/tools/fs/files.js:532:7)
      at /tools/isobuild/meteor-npm.js:393:11
      at Array.forEach (native)
      at copyNpmPackageWithSymlinkedNodeModules (/tools/isobuild/meteor-npm.js:386:29)
      at /tools/isobuild/meteor-npm.js:325:5
      at Array.forEach (native)
      at Object.rebuildIfNonPortable (/tools/isobuild/meteor-npm.js:315:17)
      at NodeModulesDirectory.rebuildIfNonPortable (/tools/isobuild/bundler.js:273:22)
      at /tools/isobuild/compiler.js:650:13
2017-04-07 16:21:43 -04:00
Jesse Rosenberger
ae35f13ed2 Use new rm_recursive_async to cleanup garbage directory w/o waiting. 2017-04-06 20:18:38 +03:00
Jesse Rosenberger
0cf0fb12c3 Remove catch-ing of EXDEV from Builder#complete.
This logic is now handled in `files.renameDirAlmostAtomically`.
2017-04-06 20:03:35 +03:00
Jesse Rosenberger
960e78c250 Sacrifice atomicity in the event that the file-system won't allow it.
/cc @benjamn
2017-04-06 19:56:17 +03:00
Jesse Rosenberger
e9a2f6d22c Just Profile the *Atomically functions directly.
...Versus reassigning them immediately after.

 (Whitespace-only view is recommended, due to indentation change)
2017-04-06 19:30:06 +03:00
Jesse Rosenberger
af1bc232d6 Hoist "Can we Fiber?" logic up to a helper function.
This also makes it possible to disable it in places where we were not
checking against the `METEOR_DISABLE_FS_FIBERS` env. variable, like in
`rm_recursive`.
2017-04-06 17:17:56 +03:00
Jesse Rosenberger
7090129f89 Re-implement renameDirAlmostAtomically in Builder#complete.
The `rename` is not sufficient on its own since it won't pave the way
for the new directory by ensuring that it's empty first.

`renameDirAlmostAtomically` will do that.
2017-04-06 17:17:55 +03:00
Jesse Rosenberger
523c7ce9d4 If EXDEV is encountered, resort to a delete and cp_r.
This operation does not have to be done atomically and this should allow
cross-device copies to be made if necessary.
2017-04-06 06:54:37 +03:00
Jesse Rosenberger
9e0f61c4b3 Revert "Use fs.move() from fs-extra to fix EXDEV cross device error in docker builds. (#8491)"
Unfortunately, `fs-extra` is still not as perfect at handling various
file system conditions as would be ideal.  It seemed sensical to try and
use a library like this however, it turns out that the Meteor suite
of file system functions stands up best on Windows, which is where I
encountered most problems.

For example, `fs-extra` still tries to create symlinks as an unprivileged
user – a forbidden task on Windows unless running as Administrator.

In addition, I ran into a constant stream of other errors: `ENOTEMPTY`,
`EBUSY`, `EEXIST` – all for various reasons.

My current recommendation is that we remove `fs-extra` and replace the
`Builder#complete` `renameDirAlmostAtomically` call (which does not
absolutely _have_ to be done atomically) with a `try`/`catch` which
resorts to a basic copy if `err.code === 'EXDEV'`.  All other
functionality stays the same.

This reverts commits:

* d49f3e2704
* 3257bafc84
* 74cb8ebdc2
* 5bbdcc9baa
* 6a0767bbac
2017-04-06 06:50:03 +03:00
Jesse Rosenberger
6a0767bbac Don't reassign, just Profile the *Atomically functions directly. 2017-04-05 19:04:22 +03:00
Jesse Rosenberger
5bbdcc9baa Change order that functions are defined so move is wrapped correctly. 2017-04-05 18:56:05 +03:00
Jesse Rosenberger
27819a164b Update installNpmModule to properly capture newer npm error formats. (#8564)
Previously, we captured and displayed shorter error messages for the
more complicated and unnecessarily verbose messages which npm produced.

While updating npm to 4.4.4, I observed the changelog for 4.4.0
indicated it would now produce less verbose messages.  In searching for
possible Meteor conflicts with this, I discovered that
`installNpmModule` had already regressed on providing pretty messages.

This fixes those messages to be parsed properly and adds tests which
ensure if npm changes again that we can capture them.

Follows-up on: https://github.com/meteor/meteor/pull/8562
2017-04-05 11:46:29 -04:00
Jesse Rosenberger
74cb8ebdc2 Improve fs-extras move calls for Windows platform. (#8560)
* Improve `fs-extra.move` calls for Windows platform.

This is a follow-up to meteor/meteor#8491 which worked properly on Unix
platforms, but failed in a variety of ways on Windows due to its lack
of Fiber-awareness and desire to create symlinks as unprivileged users
(something not always possible on Windows).

The Fiber issue was observed when trying to remove "src" directories
within the `move` function (which tries a variety of OS/OS/arch-specific
techniques to accomplish its goal) after they had been copied to "dest".
On Windows, this resulted in `EDIRNOTEMPTY` errors since Windows appears
to temporarily cache the file-handle or doesn't release the file-handle
until the next tick.

The symlink issue will hopefully improve in an upcoming release of
Windows (Creator Edition) when Microsoft makes it possible to create
symlinks as an unprivileged user, however it will still require enabling
"Developer" mode in Windows settings.  This implements the same catch
which was already in place for `fs.rename` on the `fs.move` provided by
`fs-extra`.

Performance gains were the same in tests comparing before and after
these changes.

Relates to:
https://github.com/meteor/meteor/issues/8558#issuecomment-291194385

* A few code-cleanups to my original commit.
2017-04-05 12:58:32 +03:00
Jesse Rosenberger
cba8c63340 Update node-gyp and node-pre-gyp packages.
* `node-gyp` - Adds support for Visual Studio 2017.
  - https://github.com/nodejs/node-gyp/blob/master/CHANGELOG.md#v360-2017-03-16
* `node-pre-gyp` - Nothing notable.
  - https://github.com/mapbox/node-pre-gyp/blob/master/CHANGELOG.md#0634
2017-04-04 19:42:03 +03:00
Jesse Rosenberger
8bdd0142cd Disable display of update msg about npm itself, since it's bundled.
As of npm 4.4.0 this is necessary as it will now self-check once per day
for updates.  Meteor pre-bundles the version of npm though so this
message will be confusing to users of the `meteor` tool.

https://github.com/npm/npm/releases/tag/v4.4.0
2017-04-04 19:37:20 +03:00
Ben Newman
87d0a33067 Get Cordova plugin test to pass by adding time. 2017-04-03 18:43:54 -04:00
Ben Newman
954efa7f5a Support Google Sign-In in google-oauth package. (#8549)
* Support Google Sign-In in google-oauth package.

Addresses #8253.

* Use Meteor.startup instead of listening for deviceready event.

* Fix mobile-config.js typo.

* Bump accounts-google and google-oauth package versions.

I'm only bumping the patch versions, even though the recent changes to
these packages may seem significant, for two reasons:

1. Bumping the minor versions would force Meteor 1.4.3 developers to
   upgrade to Meteor 1.4.4 if they wanted to use these changes.

2. The accounts-google and google-oauth packages without these changes
   will stop working completely in two weeks, which is much worse than the
   risks of upgrading.
2017-04-03 17:07:55 -04:00
Jesse Rosenberger
d24cd94f20 Merge branch 'release-1.4.3.x' of https://github.com/meteor/meteor into release-1.4.3.x 2017-03-30 02:15:20 +03:00
Ben Newman
fcbd398ab7 Appending module identifier extensions should not match directories.
This logic needed to change not only in meteor/tools/isobuild/resolver.js
but also in the runtime module system:
cfcc422725

Fixes #8539.
2017-03-29 18:50:41 -04:00
Jesse Rosenberger
3257bafc84 Change wrapFsFunc for "move" to acknowledge _both_ arguments as paths.
The `wrapFsFunc` function accepts an array of indexes indicating which
arguments are paths.  This is particularly important on Windows, due to
the path-conversation which takes place on those strings.

The docs say:
> Indices of arguments that have paths, these arguments will be
> converted to the correct OS slashes

This follows up on the change made from meteor/meteor#8491 which failed
in our release pipeline when publishing for the Windows architecture
for `1.4.4-rc.3`.
2017-03-30 01:46:42 +03:00
Jeremy Shimko
d49f3e2704 Use fs.move() from fs-extra to fix EXDEV cross device error in docker builds. (#8491)
Use fs.move to fix EXDEV cross device error in docker builds.

Fixes #7852.
2017-03-28 15:53:22 +03:00
Ben Newman
10127cea1f Fix modules test app now that exports.__esModule is non-enumerable.
3973bbad7f
2017-03-25 12:00:18 -04:00
Ben Newman
0eb52a1fd8 Upgrade meteor-babel to v0.19.1 and reify to v0.6.6. 2017-03-25 11:12:52 -04:00
Jesse Rosenberger
6bbd432081 Be more understanding of Windows' filesystem limitations.
Presently, the renaming of directories that are in-use will fail on
Windows.  This is already compensated for when `process.platform` is
set to `win32`.  However, within BashOnWindows/WSL (Windows Subsystem
for Linux), `process.platform` is equal to `linux`, though the
underlying filesystem is still the same.

Microsoft has stated that it is unlikely that they will remove
`Microsoft` from the `os.release()` value so we check for that.
2017-03-22 20:35:43 +02:00
Jesse Rosenberger
41cef97664 Automatically trim DEPLOY_HOSTNAME of leading/trailing spaces. (#8508)
This simple fix prevents the disappointment of trying to deploy your app
but failing because there's a space on the end of the `DEPLOY_HOSTNAME`
environment variable.

`process.env` always contains string values and assigning a property on
`process.env` implicitly converts the value to a string so it should not
be necessary to check if `typeof` is a `string`.

Fixes Dev Experience.
2017-03-22 12:50:28 -04:00
Ben Newman
d0f179b2f5 Merge pull request #8502 from hwillson/issue-6945
Updated the builder whitelist to allow "@" in filenames.
2017-03-22 12:50:28 -04:00
Jesse Rosenberger
17a786eb36 Ensure that .bin files maintain executable bits in Windows bundles.
Windows has no concept of the executable bit so it is not applied by the
`fstream` `Reader` when building the tarball which is used in both
`meteor build` and `meteor deploy`.  For Windows users, this causes
important scripts (such as `node-pre-gyp`) to not be executable when
the bundles are deployed to Unix platforms (such as Galaxy).

To avoid giving every file executable bits, this applies an executable
bit to the file only if it has read permission (something Windows _is_
aware of) and if it is in a location that Node bin links are typically
placed, the `/node_modules/.bin/` directories.
2017-03-21 12:19:08 -04:00
Ben Newman
da57ab69a8 Remove version constraints from modules test app.
This would have prevented this Circle CI self-test failure:
https://circleci.com/gh/meteor/meteor/3595#tests/containers/3
2017-03-16 13:08:06 -04:00
Ben Newman
89e1814f2e Merge branch 'devel' into use-babili-instead-of-uglify 2017-03-15 11:52:50 -04:00
Jesse Rosenberger
2f4e0124b0 Merge branch '20170303-dev-bundle-upgrades' into release-1.4.3.x 2017-03-09 17:33:28 +02:00
Jesse Rosenberger
511d43fe52 Upgrade versions of node-pre-gyp and node-gyp in the built bundle.
As a finishing move for ba06bf6eed, this
updates the versions of `node-pre-gyp` and `node-gyp` included in the
`meteor-dev-bundle`.
2017-03-09 17:19:04 +02:00
Jesse Rosenberger
c2c92b9b01 Allow malformed package.json when determining binary dependencies. (#8468)
We now check `package.json` in order to help make an educated decision
as to whether or not a package has binary dependencies which need to be
rebuilt.  In some cases, such as the `npmconf` npm which is included
as a dependency of `flow-router, the `package.json` is invalid (i.e.
empty), and we should silently permit this.

Fixes meteor/meteor#8427
2017-03-08 15:12:58 -05:00
Jesse Rosenberger
2d0fa6483e [dx] Provide warning when METEOR_SETTINGS are used in development. (#8458)
This is a developer experience (DX) change.

In production, the `METEOR_SETTINGS` environment variable is used to
pass parameters which will be available in the `Meteor.settings` within
the app.  However, `METEOR_SETTINGS` is ignored when using the
`meteor-tool` itself as in development, environment variables are
often less desirable.  Additionally, there would be no reactivity when
changing settings was necessary, instead requiring that the `meteor`
tool be restarted entirely.

On more than one occasion, developers have been confused as to why the
`METEOR_SETTINGS` are not respected in development.  To make it more
clear when this is attempted (and clarify that they will _not_ be used),
provide the a clear warning before ignoring the `METEOR_SETTINGS`
variable.

Aims to avoid meteor/meteor#8455.
2017-03-08 11:57:01 -05:00
Ben Newman
05f6705d15 Merge pull request #8431 from hwillson/issue-8154
Added CLI help text for meteor update --all-packages.
2017-03-08 11:40:17 -05:00
Ben Newman
b18b1e2755 Force garbage collection more aggressively during package DB sync.
This is an effort to keep the `meteor --get-ready` command from running
out of memory during Circle CI tests, as mentioned in this comment:
https://github.com/meteor/meteor/pull/8327#issuecomment-284431618
2017-03-06 20:34:56 -05:00
Ben Newman
ab0f9ba290 Force garbage collection more aggressively during meteor --get-ready.
This is an effort to keep the `meteor --get-ready` command from running
out of memory during Circle CI tests, as mentioned in this comment:
https://github.com/meteor/meteor/pull/8327#issuecomment-284431618
2017-03-06 20:34:56 -05:00
Jesse Rosenberger
513c270013 Add quotes around "meteor update" command. 2017-03-03 16:46:13 +02:00
Jesse Rosenberger
ad11a741bd Add brackets around package name.
To indicate that it's a variable, in the same way that `<target-version>` is notated (as well as other places in the `help.txt`).
2017-03-01 19:40:00 +02:00
Hugh Willson
8b431c6f80 Removed additional "newer versions" message reference; not needed. 2017-03-01 12:03:59 -05:00
Hugh Willson
148aeef2c9 Added paragraph explaining how to get extra information about packages that can't be updated. 2017-03-01 10:59:46 -05:00