Compare commits

...

12 Commits

Author SHA1 Message Date
Steven
8e293dd633 Publish Canary
- gatsby-plugin-now@1.2.6-canary.0
 - @now/build-utils@1.0.1-canary.0
 - @now/cgi@1.0.1-canary.0
 - now@16.5.3-canary.0
 - now-client@5.2.4-canary.0
 - @now/go@1.0.1-canary.0
 - @now/next@1.0.6-canary.0
 - @now/node-bridge@1.2.7-canary.1
 - @now/node@1.1.3-canary.0
 - @now/python@1.0.1-canary.0
 - @now/routing-utils@1.3.4-canary.0
 - @now/ruby@1.0.1-canary.0
 - @now/static-build@0.12.3-canary.0
2019-11-13 10:28:12 -05:00
Thew Dhanat
e040753b27 [now-node] Ignore babel.config.js (#3295)
@now/node shouldn't read user's Babel configuration.
Fix #3280
2019-11-13 14:36:33 +00:00
Andy
463aaf094d [now-cli] Make lambda memory test more consistent (#3301)
Make lambda memory test more consistent
2019-11-13 11:21:53 +00:00
Steven
bf867b028d [tests] Always test now-cli (#3305)
Previously, only the changed package's tests would run.

This PR makes sure that the changed package + `now-cli` tests run every time.
2019-11-13 02:32:02 +00:00
Steven
6dfefc2fe4 Publish Stable
- gatsby-plugin-now@1.2.5
 - now@16.5.2
 - @now/node@1.1.2
 - @now/static-build@0.12.2
2019-11-12 18:52:28 -05:00
Steven
9ba8a8454c Bump versions 2019-11-12 18:51:32 -05:00
Steven
9c72839bfa Empty commit 2019-11-12 18:48:26 -05:00
Steven
2e24c92799 Publish Canary
- gatsby-plugin-now@1.2.4-canary.0
 - @now/node@1.1.1-canary.0
 - @now/static-build@0.12.1-canary.0
2019-11-12 18:18:17 -05:00
Andy
fa98c8aeeb Revert "[now-static-build] Inject gatsby-plugin-now in Gatsby deployments (#3182)" (#3303)
This reverts the following gatsby changes:

- Reverts #3182
- Reverts #3260
- Reverts #3212
2019-11-12 23:13:39 +00:00
Steven
f92e3496b1 [now-node] Bump now-node-bridge (#3304)
A trivial change to follow up to #3300 so that the latest `@now/node-bridge` is bundled with `ncc`.
2019-11-12 22:37:49 +00:00
Steven
0ceea76aa4 Publish Canary
- now@16.5.1-canary.0
 - @now/node-bridge@1.2.7-canary.0
2019-11-12 14:57:22 -05:00
Steven
897d11a1e1 [now-node] Disable default node timeout (#3300)
Node had a default [timeout](https://nodejs.org/api/http.html#http_server_timeout) of 2 minutes until Node 13.x so we'll need to manually disable the timeout so that the `maxDuration` config works properly.
2019-11-12 19:54:05 +00:00
43 changed files with 125 additions and 307 deletions

View File

@@ -6,6 +6,10 @@ const REDIRECT_FILE_NAME = '__now_routes_g4t5bY.json';
exports.onPostBuild = async ({ store }) => {
const { redirects, program } = store.getState();
if (!redirects.length === 0) {
return;
}
const routes = [{ handle: 'filesystem' }];
for (const redirect of redirects) {
@@ -22,30 +26,8 @@ exports.onPostBuild = async ({ store }) => {
}
}
// we implement gatsby's recommendations
// https://www.gatsbyjs.org/docs/caching/
const finalRoutes = [
{
src: '^/static/(.*)$',
headers: { 'cache-control': 'public,max-age=31536000,immutable' },
continue: true,
},
{
src: '^/.*\\.(js|css)$',
headers: { 'cache-control': 'public,max-age=31536000,immutable' },
continue: true,
},
{
src: '^/(sw\\.js|app-data\\.json|.*\\.html|page-data/.*)$',
headers: { 'cache-control': 'public,max-age=0,must-revalidate' },
continue: true,
},
...routes,
{ src: '.*', status: 404, dest: '/404.html' },
];
await writeFile(
path.join(program.directory, 'public', REDIRECT_FILE_NAME),
JSON.stringify(finalRoutes)
JSON.stringify(routes)
);
};

View File

@@ -1,6 +1,6 @@
{
"name": "gatsby-plugin-now",
"version": "1.2.3",
"version": "1.2.6-canary.0",
"main": "index.js",
"license": "MIT",
"homepage": "https://zeit.co/guides/deploying-gatsby-with-now",

View File

@@ -1,7 +1,24 @@
# gatsby-plugin-now
⚠️ The use of this plugin is deprecated. ZEIT Now supports Gatsby Redirects out-of-the-box and does not require the use a plugin.
---
This plugin generates [Now Routes](https://zeit.co/docs/v2/advanced/routes) for [redirects](https://www.gatsbyjs.org/docs/actions/#createRedirect) you configured for to your Gatsby project.
### Usage
1. Install the plugin:
```
npm install gatsby-plugin-now --save-dev
```
2. Add it to the configuration file:
```
// gatsby-config.js
module.exports = {
plugins: [
'gatsby-plugin-now'
]
}
```
3. [Deploy your project to ZEIT Now](https://www.gatsbyjs.org/docs/deploying-to-zeit-now/)

View File

@@ -2,27 +2,6 @@
exports[`test generated now routes 1`] = `
Array [
Object {
"continue": true,
"headers": Object {
"cache-control": "public,max-age=31536000,immutable",
},
"src": "^/static/(.*)$",
},
Object {
"continue": true,
"headers": Object {
"cache-control": "public,max-age=31536000,immutable",
},
"src": "^/.*\\\\.(js|css)$",
},
Object {
"continue": true,
"headers": Object {
"cache-control": "public,max-age=0,must-revalidate",
},
"src": "^/(sw\\\\.js|app-data\\\\.json|.*\\\\.html|page-data/.*)$",
},
Object {
"headers": Object {
"Location": "/",
@@ -103,10 +82,5 @@ Array [
"src": "/randorect",
"status": 302,
},
Object {
"dest": "/404.html",
"src": ".*",
"status": 404,
},
]
`;

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@now/cgi",
"version": "1.0.0",
"version": "1.0.1-canary.0",
"license": "MIT",
"repository": {
"type": "git",

View File

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

View File

@@ -141,6 +141,7 @@ export default class DevServer {
this.cachedNowConfig = null;
this.server = http.createServer(this.devServerHandler);
this.server.timeout = 0; // Disable timeout
this.serverUrlPrinted = false;
this.stopping = false;
this.buildMatches = new Map();

View File

@@ -366,10 +366,8 @@ CMD ["node", "index.js"]`,
},
'lambda-with-128-memory': {
'api/memory.js': `
const os = require('os');
module.exports = (req, res) => {
res.json({ memory: os.totalmem() });
res.json({ memory: parseInt(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE) });
};
`,
'now.json': JSON.stringify({
@@ -382,10 +380,8 @@ CMD ["node", "index.js"]`,
},
'lambda-with-200-memory': {
'api/memory.js': `
const os = require('os');
module.exports = (req, res) => {
res.json({ memory: os.totalmem() });
res.json({ memory: parseInt(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE) });
};
`,
'now.json': JSON.stringify({

View File

@@ -1828,6 +1828,7 @@ test('create zero-config deployment', async t => {
const fixturePath = fixture('zero-config-next-js');
const output = await execute([fixturePath, '--force', '--public']);
console.log('isCanary', isCanary);
console.log(output.stderr);
console.log(output.stdout);
console.log(output.exitCode);
@@ -1848,7 +1849,10 @@ test('create zero-config deployment', async t => {
isCanary ? build.use.endsWith('@canary') : !build.use.endsWith('@canary')
);
t.true(validBuilders, JSON.stringify(data, null, 2));
t.true(
validBuilders,
'Builders are not valid: ' + JSON.stringify(data, null, 2)
);
});
test('now secret add', async t => {
@@ -1955,7 +1959,7 @@ test('deploy a Lambda with 128MB of memory', async t => {
// It won't be exactly 128MB,
// so we just compare if it is lower than 450MB
const { memory } = await response.json();
t.truthy(memory < 4.5e8, `Lambda has ${memory} bytes of memory`);
t.is(memory, 128, `Lambda has ${memory} bytes of memory`);
});
test('fail to deploy a Lambda with an incorrect value for of memory', async t => {
@@ -2020,7 +2024,7 @@ test('fail to deploy a Lambda with a specific runtime but without a locked versi
t.is(output.exitCode, 1, formatOutput(output));
t.regex(
output.stderr,
/Function runtimes must have a valid version/gm,
/Function Runtimes must have a valid version/gim,
formatOutput(output)
);
});

View File

@@ -1,6 +1,6 @@
{
"name": "now-client",
"version": "5.2.3",
"version": "5.2.4-canary.0",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
"homepage": "https://zeit.co",

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@now/next",
"version": "1.0.5",
"version": "1.0.6-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-bridge",
"version": "1.2.6",
"version": "1.2.7-canary.1",
"license": "MIT",
"main": "./index.js",
"repository": {

View File

@@ -5,7 +5,7 @@ import {
Server,
IncomingHttpHeaders,
OutgoingHttpHeaders,
request
request,
} from 'http';
interface NowProxyEvent {
@@ -29,6 +29,7 @@ export interface NowProxyResponse {
}
interface ServerLike {
timeout?: number;
listen: (
opts: {
host?: string;
@@ -132,16 +133,21 @@ export class Bridge {
}
listen() {
if (!this.server) {
const { server, resolveListening } = this;
if (!server) {
throw new Error('Server has not been set!');
}
const resolveListening = this.resolveListening;
if (typeof server.timeout === 'number' && server.timeout > 0) {
// Disable timeout (usually 2 minutes until Node 13).
// Instead, user should assign function `maxDuration`.
server.timeout = 0;
}
return this.server.listen(
return server.listen(
{
host: '127.0.0.1',
port: 0
port: 0,
},
function listeningCallback() {
if (!this || typeof this.address !== 'function') {
@@ -206,7 +212,7 @@ export class Bridge {
statusCode: response.statusCode || 200,
headers: response.headers,
body: bodyBuffer.toString('base64'),
encoding: 'base64'
encoding: 'base64',
});
});
});

View File

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

View File

@@ -7,6 +7,7 @@ export function compile(
): { code: string; map: any } {
return babel.transform(source, {
filename,
configFile: false,
babelrc: false,
highlightCode: false,
compact: false,

View File

@@ -1,4 +1,12 @@
import { basename, dirname, join, relative, resolve, sep, parse as parsePath } from 'path';
import {
basename,
dirname,
join,
relative,
resolve,
sep,
parse as parsePath,
} from 'path';
import nodeFileTrace from '@zeit/node-file-trace';
import {
glob,
@@ -19,6 +27,7 @@ import {
Config,
debug,
} from '@now/build-utils';
export { shouldServe };
export { NowRequest, NowResponse } from './types';
import { makeNowLauncher, makeAwsLauncher } from './launcher';
import { readFileSync, lstatSync, readlinkSync, statSync } from 'fs';
@@ -288,7 +297,9 @@ function getAWSLambdaHandler(entrypoint: string, config: Config) {
if (process.env.NODEJS_AWS_HANDLER_NAME) {
const { dir, name } = parsePath(entrypoint);
return `${dir}${dir ? sep : ''}${name}.${process.env.NODEJS_AWS_HANDLER_NAME}`;
return `${dir}${dir ? sep : ''}${name}.${
process.env.NODEJS_AWS_HANDLER_NAME
}`;
}
return '';
@@ -303,7 +314,9 @@ export async function build({
config = {},
meta = {},
}: BuildOptions) {
const shouldAddHelpers = !(config.helpers === false || process.env.NODEJS_HELPERS === '0');
const shouldAddHelpers = !(
config.helpers === false || process.env.NODEJS_HELPERS === '0'
);
const awsLambdaHandler = getAWSLambdaHandler(entrypoint, config);
const {
@@ -387,5 +400,3 @@ export async function prepareCache({ workPath }: PrepareCacheOptions) {
...(await glob('yarn.lock', workPath)),
};
}
export { shouldServe };

View File

@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { useBuiltIns: 'usage', corejs: 3 }]],
}

View File

@@ -0,0 +1,3 @@
export default (req, resp) => {
resp.send('Cats are the best!'.endsWith('best!'));
};

View File

@@ -0,0 +1,5 @@
{
"version": 2,
"builds": [{ "src": "index.js", "use": "@now/node" }],
"probes": [{ "path": "/", "mustContain": "true" }]
}

View File

@@ -0,0 +1,6 @@
{
"dependencies": {
"@babel/preset-env": "7.7.1",
"core-js": "3.4.1"
}
}

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@now/routing-utils",
"version": "1.3.3",
"version": "1.3.4-canary.0",
"description": "ZEIT Now routing utilities",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",

View File

@@ -1,7 +1,7 @@
{
"name": "@now/ruby",
"author": "Nathan Cahill <nathan@nathancahill.com>",
"version": "1.0.0",
"version": "1.0.1-canary.0",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://zeit.co/docs/runtimes#official-runtimes/ruby",

View File

@@ -1,5 +1 @@
dist/
# bypass all ignored files for the cache fixtures
# because they contain node_modules and package-lock.json files
!test/cache-fixtures/**

View File

@@ -3,9 +3,8 @@ set -euo pipefail
ncc build src/index.ts -o dist
# copy gatsby-plugin-now files to the dist folder to
# make them available when they need to be injected
# copy gatsby plugin files in the gatsby redirect test case
gatsby_plugin="$(dirname $(pwd))/gatsby-plugin-now"
gatsby_local="dist/gatsby-plugin-now"
gatsby_local="test/fixtures/10a-gatsby-redirects/plugins/gatsby-plugin-now"
mkdir -p $gatsby_local
cp -v "$gatsby_plugin/gatsby-node.js" "$gatsby_plugin/package.json" "$gatsby_local"

View File

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

View File

@@ -2,7 +2,6 @@ import { readdir, stat, readFile, unlink } from 'fs';
import { promisify } from 'util';
import { join } from 'path';
import { Route } from '@now/build-utils';
import { injectGatsbyConfig } from './utils/gatsby-config';
const readirPromise = promisify(readdir);
const readFilePromise = promisify(readFile);
@@ -45,10 +44,6 @@ export const frameworks: Framework[] = [
return [];
}
},
beforeBuildHook: async entrypointDir => {
await injectGatsbyConfig(entrypointDir);
},
cachePattern: '.cache/**',
},
{
name: 'Hexo',
@@ -317,6 +312,4 @@ export interface Framework {
getOutputDirName: (dirPrefix: string) => Promise<string>;
defaultRoutes?: Route[] | ((dirPrefix: string) => Promise<Route[]>);
minNodeRange?: string;
beforeBuildHook?: (entrypointDir: string) => Promise<void>;
cachePattern?: string;
}

View File

@@ -18,7 +18,6 @@ import {
getNodeVersion,
getSpawnOptions,
Files,
FileFsRef,
Route,
BuildOptions,
Config,
@@ -150,24 +149,6 @@ async function getFrameworkRoutes(
return routes;
}
function getPkg(entrypoint: string, workPath: string) {
if (path.basename(entrypoint) !== 'package.json') {
return null;
}
const pkgPath = path.join(workPath, entrypoint);
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as PackageJson;
return pkg;
}
function getFramework(pkg: PackageJson) {
const dependencies = Object.assign({}, pkg.dependencies, pkg.devDependencies);
const framework = frameworks.find(
({ dependency }) => dependencies[dependency || '']
);
return framework;
}
export async function build({
files,
entrypoint,
@@ -187,9 +168,11 @@ export async function build({
(config && (config.distDir as string)) || 'dist'
);
const pkg = getPkg(entrypoint, workPath);
const entrypointName = path.basename(entrypoint);
if (pkg) {
if (entrypointName === 'package.json') {
const pkgPath = path.join(workPath, entrypoint);
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as PackageJson;
const gemfilePath = path.join(workPath, 'Gemfile');
const requirementsPath = path.join(workPath, 'requirements.txt');
@@ -247,7 +230,15 @@ export async function build({
// `public` is the default for zero config
distPath = path.join(workPath, path.dirname(entrypoint), 'public');
framework = getFramework(pkg);
const dependencies = Object.assign(
{},
pkg.dependencies,
pkg.devDependencies
);
framework = frameworks.find(
({ dependency }) => dependencies[dependency || '']
);
}
if (framework) {
@@ -265,10 +256,6 @@ export async function build({
`${framework.name} does not require a specific Node.js version. Continuing ...`
);
}
if (framework.beforeBuildHook) {
await framework.beforeBuildHook(entrypointDir);
}
}
const nodeVersion = await getNodeVersion(
@@ -390,7 +377,7 @@ export async function build({
return { routes, watch, output, distPath };
}
if (!config.zeroConfig && entrypoint.endsWith('.sh')) {
if (!config.zeroConfig && entrypointName.endsWith('.sh')) {
debug(`Running build script "${entrypoint}"`);
const nodeVersion = await getNodeVersion(entrypointDir, undefined, config);
const spawnOpts = getSpawnOptions(meta, nodeVersion);
@@ -416,27 +403,10 @@ export async function build({
throw new Error(message);
}
export async function prepareCache({
entrypoint,
workPath,
}: PrepareCacheOptions) {
// default cache paths
const defaultCacheFiles = await glob(
'{node_modules/**,package-lock.json,yarn.lock}',
workPath
);
// framework specific cache paths
let frameworkCacheFiles: { [path: string]: FileFsRef } | null = null;
const pkg = getPkg(entrypoint, workPath);
if (pkg) {
const framework = getFramework(pkg);
if (framework && framework.cachePattern) {
frameworkCacheFiles = await glob(framework.cachePattern, workPath);
}
}
return { ...defaultCacheFiles, ...frameworkCacheFiles };
export async function prepareCache({ workPath }: PrepareCacheOptions) {
return {
...(await glob('node_modules/**', workPath)),
...(await glob('package-lock.json', workPath)),
...(await glob('yarn.lock', workPath)),
};
}

View File

@@ -1,75 +0,0 @@
import { writeFile, copyFile, mkdir } from 'fs';
import { join, dirname } from 'path';
import { promisify } from 'util';
const writeFilePromise = promisify(writeFile);
const mkdirPromise = promisify(mkdir);
const copyFilePromise = promisify(copyFile);
const GATSBY_PLUGIN_NOW_NAME = 'gatsby-plugin-now';
const GATSBY_USER_CONFIG_PATH = './__now_gatsby_config_user.js';
function createGatsbyConfig(hasUserConfig: boolean) {
return `let userConfig = {}
${hasUserConfig ? `userConfig = require('${GATSBY_USER_CONFIG_PATH}')` : ''}
module.exports = {
...userConfig,
plugins: [
...(userConfig.plugins || []),
'${GATSBY_PLUGIN_NOW_NAME}'
]
}`;
}
export async function injectGatsbyConfig(entrypointDir: string) {
try {
// first, we copy gatsby-plugin-now to plugins
const gatsbyPluginNowPath = join(
entrypointDir,
'plugins',
GATSBY_PLUGIN_NOW_NAME
);
try {
await mkdirPromise(dirname(gatsbyPluginNowPath));
} catch (err) {
// plugins folder already exists, ignore error
}
await mkdirPromise(gatsbyPluginNowPath);
await copyFilePromise(
require.resolve('./gatsby-plugin-now/gatsby-node.js'),
join(gatsbyPluginNowPath, 'gatsby-node.js')
);
await copyFilePromise(
require.resolve('./gatsby-plugin-now/package.json'),
join(gatsbyPluginNowPath, 'package.json')
);
// then, we wrap the existing config and
// inject the plugin into the config
let hasUserConfig = false;
try {
await copyFilePromise(
join(entrypointDir, 'gatsby-config.js'),
join(entrypointDir, GATSBY_USER_CONFIG_PATH)
);
hasUserConfig = true;
} catch (err) {
// do nothing here, it just means the user
// didn't define gatsby-config.js
}
await writeFilePromise(
join(entrypointDir, 'gatsby-config.js'),
createGatsbyConfig(hasUserConfig),
{ encoding: 'utf-8' }
);
} catch (err) {
// if a step fail, we can ignore the error since we're not breaking
// the user's gatsby configuration
}
}

View File

@@ -1,5 +0,0 @@
{
"dependencies": {
"gatsby": "^2.13.3"
}
}

View File

@@ -1,27 +0,0 @@
const { prepareCache } = require('../dist');
const path = require('path');
describe('prepareCache', () => {
test('should cache yarn.lock, package-lock.json and node_modules', async () => {
const files = await prepareCache({
workPath: path.resolve(__dirname, './cache-fixtures/default'),
entrypoint: 'index.js',
});
expect(files['yarn.lock']).toBeDefined();
expect(files['package-lock.json']).toBeDefined();
expect(files['node_modules/file']).toBeDefined();
expect(files['index.js']).toBeUndefined();
});
test('should cache `.cache` folder for gatsby deployments', async () => {
const files = await prepareCache({
workPath: path.resolve(__dirname, './cache-fixtures/gatsby'),
entrypoint: 'package.json',
});
expect(files['.cache/file']).toBeDefined();
expect(files['yarn.lock']).toBeDefined();
});
});

View File

@@ -1,55 +1,9 @@
{
"version": 2,
"builds": [
{
"src": "package.json",
"use": "@now/static-build",
"config": { "zeroConfig": true }
}
{ "src": "package.json", "use": "@now/static-build", "config": { "zeroConfig": true } }
],
"probes": [
{ "path": "/", "mustContain": "Welcome to your new Gatsby site" },
{
"path": "/static/d/856328897.json",
"responseHeaders": {
"cache-control": "public,max-age=31536000,immutable"
}
},
{
"path": "/app-08a9fb9626777db1bf33.js",
"responseHeaders": {
"cache-control": "public,max-age=31536000,immutable"
}
},
{
"path": "/styles.fc4fa5e094d218207796.css",
"responseHeaders": {
"cache-control": "public,max-age=31536000,immutable"
}
},
{
"path": "/sw.js",
"responseHeaders": { "cache-control": "public,max-age=0,must-revalidate" }
},
{
"path": "/app-data.json",
"responseHeaders": { "cache-control": "public,max-age=0,must-revalidate" }
},
{
"path": "/index.html",
"responseHeaders": { "cache-control": "public,max-age=0,must-revalidate" }
},
{
"path": "/page-data/404/page-data.json",
"responseHeaders": { "cache-control": "public,max-age=0,must-revalidate" }
},
{
"path": "/path-that-does-not-exist",
"mustContain": "You just hit a route that doesn&#x27;t exist..."
},
{
"path": "/path-that-does-not-exist",
"status": 404
}
{ "path": "/", "mustContain": "Welcome to your new Gatsby site" }
]
}

View File

@@ -6,3 +6,4 @@ node_modules
public/
.DS_Store
yarn-error.log
plugins

View File

@@ -0,0 +1,3 @@
module.exports = {
plugins: ["gatsby-plugin-now"]
};

4
run.js
View File

@@ -26,12 +26,12 @@ async function main() {
const changed = diff
.split('\n')
.filter(item => Boolean(item) && item.includes('packages/'))
.map(item => relative('packages', item).split('/')[0]);
.map(item => relative('packages', item).split('/')[0])
.concat('now-cli'); // Always run tests for Now CLI
matches = Array.from(new Set(changed));
if (matches.length === 0) {
matches.push('now-cli');
matches.push('now-node');
console.log('No packages changed. Using default packages.');
}