mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-25 11:49:15 +00:00
Compare commits
34 Commits
@now/frame
...
@now/next@
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2ae497762 | ||
|
|
89989719c2 | ||
|
|
8166b8e1e7 | ||
|
|
1ceeac498c | ||
|
|
1c47d1360d | ||
|
|
ddcd0918e9 | ||
|
|
573b6b8110 | ||
|
|
40039d7f9b | ||
|
|
dcb37e92f5 | ||
|
|
fe7f875549 | ||
|
|
a516ed6fb8 | ||
|
|
ca2c5f85ef | ||
|
|
adb5a01cc0 | ||
|
|
6b4d39ab4d | ||
|
|
07ce3d2e34 | ||
|
|
93ffcf487b | ||
|
|
3631f0f4cf | ||
|
|
b67b5be8a9 | ||
|
|
bf67b1a29e | ||
|
|
ed86473f74 | ||
|
|
399a3cd114 | ||
|
|
d0fd09810a | ||
|
|
f298f2e894 | ||
|
|
569200ae0e | ||
|
|
c91495338d | ||
|
|
7eed5574e0 | ||
|
|
91e6b85cec | ||
|
|
3ae83172ec | ||
|
|
7c51446e5e | ||
|
|
400a5c73e8 | ||
|
|
ec917ace69 | ||
|
|
f5e0afdd7e | ||
|
|
c1b4c62714 | ||
|
|
5e4bdfbe11 |
6
.github/workflows/cancel.yml
vendored
6
.github/workflows/cancel.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: Cancel
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
branches:
|
||||
- '*'
|
||||
- '!master'
|
||||
|
||||
@@ -11,8 +11,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 3
|
||||
steps:
|
||||
- uses: styfle/cancel-workflow-action@0.2.0
|
||||
- uses: styfle/cancel-workflow-action@0.3.1
|
||||
with:
|
||||
workflow_id: 435869
|
||||
workflow_id: 849295, 849296, 849297, 849298
|
||||
access_token: ${{ secrets.GITHUB_WORKFLOW_TOKEN }}
|
||||
|
||||
|
||||
117
.github/workflows/continuous-integration.yml
vendored
117
.github/workflows/continuous-integration.yml
vendored
@@ -1,117 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '!*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test-unit:
|
||||
name: Unit Tests
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
node: [10, 12]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- uses: actions/setup-node@v1
|
||||
- run: yarn install
|
||||
- run: yarn run build
|
||||
- run: yarn run test-lint
|
||||
- run: yarn run test-unit --clean false
|
||||
- name: Upload Artifact
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.node == 12 # only run once
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: test-unit-output
|
||||
path: packages/now-cli/.nyc_output
|
||||
|
||||
test-integration:
|
||||
name: Integration Tests
|
||||
timeout-minutes: 120
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- run: yarn install
|
||||
- run: yarn run build
|
||||
- run: yarn test-integration-once --clean false
|
||||
env:
|
||||
ZEIT_TEAM_TOKEN: ${{ secrets.ZEIT_TEAM_TOKEN }}
|
||||
ZEIT_REGISTRATION_URL: ${{ secrets.ZEIT_REGISTRATION_URL }}
|
||||
|
||||
test-now-cli:
|
||||
name: Now CLI Tests
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
node: [10, 12]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- name: Install Hugo
|
||||
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: yarn install
|
||||
- run: yarn run build
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: yarn test-integration --clean false
|
||||
env:
|
||||
ZEIT_TEAM_TOKEN: ${{ secrets.ZEIT_TEAM_TOKEN }}
|
||||
ZEIT_REGISTRATION_URL: ${{ secrets.ZEIT_REGISTRATION_URL }}
|
||||
|
||||
test-now-dev:
|
||||
name: "`now dev` Tests"
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
node: [10, 12]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- name: Install Hugo
|
||||
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: yarn install
|
||||
- run: yarn run build
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: yarn test-integration-now-dev --clean false
|
||||
|
||||
coverage:
|
||||
name: Coverage
|
||||
timeout-minutes: 5
|
||||
needs: [test-unit, test-now-cli, test-now-dev, test-integration]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: test-unit-output
|
||||
path: packages/now-cli/.nyc_output
|
||||
- run: yarn install
|
||||
- run: yarn workspace now run coverage
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
36
.github/workflows/test-integration-cli.yml
vendored
Normal file
36
.github/workflows/test-integration-cli.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: CLI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '!*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: CLI
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
node: [10, 12]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- name: Install Hugo
|
||||
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: yarn install
|
||||
- run: yarn run build
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: yarn test-integration-cli --clean false
|
||||
env:
|
||||
ZEIT_TEAM_TOKEN: ${{ secrets.ZEIT_TEAM_TOKEN }}
|
||||
ZEIT_REGISTRATION_URL: ${{ secrets.ZEIT_REGISTRATION_URL }}
|
||||
33
.github/workflows/test-integration-dev.yml
vendored
Normal file
33
.github/workflows/test-integration-dev.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Dev
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '!*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Dev
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
node: [10, 12]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- name: Install Hugo
|
||||
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: yarn install
|
||||
- run: yarn run build
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: yarn test-integration-dev --clean false
|
||||
25
.github/workflows/test-integration-once.yml
vendored
Normal file
25
.github/workflows/test-integration-once.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: E2E
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '!*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: E2E
|
||||
timeout-minutes: 120
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- run: yarn install
|
||||
- run: yarn run build
|
||||
- run: yarn test-integration-once --clean false
|
||||
env:
|
||||
ZEIT_TEAM_TOKEN: ${{ secrets.ZEIT_TEAM_TOKEN }}
|
||||
ZEIT_REGISTRATION_URL: ${{ secrets.ZEIT_REGISTRATION_URL }}
|
||||
33
.github/workflows/test-unit.yml
vendored
Normal file
33
.github/workflows/test-unit.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Unit
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '!*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Unit
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
node: [10, 12]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch origin master --depth=10
|
||||
- run: git fetch origin ${{ github.ref }} --depth=10
|
||||
- uses: actions/setup-node@v1
|
||||
- run: yarn install
|
||||
- run: yarn run build
|
||||
- run: yarn run test-lint
|
||||
- run: yarn run test-unit --clean false
|
||||
- run: yarn workspace now run coverage
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.node == 12 # only run once
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
6
examples/dojo/.dojorc
Normal file
6
examples/dojo/.dojorc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"build-app": {},
|
||||
"test-intern": {},
|
||||
"create-app": {},
|
||||
"create-widget": {}
|
||||
}
|
||||
4
examples/dojo/.gitignore
vendored
Normal file
4
examples/dojo/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules/
|
||||
_build/
|
||||
output/
|
||||
.cert/
|
||||
25
examples/dojo/README.md
Normal file
25
examples/dojo/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Dojo Example
|
||||
|
||||
This directory is a brief example of a [Dojo](https://dojo.io) site that can be deployed with ZEIT Now and zero configuration.
|
||||
|
||||
## Deploy Your Own
|
||||
|
||||
Deploy your own Dojo project with ZEIT Now.
|
||||
|
||||
[](https://zeit.co/import/project?template=https://github.com/zeit/now-examples/tree/master/dojo)
|
||||
|
||||
### How We Created This Example
|
||||
|
||||
To get started with Dojo on Now, you can use the [Dojo CLI](https://github.com/dojo/cli) to initialize the project:
|
||||
|
||||
```shell
|
||||
$ now init dojo
|
||||
```
|
||||
|
||||
### Deploying From Your Terminal
|
||||
|
||||
Once initialized, you can deploy the Dojo example with just a single command:
|
||||
|
||||
```shell
|
||||
$ now
|
||||
```
|
||||
26
examples/dojo/package.json
Normal file
26
examples/dojo/package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "dojo",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"dev": "dojo build --mode dev --watch --serve",
|
||||
"build": "dojo build --mode dist",
|
||||
"build:dev": "dojo build --mode dev",
|
||||
"test": "dojo test",
|
||||
"test:unit": "dojo build --mode unit && dojo test --unit --config local",
|
||||
"test:functional": "dojo build --mode functional && dojo test --functional --config local",
|
||||
"test:all": "dojo build --mode unit && dojo build --mode functional && dojo test --all --config local"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dojo/framework": "^6.0.0",
|
||||
"@dojo/themes": "^6.0.0",
|
||||
"@dojo/widgets": "^6.0.0",
|
||||
"tslib": "~1.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dojo/cli": "^6.0.0",
|
||||
"@dojo/cli-build-app": "^6.0.0",
|
||||
"@dojo/cli-test-intern": "^6.0.0",
|
||||
"@types/node": "~9.6.5",
|
||||
"typescript": "~3.4.5"
|
||||
}
|
||||
}
|
||||
3
examples/dojo/src/App.m.css
Normal file
3
examples/dojo/src/App.m.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.root {
|
||||
|
||||
}
|
||||
1
examples/dojo/src/App.m.css.d.ts
vendored
Normal file
1
examples/dojo/src/App.m.css.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const root: string;
|
||||
27
examples/dojo/src/App.ts
Normal file
27
examples/dojo/src/App.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { create, v, w } from '@dojo/framework/core/vdom';
|
||||
import theme from '@dojo/framework/core/middleware/theme';
|
||||
import Outlet from '@dojo/framework/routing/Outlet';
|
||||
import dojo from '@dojo/themes/dojo';
|
||||
|
||||
import Menu from './widgets/Menu';
|
||||
import Home from './widgets/Home';
|
||||
import About from './widgets/About';
|
||||
import Profile from './widgets/Profile';
|
||||
|
||||
import * as css from './App.m.css';
|
||||
|
||||
const factory = create({ theme });
|
||||
|
||||
export default factory(function App({ middleware: { theme } }) {
|
||||
if (!theme.get()) {
|
||||
theme.set(dojo);
|
||||
}
|
||||
return v('div', { classes: [css.root] }, [
|
||||
w(Menu, {}),
|
||||
v('div', [
|
||||
w(Outlet, { key: 'home', id: 'home', renderer: () => w(Home, {}) }),
|
||||
w(Outlet, { key: 'about', id: 'about', renderer: () => w(About, {}) }),
|
||||
w(Outlet, { key: 'profile', id: 'profile', renderer: () => w(Profile, { username: 'Dojo User' }) })
|
||||
])
|
||||
]);
|
||||
});
|
||||
11
examples/dojo/src/index.html
Normal file
11
examples/dojo/src/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>dojo</title>
|
||||
<meta name="theme-color" content="#222127">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
6
examples/dojo/src/main.css
Normal file
6
examples/dojo/src/main.css
Normal file
@@ -0,0 +1,6 @@
|
||||
/* Put your styles and imports here */
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
13
examples/dojo/src/main.ts
Normal file
13
examples/dojo/src/main.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import renderer, { w } from '@dojo/framework/core/vdom';
|
||||
import Registry from '@dojo/framework/core/Registry';
|
||||
import { registerRouterInjector } from '@dojo/framework/routing/RouterInjector';
|
||||
import '@dojo/themes/dojo/index.css';
|
||||
|
||||
import routes from './routes';
|
||||
import App from './App';
|
||||
|
||||
const registry = new Registry();
|
||||
registerRouterInjector(routes, registry);
|
||||
|
||||
const r = renderer(() => w(App, {}));
|
||||
r.mount({ registry });
|
||||
15
examples/dojo/src/routes.ts
Normal file
15
examples/dojo/src/routes.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export default [
|
||||
{
|
||||
path: 'home',
|
||||
outlet: 'home',
|
||||
defaultRoute: true
|
||||
},
|
||||
{
|
||||
path: 'about',
|
||||
outlet: 'about'
|
||||
},
|
||||
{
|
||||
path: 'profile',
|
||||
outlet: 'profile'
|
||||
}
|
||||
];
|
||||
9
examples/dojo/src/widgets/About.ts
Normal file
9
examples/dojo/src/widgets/About.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { v, create } from '@dojo/framework/core/vdom';
|
||||
|
||||
import * as css from './styles/About.m.css';
|
||||
|
||||
const factory = create();
|
||||
|
||||
export default factory(function Profile() {
|
||||
return v('h1', { classes: [css.root] }, ['About Page']);
|
||||
});
|
||||
9
examples/dojo/src/widgets/Home.ts
Normal file
9
examples/dojo/src/widgets/Home.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { v, create } from '@dojo/framework/core/vdom';
|
||||
|
||||
import * as css from './styles/Home.m.css';
|
||||
|
||||
const factory = create();
|
||||
|
||||
export default factory(function Profile() {
|
||||
return v('h1', { classes: [css.root] }, ['Home Page']);
|
||||
});
|
||||
39
examples/dojo/src/widgets/Menu.ts
Normal file
39
examples/dojo/src/widgets/Menu.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { create, w } from '@dojo/framework/core/vdom';
|
||||
import Link from '@dojo/framework/routing/ActiveLink';
|
||||
import Toolbar from '@dojo/widgets/toolbar';
|
||||
|
||||
import * as css from './styles/Menu.m.css';
|
||||
|
||||
const factory = create();
|
||||
|
||||
export default factory(function Menu() {
|
||||
return w(Toolbar, { heading: 'My Dojo App!', collapseWidth: 600 }, [
|
||||
w(
|
||||
Link,
|
||||
{
|
||||
to: 'home',
|
||||
classes: [css.link],
|
||||
activeClasses: [css.selected]
|
||||
},
|
||||
['Home']
|
||||
),
|
||||
w(
|
||||
Link,
|
||||
{
|
||||
to: 'about',
|
||||
classes: [css.link],
|
||||
activeClasses: [css.selected]
|
||||
},
|
||||
['About']
|
||||
),
|
||||
w(
|
||||
Link,
|
||||
{
|
||||
to: 'profile',
|
||||
classes: [css.link],
|
||||
activeClasses: [css.selected]
|
||||
},
|
||||
['Profile']
|
||||
)
|
||||
]);
|
||||
});
|
||||
14
examples/dojo/src/widgets/Profile.ts
Normal file
14
examples/dojo/src/widgets/Profile.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { v, create } from '@dojo/framework/core/vdom';
|
||||
|
||||
import * as css from './styles/Profile.m.css';
|
||||
|
||||
export interface ProfileProperties {
|
||||
username: string;
|
||||
}
|
||||
|
||||
const factory = create().properties<ProfileProperties>();
|
||||
|
||||
export default factory(function Profile({ properties }) {
|
||||
const { username } = properties();
|
||||
return v('h1', { classes: [css.root] }, [`Welcome ${username}!`]);
|
||||
});
|
||||
3
examples/dojo/src/widgets/styles/About.m.css
Normal file
3
examples/dojo/src/widgets/styles/About.m.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.root {
|
||||
|
||||
}
|
||||
1
examples/dojo/src/widgets/styles/About.m.css.d.ts
vendored
Normal file
1
examples/dojo/src/widgets/styles/About.m.css.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const root: string;
|
||||
3
examples/dojo/src/widgets/styles/Home.m.css
Normal file
3
examples/dojo/src/widgets/styles/Home.m.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.root {
|
||||
|
||||
}
|
||||
1
examples/dojo/src/widgets/styles/Home.m.css.d.ts
vendored
Normal file
1
examples/dojo/src/widgets/styles/Home.m.css.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const root: string;
|
||||
23
examples/dojo/src/widgets/styles/Menu.m.css
Normal file
23
examples/dojo/src/widgets/styles/Menu.m.css
Normal file
@@ -0,0 +1,23 @@
|
||||
.root {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.link:hover {
|
||||
color: #4db3ff;
|
||||
background-color:#ccddee;
|
||||
}
|
||||
|
||||
.link {
|
||||
min-width: 140px;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
padding: 18px;
|
||||
color: black;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.selected {
|
||||
color: darkorange;
|
||||
}
|
||||
3
examples/dojo/src/widgets/styles/Menu.m.css.d.ts
vendored
Normal file
3
examples/dojo/src/widgets/styles/Menu.m.css.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export const root: string;
|
||||
export const link: string;
|
||||
export const selected: string;
|
||||
3
examples/dojo/src/widgets/styles/Profile.m.css
Normal file
3
examples/dojo/src/widgets/styles/Profile.m.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.root {
|
||||
|
||||
}
|
||||
1
examples/dojo/src/widgets/styles/Profile.m.css.d.ts
vendored
Normal file
1
examples/dojo/src/widgets/styles/Profile.m.css.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const root: string;
|
||||
1
examples/dojo/tests/functional/all.ts
Normal file
1
examples/dojo/tests/functional/all.ts
Normal file
@@ -0,0 +1 @@
|
||||
import './main';
|
||||
1
examples/dojo/tests/functional/main.ts
Normal file
1
examples/dojo/tests/functional/main.ts
Normal file
@@ -0,0 +1 @@
|
||||
/* Write your app tests here */
|
||||
46
examples/dojo/tests/unit/App.ts
Normal file
46
examples/dojo/tests/unit/App.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
const { describe, it } = intern.getInterface('bdd');
|
||||
import harness from '@dojo/framework/testing/harness';
|
||||
import { v, w } from '@dojo/framework/core/vdom';
|
||||
import Outlet from '@dojo/framework/routing/Outlet';
|
||||
|
||||
import Menu from '../../src/widgets/Menu';
|
||||
import Home from '../../src/widgets/Home';
|
||||
import About from '../../src/widgets/About';
|
||||
import Profile from '../../src/widgets/Profile';
|
||||
|
||||
import App from '../../src/App';
|
||||
import * as css from '../../src/App.m.css';
|
||||
|
||||
describe('App', () => {
|
||||
it('default renders correctly', () => {
|
||||
const h = harness(() => w(App, {}));
|
||||
h.expect(() =>
|
||||
v('div', { classes: [css.root] }, [
|
||||
w(Menu, {}),
|
||||
v('div', [
|
||||
w(Outlet, { key: 'home', id: 'home', renderer: () => w(Home, {}) }),
|
||||
w(Outlet, { key: 'about', id: 'about', renderer: () => w(About, {}) }),
|
||||
w(Outlet, { key: 'profile', id: 'profile', renderer: () => w(Profile, { username: 'Dojo User' }) })
|
||||
])
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
it('home outlet renderer', () => {
|
||||
const h = harness(() => w(App, {}));
|
||||
const renderer = h.trigger('@home', 'renderer');
|
||||
h.expect(() => w(Home, {}), () => renderer);
|
||||
});
|
||||
|
||||
it('about outlet renderer', () => {
|
||||
const h = harness(() => w(App, {}));
|
||||
const renderer = h.trigger('@about', 'renderer');
|
||||
h.expect(() => w(About, {}), () => renderer);
|
||||
});
|
||||
|
||||
it('profile outlet renderer', () => {
|
||||
const h = harness(() => w(App, {}));
|
||||
const renderer = h.trigger('@profile', 'renderer');
|
||||
h.expect(() => w(Profile, { username: 'Dojo User' }), () => renderer);
|
||||
});
|
||||
});
|
||||
2
examples/dojo/tests/unit/all.ts
Normal file
2
examples/dojo/tests/unit/all.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import './App';
|
||||
import './widgets/all';
|
||||
1
examples/dojo/tests/unit/main.ts
Normal file
1
examples/dojo/tests/unit/main.ts
Normal file
@@ -0,0 +1 @@
|
||||
/* Write your app tests here */
|
||||
13
examples/dojo/tests/unit/widgets/About.ts
Normal file
13
examples/dojo/tests/unit/widgets/About.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
const { describe, it } = intern.getInterface('bdd');
|
||||
import harness from '@dojo/framework/testing/harness';
|
||||
import { w, v } from '@dojo/framework/core/vdom';
|
||||
|
||||
import About from '../../../src/widgets/About';
|
||||
import * as css from '../../../src/widgets/styles/About.m.css';
|
||||
|
||||
describe('About', () => {
|
||||
it('default renders correctly', () => {
|
||||
const h = harness(() => w(About, {}));
|
||||
h.expect(() => v('h1', { classes: [css.root] }, ['About Page']));
|
||||
});
|
||||
});
|
||||
13
examples/dojo/tests/unit/widgets/Home.ts
Normal file
13
examples/dojo/tests/unit/widgets/Home.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
const { describe, it } = intern.getInterface('bdd');
|
||||
import harness from '@dojo/framework/testing/harness';
|
||||
import { w, v } from '@dojo/framework/core/vdom';
|
||||
|
||||
import Home from '../../../src/widgets/Home';
|
||||
import * as css from '../../../src/widgets/styles/Home.m.css';
|
||||
|
||||
describe('Home', () => {
|
||||
it('default renders correctly', () => {
|
||||
const h = harness(() => w(Home, {}));
|
||||
h.expect(() => v('h1', { classes: [css.root] }, ['Home Page']));
|
||||
});
|
||||
});
|
||||
45
examples/dojo/tests/unit/widgets/Menu.ts
Normal file
45
examples/dojo/tests/unit/widgets/Menu.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
const { describe, it } = intern.getInterface('bdd');
|
||||
import harness from '@dojo/framework/testing/harness';
|
||||
import { w } from '@dojo/framework/core/vdom';
|
||||
import Link from '@dojo/framework/routing/ActiveLink';
|
||||
import Toolbar from '@dojo/widgets/toolbar';
|
||||
|
||||
import Menu from '../../../src/widgets/Menu';
|
||||
import * as css from '../../../src/widgets/styles/Menu.m.css';
|
||||
|
||||
describe('Menu', () => {
|
||||
it('default renders correctly', () => {
|
||||
const h = harness(() => w(Menu, {}));
|
||||
h.expect(() =>
|
||||
w(Toolbar, { heading: 'My Dojo App!', collapseWidth: 600 }, [
|
||||
w(
|
||||
Link,
|
||||
{
|
||||
to: 'home',
|
||||
classes: [css.link],
|
||||
activeClasses: [css.selected]
|
||||
},
|
||||
['Home']
|
||||
),
|
||||
w(
|
||||
Link,
|
||||
{
|
||||
to: 'about',
|
||||
classes: [css.link],
|
||||
activeClasses: [css.selected]
|
||||
},
|
||||
['About']
|
||||
),
|
||||
w(
|
||||
Link,
|
||||
{
|
||||
to: 'profile',
|
||||
classes: [css.link],
|
||||
activeClasses: [css.selected]
|
||||
},
|
||||
['Profile']
|
||||
)
|
||||
])
|
||||
);
|
||||
});
|
||||
});
|
||||
13
examples/dojo/tests/unit/widgets/Profile.ts
Normal file
13
examples/dojo/tests/unit/widgets/Profile.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
const { describe, it } = intern.getInterface('bdd');
|
||||
import harness from '@dojo/framework/testing/harness';
|
||||
import { w, v } from '@dojo/framework/core/vdom';
|
||||
|
||||
import Profile from '../../../src/widgets/Profile';
|
||||
import * as css from '../../../src/widgets/styles/Profile.m.css';
|
||||
|
||||
describe('Profile', () => {
|
||||
it('default renders correctly', () => {
|
||||
const h = harness(() => w(Profile, { username: 'Dojo User' }));
|
||||
h.expect(() => v('h1', { classes: [css.root] }, ['Welcome Dojo User!']));
|
||||
});
|
||||
});
|
||||
4
examples/dojo/tests/unit/widgets/all.ts
Normal file
4
examples/dojo/tests/unit/widgets/all.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import './About';
|
||||
import './Home';
|
||||
import './Profile';
|
||||
import './Menu';
|
||||
31
examples/dojo/tsconfig.json
Normal file
31
examples/dojo/tsconfig.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": false,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react",
|
||||
"jsxFactory": "tsx",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es5",
|
||||
"es2015.promise",
|
||||
"es2015.iterable",
|
||||
"es2015.symbol",
|
||||
"es2015.symbol.wellknown"
|
||||
],
|
||||
"module": "umd",
|
||||
"moduleResolution": "node",
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "_build/",
|
||||
"removeComments": false,
|
||||
"importHelpers": true,
|
||||
"downlevelIteration": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "es5",
|
||||
"types": [ "intern" ]
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*.ts",
|
||||
"./tests/**/*.ts"
|
||||
]
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
"react-router": "^5.1.2",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"react-scripts": "3.3.0",
|
||||
"typescript": "3.7.4"
|
||||
"typescript": "3.8.3"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"start": "next start"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "9.2.2",
|
||||
"react": "16.13.0",
|
||||
"react-dom": "16.13.0"
|
||||
"next": "^9.3.3",
|
||||
"react": "^16.13.0",
|
||||
"react-dom": "^16.13.0"
|
||||
}
|
||||
}
|
||||
|
||||
4
now.json
4
now.json
@@ -9,10 +9,6 @@
|
||||
"destination": "/api/frameworks"
|
||||
}
|
||||
],
|
||||
"env": {
|
||||
"GITHUB_ACCESS_TOKEN": "@now-api-examples-github-token",
|
||||
"SENTRY_DSN": "@sentry-product-dsn"
|
||||
},
|
||||
"github": {
|
||||
"silent": true,
|
||||
"autoJobCancelation": true
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
"build": "node utils/run.js build all",
|
||||
"test-lint": "node utils/run.js test-lint",
|
||||
"test-unit": "node utils/run.js test-unit",
|
||||
"test-integration": "node utils/run.js test-integration",
|
||||
"test-integration-cli": "node utils/run.js test-integration-cli",
|
||||
"test-integration-once": "node utils/run.js test-integration-once",
|
||||
"test-integration-now-dev": "node utils/run.js test-integration-now-dev",
|
||||
"test-integration-dev": "node utils/run.js test-integration-dev",
|
||||
"lint": "eslint . --ext .ts,.js"
|
||||
},
|
||||
"lint-staged": {
|
||||
@@ -59,9 +59,6 @@
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"resolutions": {
|
||||
"signal-exit": "TooTallNate/signal-exit#update/sighub-to-sigint-on-windows"
|
||||
},
|
||||
"prettier": {
|
||||
"trailingComma": "es5",
|
||||
"singleQuote": true
|
||||
|
||||
@@ -195,6 +195,37 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Dojo",
|
||||
"slug": "dojo",
|
||||
"demo": "https://dojo.now-examples.now.sh",
|
||||
"logo": "https://raw.githubusercontent.com/zeit/now/master/packages/frameworks/logos/dojo.svg",
|
||||
"tagline": "Dojo is a modern progressive, TypeScript first framework.",
|
||||
"description": "A Dojo app, created with the Dojo CLI's cli-create-app command.",
|
||||
"website": "https://dojo.io",
|
||||
"detectors": {
|
||||
"some": [
|
||||
{
|
||||
"path": "package.json",
|
||||
"matchContent": "\"(dev)?(d|D)ependencies\":\\s*{[^}]*\"@dojo\\/framework\":\\s*\".+?\"[^}]*}"
|
||||
},
|
||||
{
|
||||
"path": ".dojorc"
|
||||
}
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"buildCommand": {
|
||||
"placeholder": "`npm run build` or `dojo build`"
|
||||
},
|
||||
"devCommand": {
|
||||
"value": "dojo build -m dev -w -s -p $PORT"
|
||||
},
|
||||
"outputDirectory": {
|
||||
"value": "output/dist"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Ember",
|
||||
"slug": "ember",
|
||||
|
||||
BIN
packages/frameworks/logos/dojo.png
Normal file
BIN
packages/frameworks/logos/dojo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/frameworks",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.13-canary.0",
|
||||
"main": "frameworks.json",
|
||||
"license": "UNLICENSED"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/build-utils",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1-canary.0",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.js",
|
||||
|
||||
@@ -6,13 +6,18 @@ import spawn from 'cross-spawn';
|
||||
import { SpawnOptions } from 'child_process';
|
||||
import { deprecate } from 'util';
|
||||
import { cpus } from 'os';
|
||||
import { NowBuildError } from '../errors';
|
||||
import { Meta, PackageJson, NodeVersion, Config } from '../types';
|
||||
import { getSupportedNodeVersion, getLatestNodeVersion } from './node-version';
|
||||
|
||||
interface SpawnOptionsExtended extends SpawnOptions {
|
||||
prettyCommand?: string;
|
||||
}
|
||||
|
||||
export function spawnAsync(
|
||||
command: string,
|
||||
args: string[],
|
||||
opts: SpawnOptions = {}
|
||||
opts: SpawnOptionsExtended = {}
|
||||
) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const stderrLogs: Buffer[] = [];
|
||||
@@ -29,12 +34,18 @@ export function spawnAsync(
|
||||
return resolve();
|
||||
}
|
||||
|
||||
const errorLogs = stderrLogs.map(line => line.toString()).join('');
|
||||
if (opts.stdio !== 'inherit') {
|
||||
reject(new Error(`Exited with ${code || signal}\n${errorLogs}`));
|
||||
} else {
|
||||
reject(new Error(`Exited with ${code || signal}`));
|
||||
}
|
||||
const cmd = opts.prettyCommand
|
||||
? `Command "${opts.prettyCommand}"`
|
||||
: 'Command';
|
||||
reject(
|
||||
new NowBuildError({
|
||||
code: `NOW_BUILD_UTILS_SPAWN_${code || signal}`,
|
||||
message:
|
||||
opts.stdio === 'inherit'
|
||||
? `${cmd} exited with ${code || signal}`
|
||||
: stderrLogs.map(line => line.toString()).join(''),
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -42,7 +53,7 @@ export function spawnAsync(
|
||||
export function execAsync(
|
||||
command: string,
|
||||
args: string[],
|
||||
opts: SpawnOptions = {}
|
||||
opts: SpawnOptionsExtended = {}
|
||||
) {
|
||||
return new Promise<{ stdout: string; stderr: string; code: number }>(
|
||||
(resolve, reject) => {
|
||||
@@ -64,10 +75,15 @@ export function execAsync(
|
||||
child.on('error', reject);
|
||||
child.on('close', (code, signal) => {
|
||||
if (code !== 0) {
|
||||
const cmd = opts.prettyCommand
|
||||
? `Command "${opts.prettyCommand}"`
|
||||
: 'Command';
|
||||
|
||||
return reject(
|
||||
new Error(
|
||||
`Program "${command}" exited with non-zero exit code ${code} ${signal}.`
|
||||
)
|
||||
new NowBuildError({
|
||||
code: `NOW_BUILD_UTILS_EXEC_${code || signal}`,
|
||||
message: `${cmd} exited with ${code || signal}`,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,18 +98,20 @@ export function execAsync(
|
||||
}
|
||||
|
||||
export function spawnCommand(command: string, options: SpawnOptions = {}) {
|
||||
const opts = { ...options, prettyCommand: command };
|
||||
if (process.platform === 'win32') {
|
||||
return spawn('cmd.exe', ['/C', command], options);
|
||||
return spawn('cmd.exe', ['/C', command], opts);
|
||||
}
|
||||
|
||||
return spawn('sh', ['-c', command], options);
|
||||
return spawn('sh', ['-c', command], opts);
|
||||
}
|
||||
|
||||
export async function execCommand(command: string, options: SpawnOptions = {}) {
|
||||
const opts = { ...options, prettyCommand: command };
|
||||
if (process.platform === 'win32') {
|
||||
await spawnAsync('cmd.exe', ['/C', command], options);
|
||||
await spawnAsync('cmd.exe', ['/C', command], opts);
|
||||
} else {
|
||||
await spawnAsync('sh', ['-c', command], options);
|
||||
await spawnAsync('sh', ['-c', command], opts);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -120,9 +138,11 @@ export async function runShellScript(
|
||||
assert(path.isAbsolute(fsPath));
|
||||
const destPath = path.dirname(fsPath);
|
||||
await chmodPlusX(fsPath);
|
||||
await spawnAsync(`./${path.basename(fsPath)}`, args, {
|
||||
cwd: destPath,
|
||||
const command = `./${path.basename(fsPath)}`;
|
||||
await spawnAsync(command, args, {
|
||||
...spawnOpts,
|
||||
cwd: destPath,
|
||||
prettyCommand: command,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@@ -249,7 +269,7 @@ export async function runNpmInstall(
|
||||
debug(`Installing to ${destPath}`);
|
||||
|
||||
const { hasPackageLockJson } = await scanParentDirs(destPath);
|
||||
const opts: SpawnOptions = { cwd: destPath, ...spawnOpts };
|
||||
const opts: SpawnOptionsExtended = { cwd: destPath, ...spawnOpts };
|
||||
const env = opts.env ? { ...opts.env } : { ...process.env };
|
||||
delete env.NODE_ENV;
|
||||
opts.env = env;
|
||||
@@ -258,11 +278,13 @@ export async function runNpmInstall(
|
||||
let commandArgs: string[];
|
||||
|
||||
if (hasPackageLockJson) {
|
||||
opts.prettyCommand = 'npm install';
|
||||
command = 'npm';
|
||||
commandArgs = args
|
||||
.filter(a => a !== '--prefer-offline')
|
||||
.concat(['install', '--no-audit', '--unsafe-perm']);
|
||||
} else {
|
||||
opts.prettyCommand = 'yarn install';
|
||||
command = 'yarn';
|
||||
commandArgs = args.concat(['install', '--ignore-engines']);
|
||||
}
|
||||
@@ -285,7 +307,7 @@ export async function runBundleInstall(
|
||||
}
|
||||
|
||||
assert(path.isAbsolute(destPath));
|
||||
const opts = { cwd: destPath, ...spawnOpts };
|
||||
const opts = { ...spawnOpts, cwd: destPath, prettyCommand: 'bundle install' };
|
||||
|
||||
await spawnAsync(
|
||||
'bundle',
|
||||
@@ -313,7 +335,7 @@ export async function runPipInstall(
|
||||
}
|
||||
|
||||
assert(path.isAbsolute(destPath));
|
||||
const opts = { cwd: destPath, ...spawnOpts };
|
||||
const opts = { ...spawnOpts, cwd: destPath, prettyCommand: 'pip3 install' };
|
||||
|
||||
await spawnAsync(
|
||||
'pip3',
|
||||
@@ -340,18 +362,22 @@ export async function runPackageJsonScript(
|
||||
);
|
||||
if (!hasScript) return false;
|
||||
|
||||
const opts = { cwd: destPath, ...spawnOpts };
|
||||
|
||||
if (hasPackageLockJson) {
|
||||
console.log(`Running "npm run ${scriptName}"`);
|
||||
await spawnAsync('npm', ['run', scriptName], opts);
|
||||
const prettyCommand = `npm run ${scriptName}`;
|
||||
console.log(`Running "${prettyCommand}"`);
|
||||
await spawnAsync('npm', ['run', scriptName], {
|
||||
...spawnOpts,
|
||||
cwd: destPath,
|
||||
prettyCommand,
|
||||
});
|
||||
} else {
|
||||
console.log(`Running "yarn run ${scriptName}"`);
|
||||
await spawnAsync(
|
||||
'yarn',
|
||||
['--ignore-engines', '--cwd', destPath, 'run', scriptName],
|
||||
opts
|
||||
);
|
||||
const prettyCommand = `yarn run ${scriptName}`;
|
||||
console.log(`Running "${prettyCommand}"`);
|
||||
await spawnAsync('yarn', ['--ignore-engines', 'run', scriptName], {
|
||||
...spawnOpts,
|
||||
cwd: destPath,
|
||||
prettyCommand,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "now",
|
||||
"version": "17.1.2-canary.3",
|
||||
"version": "17.1.2-canary.8",
|
||||
"preferGlobal": true,
|
||||
"license": "Apache-2.0",
|
||||
"description": "The command-line interface for Now",
|
||||
@@ -13,9 +13,9 @@
|
||||
"scripts": {
|
||||
"preinstall": "node ./scripts/preinstall.js",
|
||||
"test-unit": "nyc ava test/unit.js test/dev-builder.unit.js test/dev-router.unit.js test/dev-server.unit.js --serial --fail-fast --verbose",
|
||||
"test-integration": "ava test/integration.js --serial --fail-fast",
|
||||
"test-integration-cli": "ava test/integration.js --serial --fail-fast",
|
||||
"test-integration-v1": "ava test/integration-v1.js --serial --fail-fast",
|
||||
"test-integration-now-dev": "ava test/dev/integration.js --serial --fail-fast --verbose",
|
||||
"test-integration-dev": "ava test/dev/integration.js --serial --fail-fast --verbose",
|
||||
"prepublishOnly": "yarn build",
|
||||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
|
||||
"build": "ts-node ./scripts/build.ts",
|
||||
@@ -141,7 +141,7 @@
|
||||
"micro": "9.1.2",
|
||||
"mime-types": "2.1.24",
|
||||
"minimatch": "3.0.4",
|
||||
"mri": "1.1.0",
|
||||
"mri": "1.1.5",
|
||||
"ms": "2.1.2",
|
||||
"node-fetch": "2.6.0",
|
||||
"npm-package-arg": "6.1.0",
|
||||
|
||||
@@ -46,7 +46,7 @@ export const latestHelp = () => `
|
||||
)} Path to the global ${'`.now`'} directory
|
||||
-d, --debug Debug mode [off]
|
||||
-f, --force Force a new deployment even if nothing has changed
|
||||
--force-with-cache Force a new deployment even if nothing has changed but retain build cache
|
||||
--with-cache Retain build cache when using "--force"
|
||||
-t ${chalk.underline('TOKEN')}, --token=${chalk.underline(
|
||||
'TOKEN'
|
||||
)} Login token
|
||||
@@ -98,7 +98,7 @@ export const latestHelp = () => `
|
||||
|
||||
export const latestArgs = {
|
||||
'--force': Boolean,
|
||||
'--force-with-cache': Boolean,
|
||||
'--with-cache': Boolean,
|
||||
'--public': Boolean,
|
||||
'--no-clipboard': Boolean,
|
||||
'--env': [String],
|
||||
|
||||
@@ -506,7 +506,7 @@ export default async function main(
|
||||
env: deploymentEnv,
|
||||
build: { env: deploymentBuildEnv },
|
||||
forceNew: argv['--force'],
|
||||
forceNewWithCache: argv['--force-with-cache'],
|
||||
withCache: argv['--with-cache'],
|
||||
quiet,
|
||||
wantsPublic: argv['--public'] || localConfig.public,
|
||||
isFile,
|
||||
@@ -666,7 +666,7 @@ export default async function main(
|
||||
if (err instanceof BuildError) {
|
||||
output.error('Build failed');
|
||||
output.error(
|
||||
`Check your logs at ${now.url}/_logs or run ${code(
|
||||
`Check your logs at https://${now.url}/_logs or run ${code(
|
||||
`now logs ${now.url}`,
|
||||
{
|
||||
// Backticks are interpreted as part of the URL, causing CMD+Click
|
||||
|
||||
@@ -93,7 +93,7 @@ let paths: string[];
|
||||
|
||||
// Options
|
||||
let forceNew: boolean;
|
||||
let forceNewWithCache: boolean;
|
||||
let withCache: boolean;
|
||||
let deploymentName: string;
|
||||
let sessionAffinity: string;
|
||||
let log: any;
|
||||
@@ -239,7 +239,7 @@ export default async function main(
|
||||
|
||||
// Options
|
||||
forceNew = argv.force;
|
||||
forceNewWithCache = argv['force-with-cache'];
|
||||
withCache = argv['with-cache'];
|
||||
deploymentName = argv.name;
|
||||
sessionAffinity = argv['session-affinity'];
|
||||
debugEnabled = argv.debug;
|
||||
@@ -743,7 +743,7 @@ async function sync({
|
||||
meta: metadata,
|
||||
followSymlinks,
|
||||
forceNew,
|
||||
forceNewWithCache,
|
||||
withCache,
|
||||
forwardNpm,
|
||||
quiet,
|
||||
scale,
|
||||
|
||||
@@ -110,7 +110,7 @@ const main = async ctx => {
|
||||
}
|
||||
|
||||
try {
|
||||
await run({ output, token, contextName, currentTeam });
|
||||
await run({ output, token, contextName, currentTeam, ctx });
|
||||
} catch (err) {
|
||||
handleError(err);
|
||||
exit(1);
|
||||
@@ -126,7 +126,7 @@ export default async ctx => {
|
||||
}
|
||||
};
|
||||
|
||||
async function run({ output, token, contextName, currentTeam }) {
|
||||
async function run({ output, token, contextName, currentTeam, ctx }) {
|
||||
const secrets = new NowSecrets({ apiUrl, token, debug, currentTeam });
|
||||
const args = argv._.slice(1);
|
||||
const start = Date.now();
|
||||
@@ -260,7 +260,28 @@ async function run({ output, token, contextName, currentTeam }) {
|
||||
return exit(1);
|
||||
}
|
||||
|
||||
const [name, value] = args;
|
||||
const [name, parsedValue] = args;
|
||||
const [originalName, originalValue] = ctx.argv.slice(-2);
|
||||
|
||||
let value = parsedValue;
|
||||
if (
|
||||
name === originalName &&
|
||||
typeof parsedValue === 'boolean' &&
|
||||
parsedValue !== originalValue
|
||||
) {
|
||||
// Corner case where `mri` transforms the secret value into a boolean because
|
||||
// it starts with a `-` so it thinks its a flag, so we use the original value instead.
|
||||
value = originalValue;
|
||||
}
|
||||
|
||||
if (typeof value === 'boolean') {
|
||||
const example = chalk.cyan(`$ now secret add -- "${name}"`);
|
||||
console.log(
|
||||
`If your secret starts with '-', make sure to terminate command options with double dash and wrap it in quotes. Example: \n ${example} `
|
||||
);
|
||||
return exit(1);
|
||||
}
|
||||
|
||||
await secrets.add(name, value);
|
||||
const elapsed = ms(new Date() - start);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class Client extends EventEmitter {
|
||||
_apiUrl: string;
|
||||
_debug: boolean;
|
||||
_forceNew: boolean;
|
||||
_forceNewWithCache: boolean;
|
||||
_withCache: boolean;
|
||||
_output: Output;
|
||||
_token: string;
|
||||
currentTeam?: string;
|
||||
@@ -31,21 +31,21 @@ export default class Client extends EventEmitter {
|
||||
token,
|
||||
currentTeam,
|
||||
forceNew = false,
|
||||
forceNewWithCache = false,
|
||||
withCache = false,
|
||||
debug = false,
|
||||
}: {
|
||||
apiUrl: string;
|
||||
token: string;
|
||||
currentTeam?: string;
|
||||
forceNew?: boolean;
|
||||
forceNewWithCache?: boolean;
|
||||
withCache?: boolean;
|
||||
debug?: boolean;
|
||||
}) {
|
||||
super();
|
||||
this._token = token;
|
||||
this._debug = debug;
|
||||
this._forceNew = forceNew;
|
||||
this._forceNewWithCache = forceNewWithCache;
|
||||
this._withCache = withCache;
|
||||
this._output = createOutput({ debug });
|
||||
this._apiUrl = apiUrl;
|
||||
this._onRetry = this._onRetry.bind(this);
|
||||
|
||||
@@ -66,7 +66,7 @@ export default async function processDeployment({
|
||||
quiet: boolean;
|
||||
nowConfig?: NowConfig;
|
||||
force?: boolean;
|
||||
forceNewWithCache?: boolean;
|
||||
withCache?: boolean;
|
||||
org: Org;
|
||||
projectName: string;
|
||||
isSettingUpProject: boolean;
|
||||
@@ -83,7 +83,7 @@ export default async function processDeployment({
|
||||
requestBody,
|
||||
deployStamp,
|
||||
force,
|
||||
forceNewWithCache,
|
||||
withCache,
|
||||
nowConfig,
|
||||
quiet,
|
||||
} = args;
|
||||
@@ -101,7 +101,7 @@ export default async function processDeployment({
|
||||
userAgent: ua,
|
||||
path: paths[0],
|
||||
force,
|
||||
forceNewWithCache,
|
||||
withCache,
|
||||
skipAutoDetectionConfirmation,
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class Now extends EventEmitter {
|
||||
token,
|
||||
currentTeam,
|
||||
forceNew = false,
|
||||
forceNewWithCache = false,
|
||||
withCache = false,
|
||||
debug = false,
|
||||
}) {
|
||||
super();
|
||||
@@ -42,7 +42,7 @@ export default class Now extends EventEmitter {
|
||||
this._token = token;
|
||||
this._debug = debug;
|
||||
this._forceNew = forceNew;
|
||||
this._forceNewWithCache = forceNewWithCache;
|
||||
this._withCache = withCache;
|
||||
this._output = createOutput({ debug });
|
||||
this._apiUrl = apiUrl;
|
||||
this._onRetry = this._onRetry.bind(this);
|
||||
@@ -72,7 +72,7 @@ export default class Now extends EventEmitter {
|
||||
env,
|
||||
build,
|
||||
forceNew = false,
|
||||
forceNewWithCache = false,
|
||||
withCache = false,
|
||||
target = null,
|
||||
deployStamp,
|
||||
projectSettings,
|
||||
@@ -164,7 +164,7 @@ export default class Now extends EventEmitter {
|
||||
meta,
|
||||
public: wantsPublic || nowConfig.public,
|
||||
forceNew,
|
||||
forceNewWithCache,
|
||||
withCache,
|
||||
name,
|
||||
project,
|
||||
description,
|
||||
@@ -190,7 +190,7 @@ export default class Now extends EventEmitter {
|
||||
quiet,
|
||||
nowConfig,
|
||||
force: forceNew,
|
||||
forceNewWithCache: forceNewWithCache,
|
||||
withCache,
|
||||
org,
|
||||
projectName: name,
|
||||
isSettingUpProject,
|
||||
|
||||
@@ -323,6 +323,21 @@ CMD ["node", "index.js"]`,
|
||||
'index.html': 'Home page',
|
||||
'secret/file.txt': 'my secret',
|
||||
},
|
||||
'build-secret': {
|
||||
'package.json': JSON.stringify({
|
||||
private: true,
|
||||
scripts: {
|
||||
build: 'mkdir public && echo $MY_SECRET > public/index.txt',
|
||||
},
|
||||
}),
|
||||
'now.json': JSON.stringify({
|
||||
build: {
|
||||
env: {
|
||||
MY_SECRET: '@mysecret',
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
'alias-rules': {
|
||||
'rules.json': JSON.stringify({
|
||||
rules: [
|
||||
|
||||
44
packages/now-cli/test/integration.js
vendored
44
packages/now-cli/test/integration.js
vendored
@@ -390,6 +390,50 @@ test('should error with suggestion for secrets subcommand', async t => {
|
||||
);
|
||||
});
|
||||
|
||||
test('should add secret with hyphen prefix', async t => {
|
||||
const target = fixture('build-secret');
|
||||
const key = 'mysecret';
|
||||
const value = '-foo_bar';
|
||||
|
||||
let secretCall = await execa(
|
||||
binaryPath,
|
||||
['secrets', 'add', ...defaultArgs, key, value],
|
||||
{
|
||||
cwd: target,
|
||||
reject: false,
|
||||
}
|
||||
);
|
||||
|
||||
t.is(
|
||||
secretCall.exitCode,
|
||||
0,
|
||||
formatOutput({ stderr: secretCall.stderr, stdout: secretCall.stdout })
|
||||
);
|
||||
|
||||
let targetCall = await execa(binaryPath, [...defaultArgs, '--confirm'], {
|
||||
cwd: target,
|
||||
reject: false,
|
||||
});
|
||||
|
||||
t.is(
|
||||
targetCall.exitCode,
|
||||
0,
|
||||
formatOutput({ stderr: targetCall.stderr, stdout: targetCall.stdout })
|
||||
);
|
||||
const { host } = new URL(targetCall.stdout);
|
||||
const response = await fetch(`https://${host}`);
|
||||
t.is(
|
||||
response.status,
|
||||
200,
|
||||
formatOutput({ stderr: targetCall.stderr, stdout: targetCall.stdout })
|
||||
);
|
||||
t.is(
|
||||
await response.text(),
|
||||
`${value}\n`,
|
||||
formatOutput({ stderr: targetCall.stderr, stdout: targetCall.stdout })
|
||||
);
|
||||
});
|
||||
|
||||
test('login with unregistered user', async t => {
|
||||
const { stdout, stderr, exitCode } = await execa(
|
||||
binaryPath,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "now-client",
|
||||
"version": "7.0.2-canary.0",
|
||||
"version": "7.0.2-canary.2",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"homepage": "https://zeit.co",
|
||||
|
||||
@@ -169,9 +169,9 @@ export async function* deploy(
|
||||
deploymentOptions.forceNew = clientOptions.force;
|
||||
}
|
||||
|
||||
if (clientOptions.forceNewWithCache) {
|
||||
if (clientOptions.withCache) {
|
||||
debug(
|
||||
`'forceNewWithCache' is provided. Force deploy will be performed with cache retention`
|
||||
`'withCache' is provided. Force deploy will be performed with cache retention`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import buildCreateDeployment from './create-deployment';
|
||||
|
||||
export { getNowIgnore } from './utils/index';
|
||||
export const createDeployment = buildCreateDeployment(2);
|
||||
export const createLegacyDeployment = buildCreateDeployment(1);
|
||||
export * from './errors';
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface NowClientOptions {
|
||||
teamId?: string;
|
||||
apiUrl?: string;
|
||||
force?: boolean;
|
||||
forceNewWithCache?: boolean;
|
||||
withCache?: boolean;
|
||||
userAgent?: string;
|
||||
defaultName?: string;
|
||||
isDirectory?: boolean;
|
||||
|
||||
@@ -5,6 +5,7 @@ import { nodeFetch, zeitFetch } from './fetch';
|
||||
import { join, sep, relative } from 'path';
|
||||
import qs from 'querystring';
|
||||
import ignore from 'ignore';
|
||||
type Ignore = ReturnType<typeof ignore>;
|
||||
import { pkgVersion } from '../pkg';
|
||||
import { NowClientOptions, DeploymentOptions, NowConfig } from '../types';
|
||||
import { Sema } from 'async-sema';
|
||||
@@ -74,15 +75,17 @@ const maybeRead = async function<T>(path: string, default_: T) {
|
||||
}
|
||||
};
|
||||
|
||||
export async function getNowIgnore(path: string | string[]): Promise<any> {
|
||||
let ignores: string[] = [
|
||||
'.hg',
|
||||
'.git',
|
||||
export async function getNowIgnore(
|
||||
path: string | string[]
|
||||
): Promise<{ ig: Ignore; ignores: string[] }> {
|
||||
const ignores: string[] = [
|
||||
'.hg/',
|
||||
'.git/',
|
||||
'.gitmodules',
|
||||
'.svn',
|
||||
'.svn/',
|
||||
'.cache',
|
||||
'.next',
|
||||
'.now',
|
||||
'.next/',
|
||||
'.now/',
|
||||
'.npmignore',
|
||||
'.dockerignore',
|
||||
'.gitignore',
|
||||
@@ -95,7 +98,7 @@ export async function getNowIgnore(path: string | string[]): Promise<any> {
|
||||
'.venv',
|
||||
'npm-debug.log',
|
||||
'config.gypi',
|
||||
'node_modules',
|
||||
'node_modules/',
|
||||
'__pycache__/',
|
||||
'venv/',
|
||||
'CVS',
|
||||
|
||||
@@ -12,8 +12,8 @@ export function generateQueryString(clientOptions: NowClientOptions): string {
|
||||
options.set('forceNew', '1');
|
||||
}
|
||||
|
||||
if (clientOptions.forceNewWithCache) {
|
||||
options.set('forceNewWithCache', '1');
|
||||
if (clientOptions.withCache) {
|
||||
options.set('withCache', '1');
|
||||
}
|
||||
|
||||
if (clientOptions.skipAutoDetectionConfirmation) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
now "github.com/zeit/now/utils/go/bridge"
|
||||
now "github.com/zeit/now-go-bridge/go/bridge"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"net/http"
|
||||
"__NOW_HANDLER_PACKAGE_NAME"
|
||||
|
||||
now "github.com/zeit/now/utils/go/bridge"
|
||||
now "github.com/zeit/now-go-bridge/go/bridge"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/go",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://zeit.co/docs/runtimes#official-runtimes/go",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/next",
|
||||
"version": "2.5.0",
|
||||
"version": "2.5.2",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://zeit.co/docs/runtimes#official-runtimes/next-js",
|
||||
|
||||
@@ -829,7 +829,7 @@ export const build = async ({
|
||||
} = await nodeFileTrace(apiPages, { base: workPath });
|
||||
|
||||
const { fileList, reasons: nonApiReasons } = await nodeFileTrace(
|
||||
Object.keys(pages).map(page => pages[page].fsPath),
|
||||
nonApiPages,
|
||||
{ base: workPath }
|
||||
);
|
||||
|
||||
@@ -1224,12 +1224,13 @@ export const build = async ({
|
||||
// routes that are called after each rewrite or after routes
|
||||
// if there no rewrites
|
||||
{ handle: 'rewrite' },
|
||||
// Dynamic routes
|
||||
...dynamicRoutes,
|
||||
|
||||
// /_next/data routes for getServerProps/getStaticProps pages
|
||||
...dataRoutes,
|
||||
|
||||
// Dynamic routes (must come after dataRoutes as they are more specific)
|
||||
...dynamicRoutes,
|
||||
|
||||
// routes to call after a file has been matched
|
||||
{ handle: 'hit' },
|
||||
// Before we handle static files we need to set proper caching headers
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"propes": [
|
||||
"probes": [
|
||||
{
|
||||
"path": "/api/memory",
|
||||
"status": 200,
|
||||
|
||||
5
packages/now-next/test/fixtures/22-ssg-v2-catchall/next.config.js
vendored
Normal file
5
packages/now-next/test/fixtures/22-ssg-v2-catchall/next.config.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
generateBuildId() {
|
||||
return 'testing-build-id';
|
||||
},
|
||||
};
|
||||
38
packages/now-next/test/fixtures/22-ssg-v2-catchall/now.json
vendored
Normal file
38
packages/now-next/test/fixtures/22-ssg-v2-catchall/now.json
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "package.json", "use": "@now/next" }],
|
||||
"probes": [
|
||||
// make sure index responds correctly
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "Create Next App"
|
||||
},
|
||||
|
||||
// make sure lazy catch-all SSG page matches
|
||||
{
|
||||
"path": "/another",
|
||||
"mustContain": "Loading..."
|
||||
},
|
||||
|
||||
{ "delay": 2000 },
|
||||
|
||||
// make sure lazy catch-all SSG page was cached
|
||||
{
|
||||
"path": "/another",
|
||||
"mustContain": "My awesome article"
|
||||
},
|
||||
|
||||
// make sure lazy catch-all SSG data route matches
|
||||
{
|
||||
"path": "/_next/data/testing-build-id/something.json",
|
||||
"mustContain": "My awesome article"
|
||||
},
|
||||
|
||||
// make sure lazy catch-all SSG data route doesn't have HTML
|
||||
// make sure lazy catch-all SSG data route matches
|
||||
{
|
||||
"path": "/_next/data/testing-build-id/one-more.json",
|
||||
"mustNotContain": "<html>"
|
||||
}
|
||||
]
|
||||
}
|
||||
7
packages/now-next/test/fixtures/22-ssg-v2-catchall/package.json
vendored
Normal file
7
packages/now-next/test/fixtures/22-ssg-v2-catchall/package.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "9.3.1",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6"
|
||||
}
|
||||
}
|
||||
62
packages/now-next/test/fixtures/22-ssg-v2-catchall/pages/[...path].js
vendored
Normal file
62
packages/now-next/test/fixtures/22-ssg-v2-catchall/pages/[...path].js
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { useRouter } from 'next/router'
|
||||
import Error from 'next/error'
|
||||
|
||||
function loadArticle() {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'header',
|
||||
content: 'My awesome article',
|
||||
},
|
||||
{
|
||||
type: 'paragraph',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend.'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
const Page = ({ path, article }) => {
|
||||
const router = useRouter()
|
||||
|
||||
if (router.isFallback) {
|
||||
return <div>Loading...</div>
|
||||
}
|
||||
|
||||
if (!article.content) {
|
||||
return <Error statusCode={404}/>
|
||||
}
|
||||
|
||||
const [header, ...body] = article.content;
|
||||
|
||||
return (
|
||||
<article>
|
||||
<header>{header.content}</header>
|
||||
<small>path: {path.join('/')}</small>
|
||||
<main>
|
||||
{body.map(({ content }) => <p>{content}</p>)}
|
||||
</main>
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
||||
export default Page
|
||||
|
||||
export async function getStaticProps({ params }) {
|
||||
const { path } = params;
|
||||
const article = loadArticle(path);
|
||||
|
||||
return {
|
||||
props: {
|
||||
article,
|
||||
path,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getStaticPaths() {
|
||||
return {
|
||||
paths: [],
|
||||
fallback: true,
|
||||
}
|
||||
}
|
||||
203
packages/now-next/test/fixtures/22-ssg-v2-catchall/pages/index.js
vendored
Normal file
203
packages/now-next/test/fixtures/22-ssg-v2-catchall/pages/index.js
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
import Head from 'next/head';
|
||||
|
||||
const Home = () => (
|
||||
<div className="container">
|
||||
<Head>
|
||||
<title>Create Next App</title>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
|
||||
<main>
|
||||
<h1 className="title">
|
||||
Welcome to <a href="https://nextjs.org">Next.js!</a>
|
||||
</h1>
|
||||
|
||||
<p className="description">
|
||||
Get started by editing <code>pages/index.js</code>
|
||||
</p>
|
||||
|
||||
<div className="grid">
|
||||
<a href="https://nextjs.org/docs" className="card">
|
||||
<h3>Documentation →</h3>
|
||||
<p>Find in-depth information about Next.js features and API.</p>
|
||||
</a>
|
||||
|
||||
<a href="https://nextjs.org/learn" className="card">
|
||||
<h3>Learn →</h3>
|
||||
<p>Learn about Next.js in an interactive course with quizzes!</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://github.com/zeit/next.js/tree/master/examples"
|
||||
className="card"
|
||||
>
|
||||
<h3>Examples →</h3>
|
||||
<p>Discover and deploy boilerplate example Next.js projects.</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://zeit.co/import?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 ZEIT Now.
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<a
|
||||
href="https://zeit.co?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Powered by <img src="/zeit.svg" alt="ZEIT 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;
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"propes": [
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"status": 200,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/node",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1-canary.0",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://zeit.co/docs/runtimes#official-runtimes/node-js",
|
||||
|
||||
@@ -15,3 +15,8 @@ export type NowResponse = ServerResponse & {
|
||||
json: (jsonBody: any) => NowResponse;
|
||||
status: (statusCode: number) => NowResponse;
|
||||
};
|
||||
|
||||
export type NowApiHandler = (
|
||||
req: NowRequest,
|
||||
res: NowResponse
|
||||
) => void;
|
||||
|
||||
8
packages/now-node/test/fixtures/15-helpers/ts/handler.ts
vendored
Normal file
8
packages/now-node/test/fixtures/15-helpers/ts/handler.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { NowApiHandler } from './types';
|
||||
|
||||
const listener: NowApiHandler = (req, res) => {
|
||||
res.status(200);
|
||||
res.send('hello:RANDOMNESS_PLACEHOLDER');
|
||||
};
|
||||
|
||||
export default listener;
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/routing-utils",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1-canary.0",
|
||||
"description": "ZEIT Now routing utilities",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
|
||||
@@ -172,19 +172,13 @@ function replaceSegments(
|
||||
}
|
||||
}
|
||||
|
||||
for (const [name, value] of Object.entries(indexes)) {
|
||||
if (
|
||||
isRedirect &&
|
||||
new RegExp(`\\${value}(?!\\d)`).test(pathname + (hash || ''))
|
||||
) {
|
||||
// Don't add segment to query if used in destination
|
||||
// and it's a redirect so that we don't pollute the query
|
||||
// with unwanted values
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(name in query)) {
|
||||
query[name] = value;
|
||||
// We only add path segments to redirect queries if manually
|
||||
// specified
|
||||
if (!isRedirect) {
|
||||
for (const [name, value] of Object.entries(indexes)) {
|
||||
if (!(name in query)) {
|
||||
query[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ test('convertRedirects', () => {
|
||||
},
|
||||
{
|
||||
src: '^\\/projects(?:\\/([^\\/]+?))(?:\\/([^\\/]+?))$',
|
||||
headers: { Location: '/projects.html?id=$1&action=$2' },
|
||||
headers: { Location: '/projects.html' },
|
||||
status: 308,
|
||||
},
|
||||
{
|
||||
@@ -236,7 +236,7 @@ test('convertRedirects', () => {
|
||||
},
|
||||
{
|
||||
src: '^\\/catchme(?:\\/((?:[^\\/]+?)(?:\\/(?:[^\\/]+?))*))?$',
|
||||
headers: { Location: '/api/user?id=$1' },
|
||||
headers: { Location: '/api/user' },
|
||||
status: 308,
|
||||
},
|
||||
{
|
||||
@@ -321,6 +321,8 @@ test('convertRewrites', () => {
|
||||
destination: '/another-catch/:hello+',
|
||||
},
|
||||
{ source: '/catchme/:id*', destination: '/api/user' },
|
||||
{ source: '/:path', destination: '/test?path=:path' },
|
||||
{ source: '/:path/:two', destination: '/test?path=:path' },
|
||||
]);
|
||||
|
||||
const expected = [
|
||||
@@ -386,6 +388,16 @@ test('convertRewrites', () => {
|
||||
dest: '/api/user?id=$1',
|
||||
check: true,
|
||||
},
|
||||
{
|
||||
src: '^(?:\\/([^\\/]+?))$',
|
||||
dest: '/test?path=$1',
|
||||
check: true,
|
||||
},
|
||||
{
|
||||
check: true,
|
||||
dest: '/test?path=$1&two=$2',
|
||||
src: '^(?:\\/([^\\/]+?))(?:\\/([^\\/]+?))$',
|
||||
},
|
||||
];
|
||||
|
||||
deepEqual(actual, expected);
|
||||
@@ -404,6 +416,8 @@ test('convertRewrites', () => {
|
||||
['/catchall/first/', '/catchall/first/second/'],
|
||||
['/another-catch/first/', '/another-catch/first/second/'],
|
||||
['/catchme/id-1', '/catchme/id/2'],
|
||||
['/first', '/another'],
|
||||
['/first/second', '/one/two'],
|
||||
];
|
||||
|
||||
const mustNotMatch = [
|
||||
@@ -420,6 +434,8 @@ test('convertRewrites', () => {
|
||||
['/random-catch/'],
|
||||
['/another-catch/'],
|
||||
['/catchm', '/random'],
|
||||
['/another/one'],
|
||||
['/not', '/these'],
|
||||
];
|
||||
|
||||
assertRegexMatches(actual, mustMatch, mustNotMatch);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/static-build",
|
||||
"version": "0.15.1",
|
||||
"version": "0.15.2-canary.3",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://zeit.co/docs/runtimes#official-runtimes/static-builds",
|
||||
|
||||
@@ -127,6 +127,27 @@ const frameworkList: Framework[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Dojo',
|
||||
slug: 'dojo',
|
||||
dependency: '@dojo/cli',
|
||||
buildCommand: 'dojo build',
|
||||
getOutputDirName: async () => join('output', 'dist'),
|
||||
defaultRoutes: [
|
||||
{
|
||||
handle: 'filesystem',
|
||||
},
|
||||
{
|
||||
src: '/service-worker.js',
|
||||
headers: { 'cache-control': 's-maxage=0' },
|
||||
continue: true,
|
||||
},
|
||||
{
|
||||
src: '/(.*)',
|
||||
dest: '/index.html',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Ember',
|
||||
slug: 'ember',
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
NowBuildError,
|
||||
} from '@now/build-utils';
|
||||
import { Route, Source } from '@now/routing-utils';
|
||||
import { getNowIgnore } from 'now-client';
|
||||
|
||||
const sleep = (n: number) => new Promise(resolve => setTimeout(resolve, n));
|
||||
|
||||
@@ -475,7 +476,15 @@ export async function build({
|
||||
routes.push(...frameworkRoutes);
|
||||
}
|
||||
|
||||
output = await glob('**', distPath, mountpoint);
|
||||
let ignore: string[] = [];
|
||||
if (config.zeroConfig) {
|
||||
const result = await getNowIgnore(distPath);
|
||||
ignore = result.ignores
|
||||
.map(file => (file.endsWith('/') ? `${file}**` : file))
|
||||
.concat(['yarn.lock', 'package-lock.json', 'package.json']);
|
||||
debug(`Using ignore: ${JSON.stringify(ignore)}`);
|
||||
}
|
||||
output = await glob('**', { cwd: distPath, ignore }, mountpoint);
|
||||
}
|
||||
|
||||
const watch = [path.join(mountpoint.replace(/^\.\/?/, ''), '**/*')];
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"build": "CI=false react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"react-router": "^5.1.2",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"react-scripts": "3.3.0",
|
||||
"typescript": "3.7.4"
|
||||
"typescript": "3.8.3"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
||||
1
packages/now-static-build/test/fixtures/55-ignore-output/example.html
vendored
Normal file
1
packages/now-static-build/test/fixtures/55-ignore-output/example.html
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<h1>Example Page</h1>
|
||||
10
packages/now-static-build/test/fixtures/55-ignore-output/now.json
vendored
Normal file
10
packages/now-static-build/test/fixtures/55-ignore-output/now.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{
|
||||
"src": "package.json",
|
||||
"use": "@now/static-build",
|
||||
"config": { "zeroConfig": true, "outputDirectory": "." }
|
||||
}
|
||||
]
|
||||
}
|
||||
9
packages/now-static-build/test/fixtures/55-ignore-output/package.json
vendored
Normal file
9
packages/now-static-build/test/fixtures/55-ignore-output/package.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"copee": "1.0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "echo 'Output Page' > output.html && echo 'foo' > .env && git init && ls -lA"
|
||||
}
|
||||
}
|
||||
28
packages/now-static-build/test/fixtures/55-ignore-output/probe.js
vendored
Normal file
28
packages/now-static-build/test/fixtures/55-ignore-output/probe.js
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
const assert = require('assert').strict;
|
||||
|
||||
async function tryTest({ path, status, deploymentUrl, fetch }) {
|
||||
const res = await fetch(`https://${deploymentUrl}${path}`);
|
||||
assert.equal(res.status, status);
|
||||
console.log(`Finished testing "${path}" probe.`);
|
||||
}
|
||||
|
||||
module.exports = async ({ deploymentUrl, fetch }) => {
|
||||
await tryTest({ path: '/example.html', status: 200, deploymentUrl, fetch });
|
||||
await tryTest({ path: '/output.html', status: 200, deploymentUrl, fetch });
|
||||
await tryTest({
|
||||
path: '/node_modules/copee/package.json',
|
||||
status: 404,
|
||||
deploymentUrl,
|
||||
fetch,
|
||||
});
|
||||
await tryTest({ path: '/.git/HEAD', status: 404, deploymentUrl, fetch });
|
||||
await tryTest({ path: '/.env', status: 404, deploymentUrl, fetch });
|
||||
await tryTest({ path: '/yarn.lock', status: 404, deploymentUrl, fetch });
|
||||
await tryTest({
|
||||
path: '/package-lock.json',
|
||||
status: 404,
|
||||
deploymentUrl,
|
||||
fetch,
|
||||
});
|
||||
await tryTest({ path: '/package.json', status: 404, deploymentUrl, fetch });
|
||||
};
|
||||
@@ -15,6 +15,7 @@ async function nowDeploy(bodies, randomness) {
|
||||
mode: path.extname(n) === '.sh' ? 0o100755 : 0o100644,
|
||||
}));
|
||||
|
||||
const { FORCE_BUILD_IN_REGION, NOW_DEBUG } = process.env;
|
||||
const nowJson = JSON.parse(bodies['now.json']);
|
||||
|
||||
const nowDeployPayload = {
|
||||
@@ -25,6 +26,8 @@ async function nowDeploy(bodies, randomness) {
|
||||
env: {
|
||||
...(nowJson.build || {}).env,
|
||||
RANDOMNESS_BUILD_ENV_VAR: randomness,
|
||||
FORCE_BUILD_IN_REGION,
|
||||
NOW_DEBUG,
|
||||
},
|
||||
},
|
||||
name: 'test2020',
|
||||
@@ -34,16 +37,6 @@ async function nowDeploy(bodies, randomness) {
|
||||
meta: {},
|
||||
};
|
||||
|
||||
if (process.env.FORCE_BUILD_IN_REGION) {
|
||||
const { builds = [] } = nowDeployPayload;
|
||||
builds.forEach(b => {
|
||||
if (!b.config) {
|
||||
b.config = {};
|
||||
}
|
||||
b.config.forceBuildIn = process.env.FORCE_BUILD_IN_REGION;
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`posting ${files.length} files`);
|
||||
|
||||
for (const { file: filename } of files) {
|
||||
|
||||
13
yarn.lock
13
yarn.lock
@@ -7776,6 +7776,11 @@ mri@1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.0.tgz#5c0a3f29c8ccffbbb1ec941dcec09d71fa32f36a"
|
||||
integrity sha1-XAo/KcjM/7ux7JQdzsCdcfoy82o=
|
||||
|
||||
mri@1.1.5:
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.5.tgz#ce21dba2c69f74a9b7cf8a1ec62307e089e223e0"
|
||||
integrity sha512-d2RKzMD4JNyHMbnbWnznPaa8vbdlq/4pNZ3IgdaGrVbBhebBsGUUE/6qorTMYNS6TwuH3ilfOlD2bf4Igh8CKg==
|
||||
|
||||
ms@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
@@ -9733,10 +9738,10 @@ shellwords@^0.1.1:
|
||||
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
||||
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
|
||||
|
||||
signal-exit@TooTallNate/signal-exit#update/sighub-to-sigint-on-windows, signal-exit@^3.0.0, signal-exit@^3.0.2:
|
||||
version "3.0.2"
|
||||
uid "58088fa7f715149f8411e089a4a6e3fe6ed265ec"
|
||||
resolved "https://codeload.github.com/TooTallNate/signal-exit/tar.gz/58088fa7f715149f8411e089a4a6e3fe6ed265ec"
|
||||
signal-exit@^3.0.0, signal-exit@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
|
||||
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
|
||||
|
||||
sinon@4.4.2:
|
||||
version "4.4.2"
|
||||
|
||||
Reference in New Issue
Block a user