mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 12:57:46 +00:00
Compare commits
247 Commits
@vercel/py
...
@vercel/py
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be24510f16 | ||
|
|
05c534d855 | ||
|
|
910169dba7 | ||
|
|
0fc74feddc | ||
|
|
a9ea294514 | ||
|
|
42e0450d87 | ||
|
|
08c0feb58a | ||
|
|
60aaf76ed2 | ||
|
|
bd706beba5 | ||
|
|
b85a0a349a | ||
|
|
a97bc2af6d | ||
|
|
a5dc90c8cd | ||
|
|
e90521b5a4 | ||
|
|
10c598834a | ||
|
|
e58b34b82c | ||
|
|
02e1c921ac | ||
|
|
fcb14fa70e | ||
|
|
46e18128c7 | ||
|
|
e06d5247ef | ||
|
|
02195b92a7 | ||
|
|
7945155a0f | ||
|
|
edb6043c2c | ||
|
|
971481ba51 | ||
|
|
db8e456603 | ||
|
|
d1b4f24a4a | ||
|
|
4eb39ed53b | ||
|
|
6c7236ffd5 | ||
|
|
f0def040ac | ||
|
|
ee8dff2dc9 | ||
|
|
df86a6d48c | ||
|
|
b3958b3d12 | ||
|
|
8dd22703a7 | ||
|
|
c7e2280d23 | ||
|
|
2c239a6ee2 | ||
|
|
43709fbc74 | ||
|
|
52cd486e1d | ||
|
|
175f302a7f | ||
|
|
070bbd5825 | ||
|
|
cdeb4004c9 | ||
|
|
6bb162e5f5 | ||
|
|
8282442939 | ||
|
|
1f4f2af2f2 | ||
|
|
f1bb0e465a | ||
|
|
6dab4399c2 | ||
|
|
e87465d076 | ||
|
|
2f53b0dcdb | ||
|
|
b2e5212d0f | ||
|
|
28c9999c10 | ||
|
|
edb31fb412 | ||
|
|
2f0ea24552 | ||
|
|
7d09fdc5a4 | ||
|
|
23dce48b23 | ||
|
|
d7d308ca09 | ||
|
|
0e412361ad | ||
|
|
d563a99fb8 | ||
|
|
6ce4c2e182 | ||
|
|
e31d6d4062 | ||
|
|
f2f421b494 | ||
|
|
46836e12b5 | ||
|
|
3fc2611bf0 | ||
|
|
b4d8c411bd | ||
|
|
82b7d6980c | ||
|
|
895b233605 | ||
|
|
d9e6b5348b | ||
|
|
1934a64864 | ||
|
|
c412642668 | ||
|
|
793fe9aee1 | ||
|
|
ddc54d2ca4 | ||
|
|
39e5f0a364 | ||
|
|
43ed9ec859 | ||
|
|
8ba44fca79 | ||
|
|
27dbefaecf | ||
|
|
b4a13913c7 | ||
|
|
f842266b2e | ||
|
|
ad0cc858ed | ||
|
|
4bb7180de9 | ||
|
|
7a4faa480d | ||
|
|
421be5d738 | ||
|
|
b8eaf10974 | ||
|
|
92a4bf27cf | ||
|
|
2672838b64 | ||
|
|
1c96071ddc | ||
|
|
71cdf759da | ||
|
|
93ebd213de | ||
|
|
a32ba8f214 | ||
|
|
d416f70a6e | ||
|
|
ba9e1dd0ba | ||
|
|
d513f74b70 | ||
|
|
47f92f8f14 | ||
|
|
9aa669d735 | ||
|
|
99cab6f34a | ||
|
|
547e7dccf7 | ||
|
|
dce9a89407 | ||
|
|
c1cdddd974 | ||
|
|
4bce77dd4b | ||
|
|
3a79810944 | ||
|
|
5b3fbdddb3 | ||
|
|
25e9ecb5a2 | ||
|
|
415515840c | ||
|
|
9ba14be12e | ||
|
|
f1321946c5 | ||
|
|
230b69abf4 | ||
|
|
0d96f80ac8 | ||
|
|
178f5e7f00 | ||
|
|
dbfdf20c9d | ||
|
|
a80ed4ec9b | ||
|
|
833c3d7c01 | ||
|
|
19d0db7270 | ||
|
|
041e8cc601 | ||
|
|
b118e461b1 | ||
|
|
e519d49d7b | ||
|
|
27683818ba | ||
|
|
e016e38229 | ||
|
|
5db1c5e610 | ||
|
|
24c228569f | ||
|
|
963de9b64f | ||
|
|
ab7fd52305 | ||
|
|
0fdb0dac91 | ||
|
|
bb0b632dcf | ||
|
|
ced9495143 | ||
|
|
fadc3f2588 | ||
|
|
a1d548dfef | ||
|
|
754090a8ab | ||
|
|
8269a48ee0 | ||
|
|
9f05a1865c | ||
|
|
8d1afc026f | ||
|
|
130f36aad6 | ||
|
|
dd87c9b0c6 | ||
|
|
f813b3340b | ||
|
|
976b02e895 | ||
|
|
843be9658c | ||
|
|
ad501a4cd0 | ||
|
|
727ae587db | ||
|
|
536b15079b | ||
|
|
887882697b | ||
|
|
e2db7c7734 | ||
|
|
022504787c | ||
|
|
0f424de406 | ||
|
|
4819c3ac61 | ||
|
|
c28ca7ef2d | ||
|
|
068ea00615 | ||
|
|
7f8145ab40 | ||
|
|
1a12715096 | ||
|
|
5b6d565360 | ||
|
|
0794158906 | ||
|
|
02cdb88d3b | ||
|
|
fa58855114 | ||
|
|
1fac11792f | ||
|
|
05ffc9ce2b | ||
|
|
f848551043 | ||
|
|
9712abc5bf | ||
|
|
a9ef3cc726 | ||
|
|
e5cc1d643a | ||
|
|
c68e83f972 | ||
|
|
80118de040 | ||
|
|
c69da18e9c | ||
|
|
e19446f89c | ||
|
|
ea3233502d | ||
|
|
0a8810b64f | ||
|
|
f6b373f0f4 | ||
|
|
7ad2a99cd7 | ||
|
|
0349eea494 | ||
|
|
ed4d006fb7 | ||
|
|
12a9d203e9 | ||
|
|
ac1f4cf789 | ||
|
|
b284ca350a | ||
|
|
a43bf6c912 | ||
|
|
62410806bb | ||
|
|
47e3111cab | ||
|
|
135f35002f | ||
|
|
ee40052cee | ||
|
|
86b730c1cd | ||
|
|
b440249c26 | ||
|
|
5380c12569 | ||
|
|
f11eb32b2c | ||
|
|
3d40e343ac | ||
|
|
80f525796f | ||
|
|
af4ad358f2 | ||
|
|
e6033d7a2d | ||
|
|
d3148dffaa | ||
|
|
30048cf4ff | ||
|
|
07c65fa5c8 | ||
|
|
411ec64986 | ||
|
|
e4d2cc704c | ||
|
|
38db720586 | ||
|
|
c26c7886be | ||
|
|
b0e5d308ca | ||
|
|
609b98cc73 | ||
|
|
e0ec6c792b | ||
|
|
b29db2fd1d | ||
|
|
b604ced99d | ||
|
|
b7fd69517e | ||
|
|
4c821a6fb5 | ||
|
|
5c4fb319af | ||
|
|
fbe9ea0750 | ||
|
|
fa0f1b90b4 | ||
|
|
2daa0e28d3 | ||
|
|
48358b4986 | ||
|
|
c59f44a63b | ||
|
|
ca27864201 | ||
|
|
6c81a87338 | ||
|
|
a7bef9387b | ||
|
|
65d6c5e1f4 | ||
|
|
c09355fdb3 | ||
|
|
d9ac4c45e1 | ||
|
|
c2ff95714f | ||
|
|
a51feb7a62 | ||
|
|
ff10918230 | ||
|
|
04bea1e3cd | ||
|
|
bc5e5e8a9c | ||
|
|
2e647175f5 | ||
|
|
1a4e1d2fdd | ||
|
|
49e2274d81 | ||
|
|
9af3938544 | ||
|
|
7b5bf061c2 | ||
|
|
ffb98781f1 | ||
|
|
3411fcbb68 | ||
|
|
55cfd33338 | ||
|
|
93a9e5bed3 | ||
|
|
b454021234 | ||
|
|
bb705cd091 | ||
|
|
0986f4bcb6 | ||
|
|
83f77223aa | ||
|
|
effda1fa6c | ||
|
|
2ab6a7ef0c | ||
|
|
200bf5e996 | ||
|
|
94ab2512e9 | ||
|
|
da3207278e | ||
|
|
8e10a82b43 | ||
|
|
d7731d191b | ||
|
|
0f5f99e667 | ||
|
|
93a7831943 | ||
|
|
0eacbeae11 | ||
|
|
e50417dc47 | ||
|
|
4840a25d30 | ||
|
|
785e91979d | ||
|
|
7a776c54b8 | ||
|
|
997031c53b | ||
|
|
fdee03a599 | ||
|
|
c5a93ecdad | ||
|
|
5a9391b7ce | ||
|
|
99e49473b8 | ||
|
|
de1cc6f9a7 | ||
|
|
08eedd8f34 | ||
|
|
5021a71a8e | ||
|
|
56671d7c2f | ||
|
|
5035fa537f |
@@ -19,6 +19,11 @@ indent_style = space
|
|||||||
[*.py]
|
[*.py]
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
tab_width = 4
|
||||||
|
|
||||||
[*.asm]
|
[*.asm]
|
||||||
indent_size = 8
|
indent_size = 8
|
||||||
|
|
||||||
|
|||||||
@@ -34,3 +34,6 @@ packages/now-node-bridge/bridge.*
|
|||||||
|
|
||||||
# now-static-build
|
# now-static-build
|
||||||
packages/now-static-build/test/fixtures
|
packages/now-static-build/test/fixtures
|
||||||
|
|
||||||
|
# redwood
|
||||||
|
packages/redwood/test/fixtures
|
||||||
|
|||||||
2
.github/workflows/cancel.yml
vendored
2
.github/workflows/cancel.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 2
|
timeout-minutes: 2
|
||||||
steps:
|
steps:
|
||||||
- uses: styfle/cancel-workflow-action@0.3.2
|
- uses: styfle/cancel-workflow-action@0.4.1
|
||||||
with:
|
with:
|
||||||
workflow_id: 849295, 849296, 849297, 849298
|
workflow_id: 849295, 849296, 849297, 849298
|
||||||
access_token: ${{ github.token }}
|
access_token: ${{ github.token }}
|
||||||
|
|||||||
8
.github/workflows/test-integration-cli.yml
vendored
8
.github/workflows/test-integration-cli.yml
vendored
@@ -20,8 +20,12 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: git fetch origin master --depth=10
|
with:
|
||||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
fetch-depth: 100
|
||||||
|
- run: git --version
|
||||||
|
- run: git fetch origin master --depth=100
|
||||||
|
- run: git fetch origin ${{ github.ref }} --depth=100
|
||||||
|
- run: git diff origin/master...HEAD --name-only
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- run: yarn run build
|
- run: yarn run build
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
|
|||||||
8
.github/workflows/test-integration-dev.yml
vendored
8
.github/workflows/test-integration-dev.yml
vendored
@@ -20,8 +20,12 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: git fetch origin master --depth=10
|
with:
|
||||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
fetch-depth: 100
|
||||||
|
- run: git --version
|
||||||
|
- run: git fetch origin master --depth=100
|
||||||
|
- run: git fetch origin ${{ github.ref }} --depth=100
|
||||||
|
- run: git diff origin/master...HEAD --name-only
|
||||||
- name: Install Hugo
|
- name: Install Hugo
|
||||||
if: matrix.os == 'macos-latest'
|
if: matrix.os == 'macos-latest'
|
||||||
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/now-cli/test/dev/fixtures/08-hugo/
|
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/now-cli/test/dev/fixtures/08-hugo/
|
||||||
|
|||||||
8
.github/workflows/test-integration-once.yml
vendored
8
.github/workflows/test-integration-once.yml
vendored
@@ -15,8 +15,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: git fetch origin master --depth=10
|
with:
|
||||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
fetch-depth: 100
|
||||||
|
- run: git --version
|
||||||
|
- run: git fetch origin master --depth=100
|
||||||
|
- run: git fetch origin ${{ github.ref }} --depth=100
|
||||||
|
- run: git diff origin/master...HEAD --name-only
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- run: yarn run build
|
- run: yarn run build
|
||||||
- run: yarn test-integration-once --clean false
|
- run: yarn test-integration-once --clean false
|
||||||
|
|||||||
10
.github/workflows/test-unit.yml
vendored
10
.github/workflows/test-unit.yml
vendored
@@ -20,9 +20,15 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: git fetch origin master --depth=10
|
with:
|
||||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
fetch-depth: 100
|
||||||
|
- run: git --version
|
||||||
|
- run: git fetch origin master --depth=100
|
||||||
|
- run: git fetch origin ${{ github.ref }} --depth=100
|
||||||
|
- run: git diff origin/master...HEAD --name-only
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- run: yarn run build
|
- run: yarn run build
|
||||||
- run: yarn run lint
|
- run: yarn run lint
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
|
||||||
dist
|
dist
|
||||||
.vscode
|
.vscode
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|||||||
@@ -1,10 +1,33 @@
|
|||||||
# Runtime Developer Reference
|
# Runtime Developer Reference
|
||||||
|
|
||||||
The following page is a reference for how to create a Runtime using the available Runtime API.
|
The following page is a reference for how to create a Runtime by implementing
|
||||||
|
the Runtime API interface.
|
||||||
|
|
||||||
A Runtime is an npm module that exposes a `build` function and optionally an `analyze` function and `prepareCache` function.
|
A Runtime is an npm module that implements the following interface:
|
||||||
Official Runtimes are published to [npmjs.com](https://npmjs.com) as a package and referenced in the `use` property of the `vercel.json` configuration file.
|
|
||||||
However, the `use` property will work with any [npm install argument](https://docs.npmjs.com/cli/install) such as a git repo url which is useful for testing your Runtime.
|
```typescript
|
||||||
|
interface Runtime {
|
||||||
|
version: number;
|
||||||
|
build: (options: BuildOptions) => Promise<BuildResult>;
|
||||||
|
analyze?: (options: AnalyzeOptions) => Promise<string>;
|
||||||
|
prepareCache?: (options: PrepareCacheOptions) => Promise<CacheOutputs>;
|
||||||
|
shouldServe?: (options: ShouldServeOptions) => Promise<boolean>;
|
||||||
|
startDevServer?: (
|
||||||
|
options: StartDevServerOptions
|
||||||
|
) => Promise<StartDevServerResult>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The `version` property and the `build()` function are the only _required_ fields.
|
||||||
|
The rest are optional extensions that a Runtime _may_ implement in order to
|
||||||
|
enhance functionality. These functions are documented in more detail below.
|
||||||
|
|
||||||
|
Official Runtimes are published to [the npm registry](https://npmjs.com) as a package and referenced in the `use` property of the `vercel.json` configuration file.
|
||||||
|
|
||||||
|
> **Note:** The `use` property in the `builds` array will work with any [npm
|
||||||
|
> install argument](https://docs.npmjs.com/cli/install) such as a git repo URL,
|
||||||
|
> which is useful for testing your Runtime. Alternatively, the `functions` property
|
||||||
|
> requires that you specify a specifc tag published to npm, for stability purposes.
|
||||||
|
|
||||||
See the [Runtimes Documentation](https://vercel.com/docs/runtimes) to view example usage.
|
See the [Runtimes Documentation](https://vercel.com/docs/runtimes) to view example usage.
|
||||||
|
|
||||||
@@ -16,146 +39,170 @@ A **required** exported constant that decides which version of the Runtime API t
|
|||||||
|
|
||||||
The latest and suggested version is `3`.
|
The latest and suggested version is `3`.
|
||||||
|
|
||||||
### `analyze`
|
**Example:**
|
||||||
|
|
||||||
An **optional** exported function that returns a unique fingerprint used for the purpose of [build de-duplication](https://vercel.com/docs/v2/platform/deployments#deduplication). If the `analyze` function is not supplied, a random fingerprint is assigned to each build.
|
```typescript
|
||||||
|
export const version = 3;
|
||||||
```js
|
|
||||||
export analyze({
|
|
||||||
files: Files,
|
|
||||||
entrypoint: String,
|
|
||||||
workPath: String,
|
|
||||||
config: Object
|
|
||||||
}) : String fingerprint
|
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using TypeScript, you should use the following types:
|
### `build()`
|
||||||
|
|
||||||
```ts
|
A **required** exported function that returns a Serverless Function.
|
||||||
import { AnalyzeOptions } from '@vercel/build-utils'
|
|
||||||
|
|
||||||
export analyze(options: AnalyzeOptions) {
|
> What's a Serverless Function? Read about [Serverless Functions](https://vercel.com/docs/v2/serverless-functions/introduction) to learn more.
|
||||||
return 'fingerprint goes here'
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { BuildOptions, createLambda } from '@vercel/build-utils';
|
||||||
|
|
||||||
|
export async function build(options: BuildOptions) {
|
||||||
|
// Build the code here…
|
||||||
|
|
||||||
|
const lambda = createLambda(/* … */);
|
||||||
|
return {
|
||||||
|
output: lambda,
|
||||||
|
watch: [
|
||||||
|
// Dependent files to trigger a rebuild in `vercel dev` go here…
|
||||||
|
],
|
||||||
|
routes: [
|
||||||
|
// If your Runtime needs to define additional routing, define it here…
|
||||||
|
],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### `build`
|
### `analyze()`
|
||||||
|
|
||||||
A **required** exported function that returns a [Serverless Function](#serverless-function).
|
An **optional** exported function that returns a unique fingerprint used for the
|
||||||
|
purpose of [build
|
||||||
|
de-duplication](https://vercel.com/docs/v2/platform/deployments#deduplication).
|
||||||
|
If the `analyze()` function is not supplied, then a random fingerprint is
|
||||||
|
assigned to each build.
|
||||||
|
|
||||||
What's a Serverless Function? Read about [Serverless Functions](https://vercel.com/docs/v2/serverless-functions/introduction) to learn more.
|
**Example:**
|
||||||
|
|
||||||
```js
|
```typescript
|
||||||
build({
|
import { AnalyzeOptions } from '@vercel/build-utils';
|
||||||
files: Files,
|
|
||||||
entrypoint: String,
|
export async function analyze(options: AnalyzeOptions) {
|
||||||
workPath: String,
|
// Do calculations to generate a fingerprint based off the source code here…
|
||||||
config: Object,
|
|
||||||
meta?: {
|
return 'fingerprint goes here';
|
||||||
isDev?: Boolean,
|
|
||||||
requestPath?: String,
|
|
||||||
filesChanged?: Array<String>,
|
|
||||||
filesRemoved?: Array<String>
|
|
||||||
}
|
|
||||||
}) : {
|
|
||||||
watch?: Array<String>,
|
|
||||||
output: Lambda,
|
|
||||||
routes?: Object
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using TypeScript, you should use the following types:
|
### `prepareCache()`
|
||||||
|
|
||||||
```ts
|
An **optional** exported function that is executed after [`build()`](#build) is
|
||||||
import { BuildOptions } from '@vercel/build-utils'
|
completed. The implementation should return an object of `File`s that will be
|
||||||
|
pre-populated in the working directory for the next build run in the user's
|
||||||
|
project. An example use-case is that `@vercel/node` uses this function to cache
|
||||||
|
the `node_modules` directory, making it faster to install npm dependencies for
|
||||||
|
future builds.
|
||||||
|
|
||||||
export build(options: BuildOptions) {
|
**Example:**
|
||||||
// Build the code here
|
|
||||||
|
```typescript
|
||||||
|
import { PrepareCacheOptions } from '@vercel/build-utils';
|
||||||
|
|
||||||
|
export async function prepareCache(options: PrepareCacheOptions) {
|
||||||
|
// Create a mapping of file names and `File` object instances to cache here…
|
||||||
|
|
||||||
return {
|
return {
|
||||||
output: {
|
'path-to-file': File,
|
||||||
'path-to-file': File,
|
};
|
||||||
'path-to-lambda': Lambda
|
|
||||||
},
|
|
||||||
watch: [],
|
|
||||||
routes: {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### `prepareCache`
|
### `shouldServe()`
|
||||||
|
|
||||||
An **optional** exported function that is equivalent to [`build`](#build), but it executes the instructions necessary to prepare a cache for the next run.
|
An **optional** exported function that is only used by `vercel dev` in [Vercel
|
||||||
|
CLI](https://vercel.com/download) and indicates whether a
|
||||||
|
[Runtime](https://vercel.com/docs/runtimes) wants to be responsible for responding
|
||||||
|
to a certain request path.
|
||||||
|
|
||||||
```js
|
**Example:**
|
||||||
prepareCache({
|
|
||||||
files: Files,
|
|
||||||
entrypoint: String,
|
|
||||||
workPath: String,
|
|
||||||
cachePath: String,
|
|
||||||
config: Object
|
|
||||||
}) : Files cacheOutput
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using TypeScript, you can import the types for each of these functions by using the following:
|
```typescript
|
||||||
|
import { ShouldServeOptions } from '@vercel/build-utils';
|
||||||
|
|
||||||
```ts
|
export async function shouldServe(options: ShouldServeOptions) {
|
||||||
import { PrepareCacheOptions } from '@vercel/build-utils'
|
// Determine whether or not the Runtime should respond to the request path here…
|
||||||
|
|
||||||
export prepareCache(options: PrepareCacheOptions) {
|
return options.requestPath === options.entrypoint;
|
||||||
return { 'path-to-file': File }
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### `shouldServe`
|
If this function is not defined, Vercel CLI will use the [default implementation](https://github.com/vercel/vercel/blob/52994bfe26c5f4f179bdb49783ee57ce19334631/packages/now-build-utils/src/should-serve.ts).
|
||||||
|
|
||||||
An **optional** exported function that is only used by `vercel dev` in [Vercel CLI](https:///download) and indicates whether a [Runtime](https://vercel.com/docs/runtimes) wants to be responsible for building a certain request path.
|
### `startDevServer()`
|
||||||
|
|
||||||
```js
|
An **optional** exported function that is only used by `vercel dev` in [Vercel
|
||||||
shouldServe({
|
CLI](https://vercel.com/download). If this function is defined, Vercel CLI will
|
||||||
entrypoint: String,
|
**not** invoke the `build()` function, and instead invoke this function for every
|
||||||
files: Files,
|
HTTP request. It is an opportunity to provide an optimized development experience
|
||||||
config: Object,
|
rather than going through the entire `build()` process that is used in production.
|
||||||
requestPath: String,
|
|
||||||
workPath: String
|
|
||||||
}) : Boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using TypeScript, you can import the types for each of these functions by using the following:
|
This function is invoked _once per HTTP request_ and is expected to spawn a child
|
||||||
|
process which creates an HTTP server that will execute the entrypoint code when
|
||||||
|
an HTTP request is received. This child process is _single-serve_ (only used for
|
||||||
|
a single HTTP request). After the HTTP response is complete, `vercel dev` sends
|
||||||
|
a shut down signal to the child process.
|
||||||
|
|
||||||
```ts
|
The `startDevServer()` function returns an object with the `port` number that the
|
||||||
import { ShouldServeOptions } from '@vercel/build-utils'
|
child process' HTTP server is listening on (which should be an [ephemeral
|
||||||
|
port](https://stackoverflow.com/a/28050404/376773)) as well as the child process'
|
||||||
|
Process ID, which `vercel dev` uses to send the shut down signal to.
|
||||||
|
|
||||||
export shouldServe(options: ShouldServeOptions) {
|
> **Hint:** To determine which ephemeral port the child process is listening on,
|
||||||
return Boolean
|
> some form of [IPC](https://en.wikipedia.org/wiki/Inter-process_communication) is
|
||||||
|
> required. For example, in `@vercel/go` the child process writes the port number
|
||||||
|
> to [_file descriptor 3_](https://en.wikipedia.org/wiki/File_descriptor), which is read by the `startDevServer()` function
|
||||||
|
> implementation.
|
||||||
|
|
||||||
|
It may also return `null` to opt-out of this behavior for a particular request
|
||||||
|
path or entrypoint.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { spawn } from 'child_process';
|
||||||
|
import { StartDevServerOptions } from '@vercel/build-utils';
|
||||||
|
|
||||||
|
export async function startDevServer(options: StartDevServerOptions) {
|
||||||
|
// Create a child process which will create an HTTP server.
|
||||||
|
//
|
||||||
|
// Note: `my-runtime-dev-server` is an example dev server program name.
|
||||||
|
// Your implementation will spawn a different program specific to your runtime.
|
||||||
|
const child = spawn('my-runtime-dev-server', [options.entrypoint], {
|
||||||
|
stdio: ['ignore', 'inherit', 'inherit', 'pipe'],
|
||||||
|
});
|
||||||
|
|
||||||
|
// In this example, the child process will write the port number to FD 3…
|
||||||
|
const portPipe = child.stdio[3];
|
||||||
|
const childPort = await new Promise(resolve => {
|
||||||
|
portPipe.setEncoding('utf8');
|
||||||
|
portPipe.once('data', data => {
|
||||||
|
resolve(Number(data));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return { pid: child.pid, port: childPort };
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
If this method is not defined, Vercel CLI will default to [this function](https://github.com/vercel/vercel/blob/52994bfe26c5f4f179bdb49783ee57ce19334631/packages/now-build-utils/src/should-serve.ts).
|
|
||||||
|
|
||||||
### Runtime Options
|
|
||||||
|
|
||||||
The exported functions [`analyze`](#analyze), [`build`](#build), and [`prepareCache`](#preparecache) receive one argument with the following properties.
|
|
||||||
|
|
||||||
**Properties:**
|
|
||||||
|
|
||||||
- `files`: All source files of the project as a [Files](#files) data structure.
|
|
||||||
- `entrypoint`: Name of entrypoint file for this particular build job. Value `files[entrypoint]` is guaranteed to exist and be a valid [File](#files) reference. `entrypoint` is always a discrete file and never a glob, since globs are expanded into separate builds at deployment time.
|
|
||||||
- `workPath`: A writable temporary directory where you are encouraged to perform your build process. This directory will be populated with the restored cache from the previous run (if any) for [`analyze`](#analyze) and [`build`](#build).
|
|
||||||
- `cachePath`: A writable temporary directory where you can build a cache for the next run. This is only passed to `prepareCache`.
|
|
||||||
- `config`: An arbitrary object passed from by the user in the [Build definition](#defining-the-build-step) in `vercel.json`.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
Check out our [Node.js Runtime](https://github.com/vercel/vercel/tree/master/packages/now-node), [Go Runtime](https://github.com/vercel/vercel/tree/master/packages/now-go), [Python Runtime](https://github.com/vercel/vercel/tree/master/packages/now-python) or [Ruby Runtime](https://github.com/vercel/vercel/tree/master/packages/now-ruby) for examples of how to build one.
|
|
||||||
|
|
||||||
## Technical Details
|
|
||||||
|
|
||||||
### Execution Context
|
### Execution Context
|
||||||
|
|
||||||
A [Serverless Function](https://vercel.com/docs/v2/serverless-functions/introduction) is created where the Runtime logic is executed. The lambda is run using the Node.js 8 runtime. A brand new sandbox is created for each deployment, for security reasons. The sandbox is cleaned up between executions to ensure no lingering temporary files are shared from build to build.
|
- Runtimes are executed in a Linux container that closely matches the Servereless Function runtime environment.
|
||||||
|
- The Runtime code is executed using Node.js version **12.x**.
|
||||||
|
- A brand new sandbox is created for each deployment, for security reasons.
|
||||||
|
- The sandbox is cleaned up between executions to ensure no lingering temporary files are shared from build to build.
|
||||||
|
|
||||||
All the APIs you export ([`analyze`](#analyze), [`build`](#build) and [`prepareCache`](#preparecache)) are not guaranteed to be run in the same process, but the filesystem we expose (e.g.: `workPath` and the results of calling [`getWriteableDirectory`](#getWriteableDirectory) ) is retained.
|
All the APIs you export ([`analyze()`](#analyze), [`build()`](#build),
|
||||||
|
[`prepareCache()`](#preparecache), etc.) are not guaranteed to be run in the
|
||||||
|
same process, but the filesystem we expose (e.g.: `workPath` and the results
|
||||||
|
of calling [`getWritableDirectory`](#getWritableDirectory) ) is retained.
|
||||||
|
|
||||||
If you need to share state between those steps, use the filesystem.
|
If you need to share state between those steps, use the filesystem.
|
||||||
|
|
||||||
@@ -173,11 +220,11 @@ The env and secrets specified by the user as `build.env` are passed to the Runti
|
|||||||
|
|
||||||
When you publish your Runtime to npm, make sure to not specify `@vercel/build-utils` (as seen below in the API definitions) as a dependency, but rather as part of `peerDependencies`.
|
When you publish your Runtime to npm, make sure to not specify `@vercel/build-utils` (as seen below in the API definitions) as a dependency, but rather as part of `peerDependencies`.
|
||||||
|
|
||||||
## Types
|
## `@vercel/build-utils` Types
|
||||||
|
|
||||||
### `Files`
|
### `Files`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { File } from '@vercel/build-utils';
|
import { File } from '@vercel/build-utils';
|
||||||
type Files = { [filePath: string]: File };
|
type Files = { [filePath: string]: File };
|
||||||
```
|
```
|
||||||
@@ -188,7 +235,7 @@ When used as an input, the `Files` object will only contain `FileRefs`. When `Fi
|
|||||||
|
|
||||||
An example of a valid output `Files` object is:
|
An example of a valid output `Files` object is:
|
||||||
|
|
||||||
```json
|
```javascript
|
||||||
{
|
{
|
||||||
"index.html": FileRef,
|
"index.html": FileRef,
|
||||||
"api/index.js": Lambda
|
"api/index.js": Lambda
|
||||||
@@ -199,7 +246,7 @@ An example of a valid output `Files` object is:
|
|||||||
|
|
||||||
This is an abstract type that can be imported if you are using TypeScript.
|
This is an abstract type that can be imported if you are using TypeScript.
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { File } from '@vercel/build-utils';
|
import { File } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -211,71 +258,71 @@ Valid `File` types include:
|
|||||||
|
|
||||||
### `FileRef`
|
### `FileRef`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { FileRef } from '@vercel/build-utils';
|
import { FileRef } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
This is a [JavaScript class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) that represents an abstract file instance stored in our platform, based on the file identifier string (its checksum). When a `Files` object is passed as an input to `analyze` or `build`, all its values will be instances of `FileRef`.
|
This is a [class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) that represents an abstract file instance stored in our platform, based on the file identifier string (its checksum). When a `Files` object is passed as an input to `analyze` or `build`, all its values will be instances of `FileRef`.
|
||||||
|
|
||||||
**Properties:**
|
**Properties:**
|
||||||
|
|
||||||
- `mode : Number` file mode
|
- `mode: Number` file mode
|
||||||
- `digest : String` a checksum that represents the file
|
- `digest: String` a checksum that represents the file
|
||||||
|
|
||||||
**Methods:**
|
**Methods:**
|
||||||
|
|
||||||
- `toStream() : Stream` creates a [Stream](https://nodejs.org/api/stream.html) of the file body
|
- `toStream(): Stream` creates a [Stream](https://nodejs.org/api/stream.html) of the file body
|
||||||
|
|
||||||
### `FileFsRef`
|
### `FileFsRef`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { FileFsRef } from '@vercel/build-utils';
|
import { FileFsRef } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
This is a [JavaScript class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) that represents an abstract instance of a file present in the filesystem that the build process is executing in.
|
This is a [class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) that represents an abstract instance of a file present in the filesystem that the build process is executing in.
|
||||||
|
|
||||||
**Properties:**
|
**Properties:**
|
||||||
|
|
||||||
- `mode : Number` file mode
|
- `mode: Number` file mode
|
||||||
- `fsPath : String` the absolute path of the file in file system
|
- `fsPath: String` the absolute path of the file in file system
|
||||||
|
|
||||||
**Methods:**
|
**Methods:**
|
||||||
|
|
||||||
- `static async fromStream({ mode : Number, stream : Stream, fsPath : String }) : FileFsRef` creates an instance of a [FileFsRef](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) from `Stream`, placing file at `fsPath` with `mode`
|
- `static async fromStream({ mode: Number, stream: Stream, fsPath: String }): FileFsRef` creates an instance of a [FileFsRef](#FileFsRef) from `Stream`, placing file at `fsPath` with `mode`
|
||||||
- `toStream() : Stream` creates a [Stream](https://nodejs.org/api/stream.html) of the file body
|
- `toStream(): Stream` creates a [Stream](https://nodejs.org/api/stream.html) of the file body
|
||||||
|
|
||||||
### `FileBlob`
|
### `FileBlob`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { FileBlob } from '@vercel/build-utils';
|
import { FileBlob } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
This is a [JavaScript class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) that represents an abstract instance of a file present in memory.
|
This is a [class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) that represents an abstract instance of a file present in memory.
|
||||||
|
|
||||||
**Properties:**
|
**Properties:**
|
||||||
|
|
||||||
- `mode : Number` file mode
|
- `mode: Number` file mode
|
||||||
- `data : String | Buffer` the body of the file
|
- `data: String | Buffer` the body of the file
|
||||||
|
|
||||||
**Methods:**
|
**Methods:**
|
||||||
|
|
||||||
- `static async fromStream({ mode : Number, stream : Stream }) :FileBlob` creates an instance of a [FileBlob](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) from [`Stream`](https://nodejs.org/api/stream.html) with `mode`
|
- `static async fromStream({ mode: Number, stream: Stream }): FileBlob` creates an instance of a [FileBlob](#FileBlob) from [`Stream`](https://nodejs.org/api/stream.html) with `mode`
|
||||||
- `toStream() : Stream` creates a [Stream](https://nodejs.org/api/stream.html) of the file body
|
- `toStream(): Stream` creates a [Stream](https://nodejs.org/api/stream.html) of the file body
|
||||||
|
|
||||||
### `Lambda`
|
### `Lambda`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { Lambda } from '@vercel/build-utils';
|
import { Lambda } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
This is a [JavaScript class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), called a Serverless Function, that can be created by supplying `files`, `handler`, `runtime`, and `environment` as an object to the [`createLambda`](#createlambda) helper. The instances of this class should not be created directly. Instead, invoke the [`createLambda`](#createlambda) helper function.
|
This is a [class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) that represents a Serverless Function. An instance can be created by supplying `files`, `handler`, `runtime`, and `environment` as an object to the [`createLambda`](#createlambda) helper. The instances of this class should not be created directly. Instead, invoke the [`createLambda`](#createlambda) helper function.
|
||||||
|
|
||||||
**Properties:**
|
**Properties:**
|
||||||
|
|
||||||
- `files : Files` the internal filesystem of the lambda
|
- `files: Files` the internal filesystem of the lambda
|
||||||
- `handler : String` path to handler file and (optionally) a function name it exports
|
- `handler: String` path to handler file and (optionally) a function name it exports
|
||||||
- `runtime : LambdaRuntime` the name of the lambda runtime
|
- `runtime: LambdaRuntime` the name of the lambda runtime
|
||||||
- `environment : Object` key-value map of handler-related (aside of those passed by user) environment variables
|
- `environment: Object` key-value map of handler-related (aside of those passed by user) environment variables
|
||||||
|
|
||||||
### `LambdaRuntime`
|
### `LambdaRuntime`
|
||||||
|
|
||||||
@@ -291,15 +338,15 @@ This is an abstract enumeration type that is implemented by one of the following
|
|||||||
- `ruby2.5`
|
- `ruby2.5`
|
||||||
- `provided`
|
- `provided`
|
||||||
|
|
||||||
## JavaScript API
|
## `@vercel/build-utils` Helper Functions
|
||||||
|
|
||||||
The following is exposed by `@vercel/build-utils` to simplify the process of writing Runtimes, manipulating the file system, using the above types, etc.
|
The following is exposed by `@vercel/build-utils` to simplify the process of writing Runtimes, manipulating the file system, using the above types, etc.
|
||||||
|
|
||||||
### `createLambda`
|
### `createLambda()`
|
||||||
|
|
||||||
Signature: `createLambda(Object spec) : Lambda`
|
Signature: `createLambda(Object spec): Lambda`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { createLambda } from '@vercel/build-utils';
|
import { createLambda } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -316,29 +363,33 @@ await createLambda({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
### `download`
|
### `download()`
|
||||||
|
|
||||||
Signature: `download() : Files`
|
Signature: `download(): Files`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { download } from '@vercel/build-utils';
|
import { download } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
This utility allows you to download the contents of a [`Files`](#files) data structure, therefore creating the filesystem represented in it.
|
This utility allows you to download the contents of a [`Files`](#files) data
|
||||||
|
structure, therefore creating the filesystem represented in it.
|
||||||
|
|
||||||
Since `Files` is an abstract way of representing files, you can think of `download` as a way of making that virtual filesystem _real_.
|
Since `Files` is an abstract way of representing files, you can think of
|
||||||
|
`download()` as a way of making that virtual filesystem _real_.
|
||||||
|
|
||||||
If the **optional** `meta` property is passed (the argument for [build](#build)), only the files that have changed are downloaded. This is decided using `filesRemoved` and `filesChanged` inside that object.
|
If the **optional** `meta` property is passed (the argument for
|
||||||
|
[`build()`](#build)), only the files that have changed are downloaded.
|
||||||
|
This is decided using `filesRemoved` and `filesChanged` inside that object.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
await download(files, workPath, meta);
|
await download(files, workPath, meta);
|
||||||
```
|
```
|
||||||
|
|
||||||
### `glob`
|
### `glob()`
|
||||||
|
|
||||||
Signature: `glob() : Files`
|
Signature: `glob(): Files`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { glob } from '@vercel/build-utils';
|
import { glob } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -355,21 +406,21 @@ exports.build = ({ files, workPath }) => {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### `getWriteableDirectory`
|
### `getWritableDirectory()`
|
||||||
|
|
||||||
Signature: `getWriteableDirectory() : String`
|
Signature: `getWritableDirectory(): String`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { getWriteableDirectory } from '@vercel/build-utils';
|
import { getWritableDirectory } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
In some occasions, you might want to write to a temporary directory.
|
In some occasions, you might want to write to a temporary directory.
|
||||||
|
|
||||||
### `rename`
|
### `rename()`
|
||||||
|
|
||||||
Signature: `rename(Files) : Files`
|
Signature: `rename(Files, Function): Files`
|
||||||
|
|
||||||
```ts
|
```typescript
|
||||||
import { rename } from '@vercel/build-utils';
|
import { rename } from '@vercel/build-utils';
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { NowRequest, NowResponse } from '@now/node';
|
import { NowRequest, NowResponse } from '@vercel/node';
|
||||||
import { errorHandler } from './error-handler';
|
import { errorHandler } from './error-handler';
|
||||||
|
|
||||||
type Handler = (req: NowRequest, res: NowResponse) => Promise<any>;
|
type Handler = (req: NowRequest, res: NowResponse) => Promise<any>;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import tar from 'tar-fs';
|
import tar from 'tar-fs';
|
||||||
import { extract } from '../../_lib/examples/extract';
|
import { extract } from '../../_lib/examples/extract';
|
||||||
import { NowRequest, NowResponse } from '@now/node';
|
import { NowRequest, NowResponse } from '@vercel/node';
|
||||||
import { withApiHandler } from '../../_lib/util/with-api-handler';
|
import { withApiHandler } from '../../_lib/util/with-api-handler';
|
||||||
|
|
||||||
const TMP_DIR = '/tmp';
|
const TMP_DIR = '/tmp';
|
||||||
@@ -15,8 +15,8 @@ function notFound(res: NowResponse, message: string) {
|
|||||||
return res.status(404).send({
|
return res.status(404).send({
|
||||||
error: {
|
error: {
|
||||||
code: 'not_found',
|
code: 'not_found',
|
||||||
message
|
message,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,10 @@ function streamToBuffer(stream: any) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withApiHandler(async function(req: NowRequest, res: NowResponse) {
|
export default withApiHandler(async function (
|
||||||
|
req: NowRequest,
|
||||||
|
res: NowResponse
|
||||||
|
) {
|
||||||
const ext = '.tar.gz';
|
const ext = '.tar.gz';
|
||||||
const { segment = '' } = req.query;
|
const { segment = '' } = req.query;
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import parseGitUrl from 'parse-github-url';
|
import parseGitUrl from 'parse-github-url';
|
||||||
import { NowRequest, NowResponse } from '@now/node';
|
import { NowRequest, NowResponse } from '@vercel/node';
|
||||||
import { withApiHandler } from '../_lib/util/with-api-handler';
|
import { withApiHandler } from '../_lib/util/with-api-handler';
|
||||||
import { getGitHubRepoInfo } from '../_lib/examples/github-repo-info';
|
import { getGitHubRepoInfo } from '../_lib/examples/github-repo-info';
|
||||||
import { getGitLabRepoInfo } from '../_lib/examples/gitlab-repo-info';
|
import { getGitLabRepoInfo } from '../_lib/examples/gitlab-repo-info';
|
||||||
|
|
||||||
export default withApiHandler(async function(
|
export default withApiHandler(async function (
|
||||||
req: NowRequest,
|
req: NowRequest,
|
||||||
res: NowResponse
|
res: NowResponse
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { NowRequest, NowResponse } from '@now/node';
|
import { NowRequest, NowResponse } from '@vercel/node';
|
||||||
import { getExampleList } from '../_lib/examples/example-list';
|
import { getExampleList } from '../_lib/examples/example-list';
|
||||||
import { withApiHandler } from '../_lib/util/with-api-handler';
|
import { withApiHandler } from '../_lib/util/with-api-handler';
|
||||||
|
|
||||||
export default withApiHandler(async function(
|
export default withApiHandler(async function (
|
||||||
req: NowRequest,
|
req: NowRequest,
|
||||||
res: NowResponse
|
res: NowResponse
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { extract } from '../_lib/examples/extract';
|
import { extract } from '../_lib/examples/extract';
|
||||||
import { summary } from '../_lib/examples/summary';
|
import { summary } from '../_lib/examples/summary';
|
||||||
import { NowRequest, NowResponse } from '@now/node';
|
import { NowRequest, NowResponse } from '@vercel/node';
|
||||||
import { mapOldToNew } from '../_lib/examples/map-old-to-new';
|
import { mapOldToNew } from '../_lib/examples/map-old-to-new';
|
||||||
import { withApiHandler } from '../_lib/util/with-api-handler';
|
import { withApiHandler } from '../_lib/util/with-api-handler';
|
||||||
|
|
||||||
export default withApiHandler(async function(
|
export default withApiHandler(async function (
|
||||||
req: NowRequest,
|
req: NowRequest,
|
||||||
res: NowResponse
|
res: NowResponse
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
import { NowRequest, NowResponse } from '@now/node';
|
import { NowRequest, NowResponse } from '@vercel/node';
|
||||||
import { withApiHandler } from './_lib/util/with-api-handler';
|
import { withApiHandler } from './_lib/util/with-api-handler';
|
||||||
import frameworkList, { Framework } from '../packages/frameworks';
|
import _frameworks, { Framework } from '../packages/frameworks';
|
||||||
|
|
||||||
const frameworks = (frameworkList as Framework[]).map(frameworkItem => {
|
const frameworks = (_frameworks as Framework[])
|
||||||
const framework = {
|
.sort(
|
||||||
...frameworkItem,
|
(a, b) =>
|
||||||
detectors: undefined,
|
(a.sort || Number.MAX_SAFE_INTEGER) - (b.sort || Number.MAX_SAFE_INTEGER)
|
||||||
};
|
)
|
||||||
|
.map(frameworkItem => {
|
||||||
|
const framework = {
|
||||||
|
...frameworkItem,
|
||||||
|
detectors: undefined,
|
||||||
|
sort: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
if (framework.logo) {
|
if (framework.logo) {
|
||||||
framework.logo = `https://res.cloudinary.com/zeit-inc/image/fetch/${framework.logo}`;
|
framework.logo = `https://res.cloudinary.com/zeit-inc/image/fetch/${framework.logo}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return framework;
|
return framework;
|
||||||
});
|
});
|
||||||
|
|
||||||
export default withApiHandler(async function(
|
export default withApiHandler(async function (
|
||||||
req: NowRequest,
|
req: NowRequest,
|
||||||
res: NowResponse
|
res: NowResponse
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -13,12 +13,12 @@
|
|||||||
"node-fetch": "2.6.0",
|
"node-fetch": "2.6.0",
|
||||||
"parse-github-url": "1.0.2",
|
"parse-github-url": "1.0.2",
|
||||||
"tar-fs": "2.0.0",
|
"tar-fs": "2.0.0",
|
||||||
"typescript": "3.7.4",
|
|
||||||
"unzip-stream": "0.3.0"
|
"unzip-stream": "0.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@now/node": "1.3.3",
|
|
||||||
"@types/node": "13.1.4",
|
"@types/node": "13.1.4",
|
||||||
"@types/node-fetch": "2.5.4"
|
"@types/node-fetch": "2.5.4",
|
||||||
|
"@vercel/node": "1.7.2",
|
||||||
|
"typescript": "3.9.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,6 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@now/node@1.3.3":
|
|
||||||
version "1.3.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/@now/node/-/node-1.3.3.tgz#5407cb6a730d4dd9b6b6b0bc4a316f29086c9feb"
|
|
||||||
integrity sha512-s1qajtQttWhhSs1k6FX0/6eTFYFUplzultrQeKfOPMoYzzz6OxDq5qrQ3elpsGlZlDVmO+x+JOJ7yad+3yBgpg==
|
|
||||||
dependencies:
|
|
||||||
"@types/node" "*"
|
|
||||||
|
|
||||||
"@sentry/apm@5.11.1":
|
"@sentry/apm@5.11.1":
|
||||||
version "5.11.1"
|
version "5.11.1"
|
||||||
resolved "https://registry.yarnpkg.com/@sentry/apm/-/apm-5.11.1.tgz#cc89fa4150056fbf009f92eca94fccc3980db34e"
|
resolved "https://registry.yarnpkg.com/@sentry/apm/-/apm-5.11.1.tgz#cc89fa4150056fbf009f92eca94fccc3980db34e"
|
||||||
@@ -141,11 +134,25 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@vercel/node@1.7.2":
|
||||||
|
version "1.7.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@vercel/node/-/node-1.7.2.tgz#85cb8aac661c02dfef6fe752740f5b162e90767b"
|
||||||
|
integrity sha512-XV5lrLC+K/cxsaFj8H2OoGu1zliOqnxcrOnPInI8HmQjR/Tztt+0nzgpt+7sx8wXcrib0Nu7lK303jP7VjSETw==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
ts-node "8.9.1"
|
||||||
|
typescript "3.9.3"
|
||||||
|
|
||||||
agent-base@5:
|
agent-base@5:
|
||||||
version "5.1.1"
|
version "5.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
|
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
|
||||||
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==
|
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==
|
||||||
|
|
||||||
|
arg@^4.1.0:
|
||||||
|
version "4.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
|
||||||
|
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
|
||||||
|
|
||||||
binary@^0.3.0:
|
binary@^0.3.0:
|
||||||
version "0.3.0"
|
version "0.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/binary/-/binary-0.3.0.tgz#9f60553bc5ce8c3386f3b553cff47462adecaa79"
|
resolved "https://registry.yarnpkg.com/binary/-/binary-0.3.0.tgz#9f60553bc5ce8c3386f3b553cff47462adecaa79"
|
||||||
@@ -161,6 +168,11 @@ bl@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
readable-stream "^3.0.1"
|
readable-stream "^3.0.1"
|
||||||
|
|
||||||
|
buffer-from@^1.0.0:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
|
||||||
|
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
|
||||||
|
|
||||||
buffers@~0.1.1:
|
buffers@~0.1.1:
|
||||||
version "0.1.1"
|
version "0.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb"
|
resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb"
|
||||||
@@ -229,6 +241,11 @@ defer-to-connect@^1.1.1:
|
|||||||
resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.1.tgz#88ae694b93f67b81815a2c8c769aef6574ac8f2f"
|
resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.1.tgz#88ae694b93f67b81815a2c8c769aef6574ac8f2f"
|
||||||
integrity sha512-J7thop4u3mRTkYRQ+Vpfwy2G5Ehoy82I14+14W4YMDLKdWloI9gSzRbV30s/NckQGVJtPkWNcW4oMAUigTdqiQ==
|
integrity sha512-J7thop4u3mRTkYRQ+Vpfwy2G5Ehoy82I14+14W4YMDLKdWloI9gSzRbV30s/NckQGVJtPkWNcW4oMAUigTdqiQ==
|
||||||
|
|
||||||
|
diff@^4.0.1:
|
||||||
|
version "4.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
|
||||||
|
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
|
||||||
|
|
||||||
duplexer3@^0.1.4:
|
duplexer3@^0.1.4:
|
||||||
version "0.1.4"
|
version "0.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
|
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
|
||||||
@@ -313,6 +330,11 @@ lru_map@^0.3.3:
|
|||||||
resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd"
|
resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd"
|
||||||
integrity sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=
|
integrity sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=
|
||||||
|
|
||||||
|
make-error@^1.1.1:
|
||||||
|
version "1.3.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
|
||||||
|
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
|
||||||
|
|
||||||
mimic-response@^1.0.0:
|
mimic-response@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
|
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
|
||||||
@@ -396,6 +418,19 @@ safe-buffer@~5.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
|
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
|
||||||
integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
|
integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
|
||||||
|
|
||||||
|
source-map-support@^0.5.17:
|
||||||
|
version "0.5.19"
|
||||||
|
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
|
||||||
|
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
|
||||||
|
dependencies:
|
||||||
|
buffer-from "^1.0.0"
|
||||||
|
source-map "^0.6.0"
|
||||||
|
|
||||||
|
source-map@^0.6.0:
|
||||||
|
version "0.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||||
|
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||||
|
|
||||||
string_decoder@^1.1.1:
|
string_decoder@^1.1.1:
|
||||||
version "1.3.0"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
|
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
|
||||||
@@ -434,6 +469,17 @@ to-readable-stream@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9"
|
resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9"
|
||||||
integrity sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=
|
integrity sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=
|
||||||
|
|
||||||
|
ts-node@8.9.1:
|
||||||
|
version "8.9.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.9.1.tgz#2f857f46c47e91dcd28a14e052482eb14cfd65a5"
|
||||||
|
integrity sha512-yrq6ODsxEFTLz0R3BX2myf0WBCSQh9A+py8PBo1dCzWIOcvisbyH6akNKqDHMgXePF2kir5mm5JXJTH3OUJYOQ==
|
||||||
|
dependencies:
|
||||||
|
arg "^4.1.0"
|
||||||
|
diff "^4.0.1"
|
||||||
|
make-error "^1.1.1"
|
||||||
|
source-map-support "^0.5.17"
|
||||||
|
yn "3.1.1"
|
||||||
|
|
||||||
tslib@^1.9.3:
|
tslib@^1.9.3:
|
||||||
version "1.10.0"
|
version "1.10.0"
|
||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||||
@@ -444,10 +490,15 @@ type-fest@^0.8.0:
|
|||||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
|
||||||
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
|
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
|
||||||
|
|
||||||
typescript@3.7.4:
|
typescript@3.9.3:
|
||||||
version "3.7.4"
|
version "3.9.3"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.3.tgz#d3ac8883a97c26139e42df5e93eeece33d610b8a"
|
||||||
integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==
|
integrity sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==
|
||||||
|
|
||||||
|
typescript@3.9.6:
|
||||||
|
version "3.9.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.6.tgz#8f3e0198a34c3ae17091b35571d3afd31999365a"
|
||||||
|
integrity sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==
|
||||||
|
|
||||||
unzip-stream@0.3.0:
|
unzip-stream@0.3.0:
|
||||||
version "0.3.0"
|
version "0.3.0"
|
||||||
@@ -466,3 +517,8 @@ wrappy@1:
|
|||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||||
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
|
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
|
||||||
|
|
||||||
|
yn@3.1.1:
|
||||||
|
version "3.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
|
||||||
|
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
|
|
||||||
#### Why This Error Occurred
|
#### Why This Error Occurred
|
||||||
|
|
||||||
The domain you supplied cannot be verified using either the intended set of nameservers or the given verification TXT record.
|
The domain you supplied cannot be verified using the intended nameservers.
|
||||||
|
|
||||||
#### Possible Ways to Fix It
|
#### Possible Way to Fix It
|
||||||
|
|
||||||
Apply the intended set of nameservers to your domain or add the given TXT verification record through your domain provider.
|
Apply the intended set of nameservers to your domain.
|
||||||
|
|
||||||
You can retrieve both the intended nameservers and TXT verification record for the domain you wish to verify by running `vercel domains inspect <domain>`.
|
You can retrieve both the intended nameservers and TXT verification record for the domain you wish to verify by running `vercel domains inspect <domain>`.
|
||||||
|
|
||||||
When you have added either verification method to your domain, you can run `vercel domains verify <domain>` again to complete verification for your domain.
|
|
||||||
|
|
||||||
Vercel will also automatically check periodically that your domain has been verified and automatically mark it as such if we detect either verification method on the domain.
|
Vercel will also automatically check periodically that your domain has been verified and automatically mark it as such if we detect either verification method on the domain.
|
||||||
|
|
||||||
If you would not like to verify your domain, you can remove it from your account using `vercel domains rm <domain>`.
|
If you would not like to verify your domain, you can remove it from your account using `vercel domains rm <domain>`.
|
||||||
|
|||||||
@@ -17,11 +17,3 @@ To get started deploying AMP with Vercel, you can use the [Vercel CLI](https://v
|
|||||||
```shell
|
```shell
|
||||||
$ vercel init amp
|
$ vercel init amp
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new AMP project with a single command from your terminal using Vercel CLI:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with Angular, you can use the [Angular CLI](https://cli.angular.i
|
|||||||
```shell
|
```shell
|
||||||
$ ng new
|
$ ng new
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Angular project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
4
examples/blitzjs/.babelrc.js
Normal file
4
examples/blitzjs/.babelrc.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: ["next/babel"],
|
||||||
|
plugins: [],
|
||||||
|
}
|
||||||
10
examples/blitzjs/.eslintrc.js
Normal file
10
examples/blitzjs/.eslintrc.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ["react-app", "plugin:jsx-a11y/recommended"],
|
||||||
|
plugins: ["jsx-a11y"],
|
||||||
|
rules: {
|
||||||
|
"import/no-anonymous-default-export": "error",
|
||||||
|
"import/no-webpack-loader-syntax": "off",
|
||||||
|
"react/react-in-jsx-scope": "off", // React is always in scope with Blitz
|
||||||
|
"jsx-a11y/anchor-is-valid": "off", //Doesn't play well with Blitz/Next <Link> usage
|
||||||
|
},
|
||||||
|
}
|
||||||
56
examples/blitzjs/.gitignore
vendored
Normal file
56
examples/blitzjs/.gitignore
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# dependencies
|
||||||
|
node_modules
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.pnp.*
|
||||||
|
.npm
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# blitz
|
||||||
|
/.blitz/
|
||||||
|
/.next/
|
||||||
|
*.sqlite
|
||||||
|
.now
|
||||||
|
.vercel
|
||||||
|
.blitz-console-history
|
||||||
|
blitz-log.log
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env
|
||||||
|
.envrc
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
.nyc_output
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Caches
|
||||||
|
*.tsbuildinfo
|
||||||
|
.eslintcache
|
||||||
|
.node_repl_history
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
1
examples/blitzjs/.npmrc
Normal file
1
examples/blitzjs/.npmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
save-exact=true
|
||||||
6
examples/blitzjs/.prettierignore
Normal file
6
examples/blitzjs/.prettierignore
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.gitkeep
|
||||||
|
.env
|
||||||
|
*.ico
|
||||||
|
*.lock
|
||||||
|
db/migrations
|
||||||
|
|
||||||
19
examples/blitzjs/README.md
Normal file
19
examples/blitzjs/README.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|

|
||||||
|
|
||||||
|
# Blitz.js Example
|
||||||
|
|
||||||
|
This directory is a brief example of a [Blitz.js](https://blitzjs.com/) project that can be deployed with Vercel and zero configuration.
|
||||||
|
|
||||||
|
## Deploy Your Own
|
||||||
|
|
||||||
|
Deploy your own Blitz.js project with Vercel by viewing the [documentation on deploying to Vercel](https://blitzjs.com/docs/deploy-vercel)
|
||||||
|
|
||||||
|
[](https://vercel.com/import/project?template=https://github.com/vercel/vercel/tree/master/examples/blitzjs)
|
||||||
|
|
||||||
|
### How We Created This Example
|
||||||
|
|
||||||
|
To get started with Blitz.js, you can use [npx](https://www.npmjs.com/package/npx) to initialize the project:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ npx blitz new
|
||||||
|
```
|
||||||
0
packages/now-cli/test/fixtures/unit/directory-main/a/index.js → examples/blitzjs/app/components/.keep
Executable file → Normal file
0
packages/now-cli/test/fixtures/unit/directory-main/a/index.js → examples/blitzjs/app/components/.keep
Executable file → Normal file
21
examples/blitzjs/app/components/ErrorBoundary.tsx
Normal file
21
examples/blitzjs/app/components/ErrorBoundary.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import React from "react"
|
||||||
|
|
||||||
|
export default class ErrorBoundary extends React.Component<{
|
||||||
|
fallback: (error: any) => React.ReactNode
|
||||||
|
}> {
|
||||||
|
state = { hasError: false, error: null }
|
||||||
|
|
||||||
|
static getDerivedStateFromError(error: any) {
|
||||||
|
return {
|
||||||
|
hasError: true,
|
||||||
|
error,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
if (this.state.hasError) {
|
||||||
|
return this.props.fallback(this.state.error)
|
||||||
|
}
|
||||||
|
return this.props.children
|
||||||
|
}
|
||||||
|
}
|
||||||
0
packages/now-cli/test/fixtures/unit/directory-main/build/a.js → examples/blitzjs/app/layouts/.keep
Executable file → Normal file
0
packages/now-cli/test/fixtures/unit/directory-main/build/a.js → examples/blitzjs/app/layouts/.keep
Executable file → Normal file
5
examples/blitzjs/app/pages/_app.tsx
Normal file
5
examples/blitzjs/app/pages/_app.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { AppProps } from "blitz"
|
||||||
|
|
||||||
|
export default function MyApp({ Component, pageProps }: AppProps) {
|
||||||
|
return <Component {...pageProps} />
|
||||||
|
}
|
||||||
23
examples/blitzjs/app/pages/_document.tsx
Normal file
23
examples/blitzjs/app/pages/_document.tsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { Document, Html, DocumentHead, Main, BlitzScript /*DocumentContext*/ } from "blitz"
|
||||||
|
|
||||||
|
class MyDocument extends Document {
|
||||||
|
// Only uncomment if you need to customize this behaviour
|
||||||
|
// static async getInitialProps(ctx: DocumentContext) {
|
||||||
|
// const initialProps = await Document.getInitialProps(ctx)
|
||||||
|
// return {...initialProps}
|
||||||
|
// }
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<Html lang="en">
|
||||||
|
<DocumentHead />
|
||||||
|
<body>
|
||||||
|
<Main />
|
||||||
|
<BlitzScript />
|
||||||
|
</body>
|
||||||
|
</Html>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MyDocument
|
||||||
197
examples/blitzjs/app/pages/index.tsx
Normal file
197
examples/blitzjs/app/pages/index.tsx
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
import { Head, Link } from "blitz"
|
||||||
|
|
||||||
|
const Home = () => (
|
||||||
|
<div className="container">
|
||||||
|
<Head>
|
||||||
|
<title>blitzjs</title>
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
</Head>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<div className="logo">
|
||||||
|
<img src="/logo.png" alt="blitz.js" />
|
||||||
|
</div>
|
||||||
|
<p>1. Run this command in your terminal:</p>
|
||||||
|
<pre>
|
||||||
|
<code>blitz generate all project name:string</code>
|
||||||
|
</pre>
|
||||||
|
<p>2. Then run this command:</p>
|
||||||
|
<pre>
|
||||||
|
<code>blitz db migrate</code>
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
3. Go to{" "}
|
||||||
|
<Link href="/projects">
|
||||||
|
<a>/projects</a>
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
<div className="buttons">
|
||||||
|
<a
|
||||||
|
className="button"
|
||||||
|
href="https://github.com/blitz-js/blitz/blob/master/USER_GUIDE.md?utm_source=blitz-new&utm_medium=app-template&utm_campaign=blitz-new"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
Documentation
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className="button-outline"
|
||||||
|
href="https://github.com/blitz-js/blitz"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
Github Repo
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className="button-outline"
|
||||||
|
href="https://slack.blitzjs.com"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
Slack Community
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<a
|
||||||
|
href="https://blitzjs.com?utm_source=blitz-new&utm_medium=app-template&utm_campaign=blitz-new"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
Powered by Blitz.js
|
||||||
|
</a>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<style jsx>{`
|
||||||
|
.container {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 5rem 0;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main p {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
width: 100%;
|
||||||
|
height: 60px;
|
||||||
|
border-top: 1px solid #eaeaea;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #45009d;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer a {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer a {
|
||||||
|
color: #f4f4f4;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo img {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
grid-gap: 0.5rem;
|
||||||
|
margin-top: 6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.button {
|
||||||
|
background-color: #6700eb;
|
||||||
|
padding: 1rem 2rem;
|
||||||
|
color: #f4f4f4;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.button:hover {
|
||||||
|
background-color: #45009d;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.button-outline {
|
||||||
|
border: 2px solid #6700eb;
|
||||||
|
padding: 1rem 2rem;
|
||||||
|
color: #6700eb;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.button-outline:hover {
|
||||||
|
border-color: #45009d;
|
||||||
|
color: #45009d;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background: #fafafa;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 0.75rem;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
|
||||||
|
Bitstream Vera Sans Mono, Courier New, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
max-width: 800px;
|
||||||
|
margin-top: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.grid {
|
||||||
|
width: 100%;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
|
||||||
|
<style jsx global>{`
|
||||||
|
@import url("https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@300;700&display=swap");
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
font-family: "Libre Franklin", -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
|
||||||
|
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default Home
|
||||||
15
examples/blitzjs/blitz.config.js
Normal file
15
examples/blitzjs/blitz.config.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
module.exports = {
|
||||||
|
/*
|
||||||
|
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
|
||||||
|
// Note: we provide webpack above so you should not `require` it
|
||||||
|
// Perform customizations to webpack config
|
||||||
|
// Important: return the modified config
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
webpackDevMiddleware: (config) => {
|
||||||
|
// Perform customizations to webpack dev middleware config
|
||||||
|
// Important: return the modified config
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
}
|
||||||
15
examples/blitzjs/db/index.ts
Normal file
15
examples/blitzjs/db/index.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { PrismaClient } from "@prisma/client"
|
||||||
|
export * from "@prisma/client"
|
||||||
|
|
||||||
|
let prisma: PrismaClient
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === "production") {
|
||||||
|
prisma = new PrismaClient()
|
||||||
|
} else {
|
||||||
|
// Ensure the prisma instance is re-used during hot-reloading
|
||||||
|
// Otherwise, a new client will be created on every reload
|
||||||
|
global["prisma"] = global["prisma"] || new PrismaClient()
|
||||||
|
prisma = global["prisma"]
|
||||||
|
}
|
||||||
|
|
||||||
|
export default prisma
|
||||||
0
packages/now-cli/test/fixtures/unit/dockerfile-empty/Dockerfile → examples/blitzjs/db/migrations/.keep
Executable file → Normal file
0
packages/now-cli/test/fixtures/unit/dockerfile-empty/Dockerfile → examples/blitzjs/db/migrations/.keep
Executable file → Normal file
27
examples/blitzjs/db/schema.prisma
Normal file
27
examples/blitzjs/db/schema.prisma
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// This is your Prisma schema file,
|
||||||
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||||
|
|
||||||
|
datasource sqlite {
|
||||||
|
provider = "sqlite"
|
||||||
|
url = "file:./db.sqlite"
|
||||||
|
}
|
||||||
|
|
||||||
|
// SQLite is easy to start with, but if you use Postgres in production
|
||||||
|
// you should also use it in development with the following:
|
||||||
|
//datasource postgresql {
|
||||||
|
// provider = "postgresql"
|
||||||
|
// url = env("DATABASE_URL")
|
||||||
|
//}
|
||||||
|
|
||||||
|
generator client {
|
||||||
|
provider = "prisma-client-js"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------
|
||||||
|
|
||||||
|
//model Project {
|
||||||
|
// id Int @default(autoincrement()) @id
|
||||||
|
// name String
|
||||||
|
//}
|
||||||
|
|
||||||
55
examples/blitzjs/package.json
Normal file
55
examples/blitzjs/package.json
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"name": "blitzjs",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"start": "blitz start",
|
||||||
|
"studio": "blitz db studio",
|
||||||
|
"build": "blitz build",
|
||||||
|
"lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .",
|
||||||
|
"test": "echo \"No tests yet\""
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"defaults"
|
||||||
|
],
|
||||||
|
"prettier": {
|
||||||
|
"semi": false,
|
||||||
|
"printWidth": 100
|
||||||
|
},
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "lint-staged && pretty-quick --staged",
|
||||||
|
"pre-push": "blitz test"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{js,ts,tsx}": [
|
||||||
|
"eslint --fix"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@prisma/cli": "latest",
|
||||||
|
"@prisma/client": "latest",
|
||||||
|
"blitz": "latest",
|
||||||
|
"react": "experimental",
|
||||||
|
"react-dom": "experimental"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/react": "16.9.36",
|
||||||
|
"@typescript-eslint/eslint-plugin": "2.x",
|
||||||
|
"@typescript-eslint/parser": "2.x",
|
||||||
|
"babel-eslint": "10.1.0",
|
||||||
|
"eslint": "6.8.0",
|
||||||
|
"eslint-config-react-app": "5.2.1",
|
||||||
|
"eslint-plugin-flowtype": "4.7.0",
|
||||||
|
"eslint-plugin-import": "2.21.2",
|
||||||
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||||
|
"eslint-plugin-react": "7.20.0",
|
||||||
|
"eslint-plugin-react-hooks": "3.0.0",
|
||||||
|
"husky": "4.2.5",
|
||||||
|
"lint-staged": "10.2.10",
|
||||||
|
"prettier": "2.0.5",
|
||||||
|
"pretty-quick": "2.0.1",
|
||||||
|
"typescript": "3.9.5"
|
||||||
|
},
|
||||||
|
"private": true
|
||||||
|
}
|
||||||
BIN
examples/blitzjs/public/favicon.ico
Executable file
BIN
examples/blitzjs/public/favicon.ico
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 556 B |
BIN
examples/blitzjs/public/logo.png
Normal file
BIN
examples/blitzjs/public/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
20
examples/blitzjs/tsconfig.json
Normal file
20
examples/blitzjs/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"baseUrl": "./",
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": false,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "preserve"
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules"],
|
||||||
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||||
|
}
|
||||||
0
packages/now-cli/test/fixtures/unit/extensionless-main/build/a.js → examples/blitzjs/utils/.keep
Executable file → Normal file
0
packages/now-cli/test/fixtures/unit/extensionless-main/build/a.js → examples/blitzjs/utils/.keep
Executable file → Normal file
@@ -17,11 +17,3 @@ To get started deploying Brunch with Vercel, you can use the [Brunch CLI](https:
|
|||||||
```shell
|
```shell
|
||||||
$ brunch new project-name -s es6
|
$ brunch new project-name -s es6
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Brunch project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with React, along with [Serverless Functions](https://vercel.com/
|
|||||||
```shell
|
```shell
|
||||||
$ npx create-react-app my-app
|
$ npx create-react-app my-app
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new React project, along with [Serverless Functions](https://vercel.com/docs/v2/serverless-functions/introduction), with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -17,11 +17,3 @@ To get started deploying a Custom Built project with Vercel, you can use the [Ve
|
|||||||
```shell
|
```shell
|
||||||
$ vercel init custom-build
|
$ vercel init custom-build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Custom Built project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -15,11 +15,3 @@ To get started with Docusaurus on Vercel, you can use the [Docusaurus CLI](https
|
|||||||
```shell
|
```shell
|
||||||
$ npx @docusaurus/init@next init my-website classic
|
$ npx @docusaurus/init@next init my-website classic
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Docusaurus project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with Docusaurus for deployment with Vercel, you can use the [Docu
|
|||||||
```shell
|
```shell
|
||||||
$ docusaurus-init
|
$ docusaurus-init
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Docusaurus project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -15,11 +15,3 @@ To get started with Dojo on Vercel, you can use the [Dojo CLI](https://github.co
|
|||||||
```shell
|
```shell
|
||||||
$ vercel init dojo
|
$ vercel init dojo
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Dojo project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with Eleventy for deployment with Vercel, you can use [npx](https
|
|||||||
```shell
|
```shell
|
||||||
$ npx degit 11ty/eleventy-base-blog my-11ty-project
|
$ npx degit 11ty/eleventy-base-blog my-11ty-project
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Eleventy project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with Ember for deployment with Vercel, you can use the [Ember CLI
|
|||||||
```shell
|
```shell
|
||||||
$ npx ember-cli new ember-project
|
$ npx ember-cli new ember-project
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Ember project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with Gatsby on Vercel, you can use the [Gatsby CLI](https://www.g
|
|||||||
```shell
|
```shell
|
||||||
$ gatsby new gatsby-site
|
$ gatsby new gatsby-site
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Gatsby project, along with [Serverless Functions](https://vercel.com/docs/v2/serverless-functions/introduction), with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
11913
examples/gatsby/yarn.lock
Normal file
11913
examples/gatsby/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -19,11 +19,3 @@ To get started with Gridsome for deployment with Vercel, you can use the [Gridso
|
|||||||
```shell
|
```shell
|
||||||
$ gridsome create my-website
|
$ gridsome create my-website
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Gridsome project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with Hexo for deployment with Vercel, you can use the [Hexo CLI](
|
|||||||
```shell
|
```shell
|
||||||
$ hexo init project-name
|
$ hexo init project-name
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Hexo project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -17,11 +17,3 @@ To get started with Hugo for deployment with Vercel, you can use the [Hugo CLI](
|
|||||||
```shell
|
```shell
|
||||||
$ hugo new site project-name
|
$ hugo new site project-name
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Hugo project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -15,13 +15,5 @@ _Live Example: https://ionic-angular.now-examples.now.sh_
|
|||||||
To get started with Ionic Angular deployed with Vercel, you can use the [Ionic CLI](https://ionicframework.com/docs/cli) to initialize the project:
|
To get started with Ionic Angular deployed with Vercel, you can use the [Ionic CLI](https://ionicframework.com/docs/cli) to initialize the project:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ npx ionic start [project-name] conference --type angular && cd [project-name]
|
$ npx @ionic/cli start [project-name] conference --type angular && cd [project-name]
|
||||||
```
|
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Ionic Angular project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
```
|
||||||
|
|||||||
13585
examples/ionic-angular/package-lock.json
generated
Normal file
13585
examples/ionic-angular/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@
|
|||||||
"@ionic-native/in-app-browser": "5.0.0-beta.15",
|
"@ionic-native/in-app-browser": "5.0.0-beta.15",
|
||||||
"@ionic-native/splash-screen": "5.0.0-beta.15",
|
"@ionic-native/splash-screen": "5.0.0-beta.15",
|
||||||
"@ionic-native/status-bar": "5.0.0-beta.15",
|
"@ionic-native/status-bar": "5.0.0-beta.15",
|
||||||
"@ionic/angular": "^5.0.6",
|
"@ionic/angular": "^5.1.1",
|
||||||
"@ionic/storage": "^2.1.3",
|
"@ionic/storage": "^2.1.3",
|
||||||
"cordova-android": "^8.1.0",
|
"cordova-android": "^8.1.0",
|
||||||
"cordova-ios": "^5.1.1",
|
"cordova-ios": "^5.1.1",
|
||||||
|
|||||||
@@ -17,11 +17,3 @@ To get started with Ionic React deployed with Vercel, you can use the [Ionic CLI
|
|||||||
```shell
|
```shell
|
||||||
$ npx ionic start [project-name] conference --type react && cd [project-name]
|
$ npx ionic start [project-name] conference --type react && cd [project-name]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Ionic React project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -17,11 +17,3 @@ To get started with Jekyll for deployment with Vercel, you can use the [Jekyll C
|
|||||||
```shell
|
```shell
|
||||||
$ jekyll new my-blog
|
$ jekyll new my-blog
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Jekyll project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -17,11 +17,3 @@ To get started with Middleman for deployment with Vercel, you can use the [Middl
|
|||||||
```shell
|
```shell
|
||||||
$ middleman init project-name
|
$ middleman init project-name
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Middleman project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
14
examples/nextjs/.gitignore
vendored
14
examples/nextjs/.gitignore
vendored
@@ -11,20 +11,24 @@
|
|||||||
# next.js
|
# next.js
|
||||||
/.next/
|
/.next/
|
||||||
/out/
|
/out/
|
||||||
!public/
|
|
||||||
|
|
||||||
# production
|
# production
|
||||||
/build
|
/build
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.env*
|
*.pem
|
||||||
|
|
||||||
# debug
|
# debug
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
# Environment Variables
|
# local env files
|
||||||
.env
|
.env.local
|
||||||
.env.build
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
# vercel
|
||||||
|
.vercel
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/zeit/next.js/tree/canary/packages/create-next-app).
|
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ To learn more about Next.js, take a look at the following resources:
|
|||||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||||
|
|
||||||
You can check out [the Next.js GitHub repository](https://github.com/zeit/next.js) - your feedback and contributions are welcome!
|
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||||
|
|
||||||
## Deploy on Vercel
|
## Deploy on Vercel
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
"start": "next start"
|
"start": "next start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"next": "^9.3.3",
|
"next": "9.5.1",
|
||||||
"react": "^16.13.0",
|
"react": "16.13.1",
|
||||||
"react-dom": "^16.13.0"
|
"react-dom": "16.13.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
examples/nextjs/pages/_app.js
Normal file
7
examples/nextjs/pages/_app.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import '../styles/globals.css'
|
||||||
|
|
||||||
|
function MyApp({ Component, pageProps }) {
|
||||||
|
return <Component {...pageProps} />
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MyApp
|
||||||
6
examples/nextjs/pages/api/hello.js
Normal file
6
examples/nextjs/pages/api/hello.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||||
|
|
||||||
|
export default (req, res) => {
|
||||||
|
res.statusCode = 200
|
||||||
|
res.json({ name: 'John Doe' })
|
||||||
|
}
|
||||||
@@ -1,203 +1,65 @@
|
|||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
|
import styles from '../styles/Home.module.css'
|
||||||
|
|
||||||
const Home = () => (
|
export default function Home() {
|
||||||
<div className="container">
|
return (
|
||||||
<Head>
|
<div className={styles.container}>
|
||||||
<title>Create Next App</title>
|
<Head>
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<title>Create Next App</title>
|
||||||
</Head>
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
</Head>
|
||||||
|
|
||||||
<main>
|
<main className={styles.main}>
|
||||||
<h1 className="title">
|
<h1 className={styles.title}>
|
||||||
Welcome to <a href="https://nextjs.org">Next.js!</a>
|
Welcome to <a href="https://nextjs.org">Next.js!</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<p className="description">
|
<p className={styles.description}>
|
||||||
Get started by editing <code>pages/index.js</code>
|
Get started by editing{' '}
|
||||||
</p>
|
<code className={styles.code}>pages/index.js</code>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div className="grid">
|
<div className={styles.grid}>
|
||||||
<a href="https://nextjs.org/docs" className="card">
|
<a href="https://nextjs.org/docs" className={styles.card}>
|
||||||
<h3>Documentation →</h3>
|
<h3>Documentation →</h3>
|
||||||
<p>Find in-depth information about Next.js features and API.</p>
|
<p>Find in-depth information about Next.js features and API.</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://nextjs.org/learn" className="card">
|
<a href="https://nextjs.org/learn" className={styles.card}>
|
||||||
<h3>Learn →</h3>
|
<h3>Learn →</h3>
|
||||||
<p>Learn about Next.js in an interactive course with quizzes!</p>
|
<p>Learn about Next.js in an interactive course with quizzes!</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="https://github.com/vercel/next.js/tree/master/examples"
|
||||||
|
className={styles.card}
|
||||||
|
>
|
||||||
|
<h3>Examples →</h3>
|
||||||
|
<p>Discover and deploy boilerplate example Next.js projects.</p>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||||
|
className={styles.card}
|
||||||
|
>
|
||||||
|
<h3>Deploy →</h3>
|
||||||
|
<p>
|
||||||
|
Instantly deploy your Next.js site to a public URL with Vercel.
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer className={styles.footer}>
|
||||||
<a
|
<a
|
||||||
href="https://github.com/zeit/next.js/tree/master/examples"
|
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||||
className="card"
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
<h3>Examples →</h3>
|
Powered by{' '}
|
||||||
<p>Discover and deploy boilerplate example Next.js projects.</p>
|
<img src="/vercel.svg" alt="Vercel Logo" className={styles.logo} />
|
||||||
</a>
|
</a>
|
||||||
|
</footer>
|
||||||
<a
|
</div>
|
||||||
href="https://vercel.com/new?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
)
|
||||||
className="card"
|
}
|
||||||
>
|
|
||||||
<h3>Deploy →</h3>
|
|
||||||
<p>
|
|
||||||
Instantly deploy your Next.js site to a public URL with Vercel.
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
<a
|
|
||||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
Powered by <img src="/vercel.svg" alt="Vercel Logo" />
|
|
||||||
</a>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<style jsx>{`
|
|
||||||
.container {
|
|
||||||
min-height: 100vh;
|
|
||||||
padding: 0 0.5rem;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
padding: 5rem 0;
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
width: 100%;
|
|
||||||
height: 100px;
|
|
||||||
border-top: 1px solid #eaeaea;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer img {
|
|
||||||
margin-left: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer a {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title a {
|
|
||||||
color: #0070f3;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title a:hover,
|
|
||||||
.title a:focus,
|
|
||||||
.title a:active {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
margin: 0;
|
|
||||||
line-height: 1.15;
|
|
||||||
font-size: 4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title,
|
|
||||||
.description {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
line-height: 1.5;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
background: #fafafa;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 0.75rem;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
font-family: Menlo, Monaco, Lucida Console, Liberation Mono,
|
|
||||||
DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
|
|
||||||
max-width: 800px;
|
|
||||||
margin-top: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
margin: 1rem;
|
|
||||||
flex-basis: 45%;
|
|
||||||
padding: 1.5rem;
|
|
||||||
text-align: left;
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
border: 1px solid #eaeaea;
|
|
||||||
border-radius: 10px;
|
|
||||||
transition: color 0.15s ease, border-color 0.15s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card:hover,
|
|
||||||
.card:focus,
|
|
||||||
.card:active {
|
|
||||||
color: #0070f3;
|
|
||||||
border-color: #0070f3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card h3 {
|
|
||||||
margin: 0 0 1rem 0;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card p {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.grid {
|
|
||||||
width: 100%;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`}</style>
|
|
||||||
|
|
||||||
<style jsx global>{`
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
|
|
||||||
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
`}</style>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
|
|
||||||
export default Home
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
<svg width="70" height="16" viewBox="0 0 70 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
|
||||||
<path d="M9.255.05l9.108 15.753H.148L9.255.05zM39.434 8.418c0-2.535-1.87-4.307-4.554-4.307-2.683 0-4.554 1.772-4.554 4.307 0 2.487 2.019 4.308 4.8 4.308 1.526 0 2.905-.566 3.79-1.6l-1.673-.96c-.517.517-1.28.837-2.117.837-1.23 0-2.29-.665-2.658-1.674l-.074-.172h6.966a3.76 3.76 0 00.074-.739zm-7.065-.738l.05-.148c.32-1.058 1.255-1.698 2.436-1.698 1.207 0 2.117.64 2.437 1.698l.05.148h-4.973zM65.945 8.418c0-2.535-1.871-4.307-4.554-4.307-2.683 0-4.554 1.772-4.554 4.307 0 2.487 2.018 4.308 4.8 4.308 1.526 0 2.904-.566 3.79-1.6l-1.673-.96c-.517.517-1.28.837-2.117.837-1.23 0-2.29-.665-2.659-1.674l-.073-.172h6.966a3.76 3.76 0 00.074-.739zM58.88 7.68l.05-.148c.32-1.058 1.255-1.698 2.436-1.698 1.206 0 2.117.64 2.437 1.698l.05.148H58.88zM54.13 7.015l1.673-.96c-.788-1.23-2.19-1.92-3.89-1.92-2.682 0-4.553 1.773-4.553 4.308 0 2.536 1.87 4.308 4.554 4.308 1.698 0 3.101-.69 3.89-1.92l-1.675-.96c-.443.738-1.23 1.157-2.215 1.157-1.55 0-2.585-1.034-2.585-2.585 0-1.55 1.034-2.585 2.585-2.585.96 0 1.772.419 2.215 1.157zM69.637 1.428h-1.97v11.077h1.97V1.428zM31.779 1.428h-2.265L25.182 8.91l-4.333-7.483H18.56l6.622 11.421 6.597-11.421zM45.71 6.4c.222 0 .444.025.665.074V4.382c-1.673.049-3.249.984-3.249 2.141V4.382h-1.97v8.123h1.97v-3.52c0-1.527 1.059-2.585 2.585-2.585z" fill="#000"/>
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
</svg>
|
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
|
||||||
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.1 KiB |
123
examples/nextjs/styles/Home.module.css
Normal file
123
examples/nextjs/styles/Home.module.css
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
.container {
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
padding: 5rem 0;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
width: 100%;
|
||||||
|
height: 100px;
|
||||||
|
border-top: 1px solid #eaeaea;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer img {
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title a {
|
||||||
|
color: #0070f3;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title a:hover,
|
||||||
|
.title a:focus,
|
||||||
|
.title a:active {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin: 0;
|
||||||
|
line-height: 1.15;
|
||||||
|
font-size: 4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title,
|
||||||
|
.description {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
line-height: 1.5;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code {
|
||||||
|
background: #fafafa;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 0.75rem;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
|
||||||
|
Bitstream Vera Sans Mono, Courier New, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
max-width: 800px;
|
||||||
|
margin-top: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
margin: 1rem;
|
||||||
|
flex-basis: 45%;
|
||||||
|
padding: 1.5rem;
|
||||||
|
text-align: left;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 1px solid #eaeaea;
|
||||||
|
border-radius: 10px;
|
||||||
|
transition: color 0.15s ease, border-color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover,
|
||||||
|
.card:focus,
|
||||||
|
.card:active {
|
||||||
|
color: #0070f3;
|
||||||
|
border-color: #0070f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card h3 {
|
||||||
|
margin: 0 0 1rem 0;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
height: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.grid {
|
||||||
|
width: 100%;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
16
examples/nextjs/styles/globals.css
Normal file
16
examples/nextjs/styles/globals.css
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
html,
|
||||||
|
body {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
|
||||||
|
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
@@ -19,11 +19,3 @@ $ npx create-nuxt-app my-app
|
|||||||
```
|
```
|
||||||
|
|
||||||
> The only change made is to amend the output directory in `nuxt.config.js` to `"/public"`.
|
> The only change made is to amend the output directory in `nuxt.config.js` to `"/public"`.
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Nuxt.js project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with Polymer deployed with Vercel, you can use the [Polymer CLI](
|
|||||||
```shell
|
```shell
|
||||||
$ polymer init
|
$ polymer init
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Polymer project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,11 +19,3 @@ To get started with Preact for deployment with Vercel, you can use the [Preact C
|
|||||||
```shell
|
```shell
|
||||||
$ preact create default my-project
|
$ preact create default my-project
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying From Your Terminal
|
|
||||||
|
|
||||||
You can deploy your new Preact project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ vercel
|
|
||||||
```
|
|
||||||
|
|||||||
10
examples/redwoodjs/.editorconfig
Normal file
10
examples/redwoodjs/.editorconfig
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
7
examples/redwoodjs/.env.defaults
Normal file
7
examples/redwoodjs/.env.defaults
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# These environment variables will be used by default if you do not create any
|
||||||
|
# yourself in .env. This file should be safe to check into your version control
|
||||||
|
# system. Any custom values should go in .env and .env should *not* be checked
|
||||||
|
# into version control.
|
||||||
|
|
||||||
|
DATABASE_URL=file:./dev.db
|
||||||
|
BINARY_TARGET=native
|
||||||
10
examples/redwoodjs/.gitignore
vendored
Normal file
10
examples/redwoodjs/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
|
.netlify
|
||||||
|
dev.db
|
||||||
|
dist
|
||||||
|
dist-babel
|
||||||
|
node_modules
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
|
.vercel
|
||||||
1
examples/redwoodjs/.nvmrc
Normal file
1
examples/redwoodjs/.nvmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
lts/*
|
||||||
21
examples/redwoodjs/LICENSE
Normal file
21
examples/redwoodjs/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Redwood
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
21
examples/redwoodjs/README.md
Normal file
21
examples/redwoodjs/README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|

|
||||||
|
|
||||||
|
# RedwoodJS Example
|
||||||
|
|
||||||
|
This directory is a brief example of a [RedwoodJS](https://redwoodjs.com) app with [Serverless Functions](https://vercel.com/docs/v2/serverless-functions/introduction) that can be deployed with Vercel and zero configuration.
|
||||||
|
|
||||||
|
## Deploy Your Own
|
||||||
|
|
||||||
|
Deploy your own RedwoodJS project, along with Serverless Functions, with Vercel.
|
||||||
|
|
||||||
|
[](https://vercel.com/import/project?template=https://github.com/vercel/vercel/tree/master/examples/redwoodjs)
|
||||||
|
|
||||||
|
_Live Example: https://redwoodjs.now-examples.now.sh_
|
||||||
|
|
||||||
|
### How We Created This Example
|
||||||
|
|
||||||
|
To get started with RedwoodJS on Vercel, you can [use Yarn to initialize](https://redwoodjs.com/tutorial/installation-starting-development) the project:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ yarn create redwood-app ./my-redwood-app
|
||||||
|
```
|
||||||
1
examples/redwoodjs/api/.babelrc.js
Normal file
1
examples/redwoodjs/api/.babelrc.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = { extends: '../babel.config.js' }
|
||||||
9
examples/redwoodjs/api/jsconfig.json
Normal file
9
examples/redwoodjs/api/jsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"src/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"]
|
||||||
|
}
|
||||||
8
examples/redwoodjs/api/package.json
Normal file
8
examples/redwoodjs/api/package.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "api",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@redwoodjs/api": "0.15.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
18
examples/redwoodjs/api/prisma/schema.prisma
Normal file
18
examples/redwoodjs/api/prisma/schema.prisma
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
datasource DS {
|
||||||
|
provider = "sqlite"
|
||||||
|
url = env("DATABASE_URL")
|
||||||
|
}
|
||||||
|
|
||||||
|
generator client {
|
||||||
|
provider = "prisma-client-js"
|
||||||
|
binaryTargets = env("BINARY_TARGET")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define your own datamodels here and run `yarn redwood db save` to create
|
||||||
|
// migrations for them.
|
||||||
|
// TODO: Please remove the following example:
|
||||||
|
model UserExample {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
email String @unique
|
||||||
|
name String?
|
||||||
|
}
|
||||||
26
examples/redwoodjs/api/prisma/seeds.js
Normal file
26
examples/redwoodjs/api/prisma/seeds.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/* eslint-disable no-console */
|
||||||
|
const { PrismaClient } = require('@prisma/client')
|
||||||
|
const dotenv = require('dotenv')
|
||||||
|
|
||||||
|
dotenv.config()
|
||||||
|
const db = new PrismaClient()
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
// Seed data is database data that needs to exist for your app to run.
|
||||||
|
// Ideally this file should be idempotent: running it multiple times
|
||||||
|
// will result in the same database state (usually by checking for the
|
||||||
|
// existence of a record before trying to create it). For example:
|
||||||
|
//
|
||||||
|
// const existing = await db.user.findMany({ where: { email: 'admin@email.com' }})
|
||||||
|
// if (!existing.length) {
|
||||||
|
// await db.user.create({ data: { name: 'Admin', email: 'admin@email.com' }})
|
||||||
|
// }
|
||||||
|
|
||||||
|
console.info('No data to seed. See api/prisma/seeds.js for info.')
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
.catch((e) => console.error(e))
|
||||||
|
.finally(async () => {
|
||||||
|
await db.disconnect()
|
||||||
|
})
|
||||||
19
examples/redwoodjs/api/src/functions/graphql.js
Normal file
19
examples/redwoodjs/api/src/functions/graphql.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import {
|
||||||
|
createGraphQLHandler,
|
||||||
|
makeMergedSchema,
|
||||||
|
makeServices,
|
||||||
|
} from '@redwoodjs/api'
|
||||||
|
import importAll from '@redwoodjs/api/importAll.macro'
|
||||||
|
|
||||||
|
import { db } from 'src/lib/db'
|
||||||
|
|
||||||
|
const schemas = importAll('api', 'graphql')
|
||||||
|
const services = importAll('api', 'services')
|
||||||
|
|
||||||
|
export const handler = createGraphQLHandler({
|
||||||
|
schema: makeMergedSchema({
|
||||||
|
schemas,
|
||||||
|
services: makeServices({ services }),
|
||||||
|
}),
|
||||||
|
db,
|
||||||
|
})
|
||||||
0
packages/now-cli/test/fixtures/unit/extensionless-main/index.js → examples/redwoodjs/api/src/graphql/.keep
Executable file → Normal file
0
packages/now-cli/test/fixtures/unit/extensionless-main/index.js → examples/redwoodjs/api/src/graphql/.keep
Executable file → Normal file
6
examples/redwoodjs/api/src/lib/db.js
Normal file
6
examples/redwoodjs/api/src/lib/db.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// See https://github.com/prisma/prisma2/blob/master/docs/prisma-client-js/api.md#constructor
|
||||||
|
// for options.
|
||||||
|
|
||||||
|
import { PrismaClient } from '@prisma/client'
|
||||||
|
|
||||||
|
export const db = new PrismaClient()
|
||||||
0
packages/now-cli/test/fixtures/unit/files-in-package-ignore/.a.swp → examples/redwoodjs/api/src/services/.keep
Executable file → Normal file
0
packages/now-cli/test/fixtures/unit/files-in-package-ignore/.a.swp → examples/redwoodjs/api/src/services/.keep
Executable file → Normal file
3
examples/redwoodjs/babel.config.js
Normal file
3
examples/redwoodjs/babel.config.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: ['@redwoodjs/core/config/babel-preset'],
|
||||||
|
}
|
||||||
19
examples/redwoodjs/package.json
Normal file
19
examples/redwoodjs/package.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"workspaces": {
|
||||||
|
"packages": [
|
||||||
|
"api",
|
||||||
|
"web"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@redwoodjs/core": "0.15.0"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": "@redwoodjs/eslint-config"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12",
|
||||||
|
"yarn": ">=1.15"
|
||||||
|
}
|
||||||
|
}
|
||||||
9
examples/redwoodjs/prettier.config.js
Normal file
9
examples/redwoodjs/prettier.config.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// https://prettier.io/docs/en/options.html
|
||||||
|
module.exports = {
|
||||||
|
trailingComma: 'es5',
|
||||||
|
bracketSpacing: true,
|
||||||
|
tabWidth: 2,
|
||||||
|
semi: false,
|
||||||
|
singleQuote: true,
|
||||||
|
arrowParens: 'always',
|
||||||
|
}
|
||||||
7
examples/redwoodjs/redwood.toml
Normal file
7
examples/redwoodjs/redwood.toml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[web]
|
||||||
|
port = 8910
|
||||||
|
apiProxyPath = "/api"
|
||||||
|
[api]
|
||||||
|
port = 8911
|
||||||
|
[browser]
|
||||||
|
open = false
|
||||||
1
examples/redwoodjs/web/.babelrc.js
Normal file
1
examples/redwoodjs/web/.babelrc.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = { extends: '../babel.config.js' }
|
||||||
10
examples/redwoodjs/web/jsconfig.json
Normal file
10
examples/redwoodjs/web/jsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"src/*": ["./src/*"]
|
||||||
|
},
|
||||||
|
"jsx": "preserve"
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"]
|
||||||
|
}
|
||||||
15
examples/redwoodjs/web/package.json
Normal file
15
examples/redwoodjs/web/package.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "web",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"browserslist": [
|
||||||
|
"defaults"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@redwoodjs/router": "0.15.0",
|
||||||
|
"@redwoodjs/web": "0.15.0",
|
||||||
|
"prop-types": "^15.7.2",
|
||||||
|
"react": "^16.13.1",
|
||||||
|
"react-dom": "^16.13.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
36
examples/redwoodjs/web/public/README.md
Normal file
36
examples/redwoodjs/web/public/README.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Static Assets
|
||||||
|
Use this folder to add static files directly to your app. All included files and folders will be copied directly into the `/dist` folder (created when Webpack builds for production). They will also be available during development when you run `yarn rw dev`.
|
||||||
|
>Note: files will *not* hot reload while the development server is running. You'll need to manually stop/start to access file changes.
|
||||||
|
|
||||||
|
### Example Use
|
||||||
|
A file like `favicon.png` will be copied to `/dist/favicon.png`. A folder containing a file such as `static-files/my-logo.jpg` will be copied to `/dist/static-files/my-logo.jpg`. These can be referenced in your code directly without any special handling, e.g.
|
||||||
|
```
|
||||||
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||||
|
```
|
||||||
|
and
|
||||||
|
```
|
||||||
|
<img src="/static-files/my-logo.jpg"> alt="Logo" />
|
||||||
|
```
|
||||||
|
|
||||||
|
Behind the scenes, we are using Webpack's ["copy-webpack-plugin"](https://github.com/webpack-contrib/copy-webpack-plugin).
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
Because assets in this folder are bypassing the javascript module system, **this folder should be used sparingly** for assets such as favicons, robots.txt, manifests, libraries incompatible with Webpack, etc.
|
||||||
|
|
||||||
|
In general, it's best to import files directly into a template, page, or component. This allows Webpack to include that file in the bundle, which ensures Webpack will correctly process and move assets into the distribution folder, providing error checks and correct paths along the way.
|
||||||
|
|
||||||
|
### Example Asset Import with Webpack
|
||||||
|
Instead of handling our logo image as a static file per the example above, we can do the following:
|
||||||
|
```
|
||||||
|
import React from "react"
|
||||||
|
import logo from "./my-logo.jpg"
|
||||||
|
|
||||||
|
|
||||||
|
function Header() {
|
||||||
|
return <img src={logo} alt="Logo" />
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Header
|
||||||
|
```
|
||||||
|
|
||||||
|
Behind the scenes, we are using Webpack's ["file-loader"](https://webpack.js.org/loaders/file-loader/) and ["url-loader](https://webpack.js.org/loaders/url-loader/) (for files smaller than 10kb).
|
||||||
BIN
examples/redwoodjs/web/public/favicon.png
Normal file
BIN
examples/redwoodjs/web/public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
2
examples/redwoodjs/web/public/robots.txt
Normal file
2
examples/redwoodjs/web/public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
22
examples/redwoodjs/web/src/Routes.js
Normal file
22
examples/redwoodjs/web/src/Routes.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// In this file, all Page components from 'src/pages` are auto-imported. Nested
|
||||||
|
// directories are supported, and should be uppercase. Each subdirectory will be
|
||||||
|
// prepended onto the component name.
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
//
|
||||||
|
// 'src/pages/HomePage/HomePage.js' -> HomePage
|
||||||
|
// 'src/pages/Admin/BooksPage/BooksPage.js' -> AdminBooksPage
|
||||||
|
|
||||||
|
import { Router, Route } from '@redwoodjs/router'
|
||||||
|
|
||||||
|
const Routes = () => {
|
||||||
|
return (
|
||||||
|
<Router>
|
||||||
|
<Route path="/" page={HomePage} name="home" />
|
||||||
|
<Route path="/about" page={AboutPage} name="about" />
|
||||||
|
<Route notfound page={NotFoundPage} />
|
||||||
|
</Router>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Routes
|
||||||
0
packages/now-cli/test/fixtures/unit/files-in-package-ignore/README → examples/redwoodjs/web/src/components/.keep
Executable file → Normal file
0
packages/now-cli/test/fixtures/unit/files-in-package-ignore/README → examples/redwoodjs/web/src/components/.keep
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user