Compare commits

...

27 Commits

Author SHA1 Message Date
Tim Neutkens
f9233b2e24 Publish
- @now/build-utils@0.4.28
 - @now/go@0.2.8
 - @now/html-minifier@1.0.4
 - @now/lambda@0.4.5
 - @now/md@0.4.5
 - @now/mdx-deck@0.4.14
 - @now/next@0.0.77
 - @now/node-bridge@0.1.7
 - @now/node-server@0.4.22
 - @now/node@0.4.24
 - @now/optipng@0.4.5
 - @now/php@0.4.9
 - @now/python@0.0.38
 - @now/static-build@0.4.13
2018-11-14 16:16:43 +01:00
Tim Neutkens
bfa0c05e5d Install go before publishing 2018-11-14 16:16:06 +01:00
Tim Neutkens
6caba97183 Publish
- @now/build-utils@0.4.27
 - @now/go@0.2.7
 - @now/html-minifier@1.0.3
 - @now/lambda@0.4.4
 - @now/md@0.4.4
 - @now/mdx-deck@0.4.13
 - @now/next@0.0.76
 - @now/node-bridge@0.1.6
 - @now/node-server@0.4.21
 - @now/node@0.4.23
 - @now/optipng@0.4.4
 - @now/php@0.4.8
 - @now/python@0.0.37
 - @now/static-build@0.4.12
2018-11-14 16:09:42 +01:00
Tim Neutkens
5d35de8908 Temporarily disable publish-canary 2018-11-14 16:06:34 +01:00
Tim Neutkens
551a29dd13 Use build instead of upload 2018-11-14 15:54:19 +01:00
Tim Neutkens
f63f48e1e9 Revert "Publish"
This reverts commit 7d7f0adfb3.
2018-11-14 15:53:18 +01:00
Tim Neutkens
7d7f0adfb3 Publish
- @now/build-utils@0.4.27
 - @now/go@0.2.7
 - @now/html-minifier@1.0.3
 - @now/lambda@0.4.4
 - @now/md@0.4.4
 - @now/mdx-deck@0.4.13
 - @now/next@0.0.76
 - @now/node-bridge@0.1.6
 - @now/node-server@0.4.21
 - @now/node@0.4.23
 - @now/optipng@0.4.4
 - @now/php@0.4.8
 - @now/python@0.0.37
 - @now/static-build@0.4.12
2018-11-14 15:30:51 +01:00
Tim Neutkens
5538e97bb8 Add publish-stable script 2018-11-14 15:20:25 +01:00
Tim Neutkens
f8c260353c Add stable publish 2018-11-14 15:14:02 +01:00
Tim Neutkens
9123356d23 Publish
- @now/node-bridge@0.1.6-canary.6
 - @now/node-server@0.4.21-canary.6
 - @now/node@0.4.23-canary.6
2018-11-14 13:59:58 +01:00
Tim Neutkens
d85eee5571 Add publish-canary for tag releases 2018-11-14 13:58:32 +01:00
Tim Neutkens
0f59d568e5 Fix linting 2018-11-14 13:45:48 +01:00
Tim Neutkens
2d69514a37 Publish
- @now/lambda@0.4.4-canary.5
 - @now/next@0.0.76-canary.0
 - @now/node-bridge@0.1.6-canary.5
 - @now/node-server@0.4.21-canary.5
 - @now/node@0.4.23-canary.5
2018-11-14 13:40:41 +01:00
Tim Neutkens
7b690c742b Remove publishing from build step 2018-11-14 13:39:15 +01:00
Igor Klopov
fecbad7016 account a case with no encoding. fixes #5 (#32)
* account a case with no encoding. fixes #5

* replaced assert with throw
2018-11-14 02:32:39 +03:00
Igor Klopov
c8fce90612 [now/lambda] take handler and runtime from now.json's config 2018-11-13 23:42:59 +03:00
Igor Klopov
04803712af fix @now/lambda 2018-11-13 23:13:08 +03:00
Tim Neutkens
8a3913c5b5 Add tests for libraries breaking on now/node (#23)
* Add tests for libraries breaking on now/node

* Fix eslint errors

* Change order of extends
2018-11-12 19:07:41 +03:00
Tim Neutkens
8eb66c8c23 Publish
- @now/next@0.0.75
2018-11-11 22:55:43 +01:00
Tim Neutkens
24e10396c8 Publish
- @now/next@0.0.74-canary.6
2018-11-11 20:46:15 +01:00
Tim Neutkens
740118488c @now/next parse querystring 2018-11-11 20:43:56 +01:00
Tim Neutkens
2cf6769b93 Publish
- @now/next@0.0.74-canary.5
 - @now/static-build@0.4.12-canary.5
2018-11-11 18:22:35 +01:00
Tim Neutkens
4353614ae3 Fix linting for @now/next 2018-11-11 18:21:56 +01:00
Tim Neutkens
92f1515271 @now/next - don’t run path matching for lambdas (#13)
Fixes https://spectrum.chat/thread/5e7c14aa-752a-45c3-a744-89721ecf7ceb
2018-11-11 18:13:30 +01:00
Simon Hänisch
3c24ce4116 feat(now-static-build): add a distDir option (#20)
Adds an optional `distDir` config option to now-static-build.

To be used in `now.json` like

```json
{
  "builds": [
    {
      "src": "package.json",
      "use": "@now/static-build",
      "config": { "distDir": "www" }
    }
  ]
}
```

Closes #19
2018-11-11 18:12:46 +01:00
Tim Neutkens
863b8c8fe5 Add lint-staged precommit hooks + prettier (#18)
Runs both on pre-commit
2018-11-11 16:05:59 +01:00
Tim Neutkens
3e52eda3af Add tests (#17)
Add testing setup
2018-11-10 23:55:51 +01:00
49 changed files with 1156 additions and 132 deletions

View File

@@ -19,25 +19,51 @@ jobs:
name: Bootstrapping
command: yarn bootstrap
- run:
name: Saving Authentication Information
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
name: Linting
command: yarn lint
- run:
name: Publishing to Canary Channel
command: yarn run lerna publish from-git --npm-tag canary --yes
publish-canary:
name: Tests
command: yarn test
# publish-canary:
# docker:
# - image: circleci/node:10
# working_directory: ~/repo
# steps:
# - checkout
# - run:
# name: Updating apt-get list
# command: sudo apt-get update
# - run:
# name: Installing the latest version of Go
# command: sudo apt-get install golang-go
# - run: yarn install
# - run: yarn bootstrap
# - run:
# name: Saving Authentication Information
# command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
# - run:
# name: Publishing to Canary Channel
# command: yarn run lerna publish from-git --npm-tag canary --yes
publish-stable:
docker:
- image: circleci/node:10
working_directory: ~/repo
steps:
- checkout
- run:
name: Updating apt-get list
command: sudo apt-get update
- run:
name: Installing the latest version of Go
command: sudo apt-get install golang-go
- run: yarn install
- run: yarn bootstrap
- run:
name: Saving Authentication Information
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run:
name: Publishing to Canary Channel
command: yarn run lerna publish from-git --npm-tag canary --yes
name: Publishing to Stable Channel
command: yarn run lerna publish from-git --yes
workflows:
version: 2
unscheduled:
@@ -46,17 +72,15 @@ workflows:
filters:
tags:
only: /.*/
- publish-canary:
- publish-stable:
requires:
- build
filters:
tags:
only: /.*/
branches:
ignore: /.*/
# - publish-stable:
only: /^.*(\d+\.)(\d+\.)(\*|\d+)$/
# - publish-canary:
# requires:
# - build
# filters:
# tags:
# only: /^(\d+\.)?(\d+\.)?(\*|\d+)$/
# branches:
# ignore: /.*/
# only: /^.*canary.*($|\b)/

View File

@@ -1,2 +1,3 @@
/tmp/*
/node_modules/*
/**/node_modules/*
/**/node_modules/*

View File

@@ -1,5 +1,5 @@
{
"extends": ["prettier", "airbnb-base"],
"extends": ["airbnb-base", "prettier"],
"rules": {
"no-console": 0,
"import/no-unresolved": 0,

1
.gitignore vendored
View File

@@ -1 +1,2 @@
node_modules
tmp

4
jest.config.js Normal file
View File

@@ -0,0 +1,4 @@
module.exports = {
testEnvironment: 'node',
rootDir: 'test',
};

View File

@@ -11,13 +11,28 @@
"scripts": {
"lerna": "lerna",
"bootstrap": "lerna bootstrap",
"publish-stable": "lerna version",
"publish-canary": "lerna version prerelease --preid canary",
"lint": "eslint ."
"lint": "eslint .",
"test": "jest",
"lint-staged": "lint-staged"
},
"pre-commit": "lint-staged",
"lint-staged": {
"*.js": [
"eslint",
"prettier --write --single-quote",
"git add"
]
},
"devDependencies": {
"eslint": "^5.9.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-import": "^2.14.0"
"eslint-plugin-import": "^2.14.0",
"jest": "^23.6.0",
"lint-staged": "^8.0.4",
"pre-commit": "^1.2.2",
"prettier": "^1.15.2"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@now/build-utils",
"version": "0.4.27-canary.4",
"version": "0.4.28",
"dependencies": {
"async-retry": "1.2.3",
"async-sema": "2.1.4",

View File

@@ -1,6 +1,6 @@
{
"name": "@now/go",
"version": "0.2.7-canary.4",
"version": "0.2.8",
"scripts": {
"test": "best -I test/*.js",
"prepublish": "./build.sh"

View File

@@ -1,6 +1,6 @@
{
"name": "@now/html-minifier",
"version": "1.0.3-canary.4",
"version": "1.0.4",
"dependencies": {
"html-minifier": "3.5.21"
},

View File

@@ -1,25 +1,12 @@
const { Lambda } = require('@now/build-utils/lambda.js');
const path = require('path');
const streamToBuffer = require('@now/build-utils/fs/stream-to-buffer.js');
exports.build = async ({ files, entrypoint }) => {
exports.build = async ({ files, entrypoint, config }) => {
if (!files[entrypoint]) throw new Error('Entrypoint not found in files');
// handler=launcher.main!runtime=nodejs8.10!name.zip
const config = path.basename(entrypoint).split('!').reduce((a, c) => {
const [k, v] = c.split('=');
// eslint-disable-next-line no-param-reassign
if (v) a[k] = v;
return a;
}, {});
if (!config.handler) throw new Error('Handler not found in config');
if (!config.runtime) throw new Error('Runtime not found in config');
const lambda = new Lambda({
zipStream: files[entrypoint].toStream(), // TODO zipBuffer
handler: config.handler,
runtime: config.runtime,
});
const { handler, runtime } = config;
if (!handler) throw new Error('Handler not found in config');
if (!runtime) throw new Error('Runtime not found in config');
const zipBuffer = await streamToBuffer(files[entrypoint].toStream());
const lambda = new Lambda({ zipBuffer, handler, runtime });
return { [entrypoint]: lambda };
};

View File

@@ -1,6 +1,6 @@
{
"name": "@now/lambda",
"version": "0.4.4-canary.4",
"version": "0.4.5",
"peerDependencies": {
"@now/build-utils": ">=0.0.1"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@now/md",
"version": "0.4.4-canary.4",
"version": "0.4.5",
"dependencies": {
"rehype-document": "^2.2.0",
"rehype-format": "^2.3.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@now/mdx-deck",
"version": "0.4.13-canary.4",
"version": "0.4.14",
"peerDependencies": {
"@now/build-utils": ">=0.0.1"
}

View File

@@ -1,10 +1,14 @@
const { createLambda } = require('@now/build-utils/lambda.js');
const download = require('@now/build-utils/fs/download.js');
const FileFsRef = require('@now/build-utils/file-fs-ref.js');
const FileBlob = require('@now/build-utils/file-blob');
const path = require('path');
const { readFile, writeFile, unlink } = require('fs.promised');
const rename = require('@now/build-utils/fs/rename.js');
const { runNpmInstall, runPackageJsonScript } = require('@now/build-utils/fs/run-user-scripts.js');
const {
runNpmInstall,
runPackageJsonScript
} = require('@now/build-utils/fs/run-user-scripts.js');
const glob = require('@now/build-utils/fs/glob.js');
// Exclude certain files from the files object
@@ -15,13 +19,13 @@ function excludeFiles(files, matchFn) {
}
return {
...newFiles,
[fileName]: files[fileName],
[fileName]: files[fileName]
};
}, {});
}
function shouldExcludeFile(entryDirectory) {
return (file) => {
return file => {
// If the file is not in the entry directory
if (entryDirectory !== '.' && !file.startsWith(entryDirectory)) {
return true;
@@ -45,20 +49,31 @@ function shouldExcludeFile(entryDirectory) {
}
exports.build = async ({ files, workPath, entrypoint }) => {
if (!/package\.json$/.exec(entrypoint) && !/next\.config\.js$/.exec(entrypoint)) {
throw new Error('Specified "src" for "@now/next" has to be "package.json" or "next.config.js"');
if (
!/package\.json$/.exec(entrypoint) &&
!/next\.config\.js$/.exec(entrypoint)
) {
throw new Error(
'Specified "src" for "@now/next" has to be "package.json" or "next.config.js"'
);
}
console.log('downloading user files...');
const entryDirectory = path.dirname(entrypoint);
const filesToDownload = excludeFiles(files, shouldExcludeFile(entryDirectory));
const entrypointHandledFilesToDownload = rename(filesToDownload, (file) => {
const filesToDownload = excludeFiles(
files,
shouldExcludeFile(entryDirectory)
);
const entrypointHandledFilesToDownload = rename(filesToDownload, file => {
if (entryDirectory !== '.') {
return file.replace(new RegExp(`^${entryDirectory}/`), '');
}
return file;
});
let downloadedFiles = await download(entrypointHandledFilesToDownload, workPath);
let downloadedFiles = await download(
entrypointHandledFilesToDownload,
workPath
);
let packageJson = {};
if (downloadedFiles['package.json']) {
@@ -71,35 +86,45 @@ exports.build = async ({ files, workPath, entrypoint }) => {
...packageJson,
dependencies: {
...packageJson.dependencies,
'next-server': 'canary',
'next-server': 'canary'
},
devDependencies: {
...packageJson.devDependencies,
next: 'canary',
next: 'canary'
},
scripts: {
...packageJson.scripts,
'now-build': 'next build',
},
'now-build': 'next build'
}
};
if (!packageJson.dependencies.react) {
console.log('"react" not found in dependencies, adding to "package.json" "dependencies"');
console.log(
'"react" not found in dependencies, adding to "package.json" "dependencies"'
);
packageJson.dependencies.react = 'latest';
}
if (!packageJson.dependencies['react-dom']) {
console.log('"react-dom" not found in dependencies, adding to "package.json" "dependencies"');
console.log(
'"react-dom" not found in dependencies, adding to "package.json" "dependencies"'
);
packageJson.dependencies['react-dom'] = 'latest';
}
// in case the user has `next` on their `dependencies`, we remove it
delete packageJson.dependencies.next;
await writeFile(path.join(workPath, 'package.json'), JSON.stringify(packageJson, null, 2));
await writeFile(
path.join(workPath, 'package.json'),
JSON.stringify(packageJson, null, 2)
);
if (process.env.NPM_AUTH_TOKEN) {
console.log('found NPM_AUTH_TOKEN in environement, creating .npmrc');
await writeFile(path.join(workPath, '.npmrc'), `//registry.npmjs.org/:_authToken=${process.env.NPM_AUTH_TOKEN}`);
await writeFile(
path.join(workPath, '.npmrc'),
`//registry.npmjs.org/:_authToken=${process.env.NPM_AUTH_TOKEN}`
);
}
downloadedFiles = await glob('**', workPath);
@@ -119,50 +144,88 @@ exports.build = async ({ files, workPath, entrypoint }) => {
try {
buildId = await readFile(path.join(workPath, '.next', 'BUILD_ID'), 'utf8');
} catch (err) {
console.error('BUILD_ID not found in ".next". The "package.json" "build" script did not run "next build"');
console.error(
'BUILD_ID not found in ".next". The "package.json" "build" script did not run "next build"'
);
throw new Error('Missing BUILD_ID');
}
const dotNextRootFiles = await glob('.next/*', workPath);
const dotNextServerRootFiles = await glob('.next/server/*', workPath);
const nodeModules = excludeFiles(await glob('node_modules/**', workPath), file => file.startsWith('node_modules/.cache'));
const nodeModules = excludeFiles(
await glob('node_modules/**', workPath),
file => file.startsWith('node_modules/.cache')
);
const launcherFiles = {
'now__launcher.js': new FileFsRef({ fsPath: path.join(__dirname, 'launcher.js') }),
'now__bridge.js': new FileFsRef({ fsPath: require('@now/node-bridge') }),
'now__bridge.js': new FileFsRef({ fsPath: require('@now/node-bridge') })
};
const nextFiles = {
...nodeModules, ...dotNextRootFiles, ...dotNextServerRootFiles, ...launcherFiles,
...nodeModules,
...dotNextRootFiles,
...dotNextServerRootFiles,
...launcherFiles
};
if (downloadedFiles['next.config.js']) {
nextFiles['next.config.js'] = downloadedFiles['next.config.js'];
}
const pages = await glob('**/*.js', path.join(workPath, '.next', 'server', 'static', buildId, 'pages'));
const pages = await glob(
'**/*.js',
path.join(workPath, '.next', 'server', 'static', buildId, 'pages')
);
const launcherPath = path.join(__dirname, 'launcher.js');
const launcherData = await readFile(launcherPath, 'utf8');
const lambdas = {};
await Promise.all(Object.keys(pages).map(async (page) => {
// These default pages don't have to be handled as they'd always 404
if (['_app.js', '_error.js', '_document.js'].includes(page)) {
return;
}
await Promise.all(
Object.keys(pages).map(async page => {
// These default pages don't have to be handled as they'd always 404
if (['_app.js', '_error.js', '_document.js'].includes(page)) {
return;
}
const pageFiles = {
[`.next/server/static/${buildId}/pages/_document.js`]: downloadedFiles[`.next/server/static/${buildId}/pages/_document.js`],
[`.next/server/static/${buildId}/pages/_app.js`]: downloadedFiles[`.next/server/static/${buildId}/pages/_app.js`],
[`.next/server/static/${buildId}/pages/_error.js`]: downloadedFiles[`.next/server/static/${buildId}/pages/_error.js`],
[`.next/server/static/${buildId}/pages/${page}`]: downloadedFiles[`.next/server/static/${buildId}/pages/${page}`],
};
const pathname = page.replace(/\.js$/, '');
const launcher = launcherData.replace(
'PATHNAME_PLACEHOLDER',
`/${pathname.replace(/(^|\/)index$/, '')}`
);
lambdas[path.join(entryDirectory, page.replace(/\.js$/, ''))] = await createLambda({
files: { ...nextFiles, ...pageFiles },
handler: 'now__launcher.launcher',
runtime: 'nodejs8.10',
});
}));
const pageFiles = {
[`.next/server/static/${buildId}/pages/_document.js`]: downloadedFiles[
`.next/server/static/${buildId}/pages/_document.js`
],
[`.next/server/static/${buildId}/pages/_app.js`]: downloadedFiles[
`.next/server/static/${buildId}/pages/_app.js`
],
[`.next/server/static/${buildId}/pages/_error.js`]: downloadedFiles[
`.next/server/static/${buildId}/pages/_error.js`
],
[`.next/server/static/${buildId}/pages/${page}`]: downloadedFiles[
`.next/server/static/${buildId}/pages/${page}`
]
};
const nextStaticFiles = await glob('**', path.join(workPath, '.next', 'static'));
const staticFiles = Object.keys(nextStaticFiles).reduce((mappedFiles, file) => ({
...mappedFiles,
[path.join(entryDirectory, `_next/static/${file}`)]: nextStaticFiles[file],
}), {});
lambdas[path.join(entryDirectory, pathname)] = await createLambda({
files: {
...nextFiles,
...pageFiles,
'now__launcher.js': new FileBlob({ data: launcher })
},
handler: 'now__launcher.launcher',
runtime: 'nodejs8.10'
});
})
);
const nextStaticFiles = await glob(
'**',
path.join(workPath, '.next', 'static')
);
const staticFiles = Object.keys(nextStaticFiles).reduce(
(mappedFiles, file) => ({
...mappedFiles,
[path.join(entryDirectory, `_next/static/${file}`)]: nextStaticFiles[file]
}),
{}
);
return { ...lambdas, ...staticFiles };
};
@@ -174,16 +237,18 @@ exports.prepareCache = async ({ files, cachePath, workPath }) => {
await download(await glob('node_modules/**', workPath), cachePath);
console.log('.next folder contents', await glob('.next/**', cachePath));
console.log('.cache folder contents', await glob('node_modules/.cache/**', cachePath));
console.log(
'.cache folder contents',
await glob('node_modules/.cache/**', cachePath)
);
console.log('running npm install...');
await runNpmInstall(cachePath);
return {
...await glob('.next/records.json', cachePath),
...await glob('.next/server/records.json', cachePath),
...await glob('node_modules/**', cachePath),
...await glob('yarn.lock', cachePath),
...(await glob('.next/records.json', cachePath)),
...(await glob('.next/server/records.json', cachePath)),
...(await glob('node_modules/**', cachePath)),
...(await glob('yarn.lock', cachePath))
};
};

View File

@@ -1,5 +1,6 @@
const { Server } = require('http');
const next = require('next-server');
const url = require('url');
const { Bridge } = require('./now__bridge.js');
const bridge = new Bridge();
@@ -8,9 +9,11 @@ bridge.port = 3000;
process.env.NODE_ENV = 'production';
const app = next({});
const handler = app.getRequestHandler();
const server = new Server(handler);
const server = new Server((req, res) => {
const parsedUrl = url.parse(req.url, true);
app.render(req, res, 'PATHNAME_PLACEHOLDER', parsedUrl.query, parsedUrl);
});
server.listen(bridge.port);
exports.launcher = bridge.launcher;

View File

@@ -1,6 +1,6 @@
{
"name": "@now/next",
"version": "0.0.74-canary.4",
"version": "0.0.77",
"dependencies": {
"@now/node-bridge": "0.1.4",
"execa": "^1.0.0",

View File

@@ -1,38 +1,38 @@
const assert = require('assert');
const http = require('http');
function normalizeEvent(event) {
if (event.Action === 'Invoke') {
const invokeEvent = JSON.parse(event.body);
const {
method, path, headers, encoding,
} = invokeEvent;
const { method, path, headers, encoding } = invokeEvent;
let { body } = invokeEvent;
if (body) {
assert(encoding === 'base64', JSON.stringify(event)); // do we support anything else?
body = Buffer.from(body, encoding);
if (encoding === 'base64') {
body = Buffer.from(body, encoding);
} else if (encoding === undefined) {
body = Buffer.from(body);
} else {
throw new Error(`Unsupported encoding: ${encoding}`);
}
}
return {
method,
path,
headers,
body,
body
};
}
const {
httpMethod: method,
path,
headers,
body,
} = event;
const { httpMethod: method, path, headers, body } = event;
return {
method,
path,
headers,
body,
body
};
}
@@ -53,19 +53,17 @@ class Bridge {
return resolve({ statusCode: 504, body: '' });
}
const {
method, path, headers, body,
} = normalizeEvent(event);
const { method, path, headers, body } = normalizeEvent(event);
const opts = {
hostname: '127.0.0.1',
port: this.port,
path,
method,
headers,
headers
};
const req = http.request(opts, (res) => {
const req = http.request(opts, res => {
const response = res;
const respBodyChunks = [];
response.on('data', chunk => respBodyChunks.push(Buffer.from(chunk)));
@@ -78,7 +76,7 @@ class Bridge {
statusCode: response.statusCode,
headers: response.headers,
body: Buffer.concat(respBodyChunks).toString('base64'),
encoding: 'base64',
encoding: 'base64'
});
});
});
@@ -90,5 +88,5 @@ class Bridge {
}
module.exports = {
Bridge,
Bridge
};

View File

@@ -1,6 +1,6 @@
{
"name": "@now/node-bridge",
"version": "0.1.6-canary.4",
"version": "0.1.7",
"peerDependencies": {
"@now/build-utils": ">=0.0.1"
}

View File

@@ -1,8 +1,8 @@
{
"name": "@now/node-server",
"version": "0.4.21-canary.4",
"version": "0.4.22",
"dependencies": {
"@now/node-bridge": "^0.1.6-canary.4"
"@now/node-bridge": "^0.1.7"
},
"peerDependencies": {
"@now/build-utils": ">=0.0.1"

View File

@@ -1,8 +1,8 @@
{
"name": "@now/node",
"version": "0.4.23-canary.4",
"version": "0.4.24",
"dependencies": {
"@now/node-bridge": "^0.1.6-canary.4"
"@now/node-bridge": "^0.1.7"
},
"peerDependencies": {
"@now/build-utils": ">=0.0.1"

View File

@@ -1,6 +1,6 @@
{
"name": "@now/optipng",
"version": "0.4.4-canary.4",
"version": "0.4.5",
"dependencies": {
"multipipe": "2.0.3",
"optipng": "1.1.0"

View File

@@ -1,6 +1,6 @@
{
"name": "@now/php",
"version": "0.4.8-canary.4",
"version": "0.4.9",
"peerDependencies": {
"@now/build-utils": ">=0.0.1"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@now/python",
"version": "0.0.37-canary.4",
"version": "0.0.38",
"main": "index.js",
"license": "MIT",
"dependencies": {

View File

@@ -2,17 +2,22 @@ const download = require('@now/build-utils/fs/download.js');
const glob = require('@now/build-utils/fs/glob.js');
const path = require('path');
const {
runNpmInstall, runPackageJsonScript,
runShellScript,
runNpmInstall, runPackageJsonScript, runShellScript,
} = require('@now/build-utils/fs/run-user-scripts.js');
exports.build = async ({ files, entrypoint, workPath }) => {
exports.build = async ({
files, entrypoint, workPath, config,
}) => {
console.log('downloading user files...');
await download(files, workPath);
console.log('running user scripts...');
const mountpoint = path.dirname(entrypoint);
const entrypointFsDirname = path.join(workPath, mountpoint);
const distPath = path.join(workPath, path.dirname(entrypoint), 'dist');
const distPath = path.join(
workPath,
path.dirname(entrypoint),
(config && config.distDir) || 'dist',
);
if (path.basename(entrypoint) === 'package.json') {
await runNpmInstall(entrypointFsDirname, ['--prefer-offline']);

View File

@@ -1,6 +1,6 @@
{
"name": "@now/static-build",
"version": "0.4.12-canary.4",
"version": "0.4.13",
"peerDependencies": {
"@now/build-utils": ">=0.0.1"
}

View File

@@ -0,0 +1,23 @@
/* global it, expect */
const path = require('path');
const runBuildLambda = require('../../lib/run-build-lambda');
const TWO_MINUTES = 120000;
it('Should build the standard example', async () => {
const { buildResult } = await runBuildLambda(path.join(__dirname, 'standard'));
expect(buildResult.index).toBeDefined();
const filePaths = Object.keys(buildResult);
const hasUnderScoreAppStaticFile = filePaths.some(filePath => filePath.match(/static.*\/pages\/_app\.js$/));
const hasUnderScoreErrorStaticFile = filePaths.some(filePath => filePath.match(/static.*\/pages\/_error\.js$/));
expect(hasUnderScoreAppStaticFile).toBeTruthy();
expect(hasUnderScoreErrorStaticFile).toBeTruthy();
}, TWO_MINUTES);
it('Should throw when package.json or next.config.js is not the "src"', async () => {
try {
await runBuildLambda(path.join(__dirname, 'no-package-json-and-next-config'));
} catch (err) {
expect(err.message).toMatch(/package\.json/);
}
});

View File

@@ -0,0 +1,6 @@
{
"version": 2,
"builds": [
{"src": "pages/index.js", "use": "@now/next"}
]
}

View File

@@ -0,0 +1 @@
export default () => 'Index page';

View File

@@ -0,0 +1 @@
module.exports = {};

View File

@@ -0,0 +1,6 @@
{
"version": 2,
"builds": [
{"src": "next.config.js", "use": "@now/next"}
]
}

View File

@@ -0,0 +1 @@
export default () => 'Index page';

View File

@@ -0,0 +1,6 @@
// eslint-disable-next-line no-unused-vars
const airtable = require('airtable');
module.exports = (req, res) => {
res.end('Hello world');
};

View File

@@ -0,0 +1,6 @@
{
"version": 2,
"builds": [
{"src": "index.js", "use": "@now/node"}
]
}

View File

@@ -0,0 +1,9 @@
{
"name": "airtable",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"airtable": "^0.5.7"
}
}

View File

@@ -0,0 +1,416 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
airtable@^0.5.7:
version "0.5.7"
resolved "https://registry.yarnpkg.com/airtable/-/airtable-0.5.7.tgz#19df9893564166fc2719f8e43118dbc4d7b776f6"
integrity sha512-xJiayyBTPgE0grEttU7ABdNzgvLAcmSz1l91aEea2bjqkxrVOViMPOyXilRZdVSUltPssgLMeeE+HOVVbh+Fwg==
dependencies:
async "1.5.2"
lodash "4.17.10"
request "2.88.0"
xhr "2.3.3"
ajv@^6.5.5:
version "6.5.5"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.5.tgz#cf97cdade71c6399a92c6d6c4177381291b781a1"
integrity sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg==
dependencies:
fast-deep-equal "^2.0.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
asn1@~0.2.3:
version "0.2.4"
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"
integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==
dependencies:
safer-buffer "~2.1.0"
assert-plus@1.0.0, assert-plus@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=
async@1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
aws-sign2@~0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=
aws4@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==
bcrypt-pbkdf@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=
dependencies:
tweetnacl "^0.14.3"
caseless@~0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
combined-stream@^1.0.6, combined-stream@~1.0.6:
version "1.0.7"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828"
integrity sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==
dependencies:
delayed-stream "~1.0.0"
core-util-is@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=
dependencies:
assert-plus "^1.0.0"
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk=
dom-walk@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
integrity sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=
ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=
dependencies:
jsbn "~0.1.0"
safer-buffer "^2.1.0"
extend@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==
extsprintf@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05"
integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=
extsprintf@^1.2.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=
fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=
fast-json-stable-stringify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I=
for-each@^0.3.2:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==
dependencies:
is-callable "^1.1.3"
forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=
form-data@~2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.6"
mime-types "^2.1.12"
getpass@^0.1.1:
version "0.1.7"
resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=
dependencies:
assert-plus "^1.0.0"
global@~4.3.0:
version "4.3.2"
resolved "https://registry.yarnpkg.com/global/-/global-4.3.2.tgz#e76989268a6c74c38908b1305b10fc0e394e9d0f"
integrity sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=
dependencies:
min-document "^2.19.0"
process "~0.5.1"
har-schema@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=
har-validator@~5.1.0:
version "5.1.3"
resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080"
integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==
dependencies:
ajv "^6.5.5"
har-schema "^2.0.0"
http-signature@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=
dependencies:
assert-plus "^1.0.0"
jsprim "^1.2.2"
sshpk "^1.7.0"
is-callable@^1.1.3:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==
is-function@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5"
integrity sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=
is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM=
json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
json-schema@0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"
integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=
json-stringify-safe@~5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
jsprim@^1.2.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=
dependencies:
assert-plus "1.0.0"
extsprintf "1.3.0"
json-schema "0.2.3"
verror "1.10.0"
lodash@4.17.10:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
integrity sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==
mime-db@~1.37.0:
version "1.37.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.37.0.tgz#0b6a0ce6fdbe9576e25f1f2d2fde8830dc0ad0d8"
integrity sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==
mime-types@^2.1.12, mime-types@~2.1.19:
version "2.1.21"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.21.tgz#28995aa1ecb770742fe6ae7e58f9181c744b3f96"
integrity sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==
dependencies:
mime-db "~1.37.0"
min-document@^2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=
dependencies:
dom-walk "^0.1.0"
oauth-sign@~0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455"
integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==
parse-headers@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.1.tgz#6ae83a7aa25a9d9b700acc28698cd1f1ed7e9536"
integrity sha1-aug6eqJanZtwCswoaYzR8e1+lTY=
dependencies:
for-each "^0.3.2"
trim "0.0.1"
performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
process@~0.5.1:
version "0.5.2"
resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf"
integrity sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=
psl@^1.1.24:
version "1.1.29"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.29.tgz#60f580d360170bb722a797cc704411e6da850c67"
integrity sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==
punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=
punycode@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
qs@~6.5.2:
version "6.5.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
request@2.88.0:
version "2.88.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"
integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==
dependencies:
aws-sign2 "~0.7.0"
aws4 "^1.8.0"
caseless "~0.12.0"
combined-stream "~1.0.6"
extend "~3.0.2"
forever-agent "~0.6.1"
form-data "~2.3.2"
har-validator "~5.1.0"
http-signature "~1.2.0"
is-typedarray "~1.0.0"
isstream "~0.1.2"
json-stringify-safe "~5.0.1"
mime-types "~2.1.19"
oauth-sign "~0.9.0"
performance-now "^2.1.0"
qs "~6.5.2"
safe-buffer "^5.1.2"
tough-cookie "~2.4.3"
tunnel-agent "^0.6.0"
uuid "^3.3.2"
safe-buffer@^5.0.1, safe-buffer@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
sshpk@^1.7.0:
version "1.15.2"
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.15.2.tgz#c946d6bd9b1a39d0e8635763f5242d6ed6dcb629"
integrity sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==
dependencies:
asn1 "~0.2.3"
assert-plus "^1.0.0"
bcrypt-pbkdf "^1.0.0"
dashdash "^1.12.0"
ecc-jsbn "~0.1.1"
getpass "^0.1.1"
jsbn "~0.1.0"
safer-buffer "^2.0.2"
tweetnacl "~0.14.0"
tough-cookie@~2.4.3:
version "2.4.3"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781"
integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==
dependencies:
psl "^1.1.24"
punycode "^1.4.1"
trim@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/trim/-/trim-0.0.1.tgz#5858547f6b290757ee95cccc666fb50084c460dd"
integrity sha1-WFhUf2spB1fulczMZm+1AITEYN0=
tunnel-agent@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=
dependencies:
safe-buffer "^5.0.1"
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
uri-js@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==
dependencies:
punycode "^2.1.0"
uuid@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
verror@1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"
integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=
dependencies:
assert-plus "^1.0.0"
core-util-is "1.0.2"
extsprintf "^1.2.0"
xhr@2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.3.3.tgz#ad6b810e0917ce72b5ec704f5d41f1503b8e7524"
integrity sha1-rWuBDgkXznK17HBPXUHxUDuOdSQ=
dependencies:
global "~4.3.0"
is-function "^1.0.1"
parse-headers "^2.0.0"
xtend "^4.0.0"
xtend@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
integrity sha1-pcbVMr5lbiPbgg77lDofBJmNY68=

View File

@@ -0,0 +1,6 @@
// eslint-disable-next-line no-unused-vars
const aws = require('aws-sdk');
module.exports = (req, res) => {
res.end('Hello world');
};

View File

@@ -0,0 +1,6 @@
{
"version": 2,
"builds": [
{"src": "index.js", "use": "@now/node"}
]
}

View File

@@ -0,0 +1,9 @@
{
"name": "aws-sdk",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"aws-sdk": "^2.353.0"
}
}

View File

@@ -0,0 +1,103 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
aws-sdk@^2.353.0:
version "2.353.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.353.0.tgz#3c809d2b02834d892a3f5c3f1171273b336e5692"
integrity sha512-c5MwJhfcHwA2lC1Wq9csQvP9gz8dVGpZ64s5j9f/sWY6eZiDCQ6OWjxj+VJfpnCmfxyC/pdZO7JDGwems7dqIQ==
dependencies:
buffer "4.9.1"
events "1.1.1"
ieee754 "1.1.8"
jmespath "0.15.0"
querystring "0.2.0"
sax "1.2.1"
url "0.10.3"
uuid "3.1.0"
xml2js "0.4.19"
base64-js@^1.0.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3"
integrity sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==
buffer@4.9.1:
version "4.9.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298"
integrity sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"
isarray "^1.0.0"
events@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=
ieee754@1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
integrity sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=
ieee754@^1.1.4:
version "1.1.12"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.12.tgz#50bf24e5b9c8bb98af4964c941cdb0918da7b60b"
integrity sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==
isarray@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
jmespath@0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217"
integrity sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=
punycode@1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"
integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=
querystring@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=
sax@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a"
integrity sha1-e45lYZCyKOgaZq6nSEgNgozS03o=
sax@>=0.6.0:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
url@0.10.3:
version "0.10.3"
resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64"
integrity sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=
dependencies:
punycode "1.3.2"
querystring "0.2.0"
uuid@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
integrity sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==
xml2js@0.4.19:
version "0.4.19"
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7"
integrity sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==
dependencies:
sax ">=0.6.0"
xmlbuilder "~9.0.1"
xmlbuilder@~9.0.1:
version "9.0.7"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=

View File

@@ -0,0 +1,6 @@
// eslint-disable-next-line no-unused-vars
const axios = require('axios');
module.exports = (req, res) => {
res.end('Hello world');
};

View File

@@ -0,0 +1,6 @@
{
"version": 2,
"builds": [
{"src": "index.js", "use": "@now/node"}
]
}

View File

@@ -0,0 +1,9 @@
{
"name": "axios",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"axios": "^0.18.0"
}
}

View File

@@ -0,0 +1,35 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
axios@^0.18.0:
version "0.18.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.0.tgz#32d53e4851efdc0a11993b6cd000789d70c05102"
integrity sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=
dependencies:
follow-redirects "^1.3.0"
is-buffer "^1.1.5"
debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"
follow-redirects@^1.3.0:
version "1.5.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.9.tgz#c9ed9d748b814a39535716e531b9196a845d89c6"
integrity sha512-Bh65EZI/RU8nx0wbYF9shkFZlqLP+6WT/5FnA3cE/djNSuKNHJEinGGZgu/cQEkeeb2GdFOgenAmn8qaqYke2w==
dependencies:
debug "=3.1.0"
is-buffer@^1.1.5:
version "1.1.6"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=

View File

@@ -0,0 +1,45 @@
/* global it, expect */
const path = require('path');
const runBuildLambda = require('../../lib/run-build-lambda');
const TWO_MINUTES = 120000;
function runBuildForFolder(folder) {
return runBuildLambda(path.join(__dirname, folder));
}
it(
'Should build the airtable folder',
async () => {
const { buildResult } = await runBuildForFolder('airtable');
expect(buildResult['index.js']).toBeDefined();
},
TWO_MINUTES
);
it(
'Should build the aws-sdk folder',
async () => {
const { buildResult } = await runBuildForFolder('aws-sdk');
expect(buildResult['index.js']).toBeDefined();
},
TWO_MINUTES
);
it(
'Should build the axios folder',
async () => {
const { buildResult } = await runBuildForFolder('axios');
expect(buildResult['index.js']).toBeDefined();
},
TWO_MINUTES
);
it(
'Should build the mongoose folder',
async () => {
const { buildResult } = await runBuildForFolder('mongoose');
expect(buildResult['index.js']).toBeDefined();
},
TWO_MINUTES
);

View File

@@ -0,0 +1,6 @@
// eslint-disable-next-line no-unused-vars
const mongoose = require('mongoose');
module.exports = (req, res) => {
res.end('Hello world');
};

View File

@@ -0,0 +1,6 @@
{
"version": 2,
"builds": [
{"src": "index.js", "use": "@now/node"}
]
}

View File

@@ -0,0 +1,9 @@
{
"name": "mongoose",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"mongoose": "^5.3.11"
}
}

View File

@@ -0,0 +1,158 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
async@2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610"
integrity sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==
dependencies:
lodash "^4.17.10"
bluebird@3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9"
integrity sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==
bson@^1.1.0, bson@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.0.tgz#bee57d1fb6a87713471af4e32bcae36de814b5b0"
integrity sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==
debug@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"
kareem@2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/kareem/-/kareem-2.3.0.tgz#ef33c42e9024dce511eeaf440cd684f3af1fc769"
integrity sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg==
lodash.get@4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=
lodash@^4.17.10:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
memory-pager@^1.0.2:
version "1.1.0"
resolved "https://registry.yarnpkg.com/memory-pager/-/memory-pager-1.1.0.tgz#9308915e0e972849fefbae6f8bc95d6b350e7344"
integrity sha512-Mf9OHV/Y7h6YWDxTzX/b4ZZ4oh9NSXblQL8dtPCOomOtZciEHxePR78+uHFLLlsk01A6jVHhHsQZZ/WcIPpnzg==
mongodb-core@3.1.7:
version "3.1.7"
resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-3.1.7.tgz#fe61853a6a6acbd2046c91794e5325ecad85428a"
integrity sha512-YffpSrLmgFNmrvkGx+yX00KyBNk64C0BalfEn6vHHkXtcMUGXw8nxrMmhq5eXPLLlYeBpD/CsgNxE2Chf0o4zQ==
dependencies:
bson "^1.1.0"
require_optional "^1.0.1"
safe-buffer "^5.1.2"
optionalDependencies:
saslprep "^1.0.0"
mongodb@3.1.8:
version "3.1.8"
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-3.1.8.tgz#df8084fda2efdbaddd05dfd6a269891fc4cc72df"
integrity sha512-yNKwYxQ6m00NV6+pMoWoheFTHSQVv1KkSrfOhRDYMILGWDYtUtQRqHrFqU75rmPIY8hMozVft8zdC4KYMWaM3Q==
dependencies:
mongodb-core "3.1.7"
safe-buffer "^5.1.2"
mongoose-legacy-pluralize@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz#3ba9f91fa507b5186d399fb40854bff18fb563e4"
integrity sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==
mongoose@^5.3.11:
version "5.3.11"
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.3.11.tgz#ab71e070dabcb8b2aebff4702a09198a3f8a9401"
integrity sha512-LrsatxtUfZAerAxyFiaw/8T8M4T9Ff9+6wFkJwfTVDz9skX+HVOs70QOzTDawz0k0Q0I6qt9xv/ZYQi2Paykgw==
dependencies:
async "2.6.1"
bson "~1.1.0"
kareem "2.3.0"
lodash.get "4.4.2"
mongodb "3.1.8"
mongodb-core "3.1.7"
mongoose-legacy-pluralize "1.0.2"
mpath "0.5.1"
mquery "3.2.0"
ms "2.0.0"
regexp-clone "0.0.1"
safe-buffer "5.1.2"
sliced "1.0.1"
mpath@0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mpath/-/mpath-0.5.1.tgz#17131501f1ff9e6e4fbc8ffa875aa7065b5775ab"
integrity sha512-H8OVQ+QEz82sch4wbODFOz+3YQ61FYz/z3eJ5pIdbMEaUzDqA268Wd+Vt4Paw9TJfvDgVKaayC0gBzMIw2jhsg==
mquery@3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/mquery/-/mquery-3.2.0.tgz#e276472abd5109686a15eb2a8e0761db813c81cc"
integrity sha512-qPJcdK/yqcbQiKoemAt62Y0BAc0fTEKo1IThodBD+O5meQRJT/2HSe5QpBNwaa4CjskoGrYWsEyjkqgiE0qjhg==
dependencies:
bluebird "3.5.1"
debug "3.1.0"
regexp-clone "0.0.1"
safe-buffer "5.1.2"
sliced "1.0.1"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
regexp-clone@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/regexp-clone/-/regexp-clone-0.0.1.tgz#a7c2e09891fdbf38fbb10d376fb73003e68ac589"
integrity sha1-p8LgmJH9vzj7sQ03b7cwA+aKxYk=
require_optional@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/require_optional/-/require_optional-1.0.1.tgz#4cf35a4247f64ca3df8c2ef208cc494b1ca8fc2e"
integrity sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==
dependencies:
resolve-from "^2.0.0"
semver "^5.1.0"
resolve-from@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57"
integrity sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=
safe-buffer@5.1.2, safe-buffer@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
saslprep@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/saslprep/-/saslprep-1.0.2.tgz#da5ab936e6ea0bbae911ffec77534be370c9f52d"
integrity sha512-4cDsYuAjXssUSjxHKRe4DTZC0agDwsCqcMqtJAQPzC74nJ7LfAJflAtC1Zed5hMzEQKj82d3tuzqdGNRsLJ4Gw==
dependencies:
sparse-bitfield "^3.0.3"
semver@^5.1.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
sliced@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/sliced/-/sliced-1.0.1.tgz#0b3a662b5d04c3177b1926bea82b03f837a2ef41"
integrity sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=
sparse-bitfield@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz#ff4ae6e68656056ba4b3e792ab3334d38273ca11"
integrity sha1-/0rm5oZWBWuks+eSqzM004JzyhE=
dependencies:
memory-pager "^1.0.2"

View File

@@ -0,0 +1,42 @@
/* global expect */
const getWritableDirectory = require('../../packages/now-build-utils/fs/get-writable-directory.js');
const glob = require('../../packages/now-build-utils/fs/glob.js');
function runAnalyze(wrapper, context) {
if (wrapper.analyze) {
return wrapper.analyze(context);
}
return 'this-is-a-fake-analyze-result-from-default-analyze';
}
async function runBuildLambda(inputPath) {
const inputFiles = await glob('**', inputPath);
const nowJsonRef = inputFiles['now.json'];
expect(nowJsonRef).toBeDefined();
const nowJson = require(nowJsonRef.fsPath);
expect(nowJson.builds.length).toBe(1);
const build = nowJson.builds[0];
expect(build.src.includes('*')).toBeFalsy();
const entrypoint = build.src.replace(/^\//, ''); // strip leftmost slash
expect(inputFiles[entrypoint]).toBeDefined();
inputFiles[entrypoint].digest = 'this-is-a-fake-digest-for-non-default-analyze';
const wrapper = require(build.use);
const analyzeResult = runAnalyze(wrapper, {
files: inputFiles,
entrypoint,
config: build.config,
});
console.log(analyzeResult);
const workPath = await getWritableDirectory();
const buildResult = await wrapper.build({
files: inputFiles, entrypoint, config: build.config, workPath,
});
return {
analyzeResult,
buildResult,
};
}
module.exports = runBuildLambda;