Skip to content

Commit

Permalink
chore: Introducing nx for caching (#4766)
Browse files Browse the repository at this point in the history
* initial work

* fixing typecheck output

* fixing outputs

* adjusting pr.yml workflow

* changing the root build to use dependOn

* working on test caching...

* adding inputs for example build tasks

* fixing example build caching

* adding a pr script

* fixing typo in pr.yml

* adding dependency test:ci > build-js to fix pipeline error
  • Loading branch information
ZackDeRose committed Mar 25, 2023
1 parent e8df7af commit 17cea29
Show file tree
Hide file tree
Showing 5 changed files with 1,513 additions and 991 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/pr.yml
Expand Up @@ -20,11 +20,5 @@ jobs:
- name: Install Dependencies
run: npm install --legacy-peer-deps

- name: Build the Project
run: npm run build

- name: Running Typechecks
run: npm run typecheck

- name: Running Tests
run: npm run test
- name: Run Checks
run: npm run pr
24 changes: 24 additions & 0 deletions nx.json
@@ -0,0 +1,24 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "build-js", "test:ci", "typecheck"]
}
}
},
"defaultBase": "main",
"namedInputs": {
"packageSources": [
"{workspaceRoot}/packages/**/src/**/*.ts",
"{workspaceRoot}/packages/**/tsconfig.json"
],
"buildDeps": ["{projectRoot}/**/*", "!{projectRoot}/__tests__/**/*"]
},
"targetDefaults": {
"build": {
"outputs": ["{projectRoot}/build"],
"inputs": ["buildDeps", "^buildDeps"]
}
}
}
10 changes: 6 additions & 4 deletions package.json
Expand Up @@ -4,9 +4,9 @@
"scripts": {
"clean": "npm exec --workspaces -c \"rm -rf build || true\"",
"test": "(is-ci && npm run test:ci) || npm run test:dev",
"test:ci": "vitest",
"test:ci": "nx test:ci root",
"test:dev": "vitest --watch",
"build": "rollup --config rollup.config.js && npm run typecheck",
"build": "nx build root",
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"tsc -b --watch\"",
"linkAll": "lerna exec 'npm link' --parallel",
"unlinkAll": "lerna exec 'npm unlink' --parallel",
Expand All @@ -15,7 +15,8 @@
"visualize": "lerna exec 'open build/stats-html.html'",
"cipublish": "ts-node scripts/publish.ts",
"cipublishforce": "CI=true npm run cipublish",
"typecheck": "tsc -b"
"typecheck": "nx typecheck root",
"pr": "nx run-many --targets=test:ci,build,typecheck --projects=root"
},
"namespace": "@tanstack",
"workspaces": [
Expand Down Expand Up @@ -111,6 +112,7 @@
"ts-node": "^10.7.0",
"typescript": "^4.7.4",
"vitest": "^0.29.3",
"vue": "^3.2.33"
"vue": "^3.2.33",
"nx": "15.8.7"
}
}
31 changes: 31 additions & 0 deletions project.json
@@ -0,0 +1,31 @@
{
"name": "root",
"targets": {
"build-js": {
"command": "rollup --config rollup.config.js",
"inputs": ["packageSources"],
"outputs": [
"{workspaceRoot}/packages/*/build/stats*",
"{workspaceRoot}/packages/*/build/**/*.(cjs|mjs|js)*"
]
},
"typecheck": {
"command": "tsc -b",
"inputs": ["packageSources"],
"outputs": [
"{workspaceRoot}/packages/*/build/**/*d.ts",
"{workspaceRoot}/packages/*/build/.tsbuildinfo"
]
},
"build": {
"command": "echo \" @tanstack/table > All packages built! 馃摝\"",
"dependsOn": ["build-js", "typecheck"],
"inputs": ["packageSources"]
},
"test:ci": {
"command": "vitest",
"inputs": ["packageSources", "{workspaceRoot}/packages/*/__tests__/**/*"],
"dependsOn": ["build-js"]
}
}
}

0 comments on commit 17cea29

Please sign in to comment.