This is not GitHub.com

Like what you see? Install OctoLinker now!

Skip to content
Permalink
Browse files

Decrease install size (#396)

* Remove chalk and upgrade arg

* Add engines key to package.json

* Remove handling of below node 8

* Revert "Remove handling of below node 8"

This reverts commit f41de4c.

* Revert "Revert "Remove handling of below node 8""

This reverts commit af254a0.

* Remove test for below node 8
  • Loading branch information...
timneutkens committed May 2, 2019
1 parent 85d7bd6 commit 0cf4d7c15cf73ee2666a6bc9e382f9258c65fa3a
Showing with 33 additions and 65 deletions.
  1. +17 −18 bin/micro.js
  2. +0 −10 errors/old-node-version.md
  3. +0 −12 lib/handler.js
  4. +4 −2 package.json
  5. +0 −12 test/handler.js
  6. +12 −11 yarn.lock
@@ -6,7 +6,6 @@ const {existsSync} = require('fs');

// Packages
const arg = require('arg');
const chalk = require('chalk');

// Utilities
const serve = require('../lib');
@@ -37,46 +36,46 @@ const args = arg({
// When `-h` or `--help` are used, print out
// the usage information
if (args['--help']) {
console.error(chalk`
{bold.cyan micro} - Asynchronous HTTP microservices
console.error(`
micro - Asynchronous HTTP microservices
{bold USAGE}
USAGE
{bold $} {cyan micro} --help
{bold $} {cyan micro} --version
{bold $} {cyan micro} [-l {underline listen_uri} [-l ...]] [{underline entry_point.js}]
$ micro --help
$ micro --version
$ micro [-l listen_uri [-l ...]] [entry_point.js]
By default {cyan micro} will listen on {bold 0.0.0.0:3000} and will look first
for the {bold "main"} property in package.json and subsequently for {bold index.js}
as the default {underline entry_point}.
By default micro will listen on 0.0.0.0:3000 and will look first
for the "main" property in package.json and subsequently for index.js
as the default entry_point.
Specifying a single {bold --listen} argument will overwrite the default, not supplement it.
Specifying a single --listen argument will overwrite the default, not supplement it.
{bold OPTIONS}
OPTIONS
--help shows this help message
-v, --version displays the current version of micro
-l, --listen {underline listen_uri} specify a URI endpoint on which to listen (see below) -
-l, --listen listen_uri specify a URI endpoint on which to listen (see below) -
more than one may be specified to listen in multiple places
{bold ENDPOINTS}
ENDPOINTS
Listen endpoints (specified by the {bold --listen} or {bold -l} options above) instruct {cyan micro}
Listen endpoints (specified by the --listen or -l options above) instruct micro
to listen on one or more interfaces/ports, UNIX domain sockets, or Windows named pipes.
For TCP (traditional host/port) endpoints:
{bold $} {cyan micro} -l tcp://{underline hostname}:{underline 1234}
$ micro -l tcp://hostname:1234
For UNIX domain socket endpoints:
{bold $} {cyan micro} -l unix:{underline /path/to/socket.sock}
$ micro -l unix:/path/to/socket.sock
For Windows named pipe endpoints:
{bold $} {cyan micro} -l pipe:\\\\.\\pipe\\{underline PipeName}
$ micro -l pipe:\\\\.\\pipe\\PipeName
`);
process.exit(2);
}

This file was deleted.

@@ -12,18 +12,6 @@ module.exports = async file => {
}
} catch (err) {
logError(`Error when importing ${file}: ${err.stack}`, 'invalid-entry');

if (
err instanceof SyntaxError &&
/\s+async\s+/.test(err.stack) &&
Number(process.versions.node.split('.')[0]) < 8
) {
logError(
'In order for `async` & `await` to work, you need to use at least Node.js 8!',
'old-node-version'
);
}

process.exit(1);
}

@@ -15,6 +15,9 @@
"bin": {
"micro": "./bin/micro.js"
},
"engines": {
"node": ">= 8.0.0"
},
"repository": "zeit/micro",
"keywords": [
"micro",
@@ -40,8 +43,7 @@
"then-sleep": "1.0.1"
},
"dependencies": {
"arg": "2.0.0",
"chalk": "2.4.0",
"arg": "4.1.0",
"content-type": "1.0.4",
"is-stream": "1.1.0",
"raw-body": "2.3.2"
@@ -50,15 +50,3 @@ test('process.exit when handling and inexisting file', async t => {
await t.throws(promise);
t.is(process.exit.getCall(0).args[0], 1);
});

test('log and process.exit when node version is below 8', async t => {
// Stub process.versions.node.split()
sinon.stub(String.prototype, 'split').callsFake(() => '7');
const logErrorSpy = sinon.spy();
handle.__set__('logError', logErrorSpy);
const file = path.resolve('test/fixtures/syntax-error');
const promise = handle(file);
await t.throws(promise);
t.is(logErrorSpy.callCount, 2);
t.is(process.exit.getCall(0).args[0], 1);
});
@@ -185,9 +185,10 @@ are-we-there-yet@~1.1.2:
delegates "^1.0.0"
readable-stream "^2.0.6"

arg@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/arg/-/arg-2.0.0.tgz#c06e7ff69ab05b3a4a03ebe0407fac4cba657545"
arg@4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.0.tgz#583c518199419e0037abb74062c37f8519e575f0"
integrity sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==

arg@^1.0.0:
version "1.0.1"
@@ -887,14 +888,6 @@ center-align@^0.1.1:
align-text "^0.1.3"
lazy-cache "^1.0.3"

chalk@2.4.0, chalk@^2.0.0, chalk@^2.3.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.0.tgz#a060a297a6b57e15b61ca63ce84995daa0fe6e52"
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

chalk@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.4.0.tgz#5199a3ddcd0c1efe23bc08c1b027b06176e0c64f"
@@ -913,6 +906,14 @@ chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"

chalk@^2.0.0, chalk@^2.3.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.0.tgz#a060a297a6b57e15b61ca63ce84995daa0fe6e52"
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

chalk@^2.0.1, chalk@^2.1.0:
version "2.3.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65"

0 comments on commit 0cf4d7c

Please sign in to comment.
You can’t perform that action at this time.