Commit Graph

112 Commits

Author SHA1 Message Date
Ben Newman
9cba123401 Restore CLI progress messages by revisiting progress.ts conversion.
I noticed recently that progress messages were no longer displayed (though
the ASCII spinner was still animating). I bisected the problem to the
progress.ts conversion in #10650, and I attempted to reproduce the
conversion, step by step. The problem ended up being the renaming of
._title to .title, which was a mistake because external code accesses
progress._title. Once I updated those invasive access points, progress
messages began displaying once again.
2019-09-19 19:01:33 -04:00
Michael Newman
26c0d5cf16 Convert tools/console/progress.js to TypeScript (#10650) 2019-07-26 09:22:19 -04:00
Chiciuc Nicușor
a6d454b760 Convert func-utils.js to TypeScript (#10631) 2019-07-26 09:21:23 -04:00
Michael Newman
e0eb210194 Convert tools/utils/processes.js to tools/utils/processes.ts (#10627) 2019-07-25 17:34:13 -04:00
Michael Newman
f8ba7a96fe Convert tools/utils/mongo-exit-codes to TypeScript (#10625) 2019-07-21 12:02:29 -04:00
Paulo Mogollón
2ae2690f3a Convert tools/utils/archinfo.js to TypeScript. (#10624)
* Updated code to use modern JS
* Added types
* Stopped using 2 underscore functions (1 remaining)
2019-07-21 12:01:24 -04:00
Michael Newman
8af53f97d6 Convert tools/utils/eachline.js to TypeScript (#10614)
Thanks to @menewman for tackling this small but important module!
2019-07-15 11:34:45 -04:00
Ben Newman
8a409d196c Convert mini-files.js to TypeScript. 2019-07-04 14:43:51 -04:00
Ben Newman
5ed64fb1db Remove explicit .js extension from tools/fs/files imports. 2019-07-04 10:32:09 -04:00
Ben Newman
ed41dcd4a6 Flatten buildmessage.{enterJob,capture} stacks by not using withValue. (#10266)
Whenever you're looking at a stack trace generated by the command-line
tool, you see tons and tons of useless stack frames for withValue,
enterJob, and/or capture.

Each of these function calls has its own try-finally block, which is
probably the real reason this pattern is slow, though the excess of
unnecessary stack frames is subjectively gross as well.

Initial build times for the `meteor create --full` app on my machine are
about 4.4 seconds with Meteor 1.8, and just 2.8 seconds after this change,
which is a nice 36% improvement. Rebuild times are not noticeably
different, however.

Looking to the future, flattening this function call pyramid should make
it easier to introduce non-Fiber-based async/await into the buildmessage
system, so that we can start properly propagating promises up the stack.
2018-10-11 09:47:17 -04:00
Ben Newman
8f8e2a01f6 Be more tolerant of missing err.stack in parse-stack.js.
Should help with #10083.
2018-10-03 15:13:08 -04:00
Ben Newman
7b6fd0ee10 Let buildmessage.markBoundary take optional context argument.
Since markBoundary is essentially creating a bound wrapper function,
there's no reason we can't actually bind the function to a specific
context (this) object at the same time, instead of having to bind the
function and then wrap it with buildmessage.markBoundary.
2018-06-30 11:02:02 -04:00
Ben Newman
2fa38bdf4c Convert utils/archinfo.js to use ECMAScript exports. 2018-01-22 18:07:55 -05:00
Jesse Rosenberger
9b056f5e91 Merge pull request #9341 from meteor/glasser/progress-status-only
Improved console behavior within the Emacs shell, and also general
Console refactoring to modernize ECMAScript use and remove Underscore.
2017-12-13 20:14:13 +02:00
Jesse Rosenberger
7268fb8ca0 Improve Emacs shell support by auto-detecting Emacs.
This adds a memoized helper function for detecting Emacs throughout the
CLI tool and automatically resorts to "ProgressDisplayStatus" mode when
Emacs is enabled.

In my tests with both Emacs 22 and 27, this nearly doubled performance
when using Meteor from within the Emacs shell (i.e. `M-x shell`).
2017-12-12 17:19:16 +02:00
Ben Newman
c8c88300a6 Fix remaining problems with PR #9237. 2017-11-22 14:44:22 -05:00
Edgar HIPP
16b74e5c0c Fix isNpmUrl to handle http/https urls (Closes #9236) 2017-11-22 14:44:22 -05:00
Ben Newman
1389db4631 Increase garbage collection throttling delay.
May help with this problem, which seems to stem from too much GC:
https://github.com/meteor/meteor/pull/8728#issuecomment-337636773

If this isn't enough, we could include this commit in 1.6.1:
5d212926e7
2017-10-19 11:31:23 -04:00
Ben Newman
9bedf027d4 Move VALID_ARCHITECTURES to its natural home, utils/archinfo.js.
Apparently importing cli/commands.js in isobuild/bundler.js led to calling
ensureIsopacketsLoadable more than once, which broke some tests.
2017-10-16 15:47:55 -04:00
Ben Newman
af016aa306 Disable automatic switching to 64-bit meteor-tool on Windows.
This means running `meteor update` on Windows with an existing (pre-1.6)
installation of Meteor will install a 32-bit version of Meteor 1.6, even
if the underlying machine architecture could handle a 64-bit version.

To get a native 64-bit version of Meteor, Windows developers should
reinstall Meteor 1.6 from scratch using the new and improved Windows
installer (👋 @abernix), rather than running `meteor update`.

If we really want to make `meteor update` just work , we can
revisit this change in Meteor 1.6.1.
2017-10-16 13:58:49 -04:00
Ben Newman
132a835086 Fix typo in archinfo.canSwitchTo64Bit.
5a9e837937 (r144887020)
2017-10-16 12:46:49 -04:00
Ben Newman
5a9e837937 Upgrade to 64-bit when possible on Windows.
Since we can't change the springboarding logic of existing Meteor
releases, this decision has to be made by the springboarded-to Meteor 1.6
release, and may result in a second springboarding.
2017-10-15 19:36:37 -04:00
Ben Newman
e9db660d03 Allow 64-bit Windows builds of meteor-tool to download 32-bit builds.
Once Windows developers update to a 64-bit version of Meteor 1.6, they may
still wish to run apps using older versions of Meteor where only 32-bit
builds of meteor-tool are available. This commit makes that possible.
2017-10-15 19:32:18 -04:00
Jesse Rosenberger
00bc5e6201 Address PR feedback from @benjamn on #9218. 2017-10-14 13:37:20 -04:00
Jesse Rosenberger
0dac129770 Introduce os.windows.x86_64 architecture for 64-bit Windows.
This commit reverts much of the work @hwillson had put in place for
meteor/meteor#9173, which made it possible for 32-bit and 64-bit
Mongo versions to exist in harmony within the same dev-bundle.  That
hard work was not in vein though as it offered invaluable research.
Ultimately, this showed that a more aggressive approach would be ideal,
even if the proposed option would have worked great in the short-term.

In the wake of the news that Mongo would no longer be supporting 32-bit
versions, these changes are important so 32-bit users of Meteor can
continue to have a functioning Mongo binary in development, while still
allowing Meteor to ship newer Mongo (e.g. 3.4+) binaries for 64-bit
users.  This is particularly relevant for Windows users, who have
previously only had 32-bit Meteor builds and represented a majority of
"32-bit" development, despite the fact most of their hosts supported
64-bit.  During another time in Meteor's life, this made sense.

This commit takes improved functionality to the next level (and makes
the aforementioned changes obsolete) by introducing support for building
and shipping Meteor for Windows in a 64-bit flavor (in addition to
32-bit), which will hopefully solve a number of performance matters on
Windows by using binaries which are pre-compiled for 64-bit, rather than
forcing the Windows kernel to deal with 32-bit binaries.  While Windows
has shown it's quite capable of dealing with such a situation, it seems
more and more clear (given improvements in underlying dependencies) that
performance gains could be had by freeing Windows of its 32-bit work.

This commit also further perpetuates the "archinfo" plot-line with more
story (about Windows) and various spelling corrections.
2017-10-14 13:36:29 -04:00
Hugh Willson
9a1f91843e Add Tool support for both 32 bit (3.2) and 64 bit (3.4) Mongo
These changes introduce dual Mongo support into the Meteor
Tool. 32-bit Mongo (3.2.15) will be used by Meteor when the
Tool is run on a 32-bit OS (32-bit Linux and Windows). 64-bit
Mongo (3.4.9) will be used when the Tool is run on a 64-bit
OS (64-bit Linux, Windows and macOS).

Fixes https://github.com/meteor/meteor-feature-requests/issues/129.
2017-10-14 13:36:29 -04:00
Ben Newman
a1d92f4c18 Merge branch 'release-1.5.2' into release-1.6 2017-07-17 18:02:39 -04:00
Ben Newman
7d87376bd2 Use multipipe and split2 to compose eachline streams. 2017-07-17 17:41:30 -04:00
Ben Newman
0f05575099 Simplify eachline by using split npm package. 2017-07-17 16:26:38 -04:00
Ben Newman
8af4955389 Use eachline@3.0.5 from npm instead of our own fork.
The pull request corresponding to our fork is not going to be merged, so
it's better to use the alternative this.finished API available in newer
versions of the upstream package.

https://github.com/williamkapke/node-eachline/pull/4
2017-07-14 13:34:33 -04:00
Ben Newman
25f003d0bc Throttle requestGarbageCollection to once per 500ms.
With Meteor 1.6 / Node 8, I noticed _buildLocalPackages taking multiple
seconds on initial server startup and restart, and the problem seems to be
that we call the global.gc function too often. This wasn't a problem in
previous versions of Node, as far as I know, but it makes sense to heed
the comment in tools/utils/gc.js, now that it matters.
2017-07-13 20:10:37 -04:00
Ben Newman
c253bdd71c Use eachline@3.0.5 from npm instead of our own fork.
The pull request corresponding to our fork is not going to be merged, so
it's better to use the alternative this.finished API available in newer
versions of the upstream package.

https://github.com/williamkapke/node-eachline/pull/4
2017-07-13 16:20:31 -04:00
Ben Newman
77843cdb28 Throttle requestGarbageCollection to once per 500ms.
With Meteor 1.6 / Node 8, I noticed _buildLocalPackages taking multiple
seconds on initial server startup and restart, and the problem seems to be
that we call the global.gc function too often. This wasn't a problem in
previous versions of Node, as far as I know, but it makes sense to heed
the comment in tools/utils/gc.js, now that it matters.
2017-06-06 12:52:09 -04:00
Ben Newman
0d7c9e8481 Merge branch 'wip-upgrade-to-node-6' into release-1.6 2017-05-30 15:41:12 -04: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
31c0d19019 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-21 12:09:34 -04:00
David Glasser
3dbac9e19c 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-21 12:09:34 -04:00
Ben Newman
5900f5cfb6 Merge branch 'release-1.5' into wip-upgrade-to-node-6 2017-05-11 16:36:16 -04: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
Ben Newman
1c041237d9 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-20 16:12:08 -04:00
Ben Newman
8e62f31ef1 Ensure appIdentifier is a legal Cordova package name.
This fixes intermittent failures of the cordova-platforms tests, which
would sometimes fail when one of the app identifier components happened to
start with a number instead of a letter.

The text of the exception was:

  Error validating package name. Package name must look like: com.company.Name

For example:

  https://circleci.com/gh/meteor/meteor/3710#tests/containers/2
2017-04-06 19:16:06 -04:00
Ben Newman
f6df21ff1e 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:48:53 -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
Ben Newman
dd012bf6e5 Tolerate " => awaited here:" in parseStackFrames.
da826064bc
2016-11-01 17:25:42 -04:00
Ben Newman
47d3546b3a Fix problems in request callback that broke getUrlWithResuming tests. 2016-10-21 11:25:17 -04:00
Ben Newman
545493b34a Report an error when HTTP request body is incomplete.
When a download aborts prematurely, the status code is often 200 OK, even
though we probably should not proceed with any further processing of the
downloaded information.

This silent failure leads to problems like the dreaded "Error: ENOENT: no
such file or directory, open... os.json" (#7806 and others), which were
hard to diagnose properly because the failure occurred only later, when
extracting a buffer that downloaded incompletely.

The getUrlWithResuming helper should be able to retry after this error is
thrown, which will result in a more helpful warning, even if in the most
common case, i.e. MaxCDN failure, it will never actually succeed.

Note that this change will not help until Meteor 1.4.2 is officially
released and becomes the implementation used to download later releases.

Mitigates #7806.
2016-10-21 11:25:17 -04:00
Ben Newman
bb8e1a3b9f Implement ConcatStream class instead of using concat-stream npm package. 2016-08-01 14:42:22 -04:00
Tom Coleman
7769951ee8 Switched to concat-stream for performance 2016-08-01 17:55:37 +10:00
Ben Newman
e85cef8e1a Make download resumption test faster and more deterministic.
We now use a smaller file (the `babel-compiler` archive instead of
`meteor-tool`), and we interrupt every 500kB, which leads to three total
interruptions for that file. Also, we only delay one second (instead of
five) between attempts.
2016-07-14 17:00:08 -04:00