mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 12:57:46 +00:00
Compare commits
14 Commits
vercel-plu
...
@vercel/py
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d7f3df980 | ||
|
|
5cf0c316e9 | ||
|
|
f4501433c8 | ||
|
|
19831593ce | ||
|
|
5d85bb1426 | ||
|
|
f194d54b0c | ||
|
|
6542086843 | ||
|
|
2721b3449d | ||
|
|
adb284519a | ||
|
|
b2d91f3121 | ||
|
|
32664cd13b | ||
|
|
db468c489a | ||
|
|
edd9bb506c | ||
|
|
a72549a290 |
2
.github/workflows/cancel.yml
vendored
2
.github/workflows/cancel.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 2
|
||||
steps:
|
||||
- uses: styfle/cancel-workflow-action@0.4.1
|
||||
- uses: styfle/cancel-workflow-action@0.9.1
|
||||
with:
|
||||
workflow_id: 849295, 849296, 849297, 849298
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
@@ -332,7 +332,7 @@ This is an abstract enumeration type that is implemented by one of the following
|
||||
- `nodejs10.x`
|
||||
- `go1.x`
|
||||
- `java11`
|
||||
- `python3.8`
|
||||
- `python3.9`
|
||||
- `python3.6`
|
||||
- `dotnetcore2.1`
|
||||
- `ruby2.5`
|
||||
@@ -398,12 +398,12 @@ This utility allows you to _scan_ the filesystem and return a [`Files`](#files)
|
||||
The following trivial example downloads everything to the filesystem, only to return it back (therefore just re-creating the passed-in [`Files`](#files)):
|
||||
|
||||
```js
|
||||
const { glob, download } = require('@vercel/build-utils')
|
||||
const { glob, download } = require('@vercel/build-utils');
|
||||
|
||||
exports.build = ({ files, workPath }) => {
|
||||
await download(files, workPath)
|
||||
return glob('**', workPath)
|
||||
}
|
||||
await download(files, workPath);
|
||||
return glob('**', workPath);
|
||||
};
|
||||
```
|
||||
|
||||
### `getWritableDirectory()`
|
||||
|
||||
@@ -14,8 +14,6 @@ const frameworks = (_frameworks as Framework[])
|
||||
sort: undefined,
|
||||
dependency: undefined,
|
||||
defaultRoutes: undefined,
|
||||
devCommand: undefined,
|
||||
buildCommand: undefined,
|
||||
};
|
||||
|
||||
if (framework.logo) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/build-utils",
|
||||
"version": "2.12.3-canary.18",
|
||||
"version": "2.12.3-canary.20",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.js",
|
||||
@@ -30,7 +30,7 @@
|
||||
"@types/node-fetch": "^2.1.6",
|
||||
"@types/semver": "6.0.0",
|
||||
"@types/yazl": "^2.4.1",
|
||||
"@vercel/frameworks": "0.5.1-canary.11",
|
||||
"@vercel/frameworks": "0.5.1-canary.12",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"aggregate-error": "3.0.1",
|
||||
"async-retry": "1.2.3",
|
||||
|
||||
@@ -169,3 +169,34 @@ export async function updateFunctionsManifest({
|
||||
|
||||
await fs.writeFile(functionsManifestPath, JSON.stringify(functionsManifest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Will append routes to the `routes-manifest.json` file.
|
||||
* If the file does not exist, it'll be created.
|
||||
*/
|
||||
export async function updateRoutesManifest({
|
||||
workPath,
|
||||
dynamicRoutes,
|
||||
}: {
|
||||
workPath: string;
|
||||
dynamicRoutes?: {
|
||||
page: string;
|
||||
regex: string;
|
||||
namedRegex?: string;
|
||||
routeKeys?: { [named: string]: string };
|
||||
}[];
|
||||
}) {
|
||||
const routesManifestPath = join(workPath, '.output', 'routes-manifest.json');
|
||||
|
||||
const routesManifest = await readJson(routesManifestPath);
|
||||
|
||||
if (!routesManifest.version) routesManifest.version = 1;
|
||||
if (routesManifest.pages404 === undefined) routesManifest.pages404 = true;
|
||||
|
||||
if (dynamicRoutes) {
|
||||
if (!routesManifest.dynamicRoutes) routesManifest.dynamicRoutes = [];
|
||||
routesManifest.dynamicRoutes.push(...dynamicRoutes);
|
||||
}
|
||||
|
||||
await fs.writeFile(routesManifestPath, JSON.stringify(routesManifest));
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ export { normalizePath } from './fs/normalize-path';
|
||||
export {
|
||||
convertRuntimeToPlugin,
|
||||
updateFunctionsManifest,
|
||||
updateRoutesManifest,
|
||||
} from './convert-runtime-to-plugin';
|
||||
|
||||
export * from './schemas';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vercel",
|
||||
"version": "23.1.3-canary.34",
|
||||
"version": "23.1.3-canary.38",
|
||||
"preferGlobal": true,
|
||||
"license": "Apache-2.0",
|
||||
"description": "The command-line interface for Vercel",
|
||||
@@ -43,14 +43,14 @@
|
||||
"node": ">= 12"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "2.12.3-canary.18",
|
||||
"@vercel/build-utils": "2.12.3-canary.20",
|
||||
"@vercel/go": "1.2.4-canary.4",
|
||||
"@vercel/node": "1.12.2-canary.6",
|
||||
"@vercel/python": "2.0.6-canary.6",
|
||||
"@vercel/node": "1.12.2-canary.7",
|
||||
"@vercel/python": "2.1.1",
|
||||
"@vercel/ruby": "1.2.8-canary.4",
|
||||
"update-notifier": "4.1.0",
|
||||
"vercel-plugin-middleware": "0.0.0-canary.7",
|
||||
"vercel-plugin-node": "1.12.2-canary.9"
|
||||
"vercel-plugin-node": "1.12.2-canary.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/env": "11.1.2",
|
||||
@@ -90,7 +90,7 @@
|
||||
"@types/update-notifier": "5.1.0",
|
||||
"@types/which": "1.3.2",
|
||||
"@types/write-json-file": "2.2.1",
|
||||
"@vercel/frameworks": "0.5.1-canary.11",
|
||||
"@vercel/frameworks": "0.5.1-canary.12",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/nft": "0.17.0",
|
||||
"@zeit/fun": "0.11.2",
|
||||
|
||||
@@ -30,10 +30,7 @@ import { getCommandName, getPkgName } from '../util/pkg-name';
|
||||
import { loadCliPlugins } from '../util/plugins';
|
||||
import { findFramework } from '../util/projects/find-framework';
|
||||
import { VERCEL_DIR } from '../util/projects/link';
|
||||
import {
|
||||
ProjectLinkAndSettings,
|
||||
readProjectSettings,
|
||||
} from '../util/projects/project-settings';
|
||||
import { readProjectSettings } from '../util/projects/project-settings';
|
||||
import pull from './pull';
|
||||
|
||||
const sema = new Sema(16, {
|
||||
@@ -68,15 +65,6 @@ const help = () => {
|
||||
|
||||
const OUTPUT_DIR = '.output';
|
||||
|
||||
const fields: {
|
||||
name: string;
|
||||
value: keyof ProjectLinkAndSettings['settings'];
|
||||
}[] = [
|
||||
{ name: 'Build Command', value: 'buildCommand' },
|
||||
{ name: 'Output Directory', value: 'outputDirectory' },
|
||||
{ name: 'Root Directory', value: 'rootDirectory' },
|
||||
];
|
||||
|
||||
export default async function main(client: Client) {
|
||||
if (process.env.__VERCEL_BUILD_RUNNING) {
|
||||
client.output.error(
|
||||
@@ -168,37 +156,47 @@ export default async function main(client: Client) {
|
||||
}
|
||||
|
||||
const buildState = { ...project.settings };
|
||||
|
||||
const formatSetting = (
|
||||
name: string,
|
||||
override: string | null | undefined,
|
||||
defaults: typeof framework.settings.outputDirectory
|
||||
) =>
|
||||
` - ${chalk.bold(`${name}:`)} ${`${
|
||||
override
|
||||
? override + ` (override)`
|
||||
: 'placeholder' in defaults
|
||||
? chalk.italic(`${defaults.placeholder}`)
|
||||
: defaults.value
|
||||
}`}`;
|
||||
console.log(`Retrieved Project Settings:`);
|
||||
console.log(
|
||||
chalk.dim(` - ${chalk.bold(`Framework Preset:`)} ${framework.name}`)
|
||||
);
|
||||
console.log(
|
||||
chalk.dim(
|
||||
formatSetting(
|
||||
'Build Command',
|
||||
project.settings.buildCommand,
|
||||
framework.settings.buildCommand
|
||||
)
|
||||
)
|
||||
);
|
||||
console.log(
|
||||
chalk.dim(
|
||||
formatSetting(
|
||||
'Output Directory',
|
||||
project.settings.outputDirectory,
|
||||
framework.settings.outputDirectory
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
for (let field of fields) {
|
||||
const defaults = (framework.settings as any)[field.value];
|
||||
if (defaults) {
|
||||
console.log(
|
||||
chalk.dim(
|
||||
` - ${chalk.bold(`${field.name}:`)} ${`${
|
||||
project.settings[field.value]
|
||||
? project.settings[field.value] + ` (override)`
|
||||
: isSettingValue(defaults)
|
||||
? defaults.value
|
||||
: chalk.italic(`${defaults.placeholder}`)
|
||||
}`}`
|
||||
)
|
||||
);
|
||||
}
|
||||
if (field.value != 'buildCommand') {
|
||||
(buildState as any)[field.value] = project.settings[field.value]
|
||||
? project.settings[field.value]
|
||||
: defaults
|
||||
? isSettingValue(defaults)
|
||||
? defaults.value
|
||||
: null
|
||||
: null;
|
||||
}
|
||||
}
|
||||
buildState.outputDirectory =
|
||||
project.settings.outputDirectory ||
|
||||
(isSettingValue(framework.settings.outputDirectory)
|
||||
? framework.settings.outputDirectory.value
|
||||
: null);
|
||||
buildState.rootDirectory = project.settings.rootDirectory;
|
||||
|
||||
if (loadedEnvFiles.length > 0) {
|
||||
console.log(
|
||||
@@ -285,17 +283,19 @@ export default async function main(client: Client) {
|
||||
// Clean the output directory
|
||||
fs.removeSync(join(cwd, OUTPUT_DIR));
|
||||
|
||||
// Yarn v2 PnP mode may be activated, so force
|
||||
// "node-modules" linker style
|
||||
const env = {
|
||||
YARN_NODE_LINKER: 'node-modules',
|
||||
...spawnOpts.env,
|
||||
};
|
||||
|
||||
if (typeof buildState.buildCommand === 'string') {
|
||||
console.log(`Running Build Command: ${cmd(buildState.buildCommand)}`);
|
||||
await execCommand(buildState.buildCommand, {
|
||||
...spawnOpts,
|
||||
// Yarn v2 PnP mode may be activated, so force
|
||||
// "node-modules" linker style
|
||||
env: {
|
||||
YARN_NODE_LINKER: 'node-modules',
|
||||
...spawnOpts.env,
|
||||
},
|
||||
cwd: cwd,
|
||||
env,
|
||||
cwd,
|
||||
});
|
||||
} else if (fs.existsSync(join(cwd, 'package.json'))) {
|
||||
await runPackageJsonScript(
|
||||
@@ -304,6 +304,15 @@ export default async function main(client: Client) {
|
||||
['vercel-build', 'now-build', 'build'],
|
||||
spawnOpts
|
||||
);
|
||||
} else if (typeof framework.settings.buildCommand.value === 'string') {
|
||||
console.log(
|
||||
`Running Build Command: ${cmd(framework.settings.buildCommand.value)}`
|
||||
);
|
||||
await execCommand(framework.settings.buildCommand.value, {
|
||||
...spawnOpts,
|
||||
env,
|
||||
cwd,
|
||||
});
|
||||
}
|
||||
|
||||
if (!fs.existsSync(join(cwd, OUTPUT_DIR))) {
|
||||
@@ -678,7 +687,7 @@ async function linkOrCopy(existingPath: string, newPath: string) {
|
||||
overwrite: true,
|
||||
});
|
||||
} else {
|
||||
await fs.createSymlink(existingPath, newPath, 'file');
|
||||
await fs.createLink(existingPath, newPath);
|
||||
}
|
||||
} catch (err: any) {
|
||||
// eslint-disable-line
|
||||
|
||||
@@ -6,7 +6,6 @@ import { ProjectEnvVariable } from '../../types';
|
||||
import Client from '../../util/client';
|
||||
import { getLinkedProject } from '../../util/projects/link';
|
||||
import { getFrameworks } from '../../util/get-frameworks';
|
||||
import { isSettingValue } from '../../util/is-setting-value';
|
||||
import { ProjectSettings } from '../../types';
|
||||
import getDecryptedEnvRecords from '../../util/get-decrypted-env-records';
|
||||
import setupAndLink from '../../util/link/setup-and-link';
|
||||
@@ -71,9 +70,9 @@ export default async function dev(
|
||||
frameworkSlug = framework.slug;
|
||||
}
|
||||
|
||||
const defaults = framework.settings.devCommand;
|
||||
if (isSettingValue(defaults)) {
|
||||
devCommand = defaults.value;
|
||||
const defaults = framework.settings.devCommand.value;
|
||||
if (defaults) {
|
||||
devCommand = defaults;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import crypto from 'crypto';
|
||||
import ua from 'universal-analytics';
|
||||
import { platform, release, userInfo } from 'os';
|
||||
import { getPlatformEnv } from '@vercel/build-utils';
|
||||
|
||||
import userAgent from './ua-browser';
|
||||
@@ -16,10 +15,15 @@ export const shouldCollectMetrics =
|
||||
|
||||
export const metrics = (): ua.Visitor => {
|
||||
const token =
|
||||
typeof config.token === 'string' ? config.token : platform() + release();
|
||||
const salt = userInfo().username;
|
||||
typeof config.token === 'string'
|
||||
? config.token
|
||||
: process.platform + process.arch;
|
||||
const salt =
|
||||
(process.env.USER || '') +
|
||||
(process.env.LANG || '') +
|
||||
(process.env.SHELL || '');
|
||||
const hash = crypto
|
||||
.pbkdf2Sync(token, salt, 1000, 64, 'sha512')
|
||||
.pbkdf2Sync(token, salt, 100, 64, 'sha512')
|
||||
.toString('hex')
|
||||
.substring(0, 24);
|
||||
|
||||
|
||||
4
packages/cli/test/integration.js
vendored
4
packages/cli/test/integration.js
vendored
@@ -2683,7 +2683,7 @@ test('deploy a Lambda with 3 seconds of maxDuration', async t => {
|
||||
const url = new URL(output.stdout);
|
||||
|
||||
// Should time out
|
||||
url.pathname = '/api/wait-for/4';
|
||||
url.pathname = '/api/wait-for/5';
|
||||
const response1 = await fetch(url.href);
|
||||
t.is(
|
||||
response1.status,
|
||||
@@ -2692,7 +2692,7 @@ test('deploy a Lambda with 3 seconds of maxDuration', async t => {
|
||||
);
|
||||
|
||||
// Should not time out
|
||||
url.pathname = '/api/wait-for/2';
|
||||
url.pathname = '/api/wait-for/1';
|
||||
const response2 = await fetch(url.href);
|
||||
t.is(
|
||||
response2.status,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/client",
|
||||
"version": "10.2.3-canary.19",
|
||||
"version": "10.2.3-canary.21",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"homepage": "https://vercel.com",
|
||||
@@ -40,7 +40,7 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "2.12.3-canary.18",
|
||||
"@vercel/build-utils": "2.12.3-canary.20",
|
||||
"@zeit/fetch": "5.2.0",
|
||||
"async-retry": "1.2.3",
|
||||
"async-sema": "3.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/frameworks",
|
||||
"version": "0.5.1-canary.11",
|
||||
"version": "0.5.1-canary.12",
|
||||
"main": "./dist/frameworks.js",
|
||||
"types": "./dist/frameworks.d.ts",
|
||||
"files": [
|
||||
|
||||
@@ -43,6 +43,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `blitz build`',
|
||||
value: 'blitz build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'blitz start',
|
||||
@@ -51,8 +52,6 @@ export const frameworks = [
|
||||
placeholder: 'Next.js default',
|
||||
},
|
||||
},
|
||||
devCommand: 'blitz start',
|
||||
buildCommand: 'blitz build',
|
||||
getFsOutputDir: async () => '.next',
|
||||
getOutputDirName: async () => 'public',
|
||||
},
|
||||
@@ -83,6 +82,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `next build`',
|
||||
value: 'next build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'next dev --port $PORT',
|
||||
@@ -98,8 +98,6 @@ export const frameworks = [
|
||||
dependencies: ['next-plugin-sentry', 'next-sentry-source-maps'],
|
||||
},
|
||||
],
|
||||
devCommand: 'next dev --port $PORT',
|
||||
buildCommand: 'next build',
|
||||
getFsOutputDir: async () => '.next',
|
||||
getOutputDirName: async () => 'public',
|
||||
cachePattern: '.next/cache/**',
|
||||
@@ -131,6 +129,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `gatsby build`',
|
||||
value: 'gatsby build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'gatsby develop --port $PORT',
|
||||
@@ -141,8 +140,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'gatsby',
|
||||
devCommand: 'gatsby develop --port $PORT',
|
||||
buildCommand: 'gatsby build',
|
||||
getOutputDirName: async () => 'public',
|
||||
getFsOutputDir: async () => 'public',
|
||||
defaultRoutes: async (dirPrefix: string) => {
|
||||
@@ -219,6 +216,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `hexo generate`',
|
||||
value: 'hexo generate',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'hexo server --port $PORT',
|
||||
@@ -229,8 +227,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'hexo',
|
||||
devCommand: 'hexo server --port $PORT',
|
||||
buildCommand: 'hexo generate',
|
||||
getFsOutputDir: async () => 'public',
|
||||
getOutputDirName: async () => 'public',
|
||||
},
|
||||
@@ -259,6 +255,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `npx @11ty/eleventy`',
|
||||
value: 'npx @11ty/eleventy',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'npx @11ty/eleventy --serve --watch --port $PORT',
|
||||
@@ -269,8 +266,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@11ty/eleventy',
|
||||
devCommand: 'npx @11ty/eleventy --serve --watch --port $PORT',
|
||||
buildCommand: 'npx @11ty/eleventy',
|
||||
getFsOutputDir: async () => '_site',
|
||||
getOutputDirName: async () => '_site',
|
||||
cachePattern: '.cache/**',
|
||||
@@ -300,6 +295,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `docusaurus build`',
|
||||
value: 'docusaurus build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'docusaurus start --port $PORT',
|
||||
@@ -310,8 +306,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@docusaurus/core',
|
||||
devCommand: 'docusaurus start --port $PORT',
|
||||
buildCommand: 'docusaurus build',
|
||||
getFsOutputDir: async (dirPrefix: string) => {
|
||||
const base = 'build';
|
||||
try {
|
||||
@@ -456,6 +450,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `docusaurus-build`',
|
||||
value: 'docusaurus-build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'docusaurus-start --port $PORT',
|
||||
@@ -466,8 +461,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'docusaurus',
|
||||
devCommand: 'docusaurus-start --port $PORT',
|
||||
buildCommand: 'docusaurus-build',
|
||||
getFsOutputDir: async (dirPrefix: string) => {
|
||||
const base = 'build';
|
||||
try {
|
||||
@@ -523,6 +516,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `preact build`',
|
||||
value: 'preact build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'preact watch --port $PORT',
|
||||
@@ -533,8 +527,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'preact-cli',
|
||||
devCommand: 'preact watch --port $PORT',
|
||||
buildCommand: 'preact build',
|
||||
getFsOutputDir: async () => 'build',
|
||||
getOutputDirName: async () => 'build',
|
||||
defaultRoutes: [
|
||||
@@ -581,6 +573,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `dojo build`',
|
||||
value: 'dojo build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'dojo build -m dev -w -s -p $PORT',
|
||||
@@ -591,8 +584,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@dojo/cli',
|
||||
devCommand: 'dojo build -m dev -w -s -p $PORT',
|
||||
buildCommand: 'dojo build',
|
||||
getFsOutputDir: async () => 'output/dist',
|
||||
getOutputDirName: async () => join('output', 'dist'),
|
||||
defaultRoutes: [
|
||||
@@ -649,6 +640,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `ember build`',
|
||||
value: 'ember build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'ember serve --port $PORT',
|
||||
@@ -659,8 +651,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'ember-cli',
|
||||
devCommand: 'ember serve --port $PORT',
|
||||
buildCommand: 'ember build',
|
||||
getFsOutputDir: async () => 'dist',
|
||||
getOutputDirName: async () => 'dist',
|
||||
defaultRoutes: [
|
||||
@@ -705,6 +695,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `vue-cli-service build`',
|
||||
value: 'vue-cli-service build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'vue-cli-service serve --port $PORT',
|
||||
@@ -715,8 +706,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@vue/cli-service',
|
||||
devCommand: 'vue-cli-service serve --port $PORT',
|
||||
buildCommand: 'vue-cli-service build',
|
||||
getFsOutputDir: async () => 'dist',
|
||||
getOutputDirName: async () => 'dist',
|
||||
defaultRoutes: [
|
||||
@@ -783,6 +772,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `ng build && scully`',
|
||||
value: 'ng build && scully',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'ng serve --port $PORT',
|
||||
@@ -793,8 +783,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@scullyio/init',
|
||||
devCommand: 'ng serve --port $PORT',
|
||||
buildCommand: 'ng build && scully',
|
||||
getFsOutputDir: async () => 'dist',
|
||||
getOutputDirName: async () => 'dist/static',
|
||||
},
|
||||
@@ -822,6 +810,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `ng build`',
|
||||
value: 'ng build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'ng serve --port $PORT',
|
||||
@@ -831,8 +820,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@ionic/angular',
|
||||
devCommand: 'ng serve --port $PORT',
|
||||
buildCommand: 'ng build',
|
||||
getFsOutputDir: async () => 'www',
|
||||
getOutputDirName: async () => 'www',
|
||||
defaultRoutes: [
|
||||
@@ -876,6 +863,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `ng build`',
|
||||
value: 'ng build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'ng serve --port $PORT',
|
||||
@@ -886,8 +874,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@angular/cli',
|
||||
devCommand: 'ng serve --port $PORT',
|
||||
buildCommand: 'ng build',
|
||||
getFsOutputDir: async () => 'dist',
|
||||
getOutputDirName: async (dirPrefix: string) => {
|
||||
const base = 'dist';
|
||||
@@ -945,6 +931,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `polymer build`',
|
||||
value: 'polymer build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'polymer serve --port $PORT',
|
||||
@@ -955,8 +942,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'polymer-cli',
|
||||
devCommand: 'polymer serve --port $PORT',
|
||||
buildCommand: 'polymer build',
|
||||
getFsOutputDir: async () => 'build',
|
||||
getOutputDirName: async (dirPrefix: string) => {
|
||||
const base = 'build';
|
||||
@@ -1016,6 +1001,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `rollup -c`',
|
||||
value: 'rollup -c',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'rollup -c -w',
|
||||
@@ -1025,8 +1011,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'sirv-cli',
|
||||
devCommand: 'rollup -c -w',
|
||||
buildCommand: 'rollup -c',
|
||||
getFsOutputDir: async () => 'public',
|
||||
getOutputDirName: async () => 'public',
|
||||
defaultRoutes: [
|
||||
@@ -1070,6 +1054,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `svelte-kit build`',
|
||||
value: 'svelte-kit build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'svelte-kit dev --port $PORT',
|
||||
@@ -1079,8 +1064,6 @@ export const frameworks = [
|
||||
placeholder: 'public',
|
||||
},
|
||||
},
|
||||
devCommand: 'svelte-kit dev --port $PORT',
|
||||
buildCommand: 'svelte-kit build',
|
||||
getFsOutputDir: async () => '.output',
|
||||
getOutputDirName: async () => 'public',
|
||||
},
|
||||
@@ -1108,6 +1091,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `react-scripts build`',
|
||||
value: 'react-scripts build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'react-scripts start',
|
||||
@@ -1117,8 +1101,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@ionic/react',
|
||||
devCommand: 'react-scripts start',
|
||||
buildCommand: 'react-scripts build',
|
||||
getFsOutputDir: async () => 'build',
|
||||
getOutputDirName: async () => 'build',
|
||||
defaultRoutes: [
|
||||
@@ -1216,6 +1198,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `react-scripts build`',
|
||||
value: 'react-scripts build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'react-scripts start',
|
||||
@@ -1225,8 +1208,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'react-scripts',
|
||||
devCommand: 'react-scripts start',
|
||||
buildCommand: 'react-scripts build',
|
||||
getFsOutputDir: async () => 'build',
|
||||
getOutputDirName: async () => 'build',
|
||||
defaultRoutes: [
|
||||
@@ -1318,6 +1299,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `gridsome build`',
|
||||
value: 'gridsome build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'gridsome develop -p $PORT',
|
||||
@@ -1328,8 +1310,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'gridsome',
|
||||
devCommand: 'gridsome develop -p $PORT',
|
||||
buildCommand: 'gridsome build',
|
||||
getFsOutputDir: async () => 'dist',
|
||||
getOutputDirName: async () => 'dist',
|
||||
},
|
||||
@@ -1357,6 +1337,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `umi build`',
|
||||
value: 'umi build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'umi dev --port $PORT',
|
||||
@@ -1367,8 +1348,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'umi',
|
||||
devCommand: 'umi dev --port $PORT',
|
||||
buildCommand: 'umi build',
|
||||
getFsOutputDir: async () => 'dist',
|
||||
getOutputDirName: async () => 'dist',
|
||||
defaultRoutes: [
|
||||
@@ -1412,6 +1391,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `sapper export`',
|
||||
value: 'sapper export',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'sapper dev --port $PORT',
|
||||
@@ -1422,8 +1402,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'sapper',
|
||||
devCommand: 'sapper dev --port $PORT',
|
||||
buildCommand: 'sapper export',
|
||||
getFsOutputDir: async () => '__sapper__/export',
|
||||
getOutputDirName: async () => '__sapper__/export',
|
||||
},
|
||||
@@ -1451,6 +1429,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `saber build`',
|
||||
value: 'saber build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'saber --port $PORT',
|
||||
@@ -1461,8 +1440,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'saber',
|
||||
devCommand: 'saber --port $PORT',
|
||||
buildCommand: 'saber build',
|
||||
getFsOutputDir: async () => 'public',
|
||||
getOutputDirName: async () => 'public',
|
||||
defaultRoutes: [
|
||||
@@ -1521,6 +1498,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `stencil build`',
|
||||
value: 'stencil build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'stencil build --dev --watch --serve --port $PORT',
|
||||
@@ -1531,8 +1509,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: '@stencil/core',
|
||||
devCommand: 'stencil build --dev --watch --serve --port $PORT',
|
||||
buildCommand: 'stencil build',
|
||||
getFsOutputDir: async () => 'www',
|
||||
getOutputDirName: async () => 'www',
|
||||
defaultRoutes: [
|
||||
@@ -1611,6 +1587,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `nuxt generate`',
|
||||
value: 'nuxt generate',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'nuxt',
|
||||
@@ -1620,8 +1597,6 @@ export const frameworks = [
|
||||
},
|
||||
},
|
||||
dependency: 'nuxt',
|
||||
devCommand: 'nuxt',
|
||||
buildCommand: 'nuxt generate',
|
||||
getFsOutputDir: async () => '.output',
|
||||
getOutputDirName: async () => 'dist',
|
||||
cachePattern: '.nuxt/**',
|
||||
@@ -1680,8 +1655,6 @@ export const frameworks = [
|
||||
placeholder: 'RedwoodJS default',
|
||||
},
|
||||
},
|
||||
devCommand: 'yarn rw dev --fwd="--port=$PORT --open=false',
|
||||
buildCommand: 'yarn rw deploy vercel',
|
||||
getFsOutputDir: async () => 'public',
|
||||
getOutputDirName: async () => 'public',
|
||||
},
|
||||
@@ -1717,6 +1690,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `hugo -D --gc`',
|
||||
value: 'hugo -D --gc',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'hugo server -D -w -p $PORT',
|
||||
@@ -1726,8 +1700,6 @@ export const frameworks = [
|
||||
placeholder: '`public` or `publishDir` from the `config` file',
|
||||
},
|
||||
},
|
||||
devCommand: 'hugo server -D -w -p $PORT',
|
||||
buildCommand: 'hugo -D --gc',
|
||||
getFsOutputDir: async (dirPrefix: string): Promise<string> => {
|
||||
type HugoConfig = { publishDir?: string };
|
||||
const config = await readConfigFile<HugoConfig>(
|
||||
@@ -1772,6 +1744,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `jekyll build`',
|
||||
value: 'jekyll build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'bundle exec jekyll serve --watch --port $PORT',
|
||||
@@ -1781,8 +1754,6 @@ export const frameworks = [
|
||||
placeholder: '`_site` or `destination` from `_config.yml`',
|
||||
},
|
||||
},
|
||||
devCommand: 'bundle exec jekyll serve --watch --port $PORT',
|
||||
buildCommand: 'jekyll build',
|
||||
getFsOutputDir: async (dirPrefix: string): Promise<string> => {
|
||||
type JekyllConfig = { destination?: string };
|
||||
const config = await readConfigFile<JekyllConfig>(
|
||||
@@ -1821,6 +1792,7 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `brunch build --production`',
|
||||
value: 'brunch build --production',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'brunch watch --server --port $PORT',
|
||||
@@ -1830,8 +1802,6 @@ export const frameworks = [
|
||||
value: 'public',
|
||||
},
|
||||
},
|
||||
devCommand: 'brunch watch --server --port $PORT',
|
||||
buildCommand: 'brunch build --production',
|
||||
getFsOutputDir: async () => 'public',
|
||||
getOutputDirName: async () => 'public',
|
||||
},
|
||||
@@ -1856,18 +1826,17 @@ export const frameworks = [
|
||||
value: 'bundle install',
|
||||
},
|
||||
buildCommand: {
|
||||
value: '`npm run build` or `bundle exec middleman build`',
|
||||
placeholder: '`npm run build` or `bundle exec middleman build`',
|
||||
value: 'bundle exec middleman build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'bundle exec middleman server -p $PORT',
|
||||
placeholder: 'bundle exec middleman server',
|
||||
value: 'bundle exec middleman server -p $PORT',
|
||||
},
|
||||
outputDirectory: {
|
||||
value: 'build',
|
||||
},
|
||||
},
|
||||
devCommand: 'bundle exec middleman server -p $PORT',
|
||||
buildCommand: 'bundle exec middleman build',
|
||||
getFsOutputDir: async () => 'build',
|
||||
getOutputDirName: async () => 'build',
|
||||
cachePattern: '{vendor/bin,vendor/cache,vendor/bundle}/**',
|
||||
@@ -1896,15 +1865,13 @@ export const frameworks = [
|
||||
value: 'zola build',
|
||||
},
|
||||
devCommand: {
|
||||
value: 'zola serve --port $PORT',
|
||||
placeholder: 'zola serve',
|
||||
value: 'zola serve --port $PORT',
|
||||
},
|
||||
outputDirectory: {
|
||||
value: 'public',
|
||||
},
|
||||
},
|
||||
devCommand: 'zola serve --port $PORT',
|
||||
buildCommand: 'zola build',
|
||||
getFsOutputDir: async () => 'public',
|
||||
getOutputDirName: async () => 'public',
|
||||
defaultVersion: '0.13.0',
|
||||
@@ -1934,17 +1901,17 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `vite build`',
|
||||
value: 'vite build',
|
||||
},
|
||||
devCommand: {
|
||||
placeholder: 'vite',
|
||||
value: 'vite',
|
||||
},
|
||||
outputDirectory: {
|
||||
value: 'dist',
|
||||
},
|
||||
},
|
||||
dependency: 'vite',
|
||||
devCommand: 'vite',
|
||||
buildCommand: 'vite build',
|
||||
getFsOutputDir: async () => 'dist',
|
||||
getOutputDirName: async () => 'dist',
|
||||
},
|
||||
@@ -1972,17 +1939,17 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `parcel build`',
|
||||
value: 'parcel build',
|
||||
},
|
||||
devCommand: {
|
||||
placeholder: 'parcel',
|
||||
value: 'parcel',
|
||||
},
|
||||
outputDirectory: {
|
||||
placeholder: 'dist',
|
||||
value: 'dist',
|
||||
},
|
||||
},
|
||||
dependency: 'parcel',
|
||||
devCommand: 'parcel',
|
||||
buildCommand: 'parcel build',
|
||||
getFsOutputDir: async () => 'dist',
|
||||
getOutputDirName: async () => 'dist',
|
||||
defaultRoutes: [
|
||||
@@ -2016,16 +1983,16 @@ export const frameworks = [
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run vercel-build` or `npm run build`',
|
||||
value: null,
|
||||
},
|
||||
devCommand: {
|
||||
placeholder: 'None',
|
||||
value: null,
|
||||
},
|
||||
outputDirectory: {
|
||||
placeholder: '`public` if it exists, or `.`',
|
||||
},
|
||||
},
|
||||
devCommand: null,
|
||||
buildCommand: null,
|
||||
getFsOutputDir: async (dirPrefix: string): Promise<string> => {
|
||||
// Public if it exists or `.`
|
||||
let base = 'public';
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface SettingValue {
|
||||
* A predefined setting for the detected framework
|
||||
* @example "next dev --port $PORT"
|
||||
*/
|
||||
value: string;
|
||||
value: string | null;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
@@ -129,11 +129,11 @@ export interface Framework {
|
||||
/**
|
||||
* Default Build Command or a placeholder
|
||||
*/
|
||||
buildCommand: Setting;
|
||||
buildCommand: SettingValue;
|
||||
/**
|
||||
* Default Development Command or a placeholder
|
||||
*/
|
||||
devCommand: Setting;
|
||||
devCommand: SettingValue;
|
||||
/**
|
||||
* Default Output Directory
|
||||
*/
|
||||
@@ -157,6 +157,7 @@ export interface Framework {
|
||||
/**
|
||||
* Name of a dependency in `package.json` to detect this framework.
|
||||
* @example "hexo"
|
||||
* @deprecated use `detectors` instead (new frameworks should not use this prop)
|
||||
*/
|
||||
dependency?: string;
|
||||
/**
|
||||
@@ -201,16 +202,6 @@ export interface Framework {
|
||||
* @example ".cache/**"
|
||||
*/
|
||||
cachePattern?: string;
|
||||
/**
|
||||
* The default build command for the framework.
|
||||
* @example "next build"
|
||||
*/
|
||||
buildCommand: string | null;
|
||||
/**
|
||||
* The default development command for the framework.
|
||||
* @example "next dev"
|
||||
*/
|
||||
devCommand: string | null;
|
||||
/**
|
||||
* The default version of the framework command that is available within the
|
||||
* build image. Usually an environment variable can be set to override this.
|
||||
|
||||
14
packages/frameworks/test/frameworks.unit.test.ts
vendored
14
packages/frameworks/test/frameworks.unit.test.ts
vendored
@@ -34,7 +34,7 @@ const SchemaSettings = {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
value: {
|
||||
type: 'string',
|
||||
type: ['string', 'null'],
|
||||
},
|
||||
placeholder: {
|
||||
type: 'string',
|
||||
@@ -58,15 +58,7 @@ const Schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
required: [
|
||||
'name',
|
||||
'slug',
|
||||
'logo',
|
||||
'description',
|
||||
'settings',
|
||||
'buildCommand',
|
||||
'devCommand',
|
||||
],
|
||||
required: ['name', 'slug', 'logo', 'description', 'settings'],
|
||||
properties: {
|
||||
name: { type: 'string' },
|
||||
slug: { type: ['string', 'null'] },
|
||||
@@ -138,8 +130,6 @@ const Schema = {
|
||||
|
||||
dependency: { type: 'string' },
|
||||
cachePattern: { type: 'string' },
|
||||
buildCommand: { type: ['string', 'null'] },
|
||||
devCommand: { type: ['string', 'null'] },
|
||||
defaultVersion: { type: 'string' },
|
||||
},
|
||||
},
|
||||
|
||||
@@ -33,14 +33,6 @@ async function main() {
|
||||
await fs.remove(symlinkTarget);
|
||||
await fs.symlink('symlinked-asset', symlinkTarget);
|
||||
|
||||
// Use types.d.ts as the main types export
|
||||
await Promise.all(
|
||||
(await fs.readdir(outDir))
|
||||
.filter(p => p.endsWith('.d.ts') && p !== 'types.d.ts')
|
||||
.map(p => fs.remove(join(outDir, p)))
|
||||
);
|
||||
await fs.rename(join(outDir, 'types.d.ts'), join(outDir, 'index.d.ts'));
|
||||
|
||||
// Bundle helpers.ts with ncc
|
||||
await fs.remove(join(outDir, 'helpers.js'));
|
||||
const helpersDir = join(outDir, 'helpers');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/node",
|
||||
"version": "1.12.2-canary.6",
|
||||
"version": "1.12.2-canary.7",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
|
||||
|
||||
@@ -339,6 +339,9 @@ function getAWSLambdaHandler(entrypoint: string, config: Config) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Ensures that everything from `types.ts` is exported in the final `index.d.ts` file.
|
||||
export * from './types';
|
||||
|
||||
export const version = 3;
|
||||
|
||||
export async function build({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": false,
|
||||
"name": "vercel-plugin-go",
|
||||
"version": "1.0.0-canary.3",
|
||||
"version": "1.0.0-canary.5",
|
||||
"main": "dist/index.js",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
@@ -17,7 +17,7 @@
|
||||
"prepublishOnly": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "2.12.3-canary.18",
|
||||
"@vercel/build-utils": "2.12.3-canary.20",
|
||||
"@vercel/go": "1.2.4-canary.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vercel-plugin-node",
|
||||
"version": "1.12.2-canary.9",
|
||||
"version": "1.12.2-canary.11",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
|
||||
@@ -34,7 +34,7 @@
|
||||
"@types/node-fetch": "2",
|
||||
"@types/test-listen": "1.1.0",
|
||||
"@types/yazl": "2.4.2",
|
||||
"@vercel/build-utils": "2.12.3-canary.18",
|
||||
"@vercel/build-utils": "2.12.3-canary.20",
|
||||
"@vercel/fun": "1.0.3",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/nft": "0.14.0",
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
readlinkSync,
|
||||
statSync,
|
||||
promises as fsp,
|
||||
existsSync,
|
||||
} from 'fs';
|
||||
import {
|
||||
basename,
|
||||
@@ -37,7 +36,10 @@ import {
|
||||
isSymbolicLink,
|
||||
runNpmInstall,
|
||||
updateFunctionsManifest,
|
||||
updateRoutesManifest,
|
||||
walkParentDirs,
|
||||
normalizePath,
|
||||
runPackageJsonScript,
|
||||
} from '@vercel/build-utils';
|
||||
import { FromSchema } from 'json-schema-to-ts';
|
||||
import { getConfig, BaseFunctionConfigSchema } from '@vercel/static-config';
|
||||
@@ -67,6 +69,7 @@ const { makeVercelLauncher, makeAwsLauncher } = require_(
|
||||
interface DownloadOptions {
|
||||
entrypoint: string;
|
||||
workPath: string;
|
||||
installedPaths?: Set<string>;
|
||||
}
|
||||
|
||||
interface PortInfo {
|
||||
@@ -112,21 +115,46 @@ const BRIDGE_FILENAME = '__bridge.js';
|
||||
const HELPERS_FILENAME = '__helpers.js';
|
||||
const SOURCEMAP_SUPPORT_FILENAME = '__sourcemap_support.js';
|
||||
|
||||
async function downloadInstallAndBundle({
|
||||
async function maybeInstallAndBuild({
|
||||
entrypoint,
|
||||
workPath,
|
||||
installedPaths,
|
||||
}: DownloadOptions) {
|
||||
const entrypointFsDirname = join(workPath, dirname(entrypoint));
|
||||
const nodeVersion = await getNodeVersion(entrypointFsDirname);
|
||||
const spawnOpts = getSpawnOptions({}, nodeVersion);
|
||||
|
||||
// Only run when `package.json` exists.
|
||||
if (existsSync(join(entrypointFsDirname, 'package.json'))) {
|
||||
const installTime = Date.now();
|
||||
await runNpmInstall(entrypointFsDirname, [], spawnOpts, {}, nodeVersion);
|
||||
debug(`Install complete [${Date.now() - installTime}ms]`);
|
||||
} else {
|
||||
debug(`Skip install command for \`vercel-plugin-node\`.`);
|
||||
const lastPath = await walkParentDirs({
|
||||
base: workPath,
|
||||
start: entrypointFsDirname,
|
||||
filename: 'package.json',
|
||||
});
|
||||
|
||||
if (!lastPath || dirname(lastPath) === workPath) {
|
||||
debug(`Skip install command in \`vercel-plugin-node\` for ${entrypoint}.`);
|
||||
} else if (lastPath) {
|
||||
if (!installedPaths?.has(lastPath)) {
|
||||
installedPaths?.add(lastPath);
|
||||
const installTime = Date.now();
|
||||
await runNpmInstall(dirname(lastPath), [], spawnOpts, {}, nodeVersion);
|
||||
debug(
|
||||
`Install complete [${Date.now() - installTime}ms] for ${relative(
|
||||
workPath,
|
||||
lastPath
|
||||
)}`
|
||||
);
|
||||
|
||||
await runPackageJsonScript(
|
||||
dirname(lastPath),
|
||||
// Don't consider "build" script since its intended for frontend code
|
||||
['vercel-build', 'now-build'],
|
||||
spawnOpts
|
||||
);
|
||||
} else {
|
||||
debug(
|
||||
`Skip install command in \`vercel-plugin-node\` for ${entrypoint}. Already installed for other entrypoint.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -354,6 +382,7 @@ function getAWSLambdaHandler(entrypoint: string, config: FunctionConfig) {
|
||||
export async function build({ workPath }: { workPath: string }) {
|
||||
const project = new Project();
|
||||
const entrypoints = await glob('api/**/*.[jt]s', workPath);
|
||||
const installedPaths = new Set<string>();
|
||||
for (const entrypoint of Object.keys(entrypoints)) {
|
||||
// Dotfiles are not compiled
|
||||
if (entrypoint.includes('/.')) continue;
|
||||
@@ -378,7 +407,7 @@ export async function build({ workPath }: { workPath: string }) {
|
||||
continue;
|
||||
}
|
||||
|
||||
await buildEntrypoint({ workPath, entrypoint, config });
|
||||
await buildEntrypoint({ workPath, entrypoint, config, installedPaths });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,10 +415,12 @@ export async function buildEntrypoint({
|
||||
workPath,
|
||||
entrypoint,
|
||||
config,
|
||||
installedPaths,
|
||||
}: {
|
||||
workPath: string;
|
||||
entrypoint: string;
|
||||
config: FunctionConfig;
|
||||
installedPaths?: Set<string>;
|
||||
}) {
|
||||
// Unique hash that will be used as directory name for `.output`.
|
||||
const entrypointHash = crypto
|
||||
@@ -414,21 +445,13 @@ export async function buildEntrypoint({
|
||||
config.helpers !== false && process.env.NODEJS_HELPERS !== '0';
|
||||
const awsLambdaHandler = getAWSLambdaHandler(entrypoint, config);
|
||||
|
||||
const { nodeVersion } = await downloadInstallAndBundle({
|
||||
const { nodeVersion } = await maybeInstallAndBuild({
|
||||
entrypoint,
|
||||
workPath,
|
||||
installedPaths,
|
||||
});
|
||||
const entrypointPath = join(workPath, entrypoint);
|
||||
|
||||
// TODO NATE: do we want to run the build script?
|
||||
// The frontend build command probably already did this
|
||||
//await runPackageJsonScript(
|
||||
// entrypointFsDirname,
|
||||
// // Don't consider "build" script since its intended for frontend code
|
||||
// ['vercel-build', 'now-build'],
|
||||
// spawnOpts
|
||||
//);
|
||||
|
||||
debug('Tracing input files...');
|
||||
const traceTime = Date.now();
|
||||
const { preparedFiles, shouldAddSourcemapSupport } = await compile(
|
||||
@@ -438,11 +461,12 @@ export async function buildEntrypoint({
|
||||
);
|
||||
debug(`Trace complete [${Date.now() - traceTime}ms]`);
|
||||
|
||||
const getFileName = (str: string) => `___vc/${str}`;
|
||||
// Has to be in `dirname(entrypoint)` because the `handler` will be prefixed with this path.
|
||||
const getVCFileName = (str: string) => `${dirname(entrypoint)}/___vc/${str}`;
|
||||
|
||||
const launcher = awsLambdaHandler ? makeAwsLauncher : makeVercelLauncher;
|
||||
const launcherSource = launcher({
|
||||
entrypointPath: `../${renameTStoJS(relative(workPath, entrypointPath))}`,
|
||||
entrypointPath: `../${renameTStoJS(basename(entrypoint))}`,
|
||||
bridgePath: `./${BRIDGE_FILENAME}`,
|
||||
helpersPath: `./${HELPERS_FILENAME}`,
|
||||
sourcemapSupportPath: `./${SOURCEMAP_SUPPORT_FILENAME}`,
|
||||
@@ -452,25 +476,25 @@ export async function buildEntrypoint({
|
||||
});
|
||||
|
||||
const launcherFiles: Files = {
|
||||
[getFileName('package.json')]: new FileBlob({
|
||||
[getVCFileName('package.json')]: new FileBlob({
|
||||
data: JSON.stringify({ type: 'commonjs' }),
|
||||
}),
|
||||
[getFileName(LAUNCHER_FILENAME)]: new FileBlob({
|
||||
[getVCFileName(LAUNCHER_FILENAME)]: new FileBlob({
|
||||
data: launcherSource,
|
||||
}),
|
||||
[getFileName(BRIDGE_FILENAME)]: new FileFsRef({
|
||||
[getVCFileName(BRIDGE_FILENAME)]: new FileFsRef({
|
||||
fsPath: join(DIST_DIR, 'bridge.js'),
|
||||
}),
|
||||
};
|
||||
|
||||
if (shouldAddSourcemapSupport) {
|
||||
launcherFiles[getFileName(SOURCEMAP_SUPPORT_FILENAME)] = new FileFsRef({
|
||||
launcherFiles[getVCFileName(SOURCEMAP_SUPPORT_FILENAME)] = new FileFsRef({
|
||||
fsPath: join(DIST_DIR, 'source-map-support.js'),
|
||||
});
|
||||
}
|
||||
|
||||
if (shouldAddHelpers) {
|
||||
launcherFiles[getFileName(HELPERS_FILENAME)] = new FileFsRef({
|
||||
launcherFiles[getVCFileName(HELPERS_FILENAME)] = new FileFsRef({
|
||||
fsPath: join(DIST_DIR, 'helpers.js'),
|
||||
});
|
||||
}
|
||||
@@ -499,7 +523,7 @@ export async function buildEntrypoint({
|
||||
// This means everything has to be mounted to the `dirname` of the entrypoint.
|
||||
nftFiles.push({
|
||||
input: relative(dirname(nftOutput), outPath),
|
||||
output: join('.output', 'server', 'pages', dirname(entrypoint), filename),
|
||||
output: join('.output', 'server', 'pages', filename),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -516,14 +540,9 @@ export async function buildEntrypoint({
|
||||
pageOutput
|
||||
);
|
||||
|
||||
let pageKey = relative(pagesDir, pageOutput);
|
||||
if (process.platform === 'win32') {
|
||||
pageKey = pageKey.replace(/\\/gm, '/');
|
||||
}
|
||||
|
||||
const pages = {
|
||||
[pageKey]: {
|
||||
handler: `${getFileName(LAUNCHER_FILENAME).slice(0, -3)}.launcher`,
|
||||
[normalizePath(relative(pagesDir, pageOutput))]: {
|
||||
handler: `___vc/${LAUNCHER_FILENAME.slice(0, -3)}.launcher`,
|
||||
runtime: nodeVersion.runtime,
|
||||
},
|
||||
};
|
||||
@@ -532,21 +551,10 @@ export async function buildEntrypoint({
|
||||
// Update the `routes-mainifest.json` file with the wildcard route
|
||||
// when the entrypoint is dynamic (i.e. `/api/[id].ts`).
|
||||
if (isDynamicRoute(entrypointWithoutExt)) {
|
||||
const routesManifestPath = join(outputDirPath, 'routes-manifest.json');
|
||||
let routesManifest: any = {};
|
||||
try {
|
||||
routesManifest = JSON.parse(
|
||||
await fsp.readFile(routesManifestPath, 'utf8')
|
||||
);
|
||||
} catch (_err) {
|
||||
// ignore...
|
||||
}
|
||||
if (!routesManifest.dynamicRoutes) routesManifest.dynamicRoutes = [];
|
||||
routesManifest.dynamicRoutes.push(pageToRoute(entrypointWithoutExt));
|
||||
await fsp.writeFile(
|
||||
routesManifestPath,
|
||||
JSON.stringify(routesManifest, null, 2)
|
||||
);
|
||||
await updateRoutesManifest({
|
||||
workPath,
|
||||
dynamicRoutes: [pageToRoute(entrypointWithoutExt)],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
26
packages/plugin-node/test/build.test.ts
vendored
26
packages/plugin-node/test/build.test.ts
vendored
@@ -53,6 +53,8 @@ function withFixture<T>(
|
||||
): () => Promise<T> {
|
||||
return async () => {
|
||||
const fixture = path.join(__dirname, 'fixtures', name);
|
||||
await fsp.rmdir(path.join(fixture, '.output'), { recursive: true });
|
||||
|
||||
const functions = new Map<string, Lambda>();
|
||||
|
||||
async function fetch(r: RequestInfo, init?: RequestInit) {
|
||||
@@ -348,4 +350,28 @@ describe('build()', () => {
|
||||
expect(body3.includes('GraphQL Playground')).toEqual(true);
|
||||
})
|
||||
);
|
||||
|
||||
it(
|
||||
'should build "nested-lock-and-build"',
|
||||
withFixture('nested-lock-and-build', async ({ fetch }) => {
|
||||
const resA = await fetch('/api/users/[id]');
|
||||
|
||||
expect(resA.headers.get('x-date')).toEqual('2021-11-20T20:00:00.000Z');
|
||||
|
||||
const body = await resA.text();
|
||||
expect(body).toEqual(
|
||||
' _______________________________\n' +
|
||||
'< Hello from /api/users/[id].js >\n' +
|
||||
' -------------------------------\n' +
|
||||
' \\ ^__^\n' +
|
||||
' \\ (oo)\\_______\n' +
|
||||
' (__)\\ )\\/\\\n' +
|
||||
' ||----w |\n' +
|
||||
' || ||'
|
||||
);
|
||||
|
||||
const resB = await fetch('/api/profile');
|
||||
expect(await resB.text()).toEqual('true');
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
8
packages/plugin-node/test/fixtures/nested-lock-and-build/api/package.json
vendored
Normal file
8
packages/plugin-node/test/fixtures/nested-lock-and-build/api/package.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"scripts": {
|
||||
"vercel-build": "node ./script.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"cowsay": "1.5.0"
|
||||
}
|
||||
}
|
||||
9
packages/plugin-node/test/fixtures/nested-lock-and-build/api/profile.js
vendored
Normal file
9
packages/plugin-node/test/fixtures/nested-lock-and-build/api/profile.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
const isSvg = require('is-svg');
|
||||
|
||||
module.exports = (req, res) => {
|
||||
res.end(
|
||||
isSvg(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>'
|
||||
).toString()
|
||||
);
|
||||
};
|
||||
11
packages/plugin-node/test/fixtures/nested-lock-and-build/api/script.js
vendored
Normal file
11
packages/plugin-node/test/fixtures/nested-lock-and-build/api/script.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, 'users', '.date.js'),
|
||||
`
|
||||
module.exports = {
|
||||
date: '2021-11-20T20:00:00.000Z'
|
||||
};
|
||||
`.trim()
|
||||
);
|
||||
11
packages/plugin-node/test/fixtures/nested-lock-and-build/api/users/[id].js
vendored
Normal file
11
packages/plugin-node/test/fixtures/nested-lock-and-build/api/users/[id].js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
const cowsay = require('cowsay');
|
||||
const { date } = require('./.date');
|
||||
|
||||
module.exports = (req, res) => {
|
||||
res.setHeader('x-date', date);
|
||||
res.end(
|
||||
cowsay.say({
|
||||
text: 'Hello from /api/users/[id].js',
|
||||
})
|
||||
);
|
||||
};
|
||||
220
packages/plugin-node/test/fixtures/nested-lock-and-build/api/yarn.lock
vendored
Normal file
220
packages/plugin-node/test/fixtures/nested-lock-and-build/api/yarn.lock
vendored
Normal file
@@ -0,0 +1,220 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
ansi-regex@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
|
||||
integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=
|
||||
|
||||
ansi-regex@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
||||
|
||||
ansi-styles@^4.0.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
|
||||
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
||||
dependencies:
|
||||
color-convert "^2.0.1"
|
||||
|
||||
camelcase@^5.0.0:
|
||||
version "5.3.1"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||
|
||||
cliui@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1"
|
||||
integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==
|
||||
dependencies:
|
||||
string-width "^4.2.0"
|
||||
strip-ansi "^6.0.0"
|
||||
wrap-ansi "^6.2.0"
|
||||
|
||||
color-convert@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
||||
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
||||
dependencies:
|
||||
color-name "~1.1.4"
|
||||
|
||||
color-name@~1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
|
||||
cowsay@1.5.0:
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/cowsay/-/cowsay-1.5.0.tgz#4a2a453b8b59383c7d7a50e44d765c5de0bf615f"
|
||||
integrity sha512-8Ipzr54Z8zROr/62C8f0PdhQcDusS05gKTS87xxdji8VbWefWly0k8BwGK7+VqamOrkv3eGsCkPtvlHzrhWsCA==
|
||||
dependencies:
|
||||
get-stdin "8.0.0"
|
||||
string-width "~2.1.1"
|
||||
strip-final-newline "2.0.0"
|
||||
yargs "15.4.1"
|
||||
|
||||
decamelize@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||
|
||||
emoji-regex@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
|
||||
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
||||
|
||||
find-up@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
|
||||
integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
|
||||
dependencies:
|
||||
locate-path "^5.0.0"
|
||||
path-exists "^4.0.0"
|
||||
|
||||
get-caller-file@^2.0.1:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||
|
||||
get-stdin@8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53"
|
||||
integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==
|
||||
|
||||
is-fullwidth-code-point@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
|
||||
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
|
||||
|
||||
is-fullwidth-code-point@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
|
||||
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
|
||||
|
||||
locate-path@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
|
||||
integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
|
||||
dependencies:
|
||||
p-locate "^4.1.0"
|
||||
|
||||
p-limit@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
|
||||
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
|
||||
dependencies:
|
||||
p-try "^2.0.0"
|
||||
|
||||
p-locate@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
|
||||
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
|
||||
dependencies:
|
||||
p-limit "^2.2.0"
|
||||
|
||||
p-try@^2.0.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||
|
||||
path-exists@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
|
||||
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
|
||||
|
||||
require-directory@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
|
||||
|
||||
require-main-filename@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
|
||||
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
|
||||
|
||||
set-blocking@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
|
||||
|
||||
string-width@^4.1.0, string-width@^4.2.0:
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||
dependencies:
|
||||
emoji-regex "^8.0.0"
|
||||
is-fullwidth-code-point "^3.0.0"
|
||||
strip-ansi "^6.0.1"
|
||||
|
||||
string-width@~2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
|
||||
integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
|
||||
dependencies:
|
||||
is-fullwidth-code-point "^2.0.0"
|
||||
strip-ansi "^4.0.0"
|
||||
|
||||
strip-ansi@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
|
||||
integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8=
|
||||
dependencies:
|
||||
ansi-regex "^3.0.0"
|
||||
|
||||
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||
dependencies:
|
||||
ansi-regex "^5.0.1"
|
||||
|
||||
strip-final-newline@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
|
||||
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
||||
|
||||
which-module@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
|
||||
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
|
||||
|
||||
wrap-ansi@^6.2.0:
|
||||
version "6.2.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
||||
integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==
|
||||
dependencies:
|
||||
ansi-styles "^4.0.0"
|
||||
string-width "^4.1.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
y18n@^4.0.0:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
|
||||
integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==
|
||||
|
||||
yargs-parser@^18.1.2:
|
||||
version "18.1.3"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
|
||||
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
|
||||
dependencies:
|
||||
camelcase "^5.0.0"
|
||||
decamelize "^1.2.0"
|
||||
|
||||
yargs@15.4.1:
|
||||
version "15.4.1"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
|
||||
integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==
|
||||
dependencies:
|
||||
cliui "^6.0.0"
|
||||
decamelize "^1.2.0"
|
||||
find-up "^4.1.0"
|
||||
get-caller-file "^2.0.1"
|
||||
require-directory "^2.1.1"
|
||||
require-main-filename "^2.0.0"
|
||||
set-blocking "^2.0.0"
|
||||
string-width "^4.2.0"
|
||||
which-module "^2.0.0"
|
||||
y18n "^4.0.0"
|
||||
yargs-parser "^18.1.2"
|
||||
5
packages/plugin-node/test/fixtures/nested-lock-and-build/package.json
vendored
Normal file
5
packages/plugin-node/test/fixtures/nested-lock-and-build/package.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"is-svg": "4.3.1"
|
||||
}
|
||||
}
|
||||
22
packages/plugin-node/test/fixtures/nested-lock-and-build/yarn.lock
vendored
Normal file
22
packages/plugin-node/test/fixtures/nested-lock-and-build/yarn.lock
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
fast-xml-parser@^3.19.0:
|
||||
version "3.21.1"
|
||||
resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-3.21.1.tgz#152a1d51d445380f7046b304672dd55d15c9e736"
|
||||
integrity sha512-FTFVjYoBOZTJekiUsawGsSYV9QL0A+zDYCRj7y34IO6Jg+2IMYEtQa+bbictpdpV8dHxXywqU7C0gRDEOFtBFg==
|
||||
dependencies:
|
||||
strnum "^1.0.4"
|
||||
|
||||
is-svg@4.3.1:
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-4.3.1.tgz#8c63ec8c67c8c7f0a8de0a71c8c7d58eccf4406b"
|
||||
integrity sha512-h2CGs+yPUyvkgTJQS9cJzo9lYK06WgRiXUqBBHtglSzVKAuH4/oWsqk7LGfbSa1hGk9QcZ0SyQtVggvBA8LZXA==
|
||||
dependencies:
|
||||
fast-xml-parser "^3.19.0"
|
||||
|
||||
strnum@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.4.tgz#e97e36a7d6ba9f93d0d6b496b2ed0678d422832b"
|
||||
integrity sha512-lMzNMfDpaQOLt4B2mEbfzYS0+T7dvCXeojnlGf6f1AygvWDMcWyXYaLbyICfjVu29sErR8fnRagQfBW/N/hGgw==
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": false,
|
||||
"name": "vercel-plugin-python",
|
||||
"version": "1.0.0-canary.3",
|
||||
"version": "1.0.0-canary.6",
|
||||
"main": "dist/index.js",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
@@ -17,8 +17,8 @@
|
||||
"prepublishOnly": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "2.12.3-canary.18",
|
||||
"@vercel/python": "2.0.6-canary.6"
|
||||
"@vercel/build-utils": "2.12.3-canary.20",
|
||||
"@vercel/python": "2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "*",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": false,
|
||||
"name": "vercel-plugin-ruby",
|
||||
"version": "1.0.0-canary.2",
|
||||
"version": "1.0.0-canary.4",
|
||||
"main": "dist/index.js",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
@@ -17,7 +17,7 @@
|
||||
"prepublishOnly": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "2.12.3-canary.18",
|
||||
"@vercel/build-utils": "2.12.3-canary.20",
|
||||
"@vercel/ruby": "1.2.8-canary.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/python",
|
||||
"version": "2.0.6-canary.6",
|
||||
"version": "2.1.1",
|
||||
"main": "./dist/index.js",
|
||||
"license": "MIT",
|
||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
||||
|
||||
@@ -114,10 +114,24 @@ export const build = async ({
|
||||
try {
|
||||
const json = await readFile(join(pipfileLockDir, 'Pipfile.lock'), 'utf8');
|
||||
const obj = JSON.parse(json);
|
||||
if (!meta.isDev && obj?._meta?.requires?.python_version === '3.6') {
|
||||
pipPath = 'pip3.6';
|
||||
pythonPath = 'python3.6';
|
||||
pythonRuntime = 'python3.6';
|
||||
const version = obj?._meta?.requires?.python_version;
|
||||
if (!meta.isDev) {
|
||||
if (version === '3.6') {
|
||||
pipPath = 'pip3.6';
|
||||
pythonPath = 'python3.6';
|
||||
pythonRuntime = 'python3.6';
|
||||
console.warn(
|
||||
`Warning: Python version "${version}" detected in Pipfile.lock will reach End-Of-Life December 2021. Please upgrade. http://vercel.link/python-version`
|
||||
);
|
||||
} else if (version === '3.9') {
|
||||
pipPath = 'pip3.9';
|
||||
pythonPath = 'python3.9';
|
||||
pythonRuntime = 'python3.9';
|
||||
} else {
|
||||
console.warn(
|
||||
`Warning: Invalid Python version "${version}" detected in Pipfile.lock will be ignored. http://vercel.link/python-version`
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
throw new NowBuildError({
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.py", "use": "@vercel/python" }],
|
||||
"probes": [{ "path": "/", "mustContain": "wsgi:RANDOMNESS_PLACEHOLDER" }]
|
||||
}
|
||||
11
packages/python/test/fixtures/02-wsgi-pipenv/vercel.json
vendored
Normal file
11
packages/python/test/fixtures/02-wsgi-pipenv/vercel.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.py", "use": "@vercel/python" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "wsgi:RANDOMNESS_PLACEHOLDER",
|
||||
"logMustContain": "Warning: Python version \"3.6\" detected in Pipfile.lock will reach End-Of-Life December 2021. Please upgrade."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.py", "use": "@vercel/python" }],
|
||||
"env": {
|
||||
"RANDOMNESS": "RANDOMNESS_PLACEHOLDER"
|
||||
},
|
||||
"probes": [{ "path": "/", "mustContain": "RANDOMNESS_PLACEHOLDER:env" }]
|
||||
}
|
||||
14
packages/python/test/fixtures/03-env-vars/vercel.json
vendored
Normal file
14
packages/python/test/fixtures/03-env-vars/vercel.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.py", "use": "@vercel/python" }],
|
||||
"env": {
|
||||
"RANDOMNESS": "RANDOMNESS_PLACEHOLDER"
|
||||
},
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "RANDOMNESS_PLACEHOLDER:env",
|
||||
"logMustContain": "Warning: Python version \"3.6\" detected in Pipfile.lock will reach End-Of-Life December 2021. Please upgrade."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "**/**.py", "use": "@vercel/python" }],
|
||||
"probes": [{ "path": "/", "mustContain": "pip:RANDOMNESS_PLACEHOLDER" }]
|
||||
}
|
||||
11
packages/python/test/fixtures/04-cowsay-pipfile/vercel.json
vendored
Normal file
11
packages/python/test/fixtures/04-cowsay-pipfile/vercel.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "**/**.py", "use": "@vercel/python" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "pip:RANDOMNESS_PLACEHOLDER",
|
||||
"logMustContain": "Warning: Invalid Python version \"3.7\" detected in Pipfile.lock will be ignored."
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user