Skip to content

Commit 9ba0dc6

Browse files
authored
[development] Add turborepo convenience npm script using dot (#927)
1 parent 4da8339 commit 9ba0dc6

File tree

16 files changed

+38
-14
lines changed

16 files changed

+38
-14
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ steps:
8080
- echo "--- Install dependencies"
8181
- PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=0 yarn install --immutable
8282
- echo "--- Build bundles"
83-
- yarn run -T core+deps build
83+
- yarn run -T core . build
8484
- echo "+++ Run tests"
8585
- yarn run -T core lint
8686
- yarn run -T core test

DEVELOPMENT.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
1-
## Development
1+
# Development
22

3+
This project uses [Turborepo](https://turbo.build/repo/docs), for dependency-aware builds and linting. Please read up!
4+
5+
### Setup
36
```sh
47
git clone git@github.com:segmentio/analytics-next.git && cd analytics-next
58
nvm use # install version of node defined in .nvmrc.
69
yarn && yarn build
710
yarn lint && yarn test
811
```
12+
13+
###
14+
15+
### Build a specific package and all dependencies
16+
You have a couple options:
17+
1. you can _cd_ into a single package and run `yarn . build` build a package and all its dependencies (most convenient!).
18+
19+
2. You can use turborepo directly to build a package and all dependencies. See: Turborepo https://turbo.build/repo/docs/core-concepts/monorepos/filtering#filter-syntax.
20+
21+
For example:
22+
```
23+
yarn run -T turbo run build --filter=@segment/analytics-next
24+
```
25+
or
26+
```
27+
yarn run -T turbo run build --filter='./packages/node*'
28+
```
29+
30+
^ Note, the following applies to not only `build`, but other tasks such as `test`, `lint`, etc.

examples/standalone-playground/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"hoistingLimits": "workspaces"
66
},
77
"scripts": {
8+
".": "yarn run -T turbo run --filter=@example/standalone-playground",
89
"dev": "yarn concurrently 'yarn run -T watch --filter=standalone-playground' 'sleep 10 && yarn http-server .'",
910
"concurrently": "yarn run -T concurrently"
1011
},

examples/with-next-js/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6+
".": "yarn run -T turbo run --filter=@example/with-next-js",
67
"concurrently": "yarn run -T concurrently",
78
"dev": "yarn partytown && yarn concurrently 'yarn run -T watch --filter=with-next-js' 'sleep 10 && next dev'",
89
"build": "yarn partytown && next build",

examples/with-vite/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@example/with-vite",
33
"private": true,
44
"scripts": {
5+
".": "yarn run -T turbo run --filter=@example/with-vite",
56
"concurrently": "yarn run -T concurrently",
67
"dev": "yarn concurrently 'yarn run -T watch --filter=with-vite' 'sleep 10 && vite'",
78
"build": "tsc && vite build",

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@
2525
"release": "yarn clean && yarn build --force && changeset publish && git push origin HEAD:master --follow-tags --no-verify",
2626
"version-run-all": "yarn workspaces foreach -vpt --no-private run version",
2727
"core": "yarn workspace @segment/analytics-core",
28-
"core+deps": "turbo run --filter=@segment/analytics-core",
2928
"browser": "yarn workspace @segment/analytics-next",
30-
"browser+deps": "turbo run --filter=@segment/analytics-next",
3129
"node": "yarn workspace @segment/analytics-node",
32-
"node+deps": "turbo run --filter=@segment/analytics-node",
3330
"clean": "bash scripts/clean.sh",
3431
"turbo": "turbo"
3532
},

packages/browser/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build-browser: build # build dependencies
1818
.PHONY: build-browser
1919

2020
build: ## Builds libraries in prod mode, and all dependencies
21-
yarn run -T browser+deps build
21+
yarn run -T browser . build
2222
.PHONY: build
2323

2424
clean: ## Clean the build directory

packages/browser/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
],
2525
"sideEffects": false,
2626
"scripts": {
27+
".": "yarn run -T turbo run --filter=@segment/analytics-next",
2728
"build-prep": "sh scripts/build-prep.sh",
2829
"version": "yarn run build-prep && git add src/generated/version.ts",
2930
"umd": "webpack",
@@ -33,7 +34,7 @@
3334
"concurrently": "yarn run -T concurrently",
3435
"watch": "yarn concurrently 'NODE_ENV=production WATCH=true yarn umd --watch' 'yarn pkg --watch'",
3536
"build": "yarn clean && yarn build-prep && yarn concurrently 'NODE_ENV=production yarn umd' 'yarn pkg' 'yarn cjs'",
36-
"release:cdn": "yarn run -T browser+deps build && NODE_ENV=production bash scripts/release.sh && NODE_ENV=stage bash scripts/release.sh",
37+
"release:cdn": "yarn . build && NODE_ENV=production bash scripts/release.sh && NODE_ENV=stage bash scripts/release.sh",
3738
"pkg": "yarn tsc -p tsconfig.build.json",
3839
"cjs": "yarn tsc -p tsconfig.build.json --outDir ./dist/cjs --module commonjs",
3940
"clean": "rm -rf dist",

packages/consent/consent-tools-integration-tests/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ Why is this using wd.io instead of playwright?
1717
## Development
1818
### 1. Build this package + deps
1919
```sh
20-
# include the "..."
21-
yarn build...
20+
yarn . build
2221
```
2322
### 2. Start server + run tests (and exit gracefully)
2423
```

packages/consent/consent-tools-integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "@internal/consent-tools-integration-tests",
33
"private": true,
44
"scripts": {
5+
".": "yarn -T turbo run --filter=@internal/consent-tools-integration-tests",
56
"dev": "yarn concurrently 'yarn watch' 'yarn build serve --open'",
67
"build": "webpack",
78
"watch": "yarn build --watch",
8-
"build...": "yarn run -T turbo run build --filter=@internal/consent-tools-integration-tests",
99
"test:local": "wdio wdio.conf.local.ts",
1010
"start-server-and-test": "yarn concurrently -k 'yarn build serve' 'sleep 5 && yarn test:local'",
1111
"lint": "yarn concurrently 'yarn:eslint .' 'yarn:tsc --noEmit'",

0 commit comments

Comments
 (0)