Compare commits

..

52 Commits

Author SHA1 Message Date
JJ Kasper
e2ae497762 Publish Stable
- @now/next@2.5.2
2020-04-06 15:35:12 -05:00
JJ Kasper
89989719c2 Publish Canary
- @now/next@2.5.2-canary.0
 - @now/node@1.5.1-canary.0
 - @now/static-build@0.15.2-canary.3
2020-04-06 15:27:03 -05:00
Joe Haddad
8166b8e1e7 [now-next] Correctly Exclude API Routes from Pages (#4018)
This pull request correctly omits dependencies for API Routes from pages.
2020-04-06 20:19:08 +00:00
Logan McAnsh
1ceeac498c [now-node] Add NowApiHandler type (#4001)
* add NowApiHandler type

`now` equivalent of `NextApiHandler` introduced https://github.com/zeit/next.js/pull/10573

* chore: add fixture

Signed-off-by: Logan McAnsh <logan@mcan.sh>
2020-04-03 18:29:56 -04:00
Arunoda Susiripala
1c47d1360d [now-next] Fix some typos related to fixtures (#3995)
They should be `probes` I guess.
2020-04-03 13:43:22 +00:00
Leo Lamprecht
ddcd0918e9 Removed Environment Variables (#3997) 2020-04-03 01:52:02 +02:00
Steven
573b6b8110 [now-static-build] Fix 12-creact-react-app test fixture (#3990)
Since enabling `CI` environment variable for cloud builds, this test fails because it is meant to emit a warning however that warning has turned into an error.

```
05:40:53.148  Treating warnings as errors because process.env.CI = true.
05:40:53.148  Most CI servers set it automatically.
05:40:53.148  Failed to compile.
05:40:53.149  ./src/App.js
05:40:53.149    Line 1:  'useState' is defined but never used  no-unused-vars
05:40:53.172  error Command failed with exit code 1.
```

We can again treat lint errors as warnings by setting `CI=false`.
2020-04-01 14:27:11 +00:00
Steven
40039d7f9b Publish Canary
- @now/build-utils@2.2.1-canary.0
2020-03-31 17:18:32 -04:00
Steven
dcb37e92f5 [now-build-utils] Hide internal stack trace for errors (#3988)
Example build output given a user's build script named `shouldfail.js`:

## Before

```
/zeit/4af70cdc/shouldfail.js:3
throw new Error('This is my failure')
^
Error: This is my failure
    at Object.<anonymous> (/zeit/4af70cdc/shouldfail.js:3:7)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Exited with 1
    at ChildProcess.<anonymous> (/zeit/687b1c64/.build-utils/node_modules/@now/build-utils/dist/index.js:31350:24)
    at ChildProcess.emit (events.js:223:5)
    at ChildProcess.EventEmitter.emit (domain.js:475:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
worker exited with code 20 and signal null
Done with "package.json"
```

## After 

```
/zeit/255bfdd/shouldfail.js:3
throw new Error('This is my failure')
^
Error: This is my failure
    at Object.<anonymous> (/zeit/255bfdd/shouldfail.js:3:7)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
worker exited with code 20 and signal null
Done with "package.json"
```
2020-03-31 21:09:57 +00:00
Steven
fe7f875549 Publish Canary
- now@17.1.2-canary.8
2020-03-31 12:20:59 -04:00
Steven
a516ed6fb8 [now-cli] Fix error message link to build logs (#3986)
The current error message prints a link that is not clickable from the terminal.

This PR adds the missing `https://` protocol prefix, so that the link is clickable.
2020-03-31 12:09:11 -04:00
Steven
ca2c5f85ef [now-cli] Fix for adding secret with hyphen prefix (#3983)
Follow up to #3982 which didn't actually fix the secret value. Instead it was adding `true` as the value.
2020-03-31 13:06:46 +00:00
Tim Neutkens
adb5a01cc0 Upgrade Next.js (#3984) 2020-03-31 12:24:21 +02:00
Steven
6b4d39ab4d Publish Canary
- now@17.1.2-canary.7
2020-03-30 18:27:55 -04:00
Steven
07ce3d2e34 [now-cli] Bump mri to 1.1.5 (#3982)
This fixes the error when attempting to add a secret with a hyphen and underscore such as the following:

```
$ now secret add name '-foo_bar'
Error! argv._.slice is not a function
```
2020-03-30 22:13:00 +00:00
JJ Kasper
93ffcf487b Publish Canary
- @now/routing-utils@1.8.1-canary.0
2020-03-30 14:18:01 -05:00
JJ Kasper
3631f0f4cf [now-routing-utils] Update to not add path segments to redirect query automatically (#3981)
As discussed this removes automatically adding path segments to redirect's destination query and only adds them if manually specified

x-ref: https://github.com/zeit/next.js/pull/11497
2020-03-30 18:57:24 +00:00
Steven
b67b5be8a9 Publish Canary
- now@17.1.2-canary.6
 - now-client@7.0.2-canary.2
 - @now/static-build@0.15.2-canary.2
2020-03-30 14:06:57 -04:00
Steven
bf67b1a29e [now-static-build][now-client] Ignore known static outputs (#3980)
We already ignore specific files such as `node_modules` and `.env` during the upload phase so these never make it to the build. However, if those files are generated during the build, that are still emitted.

This PR will ignore these specific files even if they end up in the output directory (for example, when the user assigns `outputDirectory='.'` in project settings)
2020-03-30 17:53:47 +00:00
Max Rovensky
ed86473f74 Publish Canary
- now@17.1.2-canary.5
 - now-client@7.0.2-canary.1
2020-03-30 17:57:56 +08:00
Max
399a3cd114 [now-cli][now-client] Change forceNewWithCache to withCache (#3966)
Follow up to https://github.com/zeit/now/pull/3953 that makes the flag composable
2020-03-30 09:51:05 +00:00
Steven
d0fd09810a Publish Stable
- @now/go@1.0.6
2020-03-28 18:33:40 -04:00
Steven
f298f2e894 Publish Canary
- @now/go@1.0.6-canary.0
2020-03-28 18:21:06 -04:00
Steven
569200ae0e [now-go] Fix import for go-bridge (#3976)
Somehow, PR #3973 broke Go since the bridge is imported from this repo's master branch.

Go has very strict file name constraints and the file `[...path].js` is not compatible.


Here's what a `@now/go` deployment error message looks like:

```
Error: Command failed: go mod tidy
go: finding github.com/zeit/now latest
go: downloading github.com/zeit/now v0.0.0-20200326223129-c91495338d5e
go: extracting github.com/zeit/now v0.0.0-20200326223129-c91495338d5e
-> unzip /tmp/5a0676f5/pkg/mod/cache/download/github.com/zeit/now/@v/v0.0.0-20200326223129-c91495338d5e.zip: malformed file path "packages/now-next/test/fixtures/22-ssg-v2-catchall/pages/[...path].js": double dot
handler imports
github.com/zeit/now/utils/go/bridge: unzip /tmp/5a0676f5/pkg/mod/cache/download/github.com/zeit/now/@v/v0.0.0-20200326223129-c91495338d5e.zip: malformed file path "packages/now-next/test/fixtures/22-ssg-v2-catchall/pages/[...path].js": double dot
```

The solution is to move Go Bridge into a separate repository: https://github.com/zeit/now-go-bridge

This will also have the side effect of speeding up Go imports because the repo will be much smaller.
2020-03-28 22:16:42 +00:00
Nathan Rajlich
c91495338d Update signal-exit to v3.0.3 (#3974)
@tootallnate's bug fix for `SIGHUB` on Windows has been merged and
published as `signal-exit@3.0.3`, so no more need for the "resolutions"
field in `package.json`.

The `yarn.lock` file has been updated accordingly.
2020-03-26 22:31:29 +00:00
JJ Kasper
7eed5574e0 Publish Stable
- @now/next@2.5.1
2020-03-26 16:12:48 -05:00
JJ Kasper
91e6b85cec Publish Canary
- @now/next@2.5.1-canary.0
 - @now/static-build@0.15.2-canary.1
2020-03-26 16:01:00 -05:00
JJ Kasper
3ae83172ec [now-next] Fix dynamic routes and data routes order (#3973)
When using a catch-all route at the base of the project it would cause it to be prioritized over any GS(S)P `/_next/data` routes. This fixes the order putting `/_next/data` routes first as they have higher specificity and adds tests to ensure we don't regress on this
2020-03-26 20:08:51 +00:00
Steven
7c51446e5e [tests] Add additional env vars (#3968)
These are used for testing and health checks.
2020-03-25 22:42:37 +00:00
Steven
400a5c73e8 [examples][now-static-build] Bump ionic-react to latest typescript (#3967)
Fixes an issue with a dependency that was bumped but typescript was pinned in `ionic-react`.


```
$ react-scripts build
Creating an optimized production build...
Failed to compile.
/zeit/333ecfab/node_modules/@types/testing-library__react/node_modules/pretty-format/build/index.d.ts
TypeScript error in /zeit/333ecfab/node_modules/@types/testing-library__react/node_modules/pretty-format/build/index.d.ts(7,13):
'=' expected.  TS1005
     5 |  * LICENSE file in the root directory of this source tree.
     6 |  */
  >  7 | import type * as PrettyFormat from './types';
       |             ^
     8 | /**
     9 |  * Returns a presentation string of your `val` object
    10 |  * @param val any potential JavaScript object
error Command failed with exit code 1.
```
2020-03-25 19:20:59 +00:00
Steven
ec917ace69 Publish Canary
- @now/frameworks@0.0.13-canary.0
 - now@17.1.2-canary.4
 - @now/static-build@0.15.2-canary.0
2020-03-25 13:41:04 -04:00
Anthony Gubler
f5e0afdd7e [examples] Add Dojo Example (#3882)
Adds an example for Dojo applications with ZEIT Now.

Co-Authored-By: Steven <steven@ceriously.com>
Co-Authored-By: Andy <AndyBitz@users.noreply.github.com>
2020-03-25 13:32:33 -04:00
Steven
c1b4c62714 [tests] Cancel previous workflows on push (#3965)
Follow up to #3961

Workflow IDs are found here: from https://api.github.com/repos/zeit/now/actions/workflows
2020-03-25 16:05:32 +00:00
Steven
5e4bdfbe11 [tests] Separate into workflows (#3961)
This PR does a few things:

- Separate tests into multiple workflows
- Rename a few package.json scripts to make naming consistent
- Rename workflows to be uppercase and jobs to be lowercase

The benefits here are:
- Restart a workflow if it fails, for example only restart `now dev` tests
- Easier to read when we need to understand a workflow or modify env vars

After merging, we'll need to modify the required checks in the repo settings.
We'll also need to update the cancel workflow (that will need to be a separate PR).
2020-03-25 11:40:11 -04:00
Andy Bitz
bd4a0cbd32 Publish Stable
- @now/frameworks@0.0.12
 - @now/static-build@0.15.1
2020-03-25 15:57:19 +01:00
Andy Bitz
7ff9adc90e Publish Canary
- @now/frameworks@0.0.12-canary.1
 - @now/static-build@0.15.1-canary.1
2020-03-25 15:56:44 +01:00
Andy
b279f1ffae [frameworks][now-static-build] Support Docusaurus v2 and v1 (#3964)
Support Docusaurus v2 and v1
2020-03-25 14:42:56 +00:00
Ana Trajkovska
344cc103ee Publish Canary
- now@17.1.2-canary.3
2020-03-25 14:11:11 +01:00
Ana Trajkovska
83249b3685 [now-cli] Add pagination for now alias ls (#3915)
* Implement pagination for `now alias ls`

* Fix issue retrieving aliases

* Add help text for pagiting aliases
2020-03-25 14:08:26 +01:00
Andy
79e7a9f477 [now-cli] Update docusaurus test (#3963) 2020-03-25 13:43:53 +01:00
Steven
b3dce70271 Publish Canary
- @now/frameworks@0.0.12-canary.0
 - now@17.1.2-canary.2
 - @now/static-build@0.15.1-canary.0
2020-03-24 19:24:57 -04:00
Steven
cff8d8b8a0 [tests] Fix test initialize existing directory --f -> -f (#3960)
Fixes test after PR #3958
2020-03-24 22:46:42 +00:00
Andy
da892100d9 [frameworks][now-static-build] Fix Docusaurus build command (#3959)
* [frameworks][now-static-build] Fix Docusaurus build command

* Update dev command
2020-03-24 23:03:31 +01:00
Max Leiter
72e87ee6e4 Fix slight spelling mistake: --f -> -f in now --force error (#3958) 2020-03-24 12:51:15 -07:00
Max Rovensky
3f9afad167 Publish Canary
- now@17.1.2-canary.1
 - now-client@7.0.2-canary.0
2020-03-25 03:12:23 +08:00
Max
1527447914 Add --force-with-cache flag support (#3953)
Adds support for an upcoming `forceNewWithCache` API flag
2020-03-24 19:09:10 +00:00
Steven
9ca35df5fb [tests] Fix coverage checks (#3957)
The CodeCov GitHub integration is confused about the monorepo and started reporting failures recently.

<img src="https://user-images.githubusercontent.com/229881/77462927-2983f280-6ddb-11ea-9ee2-38b660b2fd2f.png" height=120 />

We run `codecov` from the CLI so we can disable the integration. 

## References

- https://docs.codecov.io/docs/codecovyml-reference
- https://docs.codecov.io/docs/commit-status#section-disabling-a-status
2020-03-24 18:47:25 +00:00
Ana Trajkovska
05b2e2216c Publish Canary
- now@17.1.2-canary.0
2020-03-24 19:12:47 +01:00
Ana Trajkovska
167fd5750a [now-cli] Add pagination for now domains ls (#3922)
* Implement pagination for listing domains

* Add helpi list for paginating domains
2020-03-24 19:08:52 +01:00
Andy
4a3cd7ec72 [now-cli] Ignore 404 for aliases and certs when removing a domain (#3955) 2020-03-24 01:56:13 +01:00
Andy Bitz
9aef718917 Publish Stable
- now@17.1.1
2020-03-24 00:16:28 +01:00
Ana Trajkovska
3cdc261802 [now-cli] Fix broken message when a deployment is canceled (#3954)
* Fix broken message when a deployment is canceled

* Add \n in the message
2020-03-24 00:14:52 +01:00
155 changed files with 11650 additions and 980 deletions

View File

@@ -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 }}

View File

@@ -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 }}

View 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 }}

View 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

View 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
View 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 }}

8
codecov.yml Normal file
View File

@@ -0,0 +1,8 @@
codecov:
require_ci_to_pass: yes
coverage:
status:
project: off
patch: off

6
examples/dojo/.dojorc Normal file
View File

@@ -0,0 +1,6 @@
{
"build-app": {},
"test-intern": {},
"create-app": {},
"create-widget": {}
}

4
examples/dojo/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
node_modules/
_build/
output/
.cert/

25
examples/dojo/README.md Normal file
View 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.
[![Deploy with ZEIT Now](https://zeit.co/button)](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
```

View 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"
}
}

View File

@@ -0,0 +1,3 @@
.root {
}

1
examples/dojo/src/App.m.css.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export const root: string;

27
examples/dojo/src/App.ts Normal file
View 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' }) })
])
]);
});

View 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>

View 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
View 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 });

View File

@@ -0,0 +1,15 @@
export default [
{
path: 'home',
outlet: 'home',
defaultRoute: true
},
{
path: 'about',
outlet: 'about'
},
{
path: 'profile',
outlet: 'profile'
}
];

View 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']);
});

View 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']);
});

View 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']
)
]);
});

View 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}!`]);
});

View File

@@ -0,0 +1,3 @@
.root {
}

View File

@@ -0,0 +1 @@
export const root: string;

View File

@@ -0,0 +1,3 @@
.root {
}

View File

@@ -0,0 +1 @@
export const root: string;

View 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;
}

View File

@@ -0,0 +1,3 @@
export const root: string;
export const link: string;
export const selected: string;

View File

@@ -0,0 +1,3 @@
.root {
}

View File

@@ -0,0 +1 @@
export const root: string;

View File

@@ -0,0 +1 @@
import './main';

View File

@@ -0,0 +1 @@
/* Write your app tests here */

View 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);
});
});

View File

@@ -0,0 +1,2 @@
import './App';
import './widgets/all';

View File

@@ -0,0 +1 @@
/* Write your app tests here */

View 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']));
});
});

View 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']));
});
});

View 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']
)
])
);
});
});

View 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!']));
});
});

View File

@@ -0,0 +1,4 @@
import './About';
import './Home';
import './Profile';
import './Menu';

View 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"
]
}

View File

@@ -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",

View File

@@ -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"
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -112,7 +112,35 @@
}
},
{
"name": "Docusaurus",
"name": "Docusaurus 2",
"slug": "docusaurus-2",
"demo": "https://docusaurus.now-examples.now.sh",
"logo": "https://raw.githubusercontent.com/zeit/now/master/packages/frameworks/logos/docusaurus.svg",
"tagline": "Docusaurus makes it easy to maintain Open Source documentation websites.",
"description": "A static Docusaurus site that makes it easy to maintain OSS documentation.",
"website": "https://v2.docusaurus.io",
"detectors": {
"some": [
{
"path": "package.json",
"matchContent": "\"(dev)?(d|D)ependencies\":\\s*{[^}]*\"@docusaurus\\/core\":\\s*\".+?\"[^}]*}"
}
]
},
"settings": {
"buildCommand": {
"placeholder": "`npm run build` or `docusaurus build`"
},
"devCommand": {
"value": "docusaurus start --port $PORT"
},
"outputDirectory": {
"value": "build"
}
}
},
{
"name": "Docusaurus 1",
"slug": "docusaurus",
"demo": "https://docusaurus.now-examples.now.sh",
"logo": "https://raw.githubusercontent.com/zeit/now/master/packages/frameworks/logos/docusaurus.svg",
@@ -124,10 +152,6 @@
{
"path": "package.json",
"matchContent": "\"(dev)?(d|D)ependencies\":\\s*{[^}]*\"docusaurus\":\\s*\".+?\"[^}]*}"
},
{
"path": "package.json",
"matchContent": "\"(dev)?(d|D)ependencies\":\\s*{[^}]*\"@docusaurus\\/core\":\\s*\".+?\"[^}]*}"
}
]
},
@@ -171,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",

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,6 +1,6 @@
{
"name": "@now/frameworks",
"version": "0.0.11",
"version": "0.0.13-canary.0",
"main": "frameworks.json",
"license": "UNLICENSED"
}

View File

@@ -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",

View File

@@ -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;

View File

@@ -1,6 +1,6 @@
{
"name": "now",
"version": "17.1.0",
"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",

View File

@@ -40,7 +40,7 @@ const help = () => {
)} Login token
-S, --scope Set a custom scope
-n, --no-verify Don't wait until instance count meets the previous alias constraints
-N, --next Show next page of results
${chalk.dim('Examples:')}
${chalk.gray('')} Add a new alias to ${chalk.underline('my-api.now.sh')}
@@ -81,6 +81,12 @@ const help = () => {
${chalk.cyan(
`$ now alias ls aliasId --json > ${chalk.underline('rules.json')}`
)}
${chalk.gray('')} Paginate results, where ${chalk.dim(
'`1584722256178`'
)} is the time in milliseconds since the UNIX epoch.
${chalk.cyan(`$ now alias ls --next 1584722256178`)}
`);
};
@@ -100,9 +106,11 @@ export default async function main(ctx) {
'--no-verify': Boolean,
'--rules': String,
'--yes': Boolean,
'--next': Number,
'-n': '--no-verify',
'-r': '--rules',
'-y': '--yes',
'-N': '--next',
});
} catch (err) {
handleError(err);

View File

@@ -16,7 +16,7 @@ export default async function ls(ctx, opts, args, output) {
} = ctx;
const { currentTeam } = config;
const { apiUrl } = ctx;
const { '--debug': debugEnabled } = opts;
const { '--debug': debugEnabled, '--next': nextTimestamp } = opts;
const client = new Client({
apiUrl,
token,
@@ -36,8 +36,17 @@ export default async function ls(ctx, opts, args, output) {
throw err;
}
// $FlowFixMe
const now = new Now({ apiUrl, token, debug: debugEnabled, currentTeam });
if (typeof nextTimestamp !== undefined && Number.isNaN(nextTimestamp)) {
output.error('Please provide a number for flag --next');
return 1;
}
const now = new Now({
apiUrl,
token,
debug: debugEnabled,
currentTeam,
});
const lsStamp = stamp();
let cancelWait;
@@ -58,7 +67,11 @@ export default async function ls(ctx, opts, args, output) {
: `Fetching aliases under ${chalk.bold(contextName)}`
);
const aliases = await getAliases(now);
const { aliases, pagination } = await getAliases(
now,
undefined,
nextTimestamp
);
if (cancelWait) cancelWait();
if (args[0]) {
@@ -84,15 +97,16 @@ export default async function ls(ctx, opts, args, output) {
output.print(`${printPathAliasTable(rules)}\n`);
}
} else {
aliases.sort((a, b) => new Date(b.created) - new Date(a.created));
output.log(
`${plural('alias', aliases.length, true)} found under ${chalk.bold(
contextName
)} ${lsStamp()}`
);
output.log(`aliases found under ${chalk.bold(contextName)} ${lsStamp()}`);
console.log(printAliasTable(aliases));
}
if (pagination && aliases.length === 20) {
output.log(
`To display the next page use the flag --next ${pagination.next}`
);
}
now.close();
return 0;
}
@@ -111,7 +125,7 @@ function printAliasTable(aliases) {
? a.deployment.url
: chalk.gray(''),
a.alias,
ms(Date.now() - new Date(a.created)),
ms(Date.now() - new Date(a.createdAt)),
]),
],
{

View File

@@ -46,6 +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
--with-cache Retain build cache when using "--force"
-t ${chalk.underline('TOKEN')}, --token=${chalk.underline(
'TOKEN'
)} Login token
@@ -97,6 +98,7 @@ export const latestHelp = () => `
export const latestArgs = {
'--force': Boolean,
'--with-cache': Boolean,
'--public': Boolean,
'--no-clipboard': Boolean,
'--env': [String],

View File

@@ -506,6 +506,7 @@ export default async function main(
env: deploymentEnv,
build: { env: deploymentBuildEnv },
forceNew: argv['--force'],
withCache: argv['--with-cache'],
quiet,
wantsPublic: argv['--public'] || localConfig.public,
isFile,
@@ -576,7 +577,7 @@ export default async function main(
}
if (deployment.readyState === 'CANCELED') {
output.log('The deployment has been canceled.');
output.print('The deployment has been canceled.\n');
return 1;
}
@@ -665,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

View File

@@ -93,6 +93,7 @@ let paths: string[];
// Options
let forceNew: boolean;
let withCache: boolean;
let deploymentName: string;
let sessionAffinity: string;
let log: any;
@@ -238,6 +239,7 @@ export default async function main(
// Options
forceNew = argv.force;
withCache = argv['with-cache'];
deploymentName = argv.name;
sessionAffinity = argv['session-affinity'];
debugEnabled = argv.debug;
@@ -741,6 +743,7 @@ async function sync({
meta: metadata,
followSymlinks,
forceNew,
withCache,
forwardNpm,
quiet,
scale,

View File

@@ -45,6 +45,7 @@ const help = () => {
'TOKEN'
)} Login token
-S, --scope Set a custom scope
-N, --next Show next page of results
${chalk.dim('Examples:')}
@@ -61,6 +62,12 @@ const help = () => {
if it's configured with these nameservers (no need to ${chalk.dim(
'`domain add`'
)}).
${chalk.gray('')} Paginate results, where ${chalk.dim(
'`1584722256178`'
)} is the time in milliseconds since the UNIX epoch.
${chalk.cyan(`$ now domains ls --next 1584722256178`)}
`);
};
@@ -72,7 +79,7 @@ const COMMAND_CONFIG = {
move: ['move'],
rm: ['rm', 'remove'],
transferIn: ['transfer-in'],
verify: ['verify']
verify: ['verify'],
};
export default async function main(ctx: NowContext) {
@@ -83,7 +90,9 @@ export default async function main(ctx: NowContext) {
'--cdn': Boolean,
'--code': String,
'--no-cdn': Boolean,
'--yes': Boolean
'--yes': Boolean,
'--next': Number,
'-N': '--next',
});
} catch (error) {
handleError(error);

View File

@@ -1,6 +1,5 @@
import ms from 'ms';
import chalk from 'chalk';
import plural from 'pluralize';
import table from 'text-table';
import Client from '../../util/client';
@@ -13,6 +12,7 @@ import { Domain, NowContext } from '../../types';
type Options = {
'--debug': boolean;
'--next': number;
};
export default async function ls(
@@ -21,13 +21,21 @@ export default async function ls(
args: string[],
output: Output
) {
const { authConfig: { token }, config } = ctx;
const {
authConfig: { token },
config,
} = ctx;
const { currentTeam } = config;
const { apiUrl } = ctx;
const debug = opts['--debug'];
const { '--debug': debug, '--next': nextTimestamp } = opts;
const client = new Client({ apiUrl, token, currentTeam, debug });
let contextName = null;
if (typeof nextTimestamp !== undefined && Number.isNaN(nextTimestamp)) {
output.error('Please provide a number for flag --next');
return 1;
}
try {
({ contextName } = await getScope(client));
} catch (err) {
@@ -48,16 +56,24 @@ export default async function ls(
return 1;
}
const domains = await getDomains(client, contextName);
const { domains, pagination } = await getDomains(
client,
contextName,
nextTimestamp
);
output.log(
`${plural('domain', domains.length, true)} found under ${chalk.bold(
contextName
)} ${chalk.gray(lsStamp())}\n`
`Domains found under ${chalk.bold(contextName)} ${chalk.gray(lsStamp())}\n`
);
if (domains.length > 0) {
console.log(`${formatDomainsTable(domains)}\n`);
}
if (pagination && domains.length === 20) {
output.log(
`To display the next page use the flag --next ${pagination.next}`
);
}
return 0;
}
@@ -71,18 +87,18 @@ function formatDomainsTable(domains: Domain[]) {
chalk.gray('serviceType'),
chalk.gray('verified'),
chalk.gray('cdn'),
chalk.gray('age')
chalk.gray('age'),
].map(s => chalk.dim(s)),
...domains.map(domain => {
const url = chalk.bold(domain.name);
const time = chalk.gray(ms(current.getTime() - domain.createdAt));
return ['', url, domain.serviceType, domain.verified, true, time];
})
}),
],
{
align: ['l', 'l', 'l', 'l', 'l'],
hsep: ' '.repeat(4),
stringLength: strlen
stringLength: strlen,
}
);
}

View File

@@ -111,12 +111,26 @@ async function removeDomain(
for (const id of aliasIds) {
output.debug(`Removing alias ${id}`);
await removeAliasById(client, id);
try {
await removeAliasById(client, id);
} catch (error) {
// Ignore if the alias does not exist anymore
if (error.status !== 404) {
throw error;
}
}
}
for (const id of certIds) {
output.debug(`Removing cert ${id}`);
await deleteCertById(output, client, id);
try {
await deleteCertById(output, client, id);
} catch (error) {
// Ignore if the cert does not exist anymore
if (error.status !== 404) {
throw error;
}
}
}
if (suffix) {

View File

@@ -185,7 +185,7 @@ function prepareFolder(cwd: string, folder: string, force?: boolean) {
folder
)}" already exists and is not an empty directory. You may use ${cmd(
'--force'
)} or ${cmd('--f')} to override it.`
)} or ${cmd('-f')} to override it.`
);
}
} else if (dest !== cwd) {

View File

@@ -222,7 +222,7 @@ export default async function main(ctx) {
debug(
'No deployments: attempting to find aliases that matches supplied app name'
);
const aliases = await getAliases(now);
const { aliases } = await getAliases(now);
const item = aliases.find(e => e.uid === app || e.alias === app);
if (item) {

View File

@@ -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);

View File

@@ -238,3 +238,9 @@ export interface ProjectLink {
projectId: string;
orgId: string;
}
export interface PaginationOptions {
prev: number;
count: number;
next?: number;
}

View File

@@ -6,6 +6,6 @@ export default async function deploymentIsAliased(
client: Client,
deployment: Deployment
) {
const aliases = await getAliases(client);
const { aliases } = await getAliases(client);
return aliases.some(alias => alias.deploymentId === deployment.uid);
}

View File

@@ -7,11 +7,16 @@ type Response = {
export default async function getAliases(
client: Client,
deploymentId?: string
deploymentId?: string,
next?: number
) {
let aliasUrl = `/v3/now/aliases?limit=20`;
if (next) {
aliasUrl += `&until=${next}`;
}
const to = deploymentId
? `/now/deployments/${deploymentId}/aliases`
: '/now/aliases';
: aliasUrl;
const payload = await client.fetch<Response>(to);
return payload.aliases || [];
return payload;
}

View File

@@ -3,6 +3,6 @@ import getAliases from './get-aliases';
import { Alias } from '../../types';
export default async function getDomainAliases(client: Client, domain: string) {
const aliases = await getAliases(client);
const { aliases } = await getAliases(client);
return aliases.filter((alias: Alias) => alias.alias.endsWith(domain));
}

View File

@@ -21,6 +21,7 @@ export default class Client extends EventEmitter {
_apiUrl: string;
_debug: boolean;
_forceNew: boolean;
_withCache: boolean;
_output: Output;
_token: string;
currentTeam?: string;
@@ -30,18 +31,21 @@ export default class Client extends EventEmitter {
token,
currentTeam,
forceNew = false,
withCache = false,
debug = false,
}: {
apiUrl: string;
token: string;
currentTeam?: string;
forceNew?: boolean;
withCache?: boolean;
debug?: boolean;
}) {
super();
this._token = token;
this._debug = debug;
this._forceNew = forceNew;
this._withCache = withCache;
this._output = createOutput({ debug });
this._apiUrl = apiUrl;
this._onRetry = this._onRetry.bind(this);

View File

@@ -66,6 +66,7 @@ export default async function processDeployment({
quiet: boolean;
nowConfig?: NowConfig;
force?: boolean;
withCache?: boolean;
org: Org;
projectName: string;
isSettingUpProject: boolean;
@@ -82,6 +83,7 @@ export default async function processDeployment({
requestBody,
deployStamp,
force,
withCache,
nowConfig,
quiet,
} = args;
@@ -99,6 +101,7 @@ export default async function processDeployment({
userAgent: ua,
path: paths[0],
force,
withCache,
skipAutoDetectionConfirmation,
};
@@ -205,6 +208,9 @@ export default async function processDeployment({
}
if (event.type === 'canceled') {
if (queuedSpinner) {
queuedSpinner();
}
if (buildSpinner) {
buildSpinner();
}

View File

@@ -42,6 +42,6 @@ function getAddDomainName(domainNames: string[]) {
}
async function getDomainNames(client: Client, contextName: string) {
const domains = await getDomains(client, contextName);
const { domains } = await getDomains(client, contextName);
return domains.map(domain => domain.name).sort((a, b) => a.localeCompare(b));
}

View File

@@ -1,17 +1,24 @@
import chalk from 'chalk';
import { Domain } from '../../types';
import { Domain, PaginationOptions } from '../../types';
import Client from '../client';
import wait from '../output/wait';
type Response = {
domains: Domain[];
pagination: PaginationOptions;
};
export default async function getDomains(client: Client, contextName: string) {
export default async function getDomains(
client: Client,
contextName: string,
next?: number
) {
let domainUrl = `/v5/domains?limit=20`;
if (next) {
domainUrl += `&until=${next}`;
}
const cancelWait = wait(`Fetching domains under ${chalk.bold(contextName)}`);
const { domains } = await client.fetch<Response>('/v4/domains');
const domains = await client.fetch<Response>(domainUrl);
cancelWait();
return domains.sort(
(domainA, domainB) => domainB.createdAt - domainA.createdAt
);
return domains;
}

View File

@@ -29,12 +29,20 @@ const IS_WIN = process.platform.startsWith('win');
const SEP = IS_WIN ? '\\' : '/';
export default class Now extends EventEmitter {
constructor({ apiUrl, token, currentTeam, forceNew = false, debug = false }) {
constructor({
apiUrl,
token,
currentTeam,
forceNew = false,
withCache = false,
debug = false,
}) {
super();
this._token = token;
this._debug = debug;
this._forceNew = forceNew;
this._withCache = withCache;
this._output = createOutput({ debug });
this._apiUrl = apiUrl;
this._onRetry = this._onRetry.bind(this);
@@ -64,6 +72,7 @@ export default class Now extends EventEmitter {
env,
build,
forceNew = false,
withCache = false,
target = null,
deployStamp,
projectSettings,
@@ -155,6 +164,7 @@ export default class Now extends EventEmitter {
meta,
public: wantsPublic || nowConfig.public,
forceNew,
withCache,
name,
project,
description,
@@ -180,6 +190,7 @@ export default class Now extends EventEmitter {
quiet,
nowConfig,
force: forceNew,
withCache,
org,
projectName: name,
isSettingUpProject,

View File

@@ -1,2 +0,0 @@
*/node_modules
*.log

View File

@@ -1,12 +1,20 @@
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
node_modules
lib/core/metadata.js
lib/core/MetadataBlog.js
translated_docs
build/
yarn.lock
node_modules
i18n/*
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@@ -1,2 +0,0 @@
README.md
yarn.lock

View File

@@ -1,19 +1,33 @@
# Docusauras Example
# Website
This directory is a brief example of a [Docusauras](https://docusaurus.io/) site that can be deployed to ZEIT Now with zero configuration.
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
## How we created this example
### Installation
To get started with Docusauras on Now, you can use the [Docusauras CLI](https://docusaurus.io/docs/en/installation) to initialize the project:
```shell
$ docusauras-init
```
$ yarn
```
## Deploying this Example
### Local Development
Once initialized, you can deploy the Docusauras example with just a single command:
```shell
$ now
```
$ yarn start
```
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
### Build
```
$ yarn build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
### Deployment
```
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

View File

@@ -1,18 +0,0 @@
---
title: Blog Title
author: Blog Author
authorURL: http://twitter.com/
authorFBID: 100002976521003
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus elementum massa eget nulla aliquet sagittis. Proin odio tortor, vulputate ut odio in, ultrices ultricies augue. Cras ornare ultrices lorem malesuada iaculis. Etiam sit amet libero tempor, pulvinar mauris sed, sollicitudin sapien.
<!--truncate-->
Mauris vestibulum ullamcorper nibh, ut semper purus pulvinar ut. Donec volutpat orci sit amet mauris malesuada, non pulvinar augue aliquam. Vestibulum ultricies at urna ut suscipit. Morbi iaculis, erat at imperdiet semper, ipsum nulla sodales erat, eget tincidunt justo dui quis justo. Pellentesque dictum bibendum diam at aliquet. Sed pulvinar, dolor quis finibus ornare, eros odio facilisis erat, eu rhoncus nunc dui sed ex. Nunc gravida dui massa, sed ornare arcu tincidunt sit amet. Maecenas efficitur sapien neque, a laoreet libero feugiat ut.
Nulla facilisi. Maecenas sodales nec purus eget posuere. Sed sapien quam, pretium a risus in, porttitor dapibus erat. Sed sit amet fringilla ipsum, eget iaculis augue. Integer sollicitudin tortor quis ultricies aliquam. Suspendisse fringilla nunc in tellus cursus, at placerat tellus scelerisque. Sed tempus elit a sollicitudin rhoncus. Nulla facilisi. Morbi nec dolor dolor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras et aliquet lectus. Pellentesque sit amet eros nisi. Quisque ac sapien in sapien congue accumsan. Nullam in posuere ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin lacinia leo a nibh fringilla pharetra.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin venenatis lectus dui, vel ultrices ante bibendum hendrerit. Aenean egestas feugiat dui id hendrerit. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur in tellus laoreet, eleifend nunc id, viverra leo. Proin vulputate non dolor vel vulputate. Curabitur pretium lobortis felis, sit amet finibus lorem suscipit ut. Sed non mollis risus. Duis sagittis, mi in euismod tincidunt, nunc mauris vestibulum urna, at euismod est elit quis erat. Phasellus accumsan vitae neque eu placerat. In elementum arcu nec tellus imperdiet, eget maximus nulla sodales. Curabitur eu sapien eget nisl sodales fermentum.
Phasellus pulvinar ex id commodo imperdiet. Praesent odio nibh, sollicitudin sit amet faucibus id, placerat at metus. Donec vitae eros vitae tortor hendrerit finibus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque vitae purus dolor. Duis suscipit ac nulla et finibus. Phasellus ac sem sed dui dictum gravida. Phasellus eleifend vestibulum facilisis. Integer pharetra nec enim vitae mattis. Duis auctor, lectus quis condimentum bibendum, nunc dolor aliquam massa, id bibendum orci velit quis magna. Ut volutpat nulla nunc, sed interdum magna condimentum non. Sed urna metus, scelerisque vitae consectetur a, feugiat quis magna. Donec dignissim ornare nisl, eget tempor risus malesuada quis.

View File

@@ -1,18 +0,0 @@
---
title: New Blog Post
author: Blog Author
authorURL: http://twitter.com/
authorFBID: 100002976521003
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus elementum massa eget nulla aliquet sagittis. Proin odio tortor, vulputate ut odio in, ultrices ultricies augue. Cras ornare ultrices lorem malesuada iaculis. Etiam sit amet libero tempor, pulvinar mauris sed, sollicitudin sapien.
<!--truncate-->
Mauris vestibulum ullamcorper nibh, ut semper purus pulvinar ut. Donec volutpat orci sit amet mauris malesuada, non pulvinar augue aliquam. Vestibulum ultricies at urna ut suscipit. Morbi iaculis, erat at imperdiet semper, ipsum nulla sodales erat, eget tincidunt justo dui quis justo. Pellentesque dictum bibendum diam at aliquet. Sed pulvinar, dolor quis finibus ornare, eros odio facilisis erat, eu rhoncus nunc dui sed ex. Nunc gravida dui massa, sed ornare arcu tincidunt sit amet. Maecenas efficitur sapien neque, a laoreet libero feugiat ut.
Nulla facilisi. Maecenas sodales nec purus eget posuere. Sed sapien quam, pretium a risus in, porttitor dapibus erat. Sed sit amet fringilla ipsum, eget iaculis augue. Integer sollicitudin tortor quis ultricies aliquam. Suspendisse fringilla nunc in tellus cursus, at placerat tellus scelerisque. Sed tempus elit a sollicitudin rhoncus. Nulla facilisi. Morbi nec dolor dolor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras et aliquet lectus. Pellentesque sit amet eros nisi. Quisque ac sapien in sapien congue accumsan. Nullam in posuere ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin lacinia leo a nibh fringilla pharetra.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin venenatis lectus dui, vel ultrices ante bibendum hendrerit. Aenean egestas feugiat dui id hendrerit. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur in tellus laoreet, eleifend nunc id, viverra leo. Proin vulputate non dolor vel vulputate. Curabitur pretium lobortis felis, sit amet finibus lorem suscipit ut. Sed non mollis risus. Duis sagittis, mi in euismod tincidunt, nunc mauris vestibulum urna, at euismod est elit quis erat. Phasellus accumsan vitae neque eu placerat. In elementum arcu nec tellus imperdiet, eget maximus nulla sodales. Curabitur eu sapien eget nisl sodales fermentum.
Phasellus pulvinar ex id commodo imperdiet. Praesent odio nibh, sollicitudin sit amet faucibus id, placerat at metus. Donec vitae eros vitae tortor hendrerit finibus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque vitae purus dolor. Duis suscipit ac nulla et finibus. Phasellus ac sem sed dui dictum gravida. Phasellus eleifend vestibulum facilisis. Integer pharetra nec enim vitae mattis. Duis auctor, lectus quis condimentum bibendum, nunc dolor aliquam massa, id bibendum orci velit quis magna. Ut volutpat nulla nunc, sed interdum magna condimentum non. Sed urna metus, scelerisque vitae consectetur a, feugiat quis magna. Donec dignissim ornare nisl, eget tempor risus malesuada quis.

View File

@@ -1,11 +0,0 @@
---
title: Adding RSS Support - RSS Truncation Test
author: Eric Nakagawa
authorURL: http://twitter.com/ericnakagawa
authorFBID: 661277173
---
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
This should be truncated.
<!--truncate-->
This line should never render in XML.

View File

@@ -1,10 +0,0 @@
---
title: Adding RSS Support
author: Eric Nakagawa
authorURL: http://twitter.com/ericnakagawa
authorFBID: 661277173
---
This is a test post.
A whole bunch of other information.

View File

@@ -1,8 +0,0 @@
---
title: New Version 1.0.0
author: Eric Nakagawa
authorURL: http://twitter.com/ericnakagawa
authorFBID: 661277173
---
This blog post will test file name parsing issues when periods are present.

View File

@@ -0,0 +1,11 @@
---
id: hola
title: Hola
author: Gao Wei
author_title: Docusaurus Core Team
author_url: https://github.com/wgao19
author_image_url: https://avatars1.githubusercontent.com/u/2055384?v=4
tags: [hola, docusaurus]
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet

View File

@@ -0,0 +1,17 @@
---
id: hello-world
title: Hello
author: Endilie Yacop Sucipto
author_title: Maintainer of Docusaurus
author_url: https://github.com/endiliey
author_image_url: https://avatars1.githubusercontent.com/u/17883920?s=460&v=4
tags: [hello, docusaurus]
---
Welcome to this blog. This blog is created with [**Docusaurus 2 alpha**](https://v2.docusaurus.io/).
<!--truncate-->
This is a test post.
A whole bunch of other information.

View File

@@ -0,0 +1,13 @@
---
id: welcome
title: Welcome
author: Yangshun Tay
author_title: Front End Engineer @ Facebook
author_url: https://github.com/yangshun
author_image_url: https://avatars0.githubusercontent.com/u/1315101?s=400&v=4
tags: [facebook, hello, docusaurus]
---
Blog features are powered by the blog plugin. Simply add files to the `blog` directory. It supports tags as well!
Delete the whole directory if you don't want the blog features. As simple as that!

View File

@@ -1,108 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
class Footer extends React.Component {
docUrl(doc, language) {
const baseUrl = this.props.config.baseUrl;
const docsUrl = this.props.config.docsUrl;
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
const langPart = `${language ? `${language}/` : ''}`;
return `${baseUrl}${docsPart}${langPart}${doc}`;
}
pageUrl(doc, language) {
const baseUrl = this.props.config.baseUrl;
return baseUrl + (language ? `${language}/` : '') + doc;
}
render() {
return (
<footer className="nav-footer" id="footer">
<section className="sitemap">
<a href={this.props.config.baseUrl} className="nav-home">
{this.props.config.footerIcon && (
<img
src={this.props.config.baseUrl + this.props.config.footerIcon}
alt={this.props.config.title}
width="66"
height="58"
/>
)}
</a>
<div>
<h5>Docs</h5>
<a href={this.docUrl('doc1.html', this.props.language)}>
Getting Started (or other categories)
</a>
<a href={this.docUrl('doc2.html', this.props.language)}>
Guides (or other categories)
</a>
<a href={this.docUrl('doc3.html', this.props.language)}>
API Reference (or other categories)
</a>
</div>
<div>
<h5>Community</h5>
<a href={this.pageUrl('users.html', this.props.language)}>
User Showcase
</a>
<a
href="https://stackoverflow.com/questions/tagged/"
target="_blank"
rel="noreferrer noopener"
>
Stack Overflow
</a>
<a href="https://discordapp.com/">Project Chat</a>
<a
href="https://twitter.com/"
target="_blank"
rel="noreferrer noopener"
>
Twitter
</a>
</div>
<div>
<h5>More</h5>
<a href={`${this.props.config.baseUrl}blog`}>Blog</a>
<a href="https://github.com/">GitHub</a>
<a
className="github-button"
href={this.props.config.repoUrl}
data-icon="octicon-star"
data-count-href="/facebook/docusaurus/stargazers"
data-show-count="true"
data-count-aria-label="# stargazers on GitHub"
aria-label="Star this project on GitHub"
>
Star
</a>
</div>
</section>
<a
href="https://opensource.facebook.com/"
target="_blank"
rel="noreferrer noopener"
className="fbOpenSource"
>
<img
src={`${this.props.config.baseUrl}img/oss_logo.png`}
alt="Facebook Open Source"
width="170"
height="45"
/>
</a>
<section className="copyright">{this.props.config.copyright}</section>
</footer>
);
}
}
module.exports = Footer;

View File

@@ -1,29 +1,182 @@
---
id: doc1
title: Latin-ish
sidebar_label: Example Page
title: Style Guide
sidebar_label: Style Guide
---
Check the [documentation](https://docusaurus.io) for how to use Docusaurus.
You can write content using [GitHub-flavored Markdown syntax](https://github.github.com/gfm/).
## Lorem
## Markdown Syntax
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus elementum massa eget nulla aliquet sagittis. Proin odio tortor, vulputate ut odio in, ultrices ultricies augue. Cras ornare ultrices lorem malesuada iaculis. Etiam sit amet libero tempor, pulvinar mauris sed, sollicitudin sapien.
To serve as an example page when styling markdown based Docusaurus sites.
## Mauris In Code
## Headers
```
Mauris vestibulum ullamcorper nibh, ut semper purus pulvinar ut. Donec volutpat orci sit amet mauris malesuada, non pulvinar augue aliquam. Vestibulum ultricies at urna ut suscipit. Morbi iaculis, erat at imperdiet semper, ipsum nulla sodales erat, eget tincidunt justo dui quis justo. Pellentesque dictum bibendum diam at aliquet. Sed pulvinar, dolor quis finibus ornare, eros odio facilisis erat, eu rhoncus nunc dui sed ex. Nunc gravida dui massa, sed ornare arcu tincidunt sit amet. Maecenas efficitur sapien neque, a laoreet libero feugiat ut.
# H1 - Create the best documentation
## H2 - Create the best documentation
### H3 - Create the best documentation
#### H4 - Create the best documentation
##### H5 - Create the best documentation
###### H6 - Create the best documentation
---
## Emphasis
Emphasis, aka italics, with _asterisks_ or _underscores_.
Strong emphasis, aka bold, with **asterisks** or **underscores**.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
---
## Lists
1. First ordered list item
1. Another item ⋅⋅\* Unordered sub-list.
1. Actual numbers don't matter, just that it's a number ⋅⋅1. Ordered sub-list
1. And another item.
⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅ ⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅ ⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
- Unordered list can use asterisks
* Or minuses
- Or pluses
---
## Links
[I'm an inline-style link](https://www.google.com)
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
[I'm a reference-style link][arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself].
URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or <http://www.example.com> and sometimes example.com (but not on Github, for example).
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
---
## Images
Here's our logo (hover to see the title text):
Inline-style: ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png 'Logo Title Text 1')
Reference-style: ![alt text][logo]
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png 'Logo Title Text 2'
---
## Code
```javascript
var s = 'JavaScript syntax highlighting';
alert(s);
```
## Nulla
```python
s = "Python syntax highlighting"
print(s)
```
Nulla facilisi. Maecenas sodales nec purus eget posuere. Sed sapien quam, pretium a risus in, porttitor dapibus erat. Sed sit amet fringilla ipsum, eget iaculis augue. Integer sollicitudin tortor quis ultricies aliquam. Suspendisse fringilla nunc in tellus cursus, at placerat tellus scelerisque. Sed tempus elit a sollicitudin rhoncus. Nulla facilisi. Morbi nec dolor dolor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras et aliquet lectus. Pellentesque sit amet eros nisi. Quisque ac sapien in sapien congue accumsan. Nullam in posuere ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin lacinia leo a nibh fringilla pharetra.
```
No language indicated, so no syntax highlighting.
But let's throw in a <b>tag</b>.
```
## Orci
```js {2}
function highlightMe() {
console.log('This line can be highlighted!');
}
```
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin venenatis lectus dui, vel ultrices ante bibendum hendrerit. Aenean egestas feugiat dui id hendrerit. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur in tellus laoreet, eleifend nunc id, viverra leo. Proin vulputate non dolor vel vulputate. Curabitur pretium lobortis felis, sit amet finibus lorem suscipit ut. Sed non mollis risus. Duis sagittis, mi in euismod tincidunt, nunc mauris vestibulum urna, at euismod est elit quis erat. Phasellus accumsan vitae neque eu placerat. In elementum arcu nec tellus imperdiet, eget maximus nulla sodales. Curabitur eu sapien eget nisl sodales fermentum.
---
## Phasellus
## Tables
Phasellus pulvinar ex id commodo imperdiet. Praesent odio nibh, sollicitudin sit amet faucibus id, placerat at metus. Donec vitae eros vitae tortor hendrerit finibus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque vitae purus dolor. Duis suscipit ac nulla et finibus. Phasellus ac sem sed dui dictum gravida. Phasellus eleifend vestibulum facilisis. Integer pharetra nec enim vitae mattis. Duis auctor, lectus quis condimentum bibendum, nunc dolor aliquam massa, id bibendum orci velit quis magna. Ut volutpat nulla nunc, sed interdum magna condimentum non. Sed urna metus, scelerisque vitae consectetur a, feugiat quis magna. Donec dignissim ornare nisl, eget tempor risus malesuada quis.
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- | :-----------: | -----: |
| col 3 is | right-aligned | \$1600 |
| col 2 is | centered | \$12 |
| zebra stripes | are neat | \$1 |
There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
| Markdown | Less | Pretty |
| -------- | --------- | ---------- |
| _Still_ | `renders` | **nicely** |
| 1 | 2 | 3 |
---
## Blockquotes
> Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can _put_ **Markdown** into a blockquote.
---
## Inline HTML
<dl>
<dt>Definition list</dt>
<dd>Is something people use sometimes.</dd>
<dt>Markdown in HTML</dt>
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
---
## Line Breaks
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a _separate paragraph_.
This line is also a separate paragraph, but... This line is only separated by a single newline, so it's a separate line in the _same paragraph_.
---
## Admonitions
:::note This is a note :::
:::tip This is a tip :::
:::important This is important :::
:::caution This is a caution :::
:::warning This is a warning :::

View File

@@ -1,7 +1,6 @@
---
id: doc2
title: document number 2
title: Document Number 2
---
This is a link to [another document.](doc3.md)
This is a link to an [external page.](http://www.example.com)
This is a link to [another document.](doc3.md) This is a link to an [external page.](http://www.example.com)

View File

@@ -1,7 +1,8 @@
---
id: doc3
title: This is document number 3
title: This is Document Number 3
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac euismod odio, eu consequat dui. Nullam molestie consectetur risus id imperdiet. Proin sodales ornare turpis, non mollis massa ultricies id. Nam at nibh scelerisque, feugiat ante non, dapibus tortor. Vivamus volutpat diam quis tellus elementum bibendum. Praesent semper gravida velit quis aliquam. Etiam in cursus neque. Nam lectus ligula, malesuada et mauris a, bibendum faucibus mi. Phasellus ut interdum felis. Phasellus in odio pulvinar, porttitor urna eget, fringilla lectus. Aliquam sollicitudin est eros. Mauris consectetur quam vitae mauris interdum hendrerit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Duis et egestas libero, imperdiet faucibus ipsum. Sed posuere eget urna vel feugiat. Vivamus a arcu sagittis, fermentum urna dapibus, congue lectus. Fusce vulputate porttitor nisl, ac cursus elit volutpat vitae. Nullam vitae ipsum egestas, convallis quam non, porta nibh. Morbi gravida erat nec neque bibendum, eu pellentesque velit posuere. Fusce aliquam erat eu massa eleifend tristique.

View File

@@ -1,6 +0,0 @@
---
id: doc4
title: Other Document
---
this is another document

View File

@@ -1,6 +0,0 @@
---
id: doc5
title: Fifth Document
---
Another one

View File

@@ -0,0 +1,17 @@
---
id: mdx
title: Powered by MDX
---
You can write JSX and use React components within your Markdown thanks to [MDX](https://mdxjs.com/).
export const Highlight = ({children, color}) => ( <span style={{
backgroundColor: color,
borderRadius: '2px',
color: '#fff',
padding: '0.2rem',
}}> {children} </span> );
<Highlight color="#25c2a0">Docusaurus green</Highlight> and <Highlight color="#1877F2">Facebook blue</Highlight> are my favorite colors.
I can write **Markdown** alongside my _JSX_!

View File

@@ -0,0 +1,96 @@
module.exports = {
title: 'My Site',
tagline: 'The tagline of my site',
url: 'https://your-docusaurus-test-site.com',
baseUrl: '/',
favicon: 'img/favicon.ico',
organizationName: 'facebook', // Usually your GitHub org/user name.
projectName: 'docusaurus', // Usually your repo name.
themeConfig: {
navbar: {
title: 'My Site',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
},
links: [
{
to: 'docs/doc1',
activeBasePath: 'docs',
label: 'Docs',
position: 'left',
},
{ to: 'blog', label: 'Blog', position: 'left' },
{
href: 'https://github.com/facebook/docusaurus',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Style Guide',
to: 'docs/doc1',
},
{
label: 'Second Doc',
to: 'docs/doc2',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
label: 'Discord',
href: 'https://discordapp.com/invite/docusaurus',
},
],
},
{
title: 'Social',
items: [
{
label: 'Blog',
to: 'blog',
},
{
label: 'GitHub',
href: 'https://github.com/facebook/docusaurus',
},
{
label: 'Twitter',
href: 'https://twitter.com/docusaurus',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
},
},
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl:
'https://github.com/facebook/docusaurus/edit/master/website/',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
],
};

View File

@@ -1,14 +1,30 @@
{
"name": "23-docusaurus",
"version": "0.0.0",
"private": true,
"scripts": {
"examples": "docusaurus-examples",
"start": "docusaurus-start",
"build": "docusaurus-build",
"publish-gh-pages": "docusaurus-publish",
"write-translations": "docusaurus-write-translations",
"version": "docusaurus-version",
"rename-version": "docusaurus-rename-version"
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy"
},
"devDependencies": {
"docusaurus": "^1.11.1"
"dependencies": {
"@docusaurus/core": "2.0.0-alpha.48",
"@docusaurus/preset-classic": "2.0.0-alpha.48",
"classnames": "2.2.6",
"react": "16.8.4",
"react-dom": "16.8.4"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@@ -1,54 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
const CompLibrary = require('../../core/CompLibrary.js');
const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock;
function Help(props) {
const {config: siteConfig, language = ''} = props;
const {baseUrl, docsUrl} = siteConfig;
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
const langPart = `${language ? `${language}/` : ''}`;
const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}`;
const supportLinks = [
{
content: `Learn more using the [documentation on this site.](${docUrl(
'doc1.html',
)})`,
title: 'Browse Docs',
},
{
content: 'Ask questions about the documentation and project',
title: 'Join the community',
},
{
content: "Find out what's new with this project",
title: 'Stay up to date',
},
];
return (
<div className="docMainWrapper wrapper">
<Container className="mainContainer documentContainer postContainer">
<div className="post">
<header className="postHeader">
<h1>Need help?</h1>
</header>
<p>This project is maintained by a dedicated group of people.</p>
<GridBlock contents={supportLinks} layout="threeColumn" />
</div>
</Container>
</div>
);
}
module.exports = Help;

View File

@@ -1,212 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
const CompLibrary = require('../../core/CompLibrary.js');
const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock;
class HomeSplash extends React.Component {
render() {
const {siteConfig, language = ''} = this.props;
const {baseUrl, docsUrl} = siteConfig;
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
const langPart = `${language ? `${language}/` : ''}`;
const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}`;
const SplashContainer = props => (
<div className="homeContainer">
<div className="homeSplashFade">
<div className="wrapper homeWrapper">{props.children}</div>
</div>
</div>
);
const Logo = props => (
<div className="projectLogo">
<img src={props.img_src} alt="Project Logo" />
</div>
);
const ProjectTitle = () => (
<h2 className="projectTitle">
{siteConfig.title}
<small>{siteConfig.tagline}</small>
</h2>
);
const PromoSection = props => (
<div className="section promoSection">
<div className="promoRow">
<div className="pluginRowBlock">{props.children}</div>
</div>
</div>
);
const Button = props => (
<div className="pluginWrapper buttonWrapper">
<a className="button" href={props.href} target={props.target}>
{props.children}
</a>
</div>
);
return (
<SplashContainer>
<Logo img_src={`${baseUrl}img/undraw_monitor.svg`} />
<div className="inner">
<ProjectTitle siteConfig={siteConfig} />
<PromoSection>
<Button href="#try">Try It Out</Button>
<Button href={docUrl('doc1.html')}>Example Link</Button>
<Button href={docUrl('doc2.html')}>Example Link 2</Button>
</PromoSection>
</div>
</SplashContainer>
);
}
}
class Index extends React.Component {
render() {
const {config: siteConfig, language = ''} = this.props;
const {baseUrl} = siteConfig;
const Block = props => (
<Container
padding={['bottom', 'top']}
id={props.id}
background={props.background}>
<GridBlock
align="center"
contents={props.children}
layout={props.layout}
/>
</Container>
);
const FeatureCallout = () => (
<div
className="productShowcaseSection paddingBottom"
style={{textAlign: 'center'}}>
<h2>Feature Callout</h2>
<MarkdownBlock>These are features of this project</MarkdownBlock>
</div>
);
const TryOut = () => (
<Block id="try">
{[
{
content:
'To make your landing page more attractive, use illustrations! Check out ' +
'[**unDraw**](https://undraw.co/) which provides you with customizable illustrations which are free to use. ' +
'The illustrations you see on this page are from unDraw.',
image: `${baseUrl}img/undraw_code_review.svg`,
imageAlign: 'left',
title: 'Wonderful SVG Illustrations',
},
]}
</Block>
);
const Description = () => (
<Block background="dark">
{[
{
content:
'This is another description of how this project is useful',
image: `${baseUrl}img/undraw_note_list.svg`,
imageAlign: 'right',
title: 'Description',
},
]}
</Block>
);
const LearnHow = () => (
<Block background="light">
{[
{
content:
'Each new Docusaurus project has **randomly-generated** theme colors.',
image: `${baseUrl}img/undraw_youtube_tutorial.svg`,
imageAlign: 'right',
title: 'Randomly Generated Theme Colors',
},
]}
</Block>
);
const Features = () => (
<Block layout="fourColumn">
{[
{
content: 'This is the content of my feature',
image: `${baseUrl}img/undraw_react.svg`,
imageAlign: 'top',
title: 'Feature One',
},
{
content: 'The content of my second feature',
image: `${baseUrl}img/undraw_operating_system.svg`,
imageAlign: 'top',
title: 'Feature Two',
},
]}
</Block>
);
const Showcase = () => {
if ((siteConfig.users || []).length === 0) {
return null;
}
const showcase = siteConfig.users
.filter(user => user.pinned)
.map(user => (
<a href={user.infoLink} key={user.infoLink}>
<img src={user.image} alt={user.caption} title={user.caption} />
</a>
));
const pageUrl = page => baseUrl + (language ? `${language}/` : '') + page;
return (
<div className="productShowcaseSection paddingBottom">
<h2>Who is Using This?</h2>
<p>This project is used by all these people</p>
<div className="logos">{showcase}</div>
<div className="more-users">
<a className="button" href={pageUrl('users.html')}>
More {siteConfig.title} Users
</a>
</div>
</div>
);
};
return (
<div>
<HomeSplash siteConfig={siteConfig} language={language} />
<div className="mainContainer">
<Features />
<FeatureCallout />
<LearnHow />
<TryOut />
<Description />
<Showcase />
</div>
</div>
);
}
}
module.exports = Index;

View File

@@ -1,48 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
const CompLibrary = require('../../core/CompLibrary.js');
const Container = CompLibrary.Container;
class Users extends React.Component {
render() {
const {config: siteConfig} = this.props;
if ((siteConfig.users || []).length === 0) {
return null;
}
const editUrl = `${siteConfig.repoUrl}/edit/master/website/siteConfig.js`;
const showcase = siteConfig.users.map(user => (
<a href={user.infoLink} key={user.infoLink}>
<img src={user.image} alt={user.caption} title={user.caption} />
</a>
));
return (
<div className="mainContainer">
<Container padding={['bottom', 'top']}>
<div className="showcaseSection">
<div className="prose">
<h1>Who is Using This?</h1>
<p>This project is used by many folks</p>
</div>
<div className="logos">{showcase}</div>
<p>Are you using this project?</p>
<a href={editUrl} className="button">
Add your company
</a>
</div>
</Container>
</div>
);
}
}
module.exports = Users;

View File

@@ -0,0 +1,6 @@
module.exports = {
someSidebar: {
Docusaurus: ['doc1', 'doc2', 'doc3'],
Features: ['mdx'],
},
};

View File

@@ -1,10 +0,0 @@
{
"docs": {
"Docusaurus": ["doc1"],
"First Category": ["doc2"],
"Second Category": ["doc3"]
},
"docs-other": {
"First Category": ["doc4", "doc5"]
}
}

View File

@@ -1,111 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// See https://docusaurus.io/docs/site-config for all the possible
// site configuration options.
const path = require('path');
// List of projects/orgs using your project for the users page.
const users = [
{
caption: 'User1',
// You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/undraw_open_source.svg',
infoLink: 'https://www.facebook.com',
pinned: true,
},
];
const siteConfig = {
// We need to keep the docs folder in the same folder
// as the package.json file for now
customDocsPath: path.basename(__dirname) + '/docs',
title: 'Test Site', // Title for your website.
tagline: 'A website for testing',
url: 'https://your-docusaurus-test-site.com', // Your website URL
baseUrl: '/', // Base URL for your project */
// For github.io type URLs, you would set the url and baseUrl like:
// url: 'https://facebook.github.io',
// baseUrl: '/test-site/',
// Used for publishing and more
projectName: 'test-site',
organizationName: 'facebook',
// For top-level user or org sites, the organization is still the same.
// e.g., for the https://JoelMarcey.github.io site, it would be set like...
// organizationName: 'JoelMarcey'
// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{doc: 'doc1', label: 'Docs'},
{doc: 'doc4', label: 'API'},
{page: 'help', label: 'Help'},
{blog: true, label: 'Blog'},
],
// If you have users set above, you add it here:
users,
/* path to images for header/footer */
headerIcon: 'img/favicon.ico',
footerIcon: 'img/favicon.ico',
favicon: 'img/favicon.ico',
/* Colors for website */
colors: {
primaryColor: '#03453a',
secondaryColor: '#023028',
},
/* Custom fonts for website */
/*
fonts: {
myFont: [
"Times New Roman",
"Serif"
],
myOtherFont: [
"-apple-system",
"system-ui"
]
},
*/
// This copyright info is used in /core/Footer.js and blog RSS/Atom feeds.
copyright: `Copyright © ${new Date().getFullYear()} Your Name or Your Company Name`,
highlight: {
// Highlight.js theme to use for syntax highlighting in code blocks.
theme: 'default',
},
// Add custom scripts here that would be placed in <script> tags.
scripts: ['https://buttons.github.io/buttons.js'],
// On page navigation for the current documentation page.
onPageNav: 'separate',
// No .html extensions for paths.
cleanUrl: true,
// Open Graph and Twitter card images.
ogImage: 'img/undraw_online.svg',
twitterImage: 'img/undraw_tweetstorm.svg',
// Show documentation's last contributor's name.
// enableUpdateBy: true,
// Show documentation's last update time.
// enableUpdateTime: true,
// You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL...
// repoUrl: 'https://github.com/facebook/test-site',
};
module.exports = siteConfig;

View File

@@ -0,0 +1,25 @@
/* stylelint-disable docusaurus/copyright-header */
/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
* work well for content-centric websites.
*/
/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: rgb(33, 175, 144);
--ifm-color-primary-darker: rgb(31, 165, 136);
--ifm-color-primary-darkest: rgb(26, 136, 112);
--ifm-color-primary-light: rgb(70, 203, 174);
--ifm-color-primary-lighter: rgb(102, 212, 189);
--ifm-color-primary-lightest: rgb(146, 224, 208);
--ifm-code-font-size: 95%;
}
.docusaurus-highlight-code-line {
background-color: rgb(72, 77, 91);
display: block;
margin: 0 calc(-1 * var(--ifm-pre-padding));
padding: 0 var(--ifm-pre-padding);
}

View File

@@ -0,0 +1,99 @@
import React from 'react';
import classnames from 'classnames';
import Layout from '@theme/Layout';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import styles from './styles.module.css';
const features = [
{
title: <>Easy to Use</>,
imageUrl: 'img/undraw_docusaurus_mountain.svg',
description: (
<>
Docusaurus was designed from the ground up to be easily installed and
used to get your website up and running quickly.
</>
),
},
{
title: <>Focus on What Matters</>,
imageUrl: 'img/undraw_docusaurus_tree.svg',
description: (
<>
Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go
ahead and move your docs into the <code>docs</code> directory.
</>
),
},
{
title: <>Powered by React</>,
imageUrl: 'img/undraw_docusaurus_react.svg',
description: (
<>
Extend or customize your website layout by reusing React. Docusaurus can
be extended while reusing the same header and footer.
</>
),
},
];
function Feature({ imageUrl, title, description }) {
const imgUrl = useBaseUrl(imageUrl);
return (
<div className={classnames('col col--4', styles.feature)}>
{imgUrl && (
<div className="text--center">
<img className={styles.featureImage} src={imgUrl} alt={title} />
</div>
)}
<h3>{title}</h3>
<p>{description}</p>
</div>
);
}
function Home() {
const context = useDocusaurusContext();
const { siteConfig = {} } = context;
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />"
>
<header className={classnames('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link
className={classnames(
'button button--outline button--secondary button--lg',
styles.getStarted
)}
to={useBaseUrl('docs/doc1')}
>
Get Started
</Link>
</div>
</div>
</header>
<main>
{features && features.length && (
<section className={styles.features}>
<div className="container">
<div className="row">
{features.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
)}
</main>
</Layout>
);
}
export default Home;

Some files were not shown because too many files have changed in this diff Show More