Compare commits

..

6 Commits

Author SHA1 Message Date
Steven
537d508a1e Publish Canary
- @now/build-utils@1.3.3-canary.0
 - now@16.7.2-canary.5
 - @now/next@2.3.8-canary.0
 - @now/node@1.3.4-canary.0
 - @now/static-build@0.14.4-canary.0
2020-01-07 16:14:57 -05:00
Steven
3b98cdac4b [now-build-utils] Add property hideStackTrace (#3516)
This adds a few properties to NowBuildError so that we can display in the web interface.
2020-01-07 21:01:09 +00:00
Max Rovensky
aaf7d6b1cd Publish Canary
- @now/frameworks@0.0.4-canary.0
 - now@16.7.2-canary.4
2020-01-07 23:18:11 +08:00
Luc
d4b6814d40 [@now/frameworks] Improve Framework type (#3515)
Makes types more specific: we want to avoid missing project settings placeholder/value in the UIs that consume frameworks (cli, front-end, ...).
2020-01-07 15:12:33 +00:00
Max
a85f11aaef Store file count on file_count event for future use (#3505)
Fixes an undefined length issue introduced by #3502
2020-01-07 12:18:41 +00:00
Luc
090c3ef9fc [now-cli] Fix signal-exit in yarn.lock (#3508)
Fix https://github.com/zeit/now/pull/3490/files#r363418297.
2020-01-07 10:38:13 +00:00
11 changed files with 55 additions and 41 deletions

View File

@@ -3,10 +3,7 @@ export interface FrameworkDetectionItem {
matchContent?: string;
}
interface Setting {
value?: string;
placeholder?: string;
}
type Setting = { value: string } | { placeholder: string }
export interface Framework {
name: string;
@@ -18,9 +15,9 @@ export interface Framework {
every?: FrameworkDetectionItem[];
some?: FrameworkDetectionItem[];
};
settings?: {
buildCommand?: Setting;
devCommand?: Setting;
outputDirectory?: Setting;
settings: {
buildCommand: Setting;
devCommand: Setting;
outputDirectory: Setting;
};
}

View File

@@ -1,6 +1,6 @@
{
"name": "@now/frameworks",
"version": "0.0.3",
"version": "0.0.4-canary.0",
"main": "frameworks.json",
"license": "UNLICENSED"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@now/build-utils",
"version": "1.3.2",
"version": "1.3.3-canary.0",
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.js",

View File

@@ -4,15 +4,31 @@
* This is necessary to avoid printing a stack trace.
*/
export class NowBuildError extends Error {
public hideStackTrace = true;
public code: string;
public link?: string;
constructor({ message, code }: Props) {
constructor({ message, code, link }: Props) {
super(message);
this.code = code;
this.link = link;
}
}
interface Props {
/**
* The error message to display to the end-user.
* Should be short yet descriptive of what they did wrong.
*/
message: string;
/**
* A unique error code for this particular error.
* Should start with the builder name such as `NOW_NODE_`.
*/
code: string;
/**
* Optional hyperlink starting with https://zeit.co to
* link to more information about this error.
*/
link?: string;
}

View File

@@ -19,7 +19,8 @@ const pleaseSet =
'Please set "engines": { "node": "' +
getLatestNodeVersion().range +
'" } in your `package.json` file to upgrade to Node.js ' +
getLatestNodeVersion().major;
getLatestNodeVersion().major +
'.';
const upstreamProvider =
'This change is the result of a decision made by an upstream infrastructure provider (AWS).' +
'\nRead more: https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html';
@@ -49,10 +50,13 @@ export async function getSupportedNodeVersion(
const intro =
isAuto || !engineRange
? 'This project is using an invalid version of Node.js and must be changed.'
: 'Found `engines` in `package.json` with an invalid Node.js version range: ' +
engineRange;
: 'Found `engines` in `package.json` with an invalid Node.js version range: "' +
engineRange +
'".';
throw new NowBuildError({
code: 'NOW_BUILD_UTILS_NODE_VERSION_INVALID',
link:
'https://zeit.co/docs/runtimes#official-runtimes/node-js/node-js-version',
message: intro + '\n' + pleaseSet,
});
}
@@ -61,21 +65,26 @@ export async function getSupportedNodeVersion(
if (isDiscontinued(selection)) {
const intro =
isAuto || !engineRange
? 'This project is using a discontinued version of Node.js and must be upgraded.'
: 'Found `engines` in `package.json` with a discontinued Node.js version range: ' +
engineRange;
? 'This project is using a discontinued version of Node.js (' +
selection.range +
') and must be upgraded.'
: 'Found `engines` in `package.json` with a discontinued Node.js version range: "' +
engineRange +
'".';
throw new NowBuildError({
code: 'NOW_BUILD_UTILS_NODE_VERSION_DISCONTINUED',
link:
'https://zeit.co/docs/runtimes#official-runtimes/node-js/node-js-version',
message: intro + '\n' + pleaseSet + '\n' + upstreamProvider,
});
}
debug(
isAuto || !engineRange
? 'Using default Node.js range: ' + selection.range
: (engineRange ? 'Found' : 'Missing') +
' `engines` in `package.json`, selecting range: ' +
selection.range
? 'Using default Node.js range: "' + selection.range + '".'
: 'Found `engines` in `package.json`, selecting range: "' +
selection.range +
'".'
);
if (selection.discontinueDate) {

View File

@@ -1,6 +1,6 @@
{
"name": "now",
"version": "16.7.2-canary.3",
"version": "16.7.2-canary.5",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Now",

View File

@@ -59,6 +59,7 @@ export default async function processDeployment({
let queuedSpinner = null;
let buildSpinner = null;
let deploySpinner = null;
let fileCount = null;
for await (const event of createDeployment(
nowClientOptions,
@@ -81,6 +82,7 @@ export default async function processDeployment({
debug(
`Total files ${event.payload.total.size}, ${event.payload.missing.length} changed`
);
fileCount = event.payload.missing.length;
const missingSize = event.payload.missing
.map((sha: string) => event.payload.total.get(sha).data.length)
@@ -111,13 +113,7 @@ export default async function processDeployment({
now._host = event.payload.url;
if (!quiet) {
log(
`Synced ${pluralize(
'file',
event.payload.missing.length,
true
)} ${uploadStamp()}`
);
log(`Synced ${pluralize('file', fileCount, true)} ${uploadStamp()}`);
const version = isLegacy ? `${chalk.grey('[v1]')} ` : '';
log(`https://${event.payload.url} ${version}${deployStamp()}`);
} else {
@@ -187,6 +183,8 @@ export default async function processDeployment({
}
}
} else {
let fileCount = null;
for await (const event of createLegacyDeployment(
nowClientOptions,
requestBody,
@@ -200,7 +198,7 @@ export default async function processDeployment({
debug(
`Total files ${event.payload.total.size}, ${event.payload.missing.length} changed`
);
fileCount = event.payload.missing.length;
const missingSize = event.payload.missing
.map((sha: string) => event.payload.total.get(sha).data.length)
.reduce((a: number, b: number) => a + b, 0);
@@ -230,13 +228,7 @@ export default async function processDeployment({
now._host = event.payload.url;
if (!quiet) {
log(
`Synced ${pluralize(
'file',
event.payload.missing.length,
true
)} ${uploadStamp()}`
);
log(`Synced ${pluralize('file', fileCount, true)} ${uploadStamp()}`);
const version = isLegacy ? `${chalk.grey('[v1]')} ` : '';
log(`${event.payload.url} ${version}${deployStamp()}`);
} else {

View File

@@ -1,6 +1,6 @@
{
"name": "@now/next",
"version": "2.3.7",
"version": "2.3.8-canary.0",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://zeit.co/docs/runtimes#official-runtimes/next-js",

View File

@@ -1,6 +1,6 @@
{
"name": "@now/node",
"version": "1.3.3",
"version": "1.3.4-canary.0",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://zeit.co/docs/runtimes#official-runtimes/node-js",

View File

@@ -1,6 +1,6 @@
{
"name": "@now/static-build",
"version": "0.14.3",
"version": "0.14.4-canary.0",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://zeit.co/docs/runtimes#official-runtimes/static-builds",

View File

@@ -9738,7 +9738,7 @@ shellwords@^0.1.1:
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
signal-exit@3.0.2, signal-exit@^3.0.0, signal-exit@^3.0.2:
signal-exit@3.0.2, signal-exit@TooTallNate/signal-exit#update/sighub-to-sigint-on-windows, signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://codeload.github.com/TooTallNate/signal-exit/tar.gz/58088fa7f715149f8411e089a4a6e3fe6ed265ec"