mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-24 03:39:11 +00:00
Compare commits
43 Commits
@now/rust@
...
@now/next@
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01d0b017af | ||
|
|
db88ad4b32 | ||
|
|
4b846c3c88 | ||
|
|
2731435e3b | ||
|
|
f18e1a6bd4 | ||
|
|
167d7bedec | ||
|
|
cd0b1d61d1 | ||
|
|
86dc3708d2 | ||
|
|
1e79eae029 | ||
|
|
d0c954210a | ||
|
|
67c3481779 | ||
|
|
67473afd5b | ||
|
|
3d52610acf | ||
|
|
729ba010c4 | ||
|
|
a470e563dc | ||
|
|
15f674b8b7 | ||
|
|
1e4e6b68e0 | ||
|
|
2332100cff | ||
|
|
9cb6f500b0 | ||
|
|
79a2bfde35 | ||
|
|
86a659e5c5 | ||
|
|
0f00110db7 | ||
|
|
03ca6975ed | ||
|
|
001813c529 | ||
|
|
570ef4824b | ||
|
|
ae9a43a0bd | ||
|
|
ffaa5eaa17 | ||
|
|
7f41a23a43 | ||
|
|
e80a1a5340 | ||
|
|
7eadaf889a | ||
|
|
0823cc1005 | ||
|
|
11be2bf349 | ||
|
|
e8f31aebeb | ||
|
|
162d27a38f | ||
|
|
355c007dbb | ||
|
|
f946463cab | ||
|
|
a1e768ecc1 | ||
|
|
539f9135dd | ||
|
|
abd3d84d4c | ||
|
|
0274893d31 | ||
|
|
0ec767e0d0 | ||
|
|
e6296fa06b | ||
|
|
35def42263 |
@@ -28,4 +28,7 @@ else
|
||||
echo "Publishing stable release"
|
||||
fi
|
||||
|
||||
# Sometimes this is a false alarm and blocks publish
|
||||
git checkout yarn.lock
|
||||
|
||||
yarn run lerna publish from-git $npm_tag --yes
|
||||
|
||||
23
README.md
23
README.md
@@ -6,10 +6,10 @@ This is a monorepo containing the [Official Builders](https://zeit.co/docs/v2/de
|
||||
|
||||
There are two Channels:
|
||||
|
||||
| Channel | Git Branch | npm dist-tag | use example |
|
||||
| ------- | ---------- | ------------ | ------------------ |
|
||||
| Canary | `canary` | `@canary` | `@now/node@canary` |
|
||||
| Stable | `master` | `@latest` | `@now/node@latest` |
|
||||
| Channel | Git Branch | npm dist-tag | use example |
|
||||
| ------- | ------------------------------------------------------------- | ------------ | ------------------ |
|
||||
| Canary | [canary](https://github.com/zeit/now-builders/commits/canary) | `@canary` | `@now/node@canary` |
|
||||
| Stable | [master](https://github.com/zeit/now-builders/commits/master) | `@latest` | `@now/node@latest` |
|
||||
|
||||
All PRs should be submitted to the `canary` branch.
|
||||
|
||||
@@ -30,14 +30,23 @@ For the Stable Channel, you must do the following:
|
||||
- Deploy the modified Builders
|
||||
|
||||
```
|
||||
git checkout master
|
||||
git pull # make sure you're up to date
|
||||
# View differences excluding "Publish" commits
|
||||
git checkout canary && git pull
|
||||
git log --pretty=format:"$ad- %s [%an]" | grep -v Publish > ~/Desktop/canary.txt
|
||||
git checkout master && git pull
|
||||
git log --pretty=format:"$ad- %s [%an]" | grep -v Publish > ~/Desktop/master.txt
|
||||
diff ~/Desktop/canary.txt ~/Desktop/master.txt
|
||||
|
||||
# Cherry pick all PRs from canary into master ...
|
||||
git cherry-pick <PR501_COMMIT_SHA>
|
||||
git cherry-pick <PR502_COMMIT_SHA>
|
||||
git cherry-pick <PR503_COMMIT_SHA>
|
||||
git cherry-pick <PR504_COMMIT_SHA>
|
||||
# ... etc ...
|
||||
|
||||
# Verify the only difference is "version" in package.json
|
||||
git diff origin/canary
|
||||
|
||||
# Ship it
|
||||
yarn publish-stable
|
||||
```
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "*",
|
||||
"@zeit/ncc": "0.20.4",
|
||||
"async-retry": "1.2.3",
|
||||
"buffer-replace": "1.0.0",
|
||||
"codecov": "3.2.0",
|
||||
|
||||
@@ -11,12 +11,12 @@ curl -sfLS https://import.pw > "$IMPORT_BIN"
|
||||
chmod +x "$IMPORT_BIN"
|
||||
|
||||
# For now only the entrypoint file is copied into the lambda
|
||||
mkdir -p "$(dirname "$ENTRYPOINT")"
|
||||
cp "$SRC/$ENTRYPOINT" "$ENTRYPOINT"
|
||||
mkdir -p "$(dirname "$DIST/$ENTRYPOINT")"
|
||||
cp "$ENTRYPOINT" "$DIST/$ENTRYPOINT"
|
||||
|
||||
# Copy in the runtime
|
||||
cp "$BUILDER/runtime.sh" "$IMPORT_CACHE"
|
||||
cp "$BUILDER/bootstrap" .
|
||||
cp "$BUILDER/bootstrap" "$DIST"
|
||||
|
||||
# Load `import`
|
||||
. "$(which import)"
|
||||
@@ -24,7 +24,7 @@ cp "$BUILDER/bootstrap" .
|
||||
# Cache runtime and user dependencies
|
||||
echo "Caching imports in \"$ENTRYPOINT\"…"
|
||||
. "$IMPORT_CACHE/runtime.sh"
|
||||
. "$ENTRYPOINT"
|
||||
. "$DIST/$ENTRYPOINT"
|
||||
echo "Done caching imports"
|
||||
|
||||
# Run user build script
|
||||
|
||||
@@ -5,7 +5,6 @@ const {
|
||||
glob,
|
||||
download,
|
||||
createLambda,
|
||||
getWriteableDirectory,
|
||||
shouldServe,
|
||||
} = require('@now/build-utils'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
|
||||
@@ -21,12 +20,12 @@ const allowedConfigImports = new Set([
|
||||
exports.analyze = ({ files, entrypoint }) => files[entrypoint].digest;
|
||||
|
||||
exports.build = async ({
|
||||
workPath, files, entrypoint, config,
|
||||
workPath, files, entrypoint, meta, config,
|
||||
}) => {
|
||||
const srcDir = await getWriteableDirectory();
|
||||
|
||||
console.log('downloading files...');
|
||||
await download(files, srcDir);
|
||||
await download(files, workPath, meta);
|
||||
|
||||
const distPath = join(workPath, 'dist');
|
||||
|
||||
const configEnv = Object.keys(config).reduce((o, v) => {
|
||||
const name = snakeCase(v).toUpperCase();
|
||||
@@ -46,11 +45,11 @@ exports.build = async ({
|
||||
});
|
||||
}
|
||||
|
||||
const IMPORT_CACHE = `${workPath}/.import-cache`;
|
||||
const IMPORT_CACHE = `${distPath}/.import-cache`;
|
||||
const env = Object.assign({}, process.env, configEnv, {
|
||||
PATH: `${IMPORT_CACHE}/bin:${process.env.PATH}`,
|
||||
IMPORT_CACHE,
|
||||
SRC: srcDir,
|
||||
DIST: distPath,
|
||||
BUILDER: __dirname,
|
||||
ENTRYPOINT: entrypoint,
|
||||
});
|
||||
@@ -64,7 +63,7 @@ exports.build = async ({
|
||||
});
|
||||
|
||||
const lambda = await createLambda({
|
||||
files: await glob('**', workPath),
|
||||
files: await glob('**', distPath),
|
||||
handler: entrypoint, // not actually used in `bootstrap`
|
||||
runtime: 'provided',
|
||||
environment: Object.assign({}, configEnv, {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/bash",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Now 2.0 builder for HTTP endpoints written in Bash",
|
||||
"main": "index.js",
|
||||
"author": "Nathan Rajlich <nate@zeit.co>",
|
||||
@@ -21,5 +21,8 @@
|
||||
"dependencies": {
|
||||
"execa": "^1.0.0",
|
||||
"snake-case": "^2.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
|
||||
3
packages/now-bash/test/fixtures/01-cowsay/index.sh
vendored
Normal file
3
packages/now-bash/test/fixtures/01-cowsay/index.sh
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
handler() {
|
||||
echo "cow:RANDOMNESS_PLACEHOLDER"
|
||||
}
|
||||
11
packages/now-bash/test/fixtures/01-cowsay/now.json
vendored
Normal file
11
packages/now-bash/test/fixtures/01-cowsay/now.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{ "src": "index.sh", "use": "@now/bash" },
|
||||
{ "src": "subdirectory/index.sh", "use": "@now/bash" }
|
||||
],
|
||||
"probes": [
|
||||
{ "path": "/", "mustContain": "cow:RANDOMNESS_PLACEHOLDER" },
|
||||
{ "path": "/subdirectory/", "mustContain": "yoda:RANDOMNESS_PLACEHOLDER" }
|
||||
]
|
||||
}
|
||||
3
packages/now-bash/test/fixtures/01-cowsay/subdirectory/index.sh
vendored
Normal file
3
packages/now-bash/test/fixtures/01-cowsay/subdirectory/index.sh
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
handler() {
|
||||
echo "yoda:RANDOMNESS_PLACEHOLDER"
|
||||
}
|
||||
33
packages/now-bash/test/test.js
Normal file
33
packages/now-bash/test/test.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/* global beforeAll, expect, it, jest */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const {
|
||||
packAndDeploy,
|
||||
testDeployment,
|
||||
} = require('../../../test/lib/deployment/test-deployment.js');
|
||||
|
||||
jest.setTimeout(4 * 60 * 1000);
|
||||
const buildUtilsUrl = '@canary';
|
||||
let builderUrl;
|
||||
|
||||
beforeAll(async () => {
|
||||
const builderPath = path.resolve(__dirname, '..');
|
||||
builderUrl = await packAndDeploy(builderPath);
|
||||
console.log('builderUrl', builderUrl);
|
||||
});
|
||||
|
||||
const fixturesPath = path.resolve(__dirname, 'fixtures');
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const fixture of fs.readdirSync(fixturesPath)) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
it(`should build ${fixture}`, async () => {
|
||||
await expect(
|
||||
testDeployment(
|
||||
{ builderUrl, buildUtilsUrl },
|
||||
path.join(fixturesPath, fixture),
|
||||
),
|
||||
).resolves.toBeDefined();
|
||||
});
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
cross-spawn@^6.0.0:
|
||||
version "6.0.5"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
|
||||
integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==
|
||||
dependencies:
|
||||
nice-try "^1.0.4"
|
||||
path-key "^2.0.1"
|
||||
semver "^5.5.0"
|
||||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
end-of-stream@^1.1.0:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43"
|
||||
integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==
|
||||
dependencies:
|
||||
once "^1.4.0"
|
||||
|
||||
execa@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
|
||||
integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==
|
||||
dependencies:
|
||||
cross-spawn "^6.0.0"
|
||||
get-stream "^4.0.0"
|
||||
is-stream "^1.1.0"
|
||||
npm-run-path "^2.0.0"
|
||||
p-finally "^1.0.0"
|
||||
signal-exit "^3.0.0"
|
||||
strip-eof "^1.0.0"
|
||||
|
||||
get-stream@^4.0.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5"
|
||||
integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==
|
||||
dependencies:
|
||||
pump "^3.0.0"
|
||||
|
||||
is-stream@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
|
||||
|
||||
isexe@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
|
||||
|
||||
lower-case@^1.1.1:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
|
||||
integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=
|
||||
|
||||
nice-try@^1.0.4:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
|
||||
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
|
||||
|
||||
no-case@^2.2.0:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"
|
||||
integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==
|
||||
dependencies:
|
||||
lower-case "^1.1.1"
|
||||
|
||||
npm-run-path@^2.0.0:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
|
||||
integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=
|
||||
dependencies:
|
||||
path-key "^2.0.0"
|
||||
|
||||
once@^1.3.1, once@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
p-finally@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
|
||||
integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=
|
||||
|
||||
path-key@^2.0.0, path-key@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
|
||||
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
|
||||
|
||||
pump@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
|
||||
integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==
|
||||
dependencies:
|
||||
end-of-stream "^1.1.0"
|
||||
once "^1.3.1"
|
||||
|
||||
semver@^5.5.0:
|
||||
version "5.6.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
|
||||
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
|
||||
|
||||
shebang-command@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
|
||||
integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=
|
||||
dependencies:
|
||||
shebang-regex "^1.0.0"
|
||||
|
||||
shebang-regex@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
|
||||
integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=
|
||||
|
||||
signal-exit@^3.0.0:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
|
||||
integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=
|
||||
|
||||
snake-case@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-2.1.0.tgz#41bdb1b73f30ec66a04d4e2cad1b76387d4d6d9f"
|
||||
integrity sha1-Qb2xtz8w7GagTU4srRt2OH1NbZ8=
|
||||
dependencies:
|
||||
no-case "^2.2.0"
|
||||
|
||||
strip-eof@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
|
||||
integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=
|
||||
|
||||
which@^1.2.9:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
|
||||
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
|
||||
6
packages/now-build-utils/build.sh
Executable file
6
packages/now-build-utils/build.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
tsc
|
||||
|
||||
rm dist/index.js
|
||||
ncc build src/index.ts -o dist/main
|
||||
mv dist/main/index.js dist/index.js
|
||||
rm -rf dist/main
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/build-utils",
|
||||
"version": "0.8.9",
|
||||
"version": "0.9.5",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.js",
|
||||
@@ -11,23 +11,9 @@
|
||||
"directory": "packages/now-build-utils"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "tsc && jest",
|
||||
"prepublishOnly": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"async-retry": "1.2.3",
|
||||
"async-sema": "2.1.4",
|
||||
"cross-spawn": "6.0.5",
|
||||
"end-of-stream": "1.4.1",
|
||||
"fs-extra": "7.0.0",
|
||||
"glob": "7.1.3",
|
||||
"into-stream": "5.0.0",
|
||||
"minimatch": "3.0.4",
|
||||
"multistream": "2.1.1",
|
||||
"node-fetch": "2.2.0",
|
||||
"semver": "6.1.1",
|
||||
"yazl": "2.4.3"
|
||||
"build": "./build.sh",
|
||||
"test": "./build.sh && jest",
|
||||
"prepublishOnly": "./build.sh"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/async-retry": "^1.2.1",
|
||||
@@ -39,7 +25,19 @@
|
||||
"@types/node-fetch": "^2.1.6",
|
||||
"@types/semver": "6.0.0",
|
||||
"@types/yazl": "^2.4.1",
|
||||
"async-retry": "1.2.3",
|
||||
"async-sema": "2.1.4",
|
||||
"cross-spawn": "6.0.5",
|
||||
"end-of-stream": "1.4.1",
|
||||
"execa": "^1.0.0",
|
||||
"typescript": "3.5.2"
|
||||
"fs-extra": "7.0.0",
|
||||
"glob": "7.1.3",
|
||||
"into-stream": "5.0.0",
|
||||
"minimatch": "3.0.4",
|
||||
"multistream": "2.1.1",
|
||||
"node-fetch": "2.2.0",
|
||||
"semver": "6.1.1",
|
||||
"typescript": "3.5.2",
|
||||
"yazl": "2.4.3"
|
||||
}
|
||||
}
|
||||
|
||||
7
packages/now-build-utils/src/debug.ts
Normal file
7
packages/now-build-utils/src/debug.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export default function debug(message: string, ...additional: any[]) {
|
||||
if (process.env.NOW_BUILDER_DEBUG) {
|
||||
console.log(message, ...additional);
|
||||
} else if (process.env.NOW_BUILDER_ANNOTATE) {
|
||||
console.log(`[now-builder-debug] ${message}`, ...additional);
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
import { PackageJson, Builder, Config } from './types';
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
const src: string = 'package.json';
|
||||
const config: Config = { zeroConfig: true };
|
||||
|
||||
// Static builders are special cased in `@now/static-build`
|
||||
const BUILDERS = new Map<string, Builder>([
|
||||
['next', { src, use: '@now/next', config }],
|
||||
]);
|
||||
|
||||
const API_BUILDERS: Builder[] = [
|
||||
{ src: 'api/**/*.js', use: '@now/node@canary', config },
|
||||
{ src: 'api/**/*.ts', use: '@now/node@canary', config },
|
||||
{ src: 'api/**/*.rs', use: '@now/rust', config },
|
||||
{ src: 'api/**/*.go', use: '@now/go', config },
|
||||
{ src: 'api/**/*.php', use: '@now/php', config },
|
||||
{ src: 'api/**/*.py', use: '@now/python', config },
|
||||
{ src: 'api/**/*.rb', use: '@now/ruby', config },
|
||||
{ src: 'api/**/*.sh', use: '@now/bash', config },
|
||||
];
|
||||
|
||||
interface Warning {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export async function detectBuilder(
|
||||
pkg: PackageJson
|
||||
): Promise<{
|
||||
builder: null | Builder;
|
||||
warnings: null | Warning[];
|
||||
}> {
|
||||
let warnings: null | Warning[] = null;
|
||||
|
||||
const scripts = pkg.scripts || {};
|
||||
|
||||
if (!scripts.build) {
|
||||
warnings = [
|
||||
{
|
||||
code: 'missing_build_script',
|
||||
message:
|
||||
'Your `package.json` file is missing a `build` property inside the `script` property',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
for (const [dependency, builder] of BUILDERS) {
|
||||
const deps = Object.assign({}, pkg.dependencies, pkg.devDependencies);
|
||||
|
||||
// Return the builder when a dependency matches
|
||||
if (deps[dependency]) {
|
||||
return { builder, warnings };
|
||||
}
|
||||
}
|
||||
|
||||
// If there is no `build` and `now-build` script
|
||||
// we'll not select `@now/static-build`
|
||||
// since it would fail
|
||||
if (!scripts.build) {
|
||||
return { builder: null, warnings };
|
||||
}
|
||||
|
||||
// By default we'll choose the `static-build` builder
|
||||
const builder = { src, use: '@now/static-build', config };
|
||||
return { builder, warnings };
|
||||
}
|
||||
|
||||
// Files that match a specific pattern will get ignored
|
||||
export function ignoreApiFilter(file: string) {
|
||||
if (file.includes('/.')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.includes('/_')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the file does not match any builder we also
|
||||
// don't want to create a route e.g. `package.json`
|
||||
if (API_BUILDERS.every(({ src }) => !minimatch(file, src))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need to sort the file paths by alphabet to make
|
||||
// sure the routes stay in the same order e.g. for deduping
|
||||
export function sortFiles(fileA: string, fileB: string) {
|
||||
return fileA.localeCompare(fileB);
|
||||
}
|
||||
|
||||
export async function detectApiBuilders(
|
||||
files: string[]
|
||||
): Promise<Builder[] | null> {
|
||||
const builds = files
|
||||
.sort(sortFiles)
|
||||
.filter(ignoreApiFilter)
|
||||
.map(file => {
|
||||
const result = API_BUILDERS.find(
|
||||
({ src }): boolean => minimatch(file, src)
|
||||
);
|
||||
|
||||
return result ? { ...result, src: file } : null;
|
||||
});
|
||||
|
||||
const finishedBuilds = builds.filter(Boolean);
|
||||
return finishedBuilds.length > 0 ? (finishedBuilds as Builder[]) : null;
|
||||
}
|
||||
152
packages/now-build-utils/src/detect-builders.ts
Normal file
152
packages/now-build-utils/src/detect-builders.ts
Normal file
@@ -0,0 +1,152 @@
|
||||
import { PackageJson, Builder, Config } from './types';
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
interface ErrorResponse {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
const src: string = 'package.json';
|
||||
const config: Config = { zeroConfig: true };
|
||||
|
||||
// Static builders are special cased in `@now/static-build`
|
||||
const BUILDERS = new Map<string, Builder>([
|
||||
['next', { src, use: '@now/next', config }],
|
||||
['nuxt', { src, use: '@now/nuxt', config }],
|
||||
]);
|
||||
|
||||
const API_BUILDERS: Builder[] = [
|
||||
{ src: 'api/**/*.js', use: '@now/node', config },
|
||||
{ src: 'api/**/*.ts', use: '@now/node', config },
|
||||
{ src: 'api/**/*.rs', use: '@now/rust', config },
|
||||
{ src: 'api/**/*.go', use: '@now/go', config },
|
||||
{ src: 'api/**/*.php', use: '@now/php', config },
|
||||
{ src: 'api/**/*.py', use: '@now/python', config },
|
||||
{ src: 'api/**/*.rb', use: '@now/ruby', config },
|
||||
{ src: 'api/**/*.sh', use: '@now/bash', config },
|
||||
];
|
||||
|
||||
const MISSING_BUILD_SCRIPT_ERROR: ErrorResponse = {
|
||||
code: 'missing_build_script',
|
||||
message:
|
||||
'Your `package.json` file is missing a `build` property inside the `script` property.' +
|
||||
'\nMore details: https://zeit.co/docs/v2/advanced/platform/frequently-asked-questions#missing-build-script',
|
||||
};
|
||||
|
||||
function hasPublicDirectory(files: string[]) {
|
||||
return files.some(name => name.startsWith('public/'));
|
||||
}
|
||||
|
||||
function hasBuildScript(pkg: PackageJson | undefined) {
|
||||
const { scripts = {} } = pkg || {};
|
||||
return Boolean(scripts && scripts['build']);
|
||||
}
|
||||
|
||||
async function detectBuilder(pkg: PackageJson): Promise<Builder> {
|
||||
for (const [dependency, builder] of BUILDERS) {
|
||||
const deps = Object.assign({}, pkg.dependencies, pkg.devDependencies);
|
||||
|
||||
// Return the builder when a dependency matches
|
||||
if (deps[dependency]) {
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
// By default we'll choose the `static-build` builder
|
||||
return { src, use: '@now/static-build', config };
|
||||
}
|
||||
|
||||
// Files that match a specific pattern will get ignored
|
||||
export function ignoreApiFilter(file: string) {
|
||||
if (file.includes('/.')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.includes('/_')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the file does not match any builder we also
|
||||
// don't want to create a route e.g. `package.json`
|
||||
if (API_BUILDERS.every(({ src }) => !minimatch(file, src))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need to sort the file paths by alphabet to make
|
||||
// sure the routes stay in the same order e.g. for deduping
|
||||
export function sortFiles(fileA: string, fileB: string) {
|
||||
return fileA.localeCompare(fileB);
|
||||
}
|
||||
|
||||
async function detectApiBuilders(files: string[]): Promise<Builder[]> {
|
||||
const builds = files
|
||||
.sort(sortFiles)
|
||||
.filter(ignoreApiFilter)
|
||||
.map(file => {
|
||||
const result = API_BUILDERS.find(
|
||||
({ src }): boolean => minimatch(file, src)
|
||||
);
|
||||
|
||||
return result ? { ...result, src: file } : null;
|
||||
});
|
||||
|
||||
const finishedBuilds = builds.filter(Boolean);
|
||||
return finishedBuilds as Builder[];
|
||||
}
|
||||
|
||||
// When zero config is used we can call this function
|
||||
// to determine what builders to use
|
||||
export async function detectBuilders(
|
||||
files: string[],
|
||||
pkg?: PackageJson | undefined | null
|
||||
): Promise<{
|
||||
builders: Builder[] | null;
|
||||
errors: ErrorResponse[] | null;
|
||||
}> {
|
||||
const errors: ErrorResponse[] = [];
|
||||
|
||||
// Detect all builders for the `api` directory before anything else
|
||||
const builders = await detectApiBuilders(files);
|
||||
|
||||
if (pkg && hasBuildScript(pkg)) {
|
||||
builders.push(await detectBuilder(pkg));
|
||||
} else {
|
||||
if (pkg && builders.length === 0) {
|
||||
// We only show this error when there are no api builders
|
||||
// since the dependencies of the pkg could be used for those
|
||||
errors.push(MISSING_BUILD_SCRIPT_ERROR);
|
||||
return { errors, builders: null };
|
||||
}
|
||||
|
||||
// We allow a `public` directory
|
||||
// when there are no build steps
|
||||
if (hasPublicDirectory(files)) {
|
||||
builders.push({
|
||||
use: '@now/static',
|
||||
src: 'public/**/*',
|
||||
config,
|
||||
});
|
||||
} else if (builders.length > 0) {
|
||||
// We can't use pattern matching, since `!(api)` and `!(api)/**/*`
|
||||
// won't give the correct results
|
||||
builders.push(
|
||||
...files
|
||||
.filter(name => !name.startsWith('api/'))
|
||||
.filter(name => !(name === 'package.json'))
|
||||
.map(name => ({
|
||||
use: '@now/static',
|
||||
src: name,
|
||||
config,
|
||||
}))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
builders: builders.length ? builders : null,
|
||||
errors: errors.length ? errors : null,
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Route } from './types';
|
||||
import { Route, Builder } from './types';
|
||||
import { parse as parsePath } from 'path';
|
||||
import { ignoreApiFilter, sortFiles } from './detect-builder';
|
||||
import { ignoreApiFilter, sortFiles } from './detect-builders';
|
||||
|
||||
function joinPath(...segments: string[]) {
|
||||
const joinedPath = segments.join('/');
|
||||
@@ -167,12 +167,12 @@ function sortFilesBySegmentCount(fileA: string, fileB: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
export async function detectApiRoutes(
|
||||
files: string[]
|
||||
): Promise<{
|
||||
interface RoutesResult {
|
||||
defaultRoutes: Route[] | null;
|
||||
error: { [key: string]: string } | null;
|
||||
}> {
|
||||
}
|
||||
|
||||
async function detectApiRoutes(files: string[]): Promise<RoutesResult> {
|
||||
if (!files || files.length === 0) {
|
||||
return { defaultRoutes: null, error: null };
|
||||
}
|
||||
@@ -234,3 +234,29 @@ export async function detectApiRoutes(
|
||||
|
||||
return { defaultRoutes, error: null };
|
||||
}
|
||||
|
||||
function hasPublicBuilder(builders: Builder[]): boolean {
|
||||
return builders.some(
|
||||
builder =>
|
||||
builder.use === '@now/static' &&
|
||||
builder.src === 'public/**/*' &&
|
||||
builder.config &&
|
||||
builder.config.zeroConfig === true
|
||||
);
|
||||
}
|
||||
|
||||
export async function detectRoutes(
|
||||
files: string[],
|
||||
builders: Builder[]
|
||||
): Promise<RoutesResult> {
|
||||
const routesResult = await detectApiRoutes(files);
|
||||
|
||||
if (routesResult.defaultRoutes && hasPublicBuilder(builders)) {
|
||||
routesResult.defaultRoutes.push({
|
||||
src: '/(.*)',
|
||||
dest: '/public/$1',
|
||||
});
|
||||
}
|
||||
|
||||
return routesResult;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,9 @@ import {
|
||||
} from './fs/run-user-scripts';
|
||||
import streamToBuffer from './fs/stream-to-buffer';
|
||||
import shouldServe from './should-serve';
|
||||
import { detectBuilder, detectApiBuilders } from './detect-builder';
|
||||
import { detectApiRoutes } from './detect-routes';
|
||||
import { detectBuilders } from './detect-builders';
|
||||
import { detectRoutes } from './detect-routes';
|
||||
import debug from './debug';
|
||||
|
||||
export {
|
||||
FileBlob,
|
||||
@@ -38,9 +39,9 @@ export {
|
||||
getSpawnOptions,
|
||||
streamToBuffer,
|
||||
shouldServe,
|
||||
detectBuilder,
|
||||
detectApiBuilders,
|
||||
detectApiRoutes,
|
||||
detectBuilders,
|
||||
detectRoutes,
|
||||
debug,
|
||||
};
|
||||
|
||||
export * from './types';
|
||||
|
||||
@@ -23,6 +23,8 @@ export interface Route {
|
||||
headers?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
continue?: boolean;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
|
||||
@@ -16,11 +16,7 @@ const {
|
||||
testDeployment,
|
||||
} = require('../../../test/lib/deployment/test-deployment.js');
|
||||
|
||||
const {
|
||||
detectBuilder,
|
||||
detectApiBuilders,
|
||||
detectApiRoutes,
|
||||
} = require('../dist');
|
||||
const { detectBuilders, detectRoutes } = require('../dist');
|
||||
|
||||
jest.setTimeout(4 * 60 * 1000);
|
||||
const builderUrl = '@canary';
|
||||
@@ -139,7 +135,7 @@ for (const fixture of fs.readdirSync(fixturesPath)) {
|
||||
|
||||
// few foreign tests
|
||||
|
||||
const buildersToTestWith = ['now-node', 'now-static-build'];
|
||||
const buildersToTestWith = ['now-next', 'now-node', 'now-static-build'];
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const builder of buildersToTestWith) {
|
||||
@@ -151,7 +147,7 @@ for (const builder of buildersToTestWith) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const fixture of fs.readdirSync(fixturesPath2)) {
|
||||
// don't run all foreign fixtures, just some
|
||||
if (['01-cowsay', '03-env-vars'].includes(fixture)) {
|
||||
if (['01-cowsay', '01-cache-headers', '03-env-vars'].includes(fixture)) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
it(`should build ${builder}/${fixture}`, async () => {
|
||||
await expect(
|
||||
@@ -165,68 +161,250 @@ for (const builder of buildersToTestWith) {
|
||||
}
|
||||
}
|
||||
|
||||
it('Test `detectBuilder`', async () => {
|
||||
it('Test `detectBuilders`', async () => {
|
||||
{
|
||||
const pkg = { dependencies: { next: '1.0.0' } };
|
||||
const { builder, warnings } = await detectBuilder(pkg);
|
||||
expect(builder.use).toBe('@now/next');
|
||||
expect(warnings.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
const pkg = { devDependencies: { next: '1.0.0' } };
|
||||
const { builder } = await detectBuilder(pkg);
|
||||
expect(builder.use).toBe('@now/next');
|
||||
}
|
||||
|
||||
{
|
||||
const pkg = {};
|
||||
const { builder } = await detectBuilder(pkg);
|
||||
expect(builder).toBe(null);
|
||||
}
|
||||
});
|
||||
|
||||
it('Test `detectApiBuilders`', async () => {
|
||||
{
|
||||
const files = ['package.json', 'api/user.js', 'api/team.js'];
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
}
|
||||
|
||||
{
|
||||
const files = ['package.json', 'api/user.go', 'api/team.js'];
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
expect(builders.some(({ use }) => use === '@now/go')).toBeTruthy();
|
||||
expect(builders.some(({ use }) => use === '@now/node@canary')).toBeTruthy();
|
||||
}
|
||||
|
||||
{
|
||||
const files = ['package.json'];
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
// package.json + no build
|
||||
const pkg = { dependencies: { next: '9.0.0' } };
|
||||
const files = ['package.json', 'pages/index.js', 'public/index.html'];
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders).toBe(null);
|
||||
expect(errors.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// package.json + no build + next
|
||||
const pkg = {
|
||||
scripts: { build: 'next build' },
|
||||
dependencies: { next: '9.0.0' },
|
||||
};
|
||||
const files = ['package.json', 'pages/index.js'];
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/next');
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// package.json + no build + next
|
||||
const pkg = {
|
||||
scripts: { build: 'next build' },
|
||||
devDependencies: { next: '9.0.0' },
|
||||
};
|
||||
const files = ['package.json', 'pages/index.js'];
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/next');
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// package.json + no build
|
||||
const pkg = {};
|
||||
const files = ['package.json'];
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders).toBe(null);
|
||||
expect(errors.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// static file
|
||||
const files = ['index.html'];
|
||||
const { builders, errors } = await detectBuilders(files);
|
||||
expect(builders).toBe(null);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// no package.json + public
|
||||
const files = ['api/users.js', 'public/index.html'];
|
||||
const { builders, errors } = await detectBuilders(files);
|
||||
expect(builders[1].use).toBe('@now/static');
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// no package.json + no build + raw static + api
|
||||
const files = ['api/users.js', 'index.html'];
|
||||
const { builders, errors } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/users.js');
|
||||
expect(builders[1].use).toBe('@now/static');
|
||||
expect(builders[1].src).toBe('index.html');
|
||||
expect(builders.length).toBe(2);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// package.json + no build + root + api
|
||||
const files = ['index.html', 'api/[endpoint].js', 'static/image.png'];
|
||||
const { builders, errors } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/[endpoint].js');
|
||||
expect(builders[1].use).toBe('@now/static');
|
||||
expect(builders[1].src).toBe('index.html');
|
||||
expect(builders[2].use).toBe('@now/static');
|
||||
expect(builders[2].src).toBe('static/image.png');
|
||||
expect(builders.length).toBe(3);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// api + ignore files
|
||||
const files = [
|
||||
'api/users/[id].js',
|
||||
'api/_utils/handler.js',
|
||||
'api/users/.helper.js',
|
||||
'api/teams/_helper.js',
|
||||
'api/[endpoint]/.helper.js',
|
||||
'api/[endpoint]/[id].js',
|
||||
];
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
const { builders } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/[endpoint]/[id].js');
|
||||
expect(builders.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// api + next + public
|
||||
const pkg = {
|
||||
scripts: { build: 'next build' },
|
||||
devDependencies: { next: '9.0.0' },
|
||||
};
|
||||
const files = ['package.json', 'api/endpoint.js', 'public/index.html'];
|
||||
|
||||
const { builders } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/endpoint.js');
|
||||
expect(builders[1].use).toBe('@now/next');
|
||||
expect(builders[1].src).toBe('package.json');
|
||||
expect(builders.length).toBe(2);
|
||||
}
|
||||
|
||||
{
|
||||
// api + next + raw static
|
||||
const pkg = {
|
||||
scripts: { build: 'next build' },
|
||||
devDependencies: { next: '9.0.0' },
|
||||
};
|
||||
const files = ['package.json', 'api/endpoint.js', 'index.html'];
|
||||
|
||||
const { builders } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/endpoint.js');
|
||||
expect(builders[1].use).toBe('@now/next');
|
||||
expect(builders[1].src).toBe('package.json');
|
||||
expect(builders.length).toBe(2);
|
||||
}
|
||||
|
||||
{
|
||||
// api + raw static
|
||||
const files = ['api/endpoint.js', 'index.html', 'favicon.ico'];
|
||||
|
||||
const { builders } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/endpoint.js');
|
||||
expect(builders[1].use).toBe('@now/static');
|
||||
expect(builders[1].src).toBe('favicon.ico');
|
||||
expect(builders[2].use).toBe('@now/static');
|
||||
expect(builders[2].src).toBe('index.html');
|
||||
expect(builders.length).toBe(3);
|
||||
}
|
||||
|
||||
{
|
||||
// api + public
|
||||
const files = [
|
||||
'api/endpoint.js',
|
||||
'public/index.html',
|
||||
'public/favicon.ico',
|
||||
'README.md',
|
||||
];
|
||||
|
||||
const { builders } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/endpoint.js');
|
||||
expect(builders[1].use).toBe('@now/static');
|
||||
expect(builders[1].src).toBe('public/**/*');
|
||||
expect(builders.length).toBe(2);
|
||||
}
|
||||
|
||||
{
|
||||
// just public
|
||||
const files = ['public/index.html', 'public/favicon.ico', 'README.md'];
|
||||
|
||||
const { builders } = await detectBuilders(files);
|
||||
expect(builders[0].src).toBe('public/**/*');
|
||||
expect(builders.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// next + public
|
||||
const pkg = {
|
||||
scripts: { build: 'next build' },
|
||||
devDependencies: { next: '9.0.0' },
|
||||
};
|
||||
const files = ['package.json', 'public/index.html', 'README.md'];
|
||||
|
||||
const { builders } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/next');
|
||||
expect(builders[0].src).toBe('package.json');
|
||||
expect(builders.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// nuxt
|
||||
const pkg = {
|
||||
scripts: { build: 'nuxt build' },
|
||||
dependencies: { nuxt: '2.8.1' },
|
||||
};
|
||||
const files = ['package.json', 'pages/index.js'];
|
||||
|
||||
const { builders } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/nuxt');
|
||||
expect(builders[0].src).toBe('package.json');
|
||||
expect(builders.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// package.json with no build + api
|
||||
const pkg = { dependencies: { next: '9.0.0' } };
|
||||
const files = ['package.json', 'api/[endpoint].js'];
|
||||
|
||||
const { builders } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/[endpoint].js');
|
||||
expect(builders.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// package.json with no build + public directory
|
||||
const pkg = { dependencies: { next: '9.0.0' } };
|
||||
const files = ['package.json', 'public/index.html'];
|
||||
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders).toBe(null);
|
||||
expect(errors.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// no package.json + api
|
||||
const files = ['api/[endpoint].js', 'api/[endpoint]/[id].js'];
|
||||
|
||||
const { builders } = await detectBuilders(files);
|
||||
expect(builders.length).toBe(2);
|
||||
}
|
||||
|
||||
{
|
||||
// no package.json + no api
|
||||
const files = ['index.html'];
|
||||
|
||||
const { builders, errors } = await detectBuilders(files);
|
||||
expect(builders).toBe(null);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
});
|
||||
|
||||
it('Test `detectApiRoutes`', async () => {
|
||||
it('Test `detectRoutes`', async () => {
|
||||
{
|
||||
const files = ['api/user.go', 'api/team.js', 'api/package.json'];
|
||||
|
||||
const { defaultRoutes } = await detectApiRoutes(files);
|
||||
const { builders } = await detectBuilders(files);
|
||||
const { defaultRoutes } = await detectRoutes(files, builders);
|
||||
expect(defaultRoutes.length).toBe(2);
|
||||
expect(defaultRoutes[0].dest).toBe('/api/team.js');
|
||||
expect(defaultRoutes[1].dest).toBe('/api/user.go');
|
||||
@@ -235,39 +413,58 @@ it('Test `detectApiRoutes`', async () => {
|
||||
{
|
||||
const files = ['api/user.go', 'api/user.js'];
|
||||
|
||||
const { error } = await detectApiRoutes(files);
|
||||
const { builders } = await detectBuilders(files);
|
||||
const { error } = await detectRoutes(files, builders);
|
||||
expect(error.code).toBe('conflicting_file_path');
|
||||
}
|
||||
|
||||
{
|
||||
const files = ['api/[user].go', 'api/[team]/[id].js'];
|
||||
|
||||
const { error } = await detectApiRoutes(files);
|
||||
const { builders } = await detectBuilders(files);
|
||||
const { error } = await detectRoutes(files, builders);
|
||||
expect(error.code).toBe('conflicting_file_path');
|
||||
}
|
||||
|
||||
{
|
||||
const files = ['api/[team]/[team].js'];
|
||||
|
||||
const { error } = await detectApiRoutes(files);
|
||||
const { builders } = await detectBuilders(files);
|
||||
const { error } = await detectRoutes(files, builders);
|
||||
expect(error.code).toBe('conflicting_path_segment');
|
||||
}
|
||||
|
||||
{
|
||||
const files = ['api/[endpoint].js', 'api/[endpoint]/[id].js'];
|
||||
|
||||
const { defaultRoutes } = await detectApiRoutes(files);
|
||||
const { builders } = await detectBuilders(files);
|
||||
const { defaultRoutes } = await detectRoutes(files, builders);
|
||||
expect(defaultRoutes.length).toBe(2);
|
||||
}
|
||||
|
||||
{
|
||||
const files = [
|
||||
'api/_utils/handler.js',
|
||||
'api/[endpoint]/.helper.js',
|
||||
'public/index.html',
|
||||
'api/[endpoint].js',
|
||||
'api/[endpoint]/[id].js',
|
||||
];
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
expect(builders.length).toBe(1);
|
||||
const { builders } = await detectBuilders(files);
|
||||
const { defaultRoutes } = await detectRoutes(files, builders);
|
||||
expect(defaultRoutes[2].src).toBe('/(.*)');
|
||||
expect(defaultRoutes[2].dest).toBe('/public/$1');
|
||||
expect(defaultRoutes.length).toBe(3);
|
||||
}
|
||||
|
||||
{
|
||||
const pkg = {
|
||||
scripts: { build: 'next build' },
|
||||
devDependencies: { next: '9.0.0' },
|
||||
};
|
||||
const files = ['public/index.html', 'api/[endpoint].js'];
|
||||
|
||||
const { builders } = await detectBuilders(files, pkg);
|
||||
const { defaultRoutes } = await detectRoutes(files, builders);
|
||||
expect(defaultRoutes.length).toBe(1);
|
||||
}
|
||||
});
|
||||
|
||||
2
packages/now-next/.gitignore
vendored
2
packages/now-next/.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
/dist
|
||||
/src/now__bridge.d.ts
|
||||
/src/now__bridge.ts
|
||||
|
||||
12
packages/now-next/build.sh
Executable file
12
packages/now-next/build.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
bridge_defs="$(dirname $(pwd))/now-node-bridge/src/bridge.ts"
|
||||
|
||||
cp -v "$bridge_defs" src/now__bridge.ts
|
||||
|
||||
tsc
|
||||
|
||||
ncc build src/index.ts -o dist/main
|
||||
mv dist/main/index.js dist/index.js
|
||||
rm -rf dist/main
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
bridge_entrypoint="$(node -p 'require.resolve("@now/node-bridge")')"
|
||||
bridge_defs="$(dirname "$bridge_entrypoint")/bridge.d.ts"
|
||||
|
||||
if [ ! -e "$bridge_defs" ]; then
|
||||
yarn install --cwd "$bridge_entrypoint"
|
||||
fi
|
||||
|
||||
cp -v "$bridge_defs" src/now__bridge.d.ts
|
||||
@@ -1,33 +1,30 @@
|
||||
{
|
||||
"name": "@now/next",
|
||||
"version": "0.5.5",
|
||||
"version": "0.5.7",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/next-js-now-next",
|
||||
"scripts": {
|
||||
"build": "./getBridgeTypes.sh && tsc",
|
||||
"test": "npm run build && jest",
|
||||
"prepublish": "yarn run build"
|
||||
"build": "./build.sh",
|
||||
"test": "./build.sh && jest",
|
||||
"prepublishOnly": "./build.sh"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zeit/now-builders.git",
|
||||
"directory": "packages/now-next"
|
||||
},
|
||||
"dependencies": {
|
||||
"@now/node-bridge": "1.2.3",
|
||||
"fs-extra": "^7.0.0",
|
||||
"get-port": "^5.0.0",
|
||||
"resolve-from": "^5.0.0",
|
||||
"semver": "^5.6.0"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/next-server": "^8.0.0",
|
||||
"@types/resolve-from": "^5.0.1",
|
||||
"@types/semver": "^6.0.0",
|
||||
"@types/next-server": "8.0.0",
|
||||
"@types/resolve-from": "5.0.1",
|
||||
"@types/semver": "6.0.0",
|
||||
"fs-extra": "7.0.0",
|
||||
"get-port": "5.0.0",
|
||||
"resolve-from": "5.0.0",
|
||||
"semver": "6.1.1",
|
||||
"typescript": "3.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChildProcess, fork, SpawnOptions } from 'child_process';
|
||||
import { ChildProcess, fork } from 'child_process';
|
||||
import {
|
||||
pathExists,
|
||||
readFile,
|
||||
@@ -16,33 +16,34 @@ import {
|
||||
FileBlob,
|
||||
FileFsRef,
|
||||
Files,
|
||||
getNodeVersion,
|
||||
getSpawnOptions,
|
||||
glob,
|
||||
Lambda,
|
||||
PrepareCacheOptions,
|
||||
runNpmInstall,
|
||||
runPackageJsonScript,
|
||||
getNodeVersion,
|
||||
getSpawnOptions,
|
||||
Route,
|
||||
} from '@now/build-utils';
|
||||
|
||||
import createServerlessConfig from './create-serverless-config';
|
||||
import nextLegacyVersions from './legacy-versions';
|
||||
import {
|
||||
EnvConfig,
|
||||
excludeFiles,
|
||||
filesFromDirectory,
|
||||
getDynamicRoutes,
|
||||
getNextConfig,
|
||||
getPathsInside,
|
||||
getRoutes,
|
||||
includeOnlyEntryDirectory,
|
||||
isDynamicRoute,
|
||||
normalizePackageJson,
|
||||
filesFromDirectory,
|
||||
normalizePage,
|
||||
stringMap,
|
||||
syncEnvVars,
|
||||
validateEntrypoint,
|
||||
normalizePage,
|
||||
getDynamicRoutes,
|
||||
isDynamicRoute,
|
||||
} from './utils';
|
||||
import createServerlessConfig from './create-serverless-config';
|
||||
|
||||
interface BuildParamsMeta {
|
||||
isDev: boolean | undefined;
|
||||
@@ -157,7 +158,7 @@ export const build = async ({
|
||||
entrypoint,
|
||||
meta = {} as BuildParamsMeta,
|
||||
}: BuildParamsType): Promise<{
|
||||
routes?: ({ src?: string; dest?: string } | { handle: string })[];
|
||||
routes: Route[];
|
||||
output: Files;
|
||||
watch?: string[];
|
||||
childProcesses: ChildProcess[];
|
||||
@@ -301,7 +302,7 @@ export const build = async ({
|
||||
await unlinkFile(path.join(entryPath, '.npmrc'));
|
||||
}
|
||||
|
||||
const exportedPageRoutes: { src: string; dest: string }[] = [];
|
||||
const exportedPageRoutes: Route[] = [];
|
||||
const lambdas: { [key: string]: Lambda } = {};
|
||||
const staticPages: { [key: string]: FileFsRef } = {};
|
||||
const dynamicPages: string[] = [];
|
||||
@@ -330,7 +331,7 @@ export const build = async ({
|
||||
);
|
||||
const launcherFiles = {
|
||||
'now__bridge.js': new FileFsRef({
|
||||
fsPath: require('@now/node-bridge'),
|
||||
fsPath: path.join(__dirname, 'now__bridge.js'),
|
||||
}),
|
||||
};
|
||||
const nextFiles: { [key: string]: FileFsRef } = {
|
||||
@@ -394,7 +395,7 @@ export const build = async ({
|
||||
console.log('preparing lambda files...');
|
||||
const launcherFiles = {
|
||||
'now__bridge.js': new FileFsRef({
|
||||
fsPath: require('@now/node-bridge'),
|
||||
fsPath: path.join(__dirname, 'now__bridge.js'),
|
||||
}),
|
||||
'now__launcher.js': new FileFsRef({
|
||||
fsPath: path.join(__dirname, 'launcher.js'),
|
||||
@@ -536,6 +537,16 @@ export const build = async ({
|
||||
routes: [
|
||||
// Static exported pages (.html rewrites)
|
||||
...exportedPageRoutes,
|
||||
// Before we handle static files we need to set proper caching headers
|
||||
{
|
||||
// This ensures we only match known emitted-by-Next.js files and not
|
||||
// user-emitted files which may be missing a hash in their filename.
|
||||
src: '/_next/static/(?:[^/]+/pages|chunks|runtime)/.+',
|
||||
// Next.js assets contain a hash or entropy in their filenames, so they
|
||||
// are guaranteed to be unique and cacheable indefinitely.
|
||||
headers: { 'cache-control': 'public,max-age=31536000,immutable' },
|
||||
continue: true,
|
||||
},
|
||||
// Next.js page lambdas, `static/` folder, reserved assets, and `public/`
|
||||
// folder
|
||||
{ handle: 'filesystem' },
|
||||
@@ -547,6 +558,7 @@ export const build = async ({
|
||||
{
|
||||
src: path.join('/', entryDirectory, '.*'),
|
||||
dest: path.join('/', entryDirectory, '_error'),
|
||||
status: 404,
|
||||
},
|
||||
]),
|
||||
],
|
||||
|
||||
@@ -3,8 +3,8 @@ if (!process.env.NODE_ENV) {
|
||||
process.env.NOW_REGION === 'dev1' ? 'development' : 'production';
|
||||
}
|
||||
|
||||
const { Server } = require('http');
|
||||
const { Bridge } = require('./now__bridge');
|
||||
import { Server } from 'http';
|
||||
import { Bridge } from './now__bridge';
|
||||
const page = require('./page');
|
||||
|
||||
// page.render is for React rendering
|
||||
|
||||
@@ -228,7 +228,7 @@ function getRoutes(
|
||||
|
||||
const relativeToPages = path.relative('pages', relativePath);
|
||||
const extension = path.extname(relativeToPages);
|
||||
const pageName = relativeToPages.replace(extension, '');
|
||||
const pageName = relativeToPages.replace(extension, '').replace(/\\/g, '/');
|
||||
|
||||
if (pageName.startsWith('_')) {
|
||||
continue;
|
||||
|
||||
5
packages/now-next/test/fixtures/01-cache-headers/next.config.js
vendored
Normal file
5
packages/now-next/test/fixtures/01-cache-headers/next.config.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
generateBuildId() {
|
||||
return 'testing-build-id';
|
||||
},
|
||||
};
|
||||
12
packages/now-next/test/fixtures/01-cache-headers/now.json
vendored
Normal file
12
packages/now-next/test/fixtures/01-cache-headers/now.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "package.json", "use": "@now/next" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/_next/static/testing-build-id/pages/index.js",
|
||||
"responseHeaders": {
|
||||
"cache-control": "public,max-age=31536000,immutable"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
7
packages/now-next/test/fixtures/01-cache-headers/package.json
vendored
Normal file
7
packages/now-next/test/fixtures/01-cache-headers/package.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "latest",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6"
|
||||
}
|
||||
}
|
||||
1
packages/now-next/test/fixtures/01-cache-headers/pages/index.js
vendored
Normal file
1
packages/now-next/test/fixtures/01-cache-headers/pages/index.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default () => 'Hi';
|
||||
33
packages/now-next/test/test.js
Normal file
33
packages/now-next/test/test.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/* global beforeAll, expect, it, jest */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const {
|
||||
packAndDeploy,
|
||||
testDeployment,
|
||||
} = require('../../../test/lib/deployment/test-deployment.js');
|
||||
|
||||
jest.setTimeout(4 * 60 * 1000);
|
||||
const buildUtilsUrl = '@canary';
|
||||
let builderUrl;
|
||||
|
||||
beforeAll(async () => {
|
||||
const builderPath = path.resolve(__dirname, '..');
|
||||
builderUrl = await packAndDeploy(builderPath);
|
||||
console.log('builderUrl', builderUrl);
|
||||
});
|
||||
|
||||
const fixturesPath = path.resolve(__dirname, 'fixtures');
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const fixture of fs.readdirSync(fixturesPath)) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
it(`should build ${fixture}`, async () => {
|
||||
await expect(
|
||||
testDeployment(
|
||||
{ builderUrl, buildUtilsUrl },
|
||||
path.join(fixturesPath, fixture),
|
||||
),
|
||||
).resolves.toBeDefined();
|
||||
});
|
||||
}
|
||||
@@ -22,6 +22,24 @@ describe('build meta dev', () => {
|
||||
export default () => 'Index page'
|
||||
`,
|
||||
}),
|
||||
'pages/nested/[param].js': new FileBlob({
|
||||
mode: 0o777,
|
||||
data: `
|
||||
export default () => 'Dynamic page'
|
||||
`,
|
||||
}),
|
||||
'pages/nested/page.tsx': new FileBlob({
|
||||
mode: 0o777,
|
||||
data: `
|
||||
export default () => 'Nested page'
|
||||
`,
|
||||
}),
|
||||
'pages/api/test.js': new FileBlob({
|
||||
mode: 0o777,
|
||||
data: `
|
||||
export default (req, res) => res.status(200).end('API Route')
|
||||
`,
|
||||
}),
|
||||
// This file should be omitted because `pages/index.js` will use the same route
|
||||
'public/index': new FileBlob({
|
||||
mode: 0o777,
|
||||
@@ -39,9 +57,14 @@ describe('build meta dev', () => {
|
||||
"now-build": "next build"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "8",
|
||||
"next": "9",
|
||||
"react": "16",
|
||||
"react-dom": "16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "12",
|
||||
"@types/react": "16",
|
||||
"typescript": "3"
|
||||
}
|
||||
}
|
||||
`,
|
||||
@@ -80,11 +103,20 @@ describe('build meta dev', () => {
|
||||
{ src: '/static/(.*)', dest: 'http://localhost:5000/static/$1' },
|
||||
{ src: '/index', dest: 'http://localhost:5000/index' },
|
||||
{ src: '/', dest: 'http://localhost:5000/' },
|
||||
{ src: '/nested/page', dest: 'http://localhost:5000/nested/page' },
|
||||
{ src: '/api/test', dest: 'http://localhost:5000/api/test' },
|
||||
{
|
||||
src: '^/(nested\\/([^\\/]+?)(?:\\/)?)$',
|
||||
dest: 'http://localhost:5000/$1',
|
||||
},
|
||||
{ src: '/data.txt', dest: 'http://localhost:5000/data.txt' },
|
||||
]);
|
||||
expect(watch).toEqual([
|
||||
'next.config.js',
|
||||
'pages/index.js',
|
||||
'pages/nested/[param].js',
|
||||
'pages/nested/page.tsx',
|
||||
'pages/api/test.js',
|
||||
'public/index',
|
||||
'public/data.txt',
|
||||
'package.json',
|
||||
|
||||
@@ -6,7 +6,7 @@ const {
|
||||
normalizePackageJson,
|
||||
getNextConfig,
|
||||
} = require('@now/next/dist/utils');
|
||||
const FileRef = require('@now/build-utils/file-ref'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const { FileRef } = require('@now/build-utils'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
|
||||
describe('getNextConfig', () => {
|
||||
const workPath = path.join(__dirname, 'fixtures');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/node",
|
||||
"version": "0.12.0",
|
||||
"version": "0.12.1",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/node-js-now-node",
|
||||
@@ -28,7 +28,7 @@
|
||||
"@types/etag": "1.8.0",
|
||||
"@types/test-listen": "1.1.0",
|
||||
"@zeit/ncc": "0.20.4",
|
||||
"@zeit/node-file-trace": "0.2.1",
|
||||
"@zeit/node-file-trace": "0.2.3",
|
||||
"content-type": "1.0.4",
|
||||
"cookie": "0.4.0",
|
||||
"etag": "1.8.1",
|
||||
|
||||
@@ -56,13 +56,17 @@ async function downloadInstallAndBundle({
|
||||
meta,
|
||||
}: DownloadOptions) {
|
||||
console.log('downloading user files...');
|
||||
const downloadTime = Date.now();
|
||||
const downloadedFiles = await download(files, workPath, meta);
|
||||
console.log(`download complete [${Date.now() - downloadTime}ms]`);
|
||||
|
||||
console.log("installing dependencies for user's code...");
|
||||
const installTime = Date.now();
|
||||
const entrypointFsDirname = join(workPath, dirname(entrypoint));
|
||||
const nodeVersion = await getNodeVersion(entrypointFsDirname);
|
||||
const spawnOpts = getSpawnOptions(meta, nodeVersion);
|
||||
await runNpmInstall(entrypointFsDirname, ['--prefer-offline'], spawnOpts);
|
||||
console.log(`install complete [${Date.now() - installTime}ms]`);
|
||||
|
||||
const entrypointPath = downloadedFiles[entrypoint].fsPath;
|
||||
return { entrypointPath, entrypointFsDirname, nodeVersion, spawnOpts };
|
||||
@@ -72,8 +76,7 @@ async function compile(
|
||||
workPath: string,
|
||||
entrypointPath: string,
|
||||
entrypoint: string,
|
||||
config: CompilerConfig,
|
||||
{ isDev, filesChanged, filesRemoved }: Meta
|
||||
config: CompilerConfig
|
||||
): Promise<{
|
||||
preparedFiles: Files;
|
||||
shouldAddSourcemapSupport: boolean;
|
||||
@@ -162,6 +165,7 @@ async function compile(
|
||||
const { fileList, esmFileList } = await nodeFileTrace([...inputFiles], {
|
||||
base: workPath,
|
||||
ts: true,
|
||||
mixedModules: true,
|
||||
ignore: config.excludeFiles,
|
||||
readFile(fsPath: string): Buffer | string | null {
|
||||
const relPath = relative(workPath, fsPath);
|
||||
@@ -175,9 +179,12 @@ async function compile(
|
||||
source = compileTypeScript(fsPath, source.toString());
|
||||
}
|
||||
const { mode } = lstatSync(fsPath);
|
||||
if (isSymbolicLink(mode))
|
||||
throw new Error('Internal error: Unexpected symlink.');
|
||||
const entry = new FileBlob({ data: source, mode });
|
||||
let entry: File;
|
||||
if (isSymbolicLink(mode)) {
|
||||
entry = new FileFsRef({ fsPath, mode });
|
||||
} else {
|
||||
entry = new FileBlob({ data: source, mode });
|
||||
}
|
||||
fsCache.set(relPath, entry);
|
||||
sourceCache.set(relPath, source);
|
||||
return source.toString();
|
||||
@@ -294,16 +301,19 @@ export async function build({
|
||||
});
|
||||
|
||||
console.log('running user script...');
|
||||
const runScriptTime = Date.now();
|
||||
await runPackageJsonScript(entrypointFsDirname, 'now-build', spawnOpts);
|
||||
console.log(`script complete [${Date.now() - runScriptTime}ms]`);
|
||||
|
||||
console.log('tracing input files...');
|
||||
const traceTime = Date.now();
|
||||
const { preparedFiles, shouldAddSourcemapSupport, watch } = await compile(
|
||||
workPath,
|
||||
entrypointPath,
|
||||
entrypoint,
|
||||
config,
|
||||
meta
|
||||
config
|
||||
);
|
||||
console.log(`trace complete [${Date.now() - traceTime}ms]`);
|
||||
|
||||
const launcherFiles: Files = {
|
||||
[`${LAUNCHER_FILENAME}.js`]: new FileBlob({
|
||||
|
||||
@@ -453,11 +453,18 @@ function fixConfig(ts: TSCommon, config: _ts.ParsedCommandLine) {
|
||||
delete config.options.tsBuildInfoFile;
|
||||
delete config.options.incremental;
|
||||
|
||||
// Target ES5 output by default (instead of ES3).
|
||||
// Target esnext output by default (instead of ES3).
|
||||
// This will prevent TS from polyfill/downlevel emit.
|
||||
if (config.options.target === undefined) {
|
||||
config.options.target = ts.ScriptTarget.ESNext;
|
||||
}
|
||||
|
||||
// When mixing TS with JS, its best to enable this flag.
|
||||
// This is useful when no `tsconfig.json` is supplied.
|
||||
if (config.options.esModuleInterop === undefined) {
|
||||
config.options.esModuleInterop = true;
|
||||
}
|
||||
|
||||
// Target CommonJS, always!
|
||||
config.options.module = ts.ModuleKind.CommonJS;
|
||||
|
||||
|
||||
@@ -3,13 +3,15 @@ import { parse } from 'url';
|
||||
|
||||
const func = (req: IncomingMessage, res: ServerResponse) => {
|
||||
if (req.url) {
|
||||
const url = parse(req.url);
|
||||
const { pathname, search } = parse(req.url);
|
||||
const location = pathname
|
||||
? pathname.replace(/\/+/g, '/') + (search ? search : '')
|
||||
: '/';
|
||||
/*
|
||||
res.writeHead(302, {
|
||||
Location: url.pathname
|
||||
? url.pathname.replace(/\/+/g, '/') + (url.search ? url.search : '')
|
||||
: '/',
|
||||
});
|
||||
res.end();
|
||||
Location: location
|
||||
});*/
|
||||
res.end(`double-redirect:RANDOMNESS_PLACEHOLDER:${location}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"mustContain": "root:RANDOMNESS_PLACEHOLDER"
|
||||
},
|
||||
{
|
||||
"path": "//",
|
||||
"path": "/pricing/",
|
||||
"mustContain": "trailing-redirect:RANDOMNESS_PLACEHOLDER"
|
||||
}
|
||||
]
|
||||
|
||||
8
packages/now-node/test/fixtures/19-default-import-ts/index.ts
vendored
Normal file
8
packages/now-node/test/fixtures/19-default-import-ts/index.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
//@ts-ignore test will compile during deployment
|
||||
import express from 'express';
|
||||
const router = express.Router();
|
||||
|
||||
export default function handler(req: any, res: any) {
|
||||
if (router && req) res.end('default-import:RANDOMNESS_PLACEHOLDER');
|
||||
else res.end('failed to fetch default import');
|
||||
}
|
||||
10
packages/now-node/test/fixtures/19-default-import-ts/now.json
vendored
Normal file
10
packages/now-node/test/fixtures/19-default-import-ts/now.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.ts", "use": "@now/node" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "default-import:RANDOMNESS_PLACEHOLDER"
|
||||
}
|
||||
]
|
||||
}
|
||||
6
packages/now-node/test/fixtures/19-default-import-ts/package.json
vendored
Normal file
6
packages/now-node/test/fixtures/19-default-import-ts/package.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@types/express": "4.17.0",
|
||||
"express": "4.17.1"
|
||||
}
|
||||
}
|
||||
11
packages/now-node/test/fixtures/20-mixed-modules/entrypoint.js
vendored
Normal file
11
packages/now-node/test/fixtures/20-mixed-modules/entrypoint.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { dep1 } from './js/ecmascript-module';
|
||||
|
||||
const { dep2 } = require('./js/commonjs-module');
|
||||
|
||||
module.exports = (req, res) => {
|
||||
if (req && typeof dep1 === 'string' && typeof dep2 === 'string') {
|
||||
res.end('mixed-modules:js:RANDOMNESS_PLACEHOLDER');
|
||||
} else {
|
||||
res.end('import failed');
|
||||
}
|
||||
};
|
||||
11
packages/now-node/test/fixtures/20-mixed-modules/entrypoint.ts
vendored
Normal file
11
packages/now-node/test/fixtures/20-mixed-modules/entrypoint.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
import { dep1 } from './ts/ecmascript-module';
|
||||
const { dep2 } = require('./ts/commonjs-module');
|
||||
|
||||
module.exports = (req: IncomingMessage, res: ServerResponse) => {
|
||||
if (req && typeof dep1 === 'string' && typeof dep2 === 'string') {
|
||||
res.end('mixed-modules:ts:RANDOMNESS_PLACEHOLDER');
|
||||
} else {
|
||||
res.end('import failed');
|
||||
}
|
||||
};
|
||||
1
packages/now-node/test/fixtures/20-mixed-modules/js/commonjs-module.js
vendored
Normal file
1
packages/now-node/test/fixtures/20-mixed-modules/js/commonjs-module.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { dep2: 'dep2' };
|
||||
2
packages/now-node/test/fixtures/20-mixed-modules/js/ecmascript-module.js
vendored
Normal file
2
packages/now-node/test/fixtures/20-mixed-modules/js/ecmascript-module.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const dep1 = 'dep1';
|
||||
export const another = 'another';
|
||||
5
packages/now-node/test/fixtures/20-mixed-modules/js/package.json
vendored
Normal file
5
packages/now-node/test/fixtures/20-mixed-modules/js/package.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"engines": {
|
||||
"node": "10.x"
|
||||
}
|
||||
}
|
||||
14
packages/now-node/test/fixtures/20-mixed-modules/now.json
vendored
Normal file
14
packages/now-node/test/fixtures/20-mixed-modules/now.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "entrypoint**", "use": "@now/node" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/entrypoint.js",
|
||||
"mustContain": "mixed-modules:js:RANDOMNESS_PLACEHOLDER"
|
||||
},
|
||||
{
|
||||
"path": "/entrypoint.ts",
|
||||
"mustContain": "mixed-modules:ts:RANDOMNESS_PLACEHOLDER"
|
||||
}
|
||||
]
|
||||
}
|
||||
1
packages/now-node/test/fixtures/20-mixed-modules/ts/commonjs-module.ts
vendored
Normal file
1
packages/now-node/test/fixtures/20-mixed-modules/ts/commonjs-module.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { dep2: 'dep2' };
|
||||
1
packages/now-node/test/fixtures/20-mixed-modules/ts/ecmascript-module.ts
vendored
Normal file
1
packages/now-node/test/fixtures/20-mixed-modules/ts/ecmascript-module.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const dep1 = 'dep1';
|
||||
5
packages/now-node/test/fixtures/20-mixed-modules/ts/package.json
vendored
Normal file
5
packages/now-node/test/fixtures/20-mixed-modules/ts/package.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"engines": {
|
||||
"node": "10.x"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@builders-typescript-test/lib",
|
||||
"main": "index.ts",
|
||||
"main": "src/index",
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.4.5"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["./**/*.ts"]
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
||||
4
packages/now-static-build/build.sh
Executable file
4
packages/now-static-build/build.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
ncc build src/index.ts -o dist
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/static-build",
|
||||
"version": "0.7.3",
|
||||
"version": "0.9.2",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build",
|
||||
@@ -13,17 +13,15 @@
|
||||
"directory": "packages/now-static-build"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "tsc && jest",
|
||||
"prepublishOnly": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-spawn": "6.0.5",
|
||||
"get-port": "5.0.0",
|
||||
"promise-timeout": "1.3.0"
|
||||
"build": "./build.sh",
|
||||
"test": "./build.sh && jest",
|
||||
"prepublishOnly": "./build.sh"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/promise-timeout": "1.3.0",
|
||||
"cross-spawn": "6.0.5",
|
||||
"get-port": "5.0.0",
|
||||
"promise-timeout": "1.3.0",
|
||||
"typescript": "3.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@ export default [
|
||||
dependency: 'hexo',
|
||||
getOutputDirName: async () => 'public',
|
||||
},
|
||||
{
|
||||
name: 'Docusaurus 2.0',
|
||||
dependency: '@docusaurus/core',
|
||||
getOutputDirName: async () => 'build',
|
||||
},
|
||||
{
|
||||
name: 'Preact',
|
||||
dependency: 'preact-cli',
|
||||
@@ -41,6 +46,20 @@ export default [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Ember',
|
||||
dependency: 'ember-cli',
|
||||
getOutputDirName: async () => 'dist',
|
||||
defaultRoutes: [
|
||||
{
|
||||
handle: 'filesystem',
|
||||
},
|
||||
{
|
||||
src: '/(.*)',
|
||||
dest: '/index.html',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Vue.js',
|
||||
dependency: '@vue/cli-service',
|
||||
@@ -193,7 +212,7 @@ export default [
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Docusaurus',
|
||||
name: 'Docusaurus 1.0',
|
||||
dependency: 'docusaurus',
|
||||
getOutputDirName: async (dirPrefix: string) => {
|
||||
const base = 'build';
|
||||
|
||||
@@ -38,39 +38,45 @@ interface Framework {
|
||||
minNodeRange?: string;
|
||||
}
|
||||
|
||||
function validateDistDir(distDir: string, isDev: boolean | undefined) {
|
||||
function validateDistDir(
|
||||
distDir: string,
|
||||
isDev: boolean | undefined,
|
||||
config: Config
|
||||
) {
|
||||
const distDirName = path.basename(distDir);
|
||||
const exists = () => existsSync(distDir);
|
||||
const isDirectory = () => statSync(distDir).isDirectory();
|
||||
const isEmpty = () => readdirSync(distDir).length === 0;
|
||||
|
||||
const hash = isDev
|
||||
? '#local-development'
|
||||
: '#configuring-the-build-output-directory';
|
||||
const docsUrl = `https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build${hash}`;
|
||||
const distDirName = path.basename(distDir);
|
||||
if (!existsSync(distDir)) {
|
||||
const message =
|
||||
`Build was unable to create the distDir: "${distDirName}".` +
|
||||
`\nMake sure you configure the the correct distDir: ${docsUrl}`;
|
||||
throw new Error(message);
|
||||
}
|
||||
const stat = statSync(distDir);
|
||||
if (!stat.isDirectory()) {
|
||||
const message =
|
||||
`Build failed because distDir is not a directory: "${distDirName}".` +
|
||||
`\nMake sure you configure the the correct distDir: ${docsUrl}`;
|
||||
throw new Error(message);
|
||||
|
||||
const info = config.zeroConfig
|
||||
? '\nMore details: https://zeit.co/docs/v2/advanced/platform/frequently-asked-questions#missing-public-directory'
|
||||
: `\nMake sure you configure the the correct distDir: ${docsUrl}`;
|
||||
|
||||
if (!exists()) {
|
||||
throw new Error(`No output directory named "${distDirName}" found.${info}`);
|
||||
}
|
||||
|
||||
const contents = readdirSync(distDir);
|
||||
if (contents.length === 0) {
|
||||
const message =
|
||||
`Build failed because distDir is empty: "${distDirName}".` +
|
||||
`\nMake sure you configure the the correct distDir: ${docsUrl}`;
|
||||
throw new Error(message);
|
||||
if (!isDirectory()) {
|
||||
throw new Error(
|
||||
`Build failed because distDir is not a directory: "${distDirName}".${info}`
|
||||
);
|
||||
}
|
||||
|
||||
if (isEmpty()) {
|
||||
throw new Error(
|
||||
`Build failed because distDir is empty: "${distDirName}".${info}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getCommand(pkg: PackageJson, cmd: string, config: Config) {
|
||||
function getCommand(pkg: PackageJson, cmd: string, { zeroConfig }: Config) {
|
||||
// The `dev` script can be `now dev`
|
||||
const nowCmd = `now-${cmd}`;
|
||||
const { zeroConfig } = config;
|
||||
|
||||
if (!zeroConfig && cmd === 'dev') {
|
||||
return nowCmd;
|
||||
@@ -86,7 +92,7 @@ function getCommand(pkg: PackageJson, cmd: string, config: Config) {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
return nowCmd;
|
||||
return zeroConfig ? cmd : nowCmd;
|
||||
}
|
||||
|
||||
export const version = 2;
|
||||
@@ -139,6 +145,9 @@ export async function build({
|
||||
const devScript = getCommand(pkg, 'dev', config as Config);
|
||||
|
||||
if (config.zeroConfig) {
|
||||
// `public` is the default for zero config
|
||||
distPath = path.join(workPath, path.dirname(entrypoint), 'public');
|
||||
|
||||
const dependencies = Object.assign(
|
||||
{},
|
||||
pkg.dependencies,
|
||||
@@ -291,7 +300,7 @@ export async function build({
|
||||
distPath = path.join(outputDirPrefix, outputDirName);
|
||||
}
|
||||
|
||||
validateDistDir(distPath, meta.isDev);
|
||||
validateDistDir(distPath, meta.isDev, config);
|
||||
output = await glob('**', distPath, mountpoint);
|
||||
|
||||
if (framework && framework.defaultRoutes) {
|
||||
@@ -308,7 +317,7 @@ export async function build({
|
||||
const nodeVersion = await getNodeVersion(entrypointDir);
|
||||
const spawnOpts = getSpawnOptions(meta, nodeVersion);
|
||||
await runShellScript(path.join(workPath, entrypoint), [], spawnOpts);
|
||||
validateDistDir(distPath, meta.isDev);
|
||||
validateDistDir(distPath, meta.isDev, config);
|
||||
|
||||
return glob('**', distPath, mountpoint);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
"cowsay": "^1.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "mkdir dist && cowsay cow:RANDOMNESS_PLACEHOLDER > dist/index.txt"
|
||||
"build": "mkdir public && cowsay cow:RANDOMNESS_PLACEHOLDER > public/index.txt"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
"yodasay": "^1.1.6"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "mkdir dist && yodasay yoda:RANDOMNESS_PLACEHOLDER > dist/index.txt"
|
||||
"build": "mkdir public && yodasay yoda:RANDOMNESS_PLACEHOLDER > public/index.txt"
|
||||
}
|
||||
}
|
||||
|
||||
20
packages/now-static-build/test/fixtures/20-ember/.editorconfig
vendored
Normal file
20
packages/now-static-build/test/fixtures/20-ember/.editorconfig
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.hbs]
|
||||
insert_final_newline = false
|
||||
|
||||
[*.{diff,md}]
|
||||
trim_trailing_whitespace = false
|
||||
9
packages/now-static-build/test/fixtures/20-ember/.ember-cli
vendored
Normal file
9
packages/now-static-build/test/fixtures/20-ember/.ember-cli
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
/**
|
||||
Ember CLI sends analytics information by default. The data is completely
|
||||
anonymous, but there are times when you might want to disable this behavior.
|
||||
|
||||
Setting `disableAnalytics` to true will prevent any data from being sent.
|
||||
*/
|
||||
"disableAnalytics": false
|
||||
}
|
||||
20
packages/now-static-build/test/fixtures/20-ember/.eslintignore
vendored
Normal file
20
packages/now-static-build/test/fixtures/20-ember/.eslintignore
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# unconventional js
|
||||
/blueprints/*/files/
|
||||
/vendor/
|
||||
|
||||
# compiled output
|
||||
/dist/
|
||||
/tmp/
|
||||
|
||||
# dependencies
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
|
||||
# misc
|
||||
/coverage/
|
||||
!.*
|
||||
|
||||
# ember-try
|
||||
/.node_modules.ember-try/
|
||||
/bower.json.ember-try
|
||||
/package.json.ember-try
|
||||
47
packages/now-static-build/test/fixtures/20-ember/.eslintrc.js
vendored
Normal file
47
packages/now-static-build/test/fixtures/20-ember/.eslintrc.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['ember'],
|
||||
extends: ['eslint:recommended', 'plugin:ember/recommended'],
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
rules: {},
|
||||
overrides: [
|
||||
// node files
|
||||
{
|
||||
files: [
|
||||
'.eslintrc.js',
|
||||
'.template-lintrc.js',
|
||||
'ember-cli-build.js',
|
||||
'testem.js',
|
||||
'blueprints/*/index.js',
|
||||
'config/**/*.js',
|
||||
'lib/*/index.js',
|
||||
'server/**/*.js',
|
||||
],
|
||||
parserOptions: {
|
||||
sourceType: 'script',
|
||||
},
|
||||
env: {
|
||||
browser: false,
|
||||
node: true,
|
||||
},
|
||||
plugins: ['node'],
|
||||
rules: Object.assign(
|
||||
{},
|
||||
require('eslint-plugin-node').configs.recommended.rules,
|
||||
{
|
||||
// add your custom rules and overrides for node files here
|
||||
|
||||
// this can be removed once the following is fixed
|
||||
// https://github.com/mysticatea/eslint-plugin-node/issues/77
|
||||
'node/no-unpublished-require': 'off',
|
||||
}
|
||||
),
|
||||
},
|
||||
],
|
||||
};
|
||||
25
packages/now-static-build/test/fixtures/20-ember/.gitignore
vendored
Normal file
25
packages/now-static-build/test/fixtures/20-ember/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/dist/
|
||||
/tmp/
|
||||
|
||||
# dependencies
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
|
||||
# misc
|
||||
/.env*
|
||||
/.pnp*
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage/
|
||||
/libpeerconnection.log
|
||||
/npm-debug.log*
|
||||
/testem.log
|
||||
/yarn-error.log
|
||||
|
||||
# ember-try
|
||||
/.node_modules.ember-try/
|
||||
/bower.json.ember-try
|
||||
/package.json.ember-try
|
||||
5
packages/now-static-build/test/fixtures/20-ember/.template-lintrc.js
vendored
Normal file
5
packages/now-static-build/test/fixtures/20-ember/.template-lintrc.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
extends: 'recommended',
|
||||
};
|
||||
24
packages/now-static-build/test/fixtures/20-ember/.travis.yml
vendored
Normal file
24
packages/now-static-build/test/fixtures/20-ember/.travis.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
language: node_js
|
||||
node_js:
|
||||
- "8"
|
||||
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
addons:
|
||||
chrome: stable
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.npm
|
||||
|
||||
env:
|
||||
global:
|
||||
# See https://git.io/vdao3 for details.
|
||||
- JOBS=1
|
||||
|
||||
script:
|
||||
- npm run lint:hbs
|
||||
- npm run lint:js
|
||||
- npm test
|
||||
3
packages/now-static-build/test/fixtures/20-ember/.watchmanconfig
vendored
Normal file
3
packages/now-static-build/test/fixtures/20-ember/.watchmanconfig
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ignore_dirs": ["tmp", "dist"]
|
||||
}
|
||||
57
packages/now-static-build/test/fixtures/20-ember/README.md
vendored
Normal file
57
packages/now-static-build/test/fixtures/20-ember/README.md
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# site
|
||||
|
||||
This README outlines the details of collaborating on this Ember application.
|
||||
A short introduction of this app could easily go here.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You will need the following things properly installed on your computer.
|
||||
|
||||
- [Git](https://git-scm.com/)
|
||||
- [Node.js](https://nodejs.org/) (with npm)
|
||||
- [Ember CLI](https://ember-cli.com/)
|
||||
- [Google Chrome](https://google.com/chrome/)
|
||||
|
||||
## Installation
|
||||
|
||||
- `git clone <repository-url>` this repository
|
||||
- `cd site`
|
||||
- `npm install`
|
||||
|
||||
## Running / Development
|
||||
|
||||
- `ember serve`
|
||||
- Visit your app at [http://localhost:4200](http://localhost:4200).
|
||||
- Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).
|
||||
|
||||
### Code Generators
|
||||
|
||||
Make use of the many generators for code, try `ember help generate` for more details
|
||||
|
||||
### Running Tests
|
||||
|
||||
- `ember test`
|
||||
- `ember test --server`
|
||||
|
||||
### Linting
|
||||
|
||||
- `npm run lint:hbs`
|
||||
- `npm run lint:js`
|
||||
- `npm run lint:js -- --fix`
|
||||
|
||||
### Building
|
||||
|
||||
- `ember build` (development)
|
||||
- `ember build --environment production` (production)
|
||||
|
||||
### Deploying
|
||||
|
||||
Specify what it takes to deploy your app.
|
||||
|
||||
## Further Reading / Useful Links
|
||||
|
||||
- [ember.js](https://emberjs.com/)
|
||||
- [ember-cli](https://ember-cli.com/)
|
||||
- Development Browser Extensions
|
||||
- [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
|
||||
- [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
|
||||
14
packages/now-static-build/test/fixtures/20-ember/app/app.js
vendored
Normal file
14
packages/now-static-build/test/fixtures/20-ember/app/app.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import Application from '@ember/application';
|
||||
import Resolver from './resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from './config/environment';
|
||||
|
||||
const App = Application.extend({
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix,
|
||||
Resolver,
|
||||
});
|
||||
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
|
||||
export default App;
|
||||
0
packages/now-static-build/test/fixtures/20-ember/app/components/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/components/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/controllers/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/controllers/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/helpers/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/helpers/.gitkeep
vendored
Normal file
25
packages/now-static-build/test/fixtures/20-ember/app/index.html
vendored
Normal file
25
packages/now-static-build/test/fixtures/20-ember/app/index.html
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Site</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{content-for "head"}}
|
||||
|
||||
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
||||
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/site.css">
|
||||
|
||||
{{content-for "head-footer"}}
|
||||
</head>
|
||||
<body>
|
||||
{{content-for "body"}}
|
||||
|
||||
<script src="{{rootURL}}assets/vendor.js"></script>
|
||||
<script src="{{rootURL}}assets/site.js"></script>
|
||||
|
||||
{{content-for "body-footer"}}
|
||||
</body>
|
||||
</html>
|
||||
0
packages/now-static-build/test/fixtures/20-ember/app/models/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/models/.gitkeep
vendored
Normal file
3
packages/now-static-build/test/fixtures/20-ember/app/resolver.js
vendored
Normal file
3
packages/now-static-build/test/fixtures/20-ember/app/resolver.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import Resolver from 'ember-resolver';
|
||||
|
||||
export default Resolver;
|
||||
11
packages/now-static-build/test/fixtures/20-ember/app/router.js
vendored
Normal file
11
packages/now-static-build/test/fixtures/20-ember/app/router.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import EmberRouter from '@ember/routing/router';
|
||||
import config from './config/environment';
|
||||
|
||||
const Router = EmberRouter.extend({
|
||||
location: config.locationType,
|
||||
rootURL: config.rootURL,
|
||||
});
|
||||
|
||||
Router.map(function() {});
|
||||
|
||||
export default Router;
|
||||
0
packages/now-static-build/test/fixtures/20-ember/app/routes/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/routes/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/styles/app.css
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/styles/app.css
vendored
Normal file
5
packages/now-static-build/test/fixtures/20-ember/app/templates/application.hbs
vendored
Normal file
5
packages/now-static-build/test/fixtures/20-ember/app/templates/application.hbs
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{{!-- The following component displays Ember's default welcome message. --}}
|
||||
<WelcomePage />
|
||||
{{!-- Feel free to remove this! --}}
|
||||
|
||||
{{outlet}}
|
||||
0
packages/now-static-build/test/fixtures/20-ember/app/templates/components/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/app/templates/components/.gitkeep
vendored
Normal file
51
packages/now-static-build/test/fixtures/20-ember/config/environment.js
vendored
Normal file
51
packages/now-static-build/test/fixtures/20-ember/config/environment.js
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function(environment) {
|
||||
let ENV = {
|
||||
modulePrefix: 'site',
|
||||
environment,
|
||||
rootURL: '/',
|
||||
locationType: 'auto',
|
||||
EmberENV: {
|
||||
FEATURES: {
|
||||
// Here you can enable experimental features on an ember canary build
|
||||
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
|
||||
},
|
||||
EXTEND_PROTOTYPES: {
|
||||
// Prevent Ember Data from overriding Date.parse.
|
||||
Date: false,
|
||||
},
|
||||
},
|
||||
|
||||
APP: {
|
||||
// Here you can pass flags/options to your application instance
|
||||
// when it is created
|
||||
},
|
||||
};
|
||||
|
||||
if (environment === 'development') {
|
||||
// ENV.APP.LOG_RESOLVER = true;
|
||||
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||
// ENV.APP.LOG_TRANSITIONS = true;
|
||||
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
||||
}
|
||||
|
||||
if (environment === 'test') {
|
||||
// Testem prefers this...
|
||||
ENV.locationType = 'none';
|
||||
|
||||
// keep test console output quieter
|
||||
ENV.APP.LOG_ACTIVE_GENERATION = false;
|
||||
ENV.APP.LOG_VIEW_LOOKUPS = false;
|
||||
|
||||
ENV.APP.rootElement = '#ember-testing';
|
||||
ENV.APP.autoboot = false;
|
||||
}
|
||||
|
||||
if (environment === 'production') {
|
||||
// here you can enable a production-specific feature
|
||||
}
|
||||
|
||||
return ENV;
|
||||
};
|
||||
3
packages/now-static-build/test/fixtures/20-ember/config/optional-features.json
vendored
Normal file
3
packages/now-static-build/test/fixtures/20-ember/config/optional-features.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"jquery-integration": true
|
||||
}
|
||||
18
packages/now-static-build/test/fixtures/20-ember/config/targets.js
vendored
Normal file
18
packages/now-static-build/test/fixtures/20-ember/config/targets.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
const browsers = [
|
||||
'last 1 Chrome versions',
|
||||
'last 1 Firefox versions',
|
||||
'last 1 Safari versions',
|
||||
];
|
||||
|
||||
const isCI = !!process.env.CI;
|
||||
const isProduction = process.env.EMBER_ENV === 'production';
|
||||
|
||||
if (isCI || isProduction) {
|
||||
browsers.push('ie 11');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
browsers,
|
||||
};
|
||||
24
packages/now-static-build/test/fixtures/20-ember/ember-cli-build.js
vendored
Normal file
24
packages/now-static-build/test/fixtures/20-ember/ember-cli-build.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||
|
||||
module.exports = function(defaults) {
|
||||
let app = new EmberApp(defaults, {
|
||||
// Add options here
|
||||
});
|
||||
|
||||
// Use `app.import` to add additional libraries to the generated
|
||||
// output files.
|
||||
//
|
||||
// If you need to use different assets in different
|
||||
// environments, specify an object as the first parameter. That
|
||||
// object's keys should be the environment name and the values
|
||||
// should be the asset to use in that environment.
|
||||
//
|
||||
// If the library that you are including contains AMD or ES6
|
||||
// modules that you would like to import into your application
|
||||
// please specify an object with the list of modules as keys
|
||||
// along with the exports of each module as its value.
|
||||
|
||||
return app.toTree();
|
||||
};
|
||||
14
packages/now-static-build/test/fixtures/20-ember/now.json
vendored
Normal file
14
packages/now-static-build/test/fixtures/20-ember/now.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{
|
||||
"src": "package.json",
|
||||
"use": "@now/static-build",
|
||||
"config": { "zeroConfig": true }
|
||||
}
|
||||
],
|
||||
"probes": [
|
||||
{ "path": "/", "mustContain": "Site" },
|
||||
{ "path": "/iudieufwunifiwwnuwfuw", "mustContain": "Site" }
|
||||
]
|
||||
}
|
||||
12603
packages/now-static-build/test/fixtures/20-ember/package-lock.json
generated
vendored
Normal file
12603
packages/now-static-build/test/fixtures/20-ember/package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
52
packages/now-static-build/test/fixtures/20-ember/package.json
vendored
Normal file
52
packages/now-static-build/test/fixtures/20-ember/package.json
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "site",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Small description for site goes here",
|
||||
"repository": "",
|
||||
"license": "MIT",
|
||||
"author": "",
|
||||
"directories": {
|
||||
"doc": "doc",
|
||||
"test": "tests"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "ember build -prod",
|
||||
"lint:hbs": "ember-template-lint .",
|
||||
"lint:js": "eslint .",
|
||||
"start": "ember serve",
|
||||
"test": "ember test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ember/jquery": "^0.6.0",
|
||||
"@ember/optional-features": "^0.7.0",
|
||||
"broccoli-asset-rev": "^3.0.0",
|
||||
"ember-ajax": "^5.0.0",
|
||||
"ember-cli": "~3.11.0",
|
||||
"ember-cli-app-version": "^3.2.0",
|
||||
"ember-cli-babel": "^7.7.3",
|
||||
"ember-cli-dependency-checker": "^3.1.0",
|
||||
"ember-cli-eslint": "^5.1.0",
|
||||
"ember-cli-htmlbars": "^3.0.1",
|
||||
"ember-cli-htmlbars-inline-precompile": "^2.1.0",
|
||||
"ember-cli-inject-live-reload": "^1.8.2",
|
||||
"ember-cli-sri": "^2.1.1",
|
||||
"ember-cli-template-lint": "^1.0.0-beta.1",
|
||||
"ember-cli-uglify": "^2.1.0",
|
||||
"ember-data": "~3.11.0",
|
||||
"ember-export-application-global": "^2.0.0",
|
||||
"ember-load-initializers": "^2.0.0",
|
||||
"ember-maybe-import-regenerator": "^0.1.6",
|
||||
"ember-qunit": "^4.4.1",
|
||||
"ember-resolver": "^5.0.1",
|
||||
"ember-source": "~3.11.1",
|
||||
"ember-welcome-page": "^4.0.0",
|
||||
"eslint-plugin-ember": "^6.2.0",
|
||||
"eslint-plugin-node": "^9.0.1",
|
||||
"loader.js": "^4.7.0",
|
||||
"qunit-dom": "^0.8.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "8.* || >= 10.*"
|
||||
}
|
||||
}
|
||||
3
packages/now-static-build/test/fixtures/20-ember/public/robots.txt
vendored
Normal file
3
packages/now-static-build/test/fixtures/20-ember/public/robots.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# http://www.robotstxt.org
|
||||
User-agent: *
|
||||
Disallow:
|
||||
21
packages/now-static-build/test/fixtures/20-ember/testem.js
vendored
Normal file
21
packages/now-static-build/test/fixtures/20-ember/testem.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
test_page: 'tests/index.html?hidepassed',
|
||||
disable_watching: true,
|
||||
launch_in_ci: ['Chrome'],
|
||||
launch_in_dev: ['Chrome'],
|
||||
browser_args: {
|
||||
Chrome: {
|
||||
ci: [
|
||||
// --no-sandbox is needed when running Chrome inside a container
|
||||
process.env.CI ? '--no-sandbox' : null,
|
||||
'--headless',
|
||||
'--disable-gpu',
|
||||
'--disable-dev-shm-usage',
|
||||
'--disable-software-rasterizer',
|
||||
'--mute-audio',
|
||||
'--remote-debugging-port=0',
|
||||
'--window-size=1440,900',
|
||||
].filter(Boolean),
|
||||
},
|
||||
},
|
||||
};
|
||||
0
packages/now-static-build/test/fixtures/20-ember/vendor/.gitkeep
vendored
Normal file
0
packages/now-static-build/test/fixtures/20-ember/vendor/.gitkeep
vendored
Normal file
2
packages/now-static-build/test/fixtures/21-docusaurus-1/.dockerignore
vendored
Executable file
2
packages/now-static-build/test/fixtures/21-docusaurus-1/.dockerignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
*/node_modules
|
||||
*.log
|
||||
12
packages/now-static-build/test/fixtures/21-docusaurus-1/.gitignore
vendored
Executable file
12
packages/now-static-build/test/fixtures/21-docusaurus-1/.gitignore
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
.DS_Store
|
||||
|
||||
node_modules
|
||||
|
||||
lib/core/metadata.js
|
||||
lib/core/MetadataBlog.js
|
||||
|
||||
website/translated_docs
|
||||
website/build/
|
||||
website/yarn.lock
|
||||
website/node_modules
|
||||
website/i18n/*
|
||||
10
packages/now-static-build/test/fixtures/21-docusaurus-1/Dockerfile
vendored
Executable file
10
packages/now-static-build/test/fixtures/21-docusaurus-1/Dockerfile
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
FROM node:8.11.4
|
||||
|
||||
WORKDIR /app/website
|
||||
|
||||
EXPOSE 3000 35729
|
||||
COPY ./docs /app/docs
|
||||
COPY ./website /app/website
|
||||
RUN yarn install
|
||||
|
||||
CMD ["yarn", "start"]
|
||||
18
packages/now-static-build/test/fixtures/21-docusaurus-1/docker-compose.yml
vendored
Executable file
18
packages/now-static-build/test/fixtures/21-docusaurus-1/docker-compose.yml
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
docusaurus:
|
||||
build: .
|
||||
ports:
|
||||
- 3000:3000
|
||||
- 35729:35729
|
||||
volumes:
|
||||
- ./docs:/app/docs
|
||||
- ./website/blog:/app/website/blog
|
||||
- ./website/core:/app/website/core
|
||||
- ./website/i18n:/app/website/i18n
|
||||
- ./website/pages:/app/website/pages
|
||||
- ./website/static:/app/website/static
|
||||
- ./website/sidebars.json:/app/website/sidebars.json
|
||||
- ./website/siteConfig.js:/app/website/siteConfig.js
|
||||
working_dir: /app/website
|
||||
29
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/doc1.md
vendored
Executable file
29
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/doc1.md
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
id: doc1
|
||||
title: Latin-ish
|
||||
sidebar_label: Example Page
|
||||
---
|
||||
|
||||
Check the [documentation](https://docusaurus.io) for how to use Docusaurus.
|
||||
|
||||
## Lorem
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus elementum massa eget nulla aliquet sagittis. Proin odio tortor, vulputate ut odio in, ultrices ultricies augue. Cras ornare ultrices lorem malesuada iaculis. Etiam sit amet libero tempor, pulvinar mauris sed, sollicitudin sapien.
|
||||
|
||||
## Mauris In Code
|
||||
|
||||
```
|
||||
Mauris vestibulum ullamcorper nibh, ut semper purus pulvinar ut. Donec volutpat orci sit amet mauris malesuada, non pulvinar augue aliquam. Vestibulum ultricies at urna ut suscipit. Morbi iaculis, erat at imperdiet semper, ipsum nulla sodales erat, eget tincidunt justo dui quis justo. Pellentesque dictum bibendum diam at aliquet. Sed pulvinar, dolor quis finibus ornare, eros odio facilisis erat, eu rhoncus nunc dui sed ex. Nunc gravida dui massa, sed ornare arcu tincidunt sit amet. Maecenas efficitur sapien neque, a laoreet libero feugiat ut.
|
||||
```
|
||||
|
||||
## Nulla
|
||||
|
||||
Nulla facilisi. Maecenas sodales nec purus eget posuere. Sed sapien quam, pretium a risus in, porttitor dapibus erat. Sed sit amet fringilla ipsum, eget iaculis augue. Integer sollicitudin tortor quis ultricies aliquam. Suspendisse fringilla nunc in tellus cursus, at placerat tellus scelerisque. Sed tempus elit a sollicitudin rhoncus. Nulla facilisi. Morbi nec dolor dolor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras et aliquet lectus. Pellentesque sit amet eros nisi. Quisque ac sapien in sapien congue accumsan. Nullam in posuere ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin lacinia leo a nibh fringilla pharetra.
|
||||
|
||||
## Orci
|
||||
|
||||
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin venenatis lectus dui, vel ultrices ante bibendum hendrerit. Aenean egestas feugiat dui id hendrerit. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur in tellus laoreet, eleifend nunc id, viverra leo. Proin vulputate non dolor vel vulputate. Curabitur pretium lobortis felis, sit amet finibus lorem suscipit ut. Sed non mollis risus. Duis sagittis, mi in euismod tincidunt, nunc mauris vestibulum urna, at euismod est elit quis erat. Phasellus accumsan vitae neque eu placerat. In elementum arcu nec tellus imperdiet, eget maximus nulla sodales. Curabitur eu sapien eget nisl sodales fermentum.
|
||||
|
||||
## Phasellus
|
||||
|
||||
Phasellus pulvinar ex id commodo imperdiet. Praesent odio nibh, sollicitudin sit amet faucibus id, placerat at metus. Donec vitae eros vitae tortor hendrerit finibus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque vitae purus dolor. Duis suscipit ac nulla et finibus. Phasellus ac sem sed dui dictum gravida. Phasellus eleifend vestibulum facilisis. Integer pharetra nec enim vitae mattis. Duis auctor, lectus quis condimentum bibendum, nunc dolor aliquam massa, id bibendum orci velit quis magna. Ut volutpat nulla nunc, sed interdum magna condimentum non. Sed urna metus, scelerisque vitae consectetur a, feugiat quis magna. Donec dignissim ornare nisl, eget tempor risus malesuada quis.
|
||||
7
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/doc2.md
vendored
Executable file
7
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/doc2.md
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
id: doc2
|
||||
title: document number 2
|
||||
---
|
||||
|
||||
This is a link to [another document.](doc3.md)
|
||||
This is a link to an [external page.](http://www.example.com)
|
||||
14
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/doc3.md
vendored
Executable file
14
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/doc3.md
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
id: doc3
|
||||
title: This is document number 3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac euismod odio, eu consequat dui. Nullam molestie consectetur risus id imperdiet. Proin sodales ornare turpis, non mollis massa ultricies id. Nam at nibh scelerisque, feugiat ante non, dapibus tortor. Vivamus volutpat diam quis tellus elementum bibendum. Praesent semper gravida velit quis aliquam. Etiam in cursus neque. Nam lectus ligula, malesuada et mauris a, bibendum faucibus mi. Phasellus ut interdum felis. Phasellus in odio pulvinar, porttitor urna eget, fringilla lectus. Aliquam sollicitudin est eros. Mauris consectetur quam vitae mauris interdum hendrerit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
|
||||
Duis et egestas libero, imperdiet faucibus ipsum. Sed posuere eget urna vel feugiat. Vivamus a arcu sagittis, fermentum urna dapibus, congue lectus. Fusce vulputate porttitor nisl, ac cursus elit volutpat vitae. Nullam vitae ipsum egestas, convallis quam non, porta nibh. Morbi gravida erat nec neque bibendum, eu pellentesque velit posuere. Fusce aliquam erat eu massa eleifend tristique.
|
||||
|
||||
Sed consequat sollicitudin ipsum eget tempus. Integer a aliquet velit. In justo nibh, pellentesque non suscipit eget, gravida vel lacus. Donec odio ante, malesuada in massa quis, pharetra tristique ligula. Donec eros est, tristique eget finibus quis, semper non nisl. Vivamus et elit nec enim ornare placerat. Sed posuere odio a elit cursus sagittis.
|
||||
|
||||
Phasellus feugiat purus eu tortor ultrices finibus. Ut libero nibh, lobortis et libero nec, dapibus posuere eros. Sed sagittis euismod justo at consectetur. Nulla finibus libero placerat, cursus sapien at, eleifend ligula. Vivamus elit nisl, hendrerit ac nibh eu, ultrices tempus dui. Nam tellus neque, commodo non rhoncus eu, gravida in risus. Nullam id iaculis tortor.
|
||||
|
||||
Nullam at odio in sem varius tempor sit amet vel lorem. Etiam eu hendrerit nisl. Fusce nibh mauris, vulputate sit amet ex vitae, congue rhoncus nisl. Sed eget tellus purus. Nullam tempus commodo erat ut tristique. Cras accumsan massa sit amet justo consequat eleifend. Integer scelerisque vitae tellus id consectetur.
|
||||
6
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/exampledoc4.md
vendored
Executable file
6
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/exampledoc4.md
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
id: doc4
|
||||
title: Other Document
|
||||
---
|
||||
|
||||
this is another document
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user