mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-27 03:39:11 +00:00
Compare commits
35 Commits
@now/stati
...
@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 |
@@ -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",
|
||||
|
||||
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.9.0",
|
||||
"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,7 +1,7 @@
|
||||
import { PackageJson, Builder, Config } from './types';
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
interface Warning {
|
||||
interface ErrorResponse {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
@@ -12,11 +12,12 @@ 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@canary', config },
|
||||
{ src: 'api/**/*.ts', use: '@now/node@canary', config },
|
||||
{ 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 },
|
||||
@@ -25,10 +26,11 @@ const API_BUILDERS: Builder[] = [
|
||||
{ src: 'api/**/*.sh', use: '@now/bash', config },
|
||||
];
|
||||
|
||||
const MISSING_BUILD_SCRIPT_WARNING: Warning = {
|
||||
const MISSING_BUILD_SCRIPT_ERROR: ErrorResponse = {
|
||||
code: 'missing_build_script',
|
||||
message:
|
||||
'Your `package.json` file is missing a `build` property inside the `script` property',
|
||||
'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[]) {
|
||||
@@ -102,36 +104,38 @@ export async function detectBuilders(
|
||||
pkg?: PackageJson | undefined | null
|
||||
): Promise<{
|
||||
builders: Builder[] | null;
|
||||
warnings: Warning[] | null;
|
||||
errors: ErrorResponse[] | null;
|
||||
}> {
|
||||
const warnings: Warning[] = [];
|
||||
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 (builders.length > 0) {
|
||||
// We only want to match this if there
|
||||
// are already builds for `api`, since
|
||||
// we'd add builds even though we shouldn't otherwise
|
||||
|
||||
if (pkg) {
|
||||
warnings.push(MISSING_BUILD_SCRIPT_WARNING);
|
||||
} 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 {
|
||||
} 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,
|
||||
@@ -143,6 +147,6 @@ export async function detectBuilders(
|
||||
|
||||
return {
|
||||
builders: builders.length ? builders : null,
|
||||
warnings: warnings.length ? warnings : null,
|
||||
errors: errors.length ? errors : null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import streamToBuffer from './fs/stream-to-buffer';
|
||||
import shouldServe from './should-serve';
|
||||
import { detectBuilders } from './detect-builders';
|
||||
import { detectRoutes } from './detect-routes';
|
||||
import debug from './debug';
|
||||
|
||||
export {
|
||||
FileBlob,
|
||||
@@ -40,6 +41,7 @@ export {
|
||||
shouldServe,
|
||||
detectBuilders,
|
||||
detectRoutes,
|
||||
debug,
|
||||
};
|
||||
|
||||
export * from './types';
|
||||
|
||||
@@ -23,6 +23,8 @@ export interface Route {
|
||||
headers?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
continue?: boolean;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
|
||||
@@ -135,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) {
|
||||
@@ -147,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,10 +165,10 @@ it('Test `detectBuilders`', async () => {
|
||||
{
|
||||
// package.json + no build
|
||||
const pkg = { dependencies: { next: '9.0.0' } };
|
||||
const files = ['package.json', 'pages/index.js'];
|
||||
const { builders, warnings } = await detectBuilders(files, pkg);
|
||||
const files = ['package.json', 'pages/index.js', 'public/index.html'];
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders).toBe(null);
|
||||
expect(warnings).toBe(null);
|
||||
expect(errors.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -178,9 +178,9 @@ it('Test `detectBuilders`', async () => {
|
||||
dependencies: { next: '9.0.0' },
|
||||
};
|
||||
const files = ['package.json', 'pages/index.js'];
|
||||
const { builders, warnings } = await detectBuilders(files, pkg);
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/next');
|
||||
expect(warnings).toBe(null);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -190,60 +190,60 @@ it('Test `detectBuilders`', async () => {
|
||||
devDependencies: { next: '9.0.0' },
|
||||
};
|
||||
const files = ['package.json', 'pages/index.js'];
|
||||
const { builders, warnings } = await detectBuilders(files, pkg);
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/next');
|
||||
expect(warnings).toBe(null);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// package.json + no build
|
||||
const pkg = {};
|
||||
const files = ['package.json'];
|
||||
const { builders, warnings } = await detectBuilders(files, pkg);
|
||||
const { builders, errors } = await detectBuilders(files, pkg);
|
||||
expect(builders).toBe(null);
|
||||
expect(warnings).toBe(null);
|
||||
expect(errors.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
// no package.json + public
|
||||
const files = ['public/index.html'];
|
||||
const { builders, warnings } = await detectBuilders(files);
|
||||
// static file
|
||||
const files = ['index.html'];
|
||||
const { builders, errors } = await detectBuilders(files);
|
||||
expect(builders).toBe(null);
|
||||
expect(warnings).toBe(null);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// no package.json + public
|
||||
const files = ['api/users.js', 'public/index.html'];
|
||||
const { builders, warnings } = await detectBuilders(files);
|
||||
const { builders, errors } = await detectBuilders(files);
|
||||
expect(builders[1].use).toBe('@now/static');
|
||||
expect(warnings).toBe(null);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// no package.json + no build + raw static + api
|
||||
const files = ['api/users.js', 'index.html'];
|
||||
const { builders, warnings } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
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(warnings).toBe(null);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
// package.json + no build + root + api
|
||||
const files = ['index.html', 'api/[endpoint].js', 'static/image.png'];
|
||||
const { builders, warnings } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
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(warnings).toBe(null);
|
||||
expect(errors).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -255,7 +255,7 @@ it('Test `detectBuilders`', async () => {
|
||||
];
|
||||
|
||||
const { builders } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].src).toBe('api/[endpoint]/[id].js');
|
||||
expect(builders.length).toBe(1);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ it('Test `detectBuilders`', async () => {
|
||||
const files = ['package.json', 'api/endpoint.js', 'public/index.html'];
|
||||
|
||||
const { builders } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
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');
|
||||
@@ -285,7 +285,7 @@ it('Test `detectBuilders`', async () => {
|
||||
const files = ['package.json', 'api/endpoint.js', 'index.html'];
|
||||
|
||||
const { builders } = await detectBuilders(files, pkg);
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
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');
|
||||
@@ -297,7 +297,7 @@ it('Test `detectBuilders`', async () => {
|
||||
const files = ['api/endpoint.js', 'index.html', 'favicon.ico'];
|
||||
|
||||
const { builders } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
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');
|
||||
@@ -316,13 +316,22 @@ it('Test `detectBuilders`', async () => {
|
||||
];
|
||||
|
||||
const { builders } = await detectBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
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 = {
|
||||
@@ -336,6 +345,58 @@ it('Test `detectBuilders`', async () => {
|
||||
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 `detectRoutes`', async () => {
|
||||
|
||||
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.4",
|
||||
"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;
|
||||
@@ -294,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) {
|
||||
@@ -311,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);
|
||||
}
|
||||
|
||||
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
|
||||
6
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/exampledoc5.md
vendored
Executable file
6
packages/now-static-build/test/fixtures/21-docusaurus-1/docs/exampledoc5.md
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
id: doc5
|
||||
title: Fifth Document
|
||||
---
|
||||
|
||||
Another one
|
||||
20
packages/now-static-build/test/fixtures/21-docusaurus-1/now.json
vendored
Normal file
20
packages/now-static-build/test/fixtures/21-docusaurus-1/now.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{
|
||||
"src": "./website/package.json",
|
||||
"use": "@now/static-build",
|
||||
"config": { "zeroConfig": true }
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"src": "/(.*)",
|
||||
"dest": "/website/$1"
|
||||
}
|
||||
],
|
||||
"probes": [
|
||||
{ "path": "/", "mustContain": "A website for testing" },
|
||||
{ "path": "/docs/doc1", "mustContain": "Latin-ish" }
|
||||
]
|
||||
}
|
||||
198
packages/now-static-build/test/fixtures/21-docusaurus-1/website/README.md
vendored
Executable file
198
packages/now-static-build/test/fixtures/21-docusaurus-1/website/README.md
vendored
Executable file
@@ -0,0 +1,198 @@
|
||||
This website was created with [Docusaurus](https://docusaurus.io/).
|
||||
|
||||
# What's In This Document
|
||||
|
||||
- [Get Started in 5 Minutes](#get-started-in-5-minutes)
|
||||
- [Directory Structure](#directory-structure)
|
||||
- [Editing Content](#editing-content)
|
||||
- [Adding Content](#adding-content)
|
||||
- [Full Documentation](#full-documentation)
|
||||
|
||||
# Get Started in 5 Minutes
|
||||
|
||||
1. Make sure all the dependencies for the website are installed:
|
||||
|
||||
```sh
|
||||
# Install dependencies
|
||||
$ yarn
|
||||
```
|
||||
|
||||
2. Run your dev server:
|
||||
|
||||
```sh
|
||||
# Start the site
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
Your project file structure should look something like this
|
||||
|
||||
```
|
||||
my-docusaurus/
|
||||
docs/
|
||||
doc-1.md
|
||||
doc-2.md
|
||||
doc-3.md
|
||||
website/
|
||||
blog/
|
||||
2016-3-11-oldest-post.md
|
||||
2017-10-24-newest-post.md
|
||||
core/
|
||||
node_modules/
|
||||
pages/
|
||||
static/
|
||||
css/
|
||||
img/
|
||||
package.json
|
||||
sidebar.json
|
||||
siteConfig.js
|
||||
```
|
||||
|
||||
# Editing Content
|
||||
|
||||
## Editing an existing docs page
|
||||
|
||||
Edit docs by navigating to `docs/` and editing the corresponding document:
|
||||
|
||||
`docs/doc-to-be-edited.md`
|
||||
|
||||
```markdown
|
||||
---
|
||||
id: page-needs-edit
|
||||
title: This Doc Needs To Be Edited
|
||||
---
|
||||
|
||||
Edit me...
|
||||
```
|
||||
|
||||
For more information about docs, click [here](https://docusaurus.io/docs/en/navigation)
|
||||
|
||||
## Editing an existing blog post
|
||||
|
||||
Edit blog posts by navigating to `website/blog` and editing the corresponding post:
|
||||
|
||||
`website/blog/post-to-be-edited.md`
|
||||
|
||||
```markdown
|
||||
---
|
||||
id: post-needs-edit
|
||||
title: This Blog Post Needs To Be Edited
|
||||
---
|
||||
|
||||
Edit me...
|
||||
```
|
||||
|
||||
For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog)
|
||||
|
||||
# Adding Content
|
||||
|
||||
## Adding a new docs page to an existing sidebar
|
||||
|
||||
1. Create the doc as a new markdown file in `/docs`, example `docs/newly-created-doc.md`:
|
||||
|
||||
```md
|
||||
---
|
||||
id: newly-created-doc
|
||||
title: This Doc Needs To Be Edited
|
||||
---
|
||||
|
||||
My new content here..
|
||||
```
|
||||
|
||||
1. Refer to that doc's ID in an existing sidebar in `website/sidebar.json`:
|
||||
|
||||
```javascript
|
||||
// Add newly-created-doc to the Getting Started category of docs
|
||||
{
|
||||
"docs": {
|
||||
"Getting Started": [
|
||||
"quick-start",
|
||||
"newly-created-doc" // new doc here
|
||||
],
|
||||
...
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
For more information about adding new docs, click [here](https://docusaurus.io/docs/en/navigation)
|
||||
|
||||
## Adding a new blog post
|
||||
|
||||
1. Make sure there is a header link to your blog in `website/siteConfig.js`:
|
||||
|
||||
`website/siteConfig.js`
|
||||
|
||||
```javascript
|
||||
headerLinks: [
|
||||
...
|
||||
{ blog: true, label: 'Blog' },
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
2. Create the blog post with the format `YYYY-MM-DD-My-Blog-Post-Title.md` in `website/blog`:
|
||||
|
||||
`website/blog/2018-05-21-New-Blog-Post.md`
|
||||
|
||||
```markdown
|
||||
---
|
||||
author: Frank Li
|
||||
authorURL: https://twitter.com/foobarbaz
|
||||
authorFBID: 503283835
|
||||
title: New Blog Post
|
||||
---
|
||||
|
||||
Lorem Ipsum...
|
||||
```
|
||||
|
||||
For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog)
|
||||
|
||||
## Adding items to your site's top navigation bar
|
||||
|
||||
1. Add links to docs, custom pages or external links by editing the headerLinks field of `website/siteConfig.js`:
|
||||
|
||||
`website/siteConfig.js`
|
||||
|
||||
```javascript
|
||||
{
|
||||
headerLinks: [
|
||||
...
|
||||
/* you can add docs */
|
||||
{ doc: 'my-examples', label: 'Examples' },
|
||||
/* you can add custom pages */
|
||||
{ page: 'help', label: 'Help' },
|
||||
/* you can add external links */
|
||||
{ href: 'https://github.com/facebook/Docusaurus', label: 'GitHub' },
|
||||
...
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
For more information about the navigation bar, click [here](https://docusaurus.io/docs/en/navigation)
|
||||
|
||||
## Adding custom pages
|
||||
|
||||
1. Docusaurus uses React components to build pages. The components are saved as .js files in `website/pages/en`:
|
||||
1. If you want your page to show up in your navigation header, you will need to update `website/siteConfig.js` to add to the `headerLinks` element:
|
||||
|
||||
`website/siteConfig.js`
|
||||
|
||||
```javascript
|
||||
{
|
||||
headerLinks: [
|
||||
...
|
||||
{ page: 'my-new-custom-page', label: 'My New Custom Page' },
|
||||
...
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
For more information about custom pages, click [here](https://docusaurus.io/docs/en/custom-pages).
|
||||
|
||||
# Full Documentation
|
||||
|
||||
Full documentation can be found on the [website](https://docusaurus.io/).
|
||||
18
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2016-03-11-blog-post.md
vendored
Executable file
18
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2016-03-11-blog-post.md
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: Blog Title
|
||||
author: Blog Author
|
||||
authorURL: http://twitter.com/
|
||||
authorFBID: 100002976521003
|
||||
---
|
||||
|
||||
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.
|
||||
|
||||
<!--truncate-->
|
||||
|
||||
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 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 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 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.
|
||||
18
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2017-04-10-blog-post-two.md
vendored
Executable file
18
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2017-04-10-blog-post-two.md
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: New Blog Post
|
||||
author: Blog Author
|
||||
authorURL: http://twitter.com/
|
||||
authorFBID: 100002976521003
|
||||
---
|
||||
|
||||
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.
|
||||
|
||||
<!--truncate-->
|
||||
|
||||
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 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 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 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.
|
||||
14
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2017-09-25-testing-rss.md
vendored
Executable file
14
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2017-09-25-testing-rss.md
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: Adding RSS Support - RSS Truncation Test
|
||||
author: Eric Nakagawa
|
||||
authorURL: http://twitter.com/ericnakagawa
|
||||
authorFBID: 661277173
|
||||
---
|
||||
|
||||
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
This should be truncated.
|
||||
|
||||
<!--truncate-->
|
||||
|
||||
This line should never render in XML.
|
||||
10
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2017-09-26-adding-rss.md
vendored
Executable file
10
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2017-09-26-adding-rss.md
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Adding RSS Support
|
||||
author: Eric Nakagawa
|
||||
authorURL: http://twitter.com/ericnakagawa
|
||||
authorFBID: 661277173
|
||||
---
|
||||
|
||||
This is a test post.
|
||||
|
||||
A whole bunch of other information.
|
||||
8
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2017-10-24-new-version-1.0.0.md
vendored
Executable file
8
packages/now-static-build/test/fixtures/21-docusaurus-1/website/blog/2017-10-24-new-version-1.0.0.md
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: New Version 1.0.0
|
||||
author: Eric Nakagawa
|
||||
authorURL: http://twitter.com/ericnakagawa
|
||||
authorFBID: 661277173
|
||||
---
|
||||
|
||||
This blog post will test file name parsing issues when periods are present.
|
||||
133
packages/now-static-build/test/fixtures/21-docusaurus-1/website/core/Footer.js
vendored
Executable file
133
packages/now-static-build/test/fixtures/21-docusaurus-1/website/core/Footer.js
vendored
Executable file
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const React = require('react');
|
||||
|
||||
class Footer extends React.Component {
|
||||
docUrl(doc, language) {
|
||||
const baseUrl = this.props.config.baseUrl;
|
||||
const docsUrl = this.props.config.docsUrl;
|
||||
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
|
||||
const langPart = `${language ? `${language}/` : ''}`;
|
||||
return `${baseUrl}${docsPart}${langPart}${doc}`;
|
||||
}
|
||||
|
||||
pageUrl(doc, language) {
|
||||
const baseUrl = this.props.config.baseUrl;
|
||||
return baseUrl + (language ? `${language}/` : '') + doc;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<footer className="nav-footer" id="footer">
|
||||
<section className="sitemap">
|
||||
<a href={this.props.config.baseUrl} className="nav-home">
|
||||
{this.props.config.footerIcon && (
|
||||
<img
|
||||
src={this.props.config.baseUrl + this.props.config.footerIcon}
|
||||
alt={this.props.config.title}
|
||||
width="66"
|
||||
height="58"
|
||||
/>
|
||||
)}
|
||||
</a>
|
||||
<div>
|
||||
<h5>Docs</h5>
|
||||
<a href={this.docUrl('doc1.html', this.props.language)}>
|
||||
Getting Started (or other categories)
|
||||
</a>
|
||||
<a href={this.docUrl('doc2.html', this.props.language)}>
|
||||
Guides (or other categories)
|
||||
</a>
|
||||
<a href={this.docUrl('doc3.html', this.props.language)}>
|
||||
API Reference (or other categories)
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<h5>Community</h5>
|
||||
<a href={this.pageUrl('users.html', this.props.language)}>
|
||||
User Showcase
|
||||
</a>
|
||||
<a
|
||||
href="https://stackoverflow.com/questions/tagged/"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
Stack Overflow
|
||||
</a>
|
||||
<a href="https://discordapp.com/">Project Chat</a>
|
||||
<a
|
||||
href="https://twitter.com/"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
Twitter
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<h5>More</h5>
|
||||
<a href={`${this.props.config.baseUrl}blog`}>Blog</a>
|
||||
<a href="https://github.com/">GitHub</a>
|
||||
<a
|
||||
className="github-button"
|
||||
href={this.props.config.repoUrl}
|
||||
data-icon="octicon-star"
|
||||
data-count-href="/facebook/docusaurus/stargazers"
|
||||
data-show-count="true"
|
||||
data-count-aria-label="# stargazers on GitHub"
|
||||
aria-label="Star this project on GitHub"
|
||||
>
|
||||
Star
|
||||
</a>
|
||||
{this.props.config.twitterUsername && (
|
||||
<div className="social">
|
||||
<a
|
||||
href={`https://twitter.com/${
|
||||
this.props.config.twitterUsername
|
||||
}`}
|
||||
className="twitter-follow-button"
|
||||
>
|
||||
Follow @{this.props.config.twitterUsername}
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
{this.props.config.facebookAppId && (
|
||||
<div className="social">
|
||||
<div
|
||||
className="fb-like"
|
||||
data-href={this.props.config.url}
|
||||
data-colorscheme="dark"
|
||||
data-layout="standard"
|
||||
data-share="true"
|
||||
data-width="225"
|
||||
data-show-faces="false"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<a
|
||||
href="https://opensource.facebook.com/"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="fbOpenSource"
|
||||
>
|
||||
<img
|
||||
src={`${this.props.config.baseUrl}img/oss_logo.png`}
|
||||
alt="Facebook Open Source"
|
||||
width="170"
|
||||
height="45"
|
||||
/>
|
||||
</a>
|
||||
<section className="copyright">{this.props.config.copyright}</section>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Footer;
|
||||
14
packages/now-static-build/test/fixtures/21-docusaurus-1/website/package.json
vendored
Normal file
14
packages/now-static-build/test/fixtures/21-docusaurus-1/website/package.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"scripts": {
|
||||
"examples": "docusaurus-examples",
|
||||
"start": "docusaurus-start",
|
||||
"build": "docusaurus-build",
|
||||
"publish-gh-pages": "docusaurus-publish",
|
||||
"write-translations": "docusaurus-write-translations",
|
||||
"version": "docusaurus-version",
|
||||
"rename-version": "docusaurus-rename-version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"docusaurus": "1.12.0"
|
||||
}
|
||||
}
|
||||
54
packages/now-static-build/test/fixtures/21-docusaurus-1/website/pages/en/help.js
vendored
Executable file
54
packages/now-static-build/test/fixtures/21-docusaurus-1/website/pages/en/help.js
vendored
Executable file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const React = require('react');
|
||||
|
||||
const CompLibrary = require('../../core/CompLibrary.js');
|
||||
|
||||
const Container = CompLibrary.Container;
|
||||
const GridBlock = CompLibrary.GridBlock;
|
||||
|
||||
function Help(props) {
|
||||
const { config: siteConfig, language = '' } = props;
|
||||
const { baseUrl, docsUrl } = siteConfig;
|
||||
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
|
||||
const langPart = `${language ? `${language}/` : ''}`;
|
||||
const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}`;
|
||||
|
||||
const supportLinks = [
|
||||
{
|
||||
content: `Learn more using the [documentation on this site.](${docUrl(
|
||||
'doc1.html'
|
||||
)})`,
|
||||
title: 'Browse Docs',
|
||||
},
|
||||
{
|
||||
content: 'Ask questions about the documentation and project',
|
||||
title: 'Join the community',
|
||||
},
|
||||
{
|
||||
content: "Find out what's new with this project",
|
||||
title: 'Stay up to date',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="docMainWrapper wrapper">
|
||||
<Container className="mainContainer documentContainer postContainer">
|
||||
<div className="post">
|
||||
<header className="postHeader">
|
||||
<h1>Need help?</h1>
|
||||
</header>
|
||||
<p>This project is maintained by a dedicated group of people.</p>
|
||||
<GridBlock contents={supportLinks} layout="threeColumn" />
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = Help;
|
||||
214
packages/now-static-build/test/fixtures/21-docusaurus-1/website/pages/en/index.js
vendored
Executable file
214
packages/now-static-build/test/fixtures/21-docusaurus-1/website/pages/en/index.js
vendored
Executable file
@@ -0,0 +1,214 @@
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const React = require('react');
|
||||
|
||||
const CompLibrary = require('../../core/CompLibrary.js');
|
||||
|
||||
const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
|
||||
const Container = CompLibrary.Container;
|
||||
const GridBlock = CompLibrary.GridBlock;
|
||||
|
||||
class HomeSplash extends React.Component {
|
||||
render() {
|
||||
const { siteConfig, language = '' } = this.props;
|
||||
const { baseUrl, docsUrl } = siteConfig;
|
||||
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
|
||||
const langPart = `${language ? `${language}/` : ''}`;
|
||||
const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}`;
|
||||
|
||||
const SplashContainer = props => (
|
||||
<div className="homeContainer">
|
||||
<div className="homeSplashFade">
|
||||
<div className="wrapper homeWrapper">{props.children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const Logo = props => (
|
||||
<div className="projectLogo">
|
||||
<img src={props.img_src} alt="Project Logo" />
|
||||
</div>
|
||||
);
|
||||
|
||||
const ProjectTitle = () => (
|
||||
<h2 className="projectTitle">
|
||||
{siteConfig.title}
|
||||
<small>{siteConfig.tagline}</small>
|
||||
</h2>
|
||||
);
|
||||
|
||||
const PromoSection = props => (
|
||||
<div className="section promoSection">
|
||||
<div className="promoRow">
|
||||
<div className="pluginRowBlock">{props.children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const Button = props => (
|
||||
<div className="pluginWrapper buttonWrapper">
|
||||
<a className="button" href={props.href} target={props.target}>
|
||||
{props.children}
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<SplashContainer>
|
||||
<Logo img_src={`${baseUrl}img/undraw_monitor.svg`} />
|
||||
<div className="inner">
|
||||
<ProjectTitle siteConfig={siteConfig} />
|
||||
<PromoSection>
|
||||
<Button href="#try">Try It Out</Button>
|
||||
<Button href={docUrl('doc1.html')}>Example Link</Button>
|
||||
<Button href={docUrl('doc2.html')}>Example Link 2</Button>
|
||||
</PromoSection>
|
||||
</div>
|
||||
</SplashContainer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Index extends React.Component {
|
||||
render() {
|
||||
const { config: siteConfig, language = '' } = this.props;
|
||||
const { baseUrl } = siteConfig;
|
||||
|
||||
const Block = props => (
|
||||
<Container
|
||||
padding={['bottom', 'top']}
|
||||
id={props.id}
|
||||
background={props.background}
|
||||
>
|
||||
<GridBlock
|
||||
align="center"
|
||||
contents={props.children}
|
||||
layout={props.layout}
|
||||
/>
|
||||
</Container>
|
||||
);
|
||||
|
||||
const FeatureCallout = () => (
|
||||
<div
|
||||
className="productShowcaseSection paddingBottom"
|
||||
style={{ textAlign: 'center' }}
|
||||
>
|
||||
<h2>Feature Callout</h2>
|
||||
<MarkdownBlock>These are features of this project</MarkdownBlock>
|
||||
</div>
|
||||
);
|
||||
|
||||
const TryOut = () => (
|
||||
<Block id="try">
|
||||
{[
|
||||
{
|
||||
content:
|
||||
'To make your landing page more attractive, use illustrations! Check out ' +
|
||||
'[**unDraw**](https://undraw.co/) which provides you with customizable illustrations which are free to use. ' +
|
||||
'The illustrations you see on this page are from unDraw.',
|
||||
image: `${baseUrl}img/undraw_code_review.svg`,
|
||||
imageAlign: 'left',
|
||||
title: 'Wonderful SVG Illustrations',
|
||||
},
|
||||
]}
|
||||
</Block>
|
||||
);
|
||||
|
||||
const Description = () => (
|
||||
<Block background="dark">
|
||||
{[
|
||||
{
|
||||
content:
|
||||
'This is another description of how this project is useful',
|
||||
image: `${baseUrl}img/undraw_note_list.svg`,
|
||||
imageAlign: 'right',
|
||||
title: 'Description',
|
||||
},
|
||||
]}
|
||||
</Block>
|
||||
);
|
||||
|
||||
const LearnHow = () => (
|
||||
<Block background="light">
|
||||
{[
|
||||
{
|
||||
content:
|
||||
'Each new Docusaurus project has **randomly-generated** theme colors.',
|
||||
image: `${baseUrl}img/undraw_youtube_tutorial.svg`,
|
||||
imageAlign: 'right',
|
||||
title: 'Randomly Generated Theme Colors',
|
||||
},
|
||||
]}
|
||||
</Block>
|
||||
);
|
||||
|
||||
const Features = () => (
|
||||
<Block layout="fourColumn">
|
||||
{[
|
||||
{
|
||||
content: 'This is the content of my feature',
|
||||
image: `${baseUrl}img/undraw_react.svg`,
|
||||
imageAlign: 'top',
|
||||
title: 'Feature One',
|
||||
},
|
||||
{
|
||||
content: 'The content of my second feature',
|
||||
image: `${baseUrl}img/undraw_operating_system.svg`,
|
||||
imageAlign: 'top',
|
||||
title: 'Feature Two',
|
||||
},
|
||||
]}
|
||||
</Block>
|
||||
);
|
||||
|
||||
const Showcase = () => {
|
||||
if ((siteConfig.users || []).length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const showcase = siteConfig.users
|
||||
.filter(user => user.pinned)
|
||||
.map(user => (
|
||||
<a href={user.infoLink} key={user.infoLink}>
|
||||
<img src={user.image} alt={user.caption} title={user.caption} />
|
||||
</a>
|
||||
));
|
||||
|
||||
const pageUrl = page => baseUrl + (language ? `${language}/` : '') + page;
|
||||
|
||||
return (
|
||||
<div className="productShowcaseSection paddingBottom">
|
||||
<h2>Who is Using This?</h2>
|
||||
<p>This project is used by all these people</p>
|
||||
<div className="logos">{showcase}</div>
|
||||
<div className="more-users">
|
||||
<a className="button" href={pageUrl('users.html')}>
|
||||
More {siteConfig.title} Users
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<HomeSplash siteConfig={siteConfig} language={language} />
|
||||
<div className="mainContainer">
|
||||
<Features />
|
||||
<FeatureCallout />
|
||||
<LearnHow />
|
||||
<TryOut />
|
||||
<Description />
|
||||
<Showcase />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Index;
|
||||
48
packages/now-static-build/test/fixtures/21-docusaurus-1/website/pages/en/users.js
vendored
Executable file
48
packages/now-static-build/test/fixtures/21-docusaurus-1/website/pages/en/users.js
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const React = require('react');
|
||||
|
||||
const CompLibrary = require('../../core/CompLibrary.js');
|
||||
|
||||
const Container = CompLibrary.Container;
|
||||
|
||||
class Users extends React.Component {
|
||||
render() {
|
||||
const { config: siteConfig } = this.props;
|
||||
if ((siteConfig.users || []).length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const editUrl = `${siteConfig.repoUrl}/edit/master/website/siteConfig.js`;
|
||||
const showcase = siteConfig.users.map(user => (
|
||||
<a href={user.infoLink} key={user.infoLink}>
|
||||
<img src={user.image} alt={user.caption} title={user.caption} />
|
||||
</a>
|
||||
));
|
||||
|
||||
return (
|
||||
<div className="mainContainer">
|
||||
<Container padding={['bottom', 'top']}>
|
||||
<div className="showcaseSection">
|
||||
<div className="prose">
|
||||
<h1>Who is Using This?</h1>
|
||||
<p>This project is used by many folks</p>
|
||||
</div>
|
||||
<div className="logos">{showcase}</div>
|
||||
<p>Are you using this project?</p>
|
||||
<a href={editUrl} className="button">
|
||||
Add your company
|
||||
</a>
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Users;
|
||||
10
packages/now-static-build/test/fixtures/21-docusaurus-1/website/sidebars.json
vendored
Executable file
10
packages/now-static-build/test/fixtures/21-docusaurus-1/website/sidebars.json
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"docs": {
|
||||
"Docusaurus": ["doc1"],
|
||||
"First Category": ["doc2"],
|
||||
"Second Category": ["doc3"]
|
||||
},
|
||||
"docs-other": {
|
||||
"First Category": ["doc4", "doc5"]
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user