From b43cd2d699d813b7f5db79f4532f76d36db1c259 Mon Sep 17 00:00:00 2001 From: Simon Boudrias Date: Tue, 9 Jul 2024 17:58:40 -0400 Subject: [PATCH] Chore(tests): Update Turbo + Github actions to run everything --- .github/workflows/main.yml | 8 +++++--- CONTRIBUTING.md | 6 +++--- package.json | 6 +++++- packages/checkbox/package.json | 2 +- packages/confirm/package.json | 2 +- packages/core/package.json | 2 +- packages/editor/package.json | 2 +- packages/expand/package.json | 2 +- packages/figures/package.json | 2 +- packages/input/package.json | 2 +- packages/inquirer/package.json | 2 +- packages/number/package.json | 2 +- packages/password/package.json | 2 +- packages/prompts/package.json | 2 +- packages/rawlist/package.json | 2 +- packages/select/package.json | 2 +- packages/testing/package.json | 2 +- packages/type/package.json | 2 +- tools/setup-packages.mjs | 2 +- turbo.json | 12 ++++++++---- 20 files changed, 37 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9e5e5bbb..a5213b767 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,8 +14,10 @@ jobs: node-version: 20 cache: 'yarn' - run: yarn install --immutable --immutable-cache - - name: Typescript - run: yarn turbo tsc + - name: Typescript - packages + run: yarn tsc + - name: Typescript - test files + run: yarn tsc:test - name: Eslint run: yarn eslint . - name: Validate package setup @@ -63,7 +65,7 @@ jobs: cache: 'yarn' - run: yarn install --immutable --immutable-cache - name: Typescript - run: yarn turbo tsc + run: yarn tsc - name: Integration tests run: yarn node --test integration/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2194b842..ea551c6a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,14 +56,14 @@ yarn prettier --write . ## Type checking ```sh -yarn turbo tsc +yarn tsc ``` ## Running demos ```sh -# First you need to build the prompts; and every time you change code. -yarn turbo tsc +# This command will launch tsc in watch mode +yarn dev # Then run the demos yarn node packages/demo diff --git a/package.json b/package.json index 124f135f6..265120930 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,11 @@ "prepare": "husky && turbo tsc attw", "setup": "node ./tools/setup-packages.mjs", "pretest": "eslint . && turbo tsc", - "test": "vitest --run packages && node --test integration/**/*.test.*" + "test": "vitest --run packages && node --test integration/**/*.test.*", + "dev": "turbo tsc:watch --concurrency 17", + "tsc": "turbo tsc", + "tsc:test": "tsc -p tsconfig.test.json", + "tsc:watch": "tsc -p tsconfig.test.json --watch" }, "repository": { "type": "git", diff --git a/packages/checkbox/package.json b/packages/checkbox/package.json index 41d834448..9df423b3f 100644 --- a/packages/checkbox/package.json +++ b/packages/checkbox/package.json @@ -70,7 +70,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/confirm/package.json b/packages/confirm/package.json index 40a538cee..0b84bd281 100644 --- a/packages/confirm/package.json +++ b/packages/confirm/package.json @@ -64,7 +64,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/core/package.json b/packages/core/package.json index e693ddb34..3f19001e0 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -78,7 +78,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/editor/package.json b/packages/editor/package.json index 700946461..ebcf00d36 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -65,7 +65,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/expand/package.json b/packages/expand/package.json index 5bf508dcb..66c959eb0 100644 --- a/packages/expand/package.json +++ b/packages/expand/package.json @@ -65,7 +65,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/figures/package.json b/packages/figures/package.json index 10515b9e7..8986e3232 100644 --- a/packages/figures/package.json +++ b/packages/figures/package.json @@ -58,7 +58,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "engines": { diff --git a/packages/input/package.json b/packages/input/package.json index 985309812..3e80779c5 100644 --- a/packages/input/package.json +++ b/packages/input/package.json @@ -64,7 +64,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/inquirer/package.json b/packages/inquirer/package.json index 80bd9566a..4663ff403 100644 --- a/packages/inquirer/package.json +++ b/packages/inquirer/package.json @@ -69,7 +69,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "exports": { diff --git a/packages/number/package.json b/packages/number/package.json index 3b04df116..124523368 100644 --- a/packages/number/package.json +++ b/packages/number/package.json @@ -64,7 +64,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/password/package.json b/packages/password/package.json index cd005bb78..54587dff6 100644 --- a/packages/password/package.json +++ b/packages/password/package.json @@ -68,7 +68,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/prompts/package.json b/packages/prompts/package.json index 445211d01..ca2ab6d3b 100644 --- a/packages/prompts/package.json +++ b/packages/prompts/package.json @@ -58,7 +58,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "engines": { diff --git a/packages/rawlist/package.json b/packages/rawlist/package.json index 381cb098d..f1e141eb8 100644 --- a/packages/rawlist/package.json +++ b/packages/rawlist/package.json @@ -65,7 +65,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/select/package.json b/packages/select/package.json index 2f37f32ff..cb1fe0839 100644 --- a/packages/select/package.json +++ b/packages/select/package.json @@ -67,7 +67,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "publishConfig": { diff --git a/packages/testing/package.json b/packages/testing/package.json index 83159a83c..0d4b4ddc7 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -71,7 +71,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "exports": { diff --git a/packages/type/package.json b/packages/type/package.json index e5f77fd50..4aeba29fb 100644 --- a/packages/type/package.json +++ b/packages/type/package.json @@ -61,7 +61,7 @@ "tsc": "yarn run tsc:esm && yarn run tsc:cjs", "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json", "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", - "dev": "tsc -p ./tsconfig.json --watch", + "tsc:watch": "tsc -p ./tsconfig.json --watch", "attw": "attw --pack" }, "engines": { diff --git a/tools/setup-packages.mjs b/tools/setup-packages.mjs index fe5b625c3..5ad7a2a0b 100644 --- a/tools/setup-packages.mjs +++ b/tools/setup-packages.mjs @@ -94,7 +94,7 @@ paths.forEach(async (pkgPath) => { 'tsc:esm': 'rm -rf dist/esm && tsc -p ./tsconfig.json', 'tsc:cjs': 'rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs', - dev: 'tsc -p ./tsconfig.json --watch', + 'tsc:watch': 'tsc -p ./tsconfig.json --watch', attw: emitDeclaration ? 'attw --pack' : undefined, }; diff --git a/turbo.json b/turbo.json index abb15bf63..4886e6a42 100644 --- a/turbo.json +++ b/turbo.json @@ -1,16 +1,20 @@ { "$schema": "https://turbo.build/schema.json", "tasks": { + "attw": { + "dependsOn": ["tsc"], + "outputs": [] + }, "tsc": { "dependsOn": ["^tsc"], "outputs": ["dist/**"], "inputs": ["$TURBO_DEFAULT$", "../../tools/fix-ext.mjs", "../../tsconfig.json"] }, - "attw": { - "dependsOn": ["tsc"], - "outputs": [] + "tsc:watch": { + "cache": false, + "persistent": true }, - "dev": { + "//#tsc:watch": { "cache": false, "persistent": true }