Skip to content

Commit b0ad523

Browse files
styflekodiakhq[bot]
authored andcommitted
Create monorepo (vercel#2812)
* Move now-cli to /packages/now-cli * Fix .gitignore paths * Add now-client * Add lerna to top level * Add scripts * Update codeowners * Fix `/now-cli/build.ts` script * Fix circleci path to artifacts * Use relative paths * Fix path to scripts * Add test-lint script * Add missing return type * Fix typo in test-lint * Fix string match in shell scripts * Fix path to hugo * Add package node_modules * Delete lock files in packages, use root yarn.lock * Add missing b.js file * Add test-integration-now-dev script * Add missing test files * Add missing integration test script * Add missing test files * Delete travis.yml * Fix ts-jest in now-client * Add support for Node 8 (ES2015 target) * Add support for Node 8 * Add polyfill for Node 8 * Fix polyfill for Node 8 * Only run coverage for now-cli * Add packages from now-builders * Run integration tests for builders * Add node_modules to cache * Add root readme.md * Move readme to top level * Add yarn bootstrap * Add bootstrap step * Add dist to `persist_to_workspace` * Fix 08-yarn-npm integration test * Remove duplicate path * Change stdio to inherit * Add back store_artifacts * testing - remove bootstrap step * Add back now-build-utils * Remove bootstrap step * Fix test again * Add console.log() * Fix lint * Use local ncc version * Install go * Revert changes to stdio and console.log() * Add missing now-go test * Add missing integration tests * Add --runInBand flag * Fix now-node-bridge persistence * Add missing symlinks * Add codeowners * Consolidate into single run.sh function * Run uniq * Fix typo * Change now-routing-utils to test-unit * Special case test for node 8 * Add docs from builders * Only run script for modified packages * Add test-integration-once which only runs once * Fix set intersection
1 parent 774e0a0 commit b0ad523

File tree

2,161 files changed

+77740
-17893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,161 files changed

+77740
-17893
lines changed

.circleci/config.yml

+82-14
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,56 @@ jobs:
55
docker:
66
- image: circleci/node:10
77
working_directory: ~/repo
8+
environment:
9+
GOPATH: $HOME/go
810
steps:
911
- checkout
1012
- restore_cache:
1113
keys:
1214
- v1-dependencies-{{ checksum "yarn.lock" }}
1315
# fallback to using the latest cache if no exact match is found
1416
- v1-dependencies-
17+
- run:
18+
name: Updating apt packages
19+
command: sudo apt-get update
20+
- run:
21+
name: Installing the latest version of Go
22+
command: sudo apt-get install golang-go
1523
- run:
1624
name: Installing Dependencies
17-
command: yarn
25+
command: yarn install
1826
- save_cache:
1927
paths:
2028
- node_modules
29+
- packages/now-build-utils/node_modules
30+
- packages/now-cgi/node_modules
31+
- packages/now-cli/node_modules
32+
- packages/now-client/node_modules
33+
- packages/now-go/node_modules
34+
- packages/now-next/node_modules
35+
- packages/now-node/node_modules
36+
- packages/now-node-bridge/node_modules
37+
- packages/now-python/node_modules
38+
- packages/now-routing-utils/node_modules
39+
- packages/now-ruby/node_modules
40+
- packages/now-static-build/node_modules
2141
key: v1-dependencies-{{ checksum "yarn.lock" }}
2242
- persist_to_workspace:
2343
root: .
2444
paths:
2545
- node_modules
46+
- packages/now-build-utils/node_modules
47+
- packages/now-cgi/node_modules
48+
- packages/now-cli/node_modules
49+
- packages/now-client/node_modules
50+
- packages/now-go/node_modules
51+
- packages/now-next/node_modules
52+
- packages/now-node/node_modules
53+
- packages/now-node-bridge/node_modules
54+
- packages/now-python/node_modules
55+
- packages/now-routing-utils/node_modules
56+
- packages/now-ruby/node_modules
57+
- packages/now-static-build/node_modules
2658

2759
build:
2860
docker:
@@ -39,12 +71,26 @@ jobs:
3971
name: Building
4072
command: yarn build
4173
- store_artifacts:
42-
path: dist
74+
path: packages/now-cli/dist
4375
- persist_to_workspace:
4476
root: .
4577
paths:
46-
- assets
47-
- dist
78+
- packages/now-build-utils/dist
79+
- packages/now-cgi/dist
80+
- packages/now-cli/dist
81+
- packages/now-cli/assets
82+
- packages/now-client/dist
83+
- packages/now-go/dist
84+
- packages/now-next/dist
85+
- packages/now-node/dist
86+
- packages/now-node/test/fixtures/15-helpers/ts/types.d.ts
87+
- packages/now-node/test/fixtures/11-symlinks/symlink
88+
- packages/now-node-bridge/index.js
89+
- packages/now-node-bridge/bridge.js
90+
- packages/now-python/dist
91+
- packages/now-routing-utils/dist
92+
- packages/now-ruby/dist
93+
- packages/now-static-build/dist
4894

4995
test-lint:
5096
docker:
@@ -56,7 +102,7 @@ jobs:
56102
at: .
57103
- run:
58104
name: Compiling `now dev` HTML error templates
59-
command: node ./scripts/compile-templates.js
105+
command: node packages/now-cli/scripts/compile-templates.js
60106
- run:
61107
name: Linting Code
62108
command: yarn test-lint
@@ -71,14 +117,14 @@ jobs:
71117
at: .
72118
- run:
73119
name: Compiling `now dev` HTML error templates
74-
command: node ./scripts/compile-templates.js
120+
command: node packages/now-cli/scripts/compile-templates.js
75121
- run:
76122
name: Running Unit Tests
77123
command: yarn test-unit --clean false
78124
- persist_to_workspace:
79125
root: .
80126
paths:
81-
- .nyc_output
127+
- packages/now-cli/.nyc_output
82128

83129
test-integration-macos-node-8:
84130
macos:
@@ -189,7 +235,7 @@ jobs:
189235
command: node --version
190236
- run:
191237
name: Downloading Hugo
192-
command: 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 test/dev/fixtures/08-hugo
238+
command: 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/
193239
- run:
194240
name: Running Integration Tests for `now dev`
195241
command: yarn test-integration-now-dev --clean false
@@ -207,7 +253,7 @@ jobs:
207253
command: node --version
208254
- run:
209255
name: Downloading Hugo
210-
command: 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 test/dev/fixtures/08-hugo
256+
command: 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/
211257
- run:
212258
name: Running Integration Tests for `now dev`
213259
command: yarn test-integration-now-dev --clean false
@@ -225,7 +271,7 @@ jobs:
225271
command: node --version
226272
- run:
227273
name: Downloading Hugo
228-
command: 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 test/dev/fixtures/08-hugo
274+
command: 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/
229275
- run:
230276
name: Running Integration Tests for `now dev`
231277
command: yarn test-integration-now-dev --clean false
@@ -243,7 +289,7 @@ jobs:
243289
command: node --version
244290
- run:
245291
name: Downloading Hugo
246-
command: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_0.55.6_Linux-64bit.tar.gz && tar -xzf hugo_0.55.6_Linux-64bit.tar.gz && mv ./hugo test/dev/fixtures/08-hugo
292+
command: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_0.55.6_Linux-64bit.tar.gz && tar -xzf hugo_0.55.6_Linux-64bit.tar.gz && mv ./hugo packages/now-cli/test/dev/fixtures/08-hugo/
247293
- run:
248294
name: Running Integration Tests for `now dev`
249295
command: yarn test-integration-now-dev --clean false
@@ -261,7 +307,7 @@ jobs:
261307
command: node --version
262308
- run:
263309
name: Downloading Hugo
264-
command: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_0.55.6_Linux-64bit.tar.gz && tar -xzf hugo_0.55.6_Linux-64bit.tar.gz && mv ./hugo test/dev/fixtures/08-hugo
310+
command: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_0.55.6_Linux-64bit.tar.gz && tar -xzf hugo_0.55.6_Linux-64bit.tar.gz && mv ./hugo packages/now-cli/test/dev/fixtures/08-hugo/
265311
- run:
266312
name: Running Integration Tests for `now dev`
267313
command: yarn test-integration-now-dev --clean false
@@ -279,11 +325,26 @@ jobs:
279325
command: node --version
280326
- run:
281327
name: Downloading Hugo
282-
command: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_0.55.6_Linux-64bit.tar.gz && tar -xzf hugo_0.55.6_Linux-64bit.tar.gz && mv ./hugo test/dev/fixtures/08-hugo
328+
command: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_0.55.6_Linux-64bit.tar.gz && tar -xzf hugo_0.55.6_Linux-64bit.tar.gz && mv ./hugo packages/now-cli/test/dev/fixtures/08-hugo/
283329
- run:
284330
name: Running Integration Tests for `now dev`
285331
command: yarn test-integration-now-dev --clean false
286332

333+
test-integration-once:
334+
docker:
335+
- image: circleci/node:10
336+
working_directory: ~/repo
337+
steps:
338+
- checkout
339+
- attach_workspace:
340+
at: .
341+
- run:
342+
name: Output version
343+
command: node --version
344+
- run:
345+
name: Running Integration Tests Once
346+
command: yarn test-integration-once --clean false
347+
287348
coverage:
288349
docker:
289350
- image: circleci/node:10
@@ -294,7 +355,7 @@ jobs:
294355
at: .
295356
- run:
296357
name: Run coverage report
297-
command: yarn coverage
358+
command: yarn workspace now run coverage
298359

299360
source-maps:
300361
docker:
@@ -445,6 +506,12 @@ workflows:
445506
filters:
446507
tags:
447508
only: /.*/
509+
- test-integration-once:
510+
requires:
511+
- build
512+
filters:
513+
tags:
514+
only: /.*/
448515
- coverage:
449516
requires:
450517
- test-unit
@@ -460,6 +527,7 @@ workflows:
460527
- test-integration-linux-now-dev-node-8
461528
- test-integration-linux-now-dev-node-10
462529
- test-integration-linux-now-dev-node-12
530+
- test-integration-once
463531
- test-lint
464532
filters:
465533
tags:

.circleci/publish.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if [ -z "$NPM_TOKEN" ]; then
5+
echo "NPM_TOKEN not found. Did you forget to assign the GitHub Action secret?"
6+
exit 1
7+
fi
8+
9+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
10+
11+
if [ ! -e ~/.npmrc ]; then
12+
echo "~/.npmrc file does not exist, skipping publish"
13+
exit 0
14+
fi
15+
16+
npm_tag=""
17+
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
18+
19+
if [ -z "$tag" ]; then
20+
echo "Not a tagged commit, skipping publish"
21+
exit 0
22+
fi
23+
24+
if [[ "$tag" =~ -canary ]]; then
25+
echo "Publishing canary release"
26+
npm_tag="--npm-tag canary"
27+
else
28+
echo "Publishing stable release"
29+
fi
30+
31+
# Sometimes this is a false alarm and blocks publish
32+
git checkout yarn.lock
33+
34+
yarn run lerna publish from-git $npm_tag --yes

.circleci/run.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if [ "$1" == "" ]; then
5+
echo "Please provide at least one argument"
6+
exit 1
7+
fi
8+
9+
circleci_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
10+
found="$(grep -rn \"""$1"\"": packages/*/package.json | cut -d '/' -f2 | uniq)"
11+
modified="$(git diff origin/canary...HEAD --name-only | grep '^packages/' | cut -d '/' -f2 | uniq)"
12+
echo "$found" > /tmp/found.txt
13+
echo "$modified" > /tmp/modified.txt
14+
pkgs="$(comm -12 <(sort /tmp/found.txt) <(sort /tmp/modified.txt))"
15+
echo "The following packages were modified: "
16+
echo "$pkgs" | wc -l
17+
echo "$pkgs"
18+
19+
for dir in $pkgs; do
20+
echo "cd packages/$dir && yarn $1"
21+
cd "$circleci_dir/../packages/$dir"
22+
yarn "$1"
23+
done

.github/CODEOWNERS

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
# Documentation
22
# https://help.github.com/en/articles/about-code-owners
33

4-
* @tootallnate @leo
5-
/src/commands/dev/ @tootallnate @leo @styfle @AndyBitz
6-
/src/util/dev/ @tootallnate @leo @styfle @AndyBitz
7-
/src/commands/domains/ @javivelasco @mglagola @anatrajkovska
8-
/src/commands/certs/ @javivelasco @mglagola @anatrajkovska
4+
* @tootallnate @leo
5+
/packages/now-cli/src/commands/dev/ @tootallnate @leo @styfle @AndyBitz
6+
/packages/now-cli/src/util/dev/ @tootallnate @leo @styfle @AndyBitz
7+
/packages/now-cli/src/commands/domains/ @javivelasco @mglagola @anatrajkovska
8+
/packages/now-cli/src/commands/certs/ @javivelasco @mglagola @anatrajkovska
9+
/packages/now-client @leo @rdev
10+
/packages/now-build-utils @styfle @AndyBitz
11+
/packages/now-node @styfle @tootallnate @lucleray
12+
/packages/now-node-bridge @styfle @tootallnate @lucleray
13+
/packages/now-next @Timer
14+
/packages/now-go @styfle @sophearak
15+
/packages/now-python @styfle @sophearak
16+
/packages/now-ruby @styfle @coetry @nathancahill
17+
/packages/now-static-build @styfle @AndyBitz
18+
/packages/now-routing-utils @dav-is

.gitignore

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
node_modules
22
package-lock.json
33
dist
4-
test/fixtures/integration
54
npm-debug.log
65
yarn-error.log
76
.nyc_output
87
coverage
98
*.swp
109
*.bak
1110
*.tgz
12-
.builders
13-
/assets
14-
/src/util/dev/templates/*.ts
15-
/test/**/yarn.lock
16-
/test/**/node_modules
17-
/test/dev/fixtures/08-hugo/hugo
18-
/test/dev/fixtures/**/dist
19-
/test/dev/fixtures/**/public
11+
packages/now-cli/.builders
12+
packages/now-cli/assets
13+
packages/now-cli/src/util/dev/templates/*.ts
14+
packages/now-cli/test/**/yarn.lock
15+
packages/now-cli/test/**/node_modules
16+
packages/now-cli/test/dev/fixtures/08-hugo/hugo
17+
packages/now-cli/test/dev/fixtures/**/dist
18+
packages/now-cli/test/dev/fixtures/**/public

.yarnrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
save-prefix ""
1+
save-prefix ""

0 commit comments

Comments
 (0)