Skip to content

Commit

Permalink
chore: move scripts to build and benchmark demos to new package (#7217)
Browse files Browse the repository at this point in the history
These scripts don't work right now, but this commit moves them to
a new home so we can think out the cli/package and eventually delete
it.
  • Loading branch information
mehulkar committed Feb 5, 2024
1 parent a514a72 commit 50d2f9a
Show file tree
Hide file tree
Showing 14 changed files with 185 additions and 188 deletions.
1 change: 0 additions & 1 deletion cli/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/demo/
/dist/
/dist-*

Expand Down
34 changes: 1 addition & 33 deletions cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,46 +146,14 @@ ifneq ($(SKIP_PUBLISH),--skip-publish)
npm publish -ddd --tag $(TURBO_TAG) $(CLI_DIR)/../turbo-types-$(TURBO_VERSION).tgz
endif

demo/lage: install
node $(CLI_DIR)/scripts/generate.mjs lage

demo/lerna: install
node $(CLI_DIR)/scripts/generate.mjs lerna

demo/nx: install
node $(CLI_DIR)/scripts/generate.mjs nx

demo/turbo: install
node $(CLI_DIR)/scripts/generate.mjs turbo

demo: demo/lage demo/lerna demo/nx demo/turbo

bench/lerna: demo/lerna
cd $(CLI_DIR)/demo/lerna && node_modules/.bin/lerna run build

bench/lage: demo/lage
cd $(CLI_DIR)/demo/lage && node_modules/.bin/lage build

bench/nx: demo/nx
cd $(CLI_DIR)/demo/nx && node_modules/.bin/nx run-many --target=build --all

bench/turbo: demo/turbo turbo
cd $(CLI_DIR)/demo/turbo && $(CLI_DIR)/turbo run test

bench: bench/lerna bench/lage bench/nx bench/turbo

clean: clean-build clean-demo clean-rust
clean: clean-build clean-rust

clean-rust:
cargo clean

clean-build:
rm -f turbo

clean-demo:
rm -rf node_modules
rm -rf demo

# use target fixture-<some directory under turborepo-tests/integration/fixtures> to set up the testbed directory
.PHONY=fixture-%
fixture-%:
Expand Down
9 changes: 1 addition & 8 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
"version": "0.0.0",
"scripts": {
"clean": "make clean",
"build": "make",
"lint:prettier": "prettier -c ./**/*.js ./**/*.ts --cache --ignore-path=../.prettierignore"
},
"devDependencies": {
"copy-template-dir": "^1.4.0",
"faker": "^5.1.0",
"ngraph.generators": "^19.3.0",
"shelljs": "^0.8.4"
"build": "make"
}
}
1 change: 1 addition & 0 deletions packages/turbo-benchmark/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/templates/**
1 change: 1 addition & 0 deletions packages/turbo-benchmark/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ large-monorepo
benchmarks.json
tinybird.ndjson
profiles/*.json
demo/
31 changes: 23 additions & 8 deletions packages/turbo-benchmark/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
{
"name": "@turbo/benchmark",
"version": "1.0.0",
"dependencies": {
"esbuild": "^0.15.0",
"esbuild-register": "^3.3.2",
"fs-extra": "^10.0.0",
"ndjson": "^2.0.0",
"node-fetch": "^2.6.8"
},
"scripts": {
"benchmark": "node -r esbuild-register src/index.ts",
"ttft": "node -r esbuild-register src/ttft/index.ts",
"lint": "eslint src",
"lint:prettier": "prettier -c src --cache --ignore-path=../.prettierignore",
"check-types": "tsc --noEmit"
"check-types": "tsc --noEmit",
"demo": "pnpm run demo:lage && pnpm run demo:lerna && pnpm run demo:nx && pnpm run demo:turbo",
"demo:lage": "node src/generate.mjs lage",
"demo:lerna": "node src/generate.mjs lerna",
"demo:nx": "node src/generate.mjs nx",
"demo:turbo": "node src/generate.mjs turbo",
"bench": "pnpm run bench:lerna && pnpm run bench:lage && pnpm run bench:nx && pnpm run bench:turbo",
"bench:lerna": "cd ./demo/lerna && node_modules/.bin/lerna run build",
"bench:lage": "echo $PWD && cd ./demo/lage && node_modules/.bin/lage build",
"bench:nx": "cd ./demo/nx && node_modules/.bin/nx run-many --target=build --all",
"bench:turbo": "cd ./demo/turbo && ./turbo run test",
"clean": "rm -rf ./demo"
},
"dependencies": {
"esbuild": "^0.15.0",
"esbuild-register": "^3.3.2",
"fs-extra": "^10.0.0",
"ndjson": "^2.0.0",
"node-fetch": "^2.6.8",
"copy-template-dir": "^1.4.0",
"faker": "^5.1.0",
"ngraph.generators": "^19.3.0",
"shelljs": "^0.8.4"
},
"devDependencies": {
"@turbo/tsconfig": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env node
import path from "node:path";
import { fileURLToPath } from "node:url";
import shelljs from "shelljs";
import path from "path";
import fs from "fs-extra";
import faker from "faker";
import graphGenerator from "ngraph.generators";
import copy from "copy-template-dir";
import { fileURLToPath } from "url";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
faker.seed(123);
Expand Down Expand Up @@ -54,7 +54,7 @@ packageGraph.forEachNode((node) => {
// 1. the root package.json
// 2. create packages/
// 3. create package directories
const root = path.join(__dirname, "../demo", type);
const root = path.join(__dirname, "..", "demo", type);

function generate(root, skipInstall) {
fs.mkdirSync(root, { recursive: true });
Expand All @@ -72,7 +72,9 @@ turbo-linux
if (fs.existsSync(root)) {
try {
fs.rmSync(root + "/packages", { recursive: true });

Check warning on line 74 in packages/turbo-benchmark/src/generate.mjs

View workflow job for this annotation

GitHub Actions / Formatting

Unexpected string concatenation
} catch (error) {}
} catch (error) {
// do nothing
}
}

let deps =

Check warning on line 80 in packages/turbo-benchmark/src/generate.mjs

View workflow job for this annotation

GitHub Actions / Formatting

'deps' is never reassigned. Use 'const' instead
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 9 additions & 2 deletions packages/turbo-benchmark/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{
"extends": "@turbo/tsconfig/library.json",
"skipLibCheck": true,
"include": ["./src/**/*"],
"include": [
"./src/**/*"
],
"exclude": [
"./src/templates/**/*"
],
"compilerOptions": {
"rootDir": ".",
"lib": ["ES2020"],
"lib": [
"ES2020"
],
}
}
Loading

0 comments on commit 50d2f9a

Please sign in to comment.