Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fea: switching tsm to ts-node in packagejson #6877

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions .changeset/loud-deers-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-qwik': major
---

migration from tsm to ts node
53 changes: 28 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
"@node-rs/helper": "1.6.0",
"@octokit/action": "6.1.0",
"@playwright/test": "1.40.0",
"@swc/core": "^1.7.25",
"@swc/helpers": "^0.5.13",
"@types/brotli": "1.3.4",
"@types/bun": "1.1.6",
"@types/cross-spawn": "6.0.6",
Expand Down Expand Up @@ -145,6 +147,7 @@
"prettier-plugin-jsdoc": "1.3.0",
"pretty-quick": "4.0.0",
"prompts": "2.4.2",
"regenerator-runtime": "^0.14.1",
JerryWu1234 marked this conversation as resolved.
Show resolved Hide resolved
"rollup": "4.19.0",
"semver": "7.6.3",
"simple-git-hooks": "2.11.1",
Expand All @@ -155,7 +158,7 @@
"terser": "5.31.3",
"tmp": "0.2.3",
"tree-kill": "1.2.2",
"tsm": "2.3.0",
"ts-node": "^10.9.2",
"typescript": "5.4.5",
"undici": "*",
"vfile": "6.0.1",
Expand Down Expand Up @@ -187,35 +190,35 @@
},
"private": true,
"scripts": {
"api.update": "tsm scripts/index.ts --tsc --api --dev",
"build": "tsm scripts/index.ts",
"api.update": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --api --dev",
Copy link
Contributor

@octet-stream octet-stream Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --loader flag is discouraged in favor of --import and will likely be removed in a future. Are you sure this is the right one? Also ts-node does not work with the --import flag. See: TypeStrong/ts-node#1909

I suggest to consider these other options instead:

  1. tsimp - uses tsc + caching;
  2. tsx - uses esbuild;
  3. Anything Node.js itself has to offer: --experimental-strip-types or --experimental-transform-types flag, but they are available since Node v22 end they are experimental;

"build": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts",
"build.changelog-formatter": "tsc .changeset/changelog-github-custom.ts && mv .changeset/changelog-github-custom.js .changeset/changelog-github-custom.cjs",
"build.clean": "rm -rf packages/qwik/dist/ && rm -rf packages/qwik-city/lib/ && rm -rf packages/docs/dist/ && rm -rf packages/insights/dist/ && rm -rf packages/qwik-labs/lib/ && rm -rf packages/qwik-labs/vite/",
"build.cli": "tsm scripts/index.ts --cli --dev",
"build.cli.prod": "tsm scripts/index.ts --cli",
"build.core": "tsm scripts/index.ts --tsc --build --qwikcity --api --platform-binding",
"build.eslint": "tsm scripts/index.ts --eslint",
"build.full": "tsm scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding --wasm",
"build.local": "tsm scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding-wasm-copy",
"build.only_javascript": "tsm scripts/index.ts --tsc --build --api",
"build.cli": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --cli --dev",
"build.cli.prod": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --cli",
"build.core": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --qwikcity --api --platform-binding",
"build.eslint": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --eslint",
"build.full": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding --wasm",
"build.local": "node --loader ts-node/esm --require ./scripts/runBefore.tsscripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding-wasm-copy",
"build.only_javascript": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api",
"build.packages.docs": "pnpm -C ./packages/docs/ run build",
"build.packages.insights": "pnpm -C ./packages/insights/ run build",
"build.platform": "tsm scripts/index.ts --platform-binding",
"build.platform.copy": "tsm scripts/index.ts --platform-binding-wasm-copy",
"build.qwik-city": "tsm scripts/index.ts --tsc --qwikcity",
"build.validate": "tsm scripts/index.ts --tsc --build --api --eslint --qwikcity --platform-binding --wasm --validate",
"build.vite": "tsm scripts/index.ts --tsc --build --api --qwikcity --eslint --platform-binding-wasm-copy",
"build.wasm": "tsm scripts/index.ts --wasm",
"build.watch": "tsm scripts/index.ts --build --qwikcity --watch --dev --platform-binding",
"build.platform": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --platform-binding",
"build.platform.copy": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --platform-binding-wasm-copy",
"build.qwik-city": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwikcity",
"build.validate": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api --eslint --qwikcity --platform-binding --wasm --validate",
"build.vite": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api --qwikcity --eslint --platform-binding-wasm-copy",
"build.wasm": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --wasm",
"build.watch": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/index.ts --build --qwikcity --watch --dev --platform-binding",
"change": "changeset",
"cli": "pnpm build.cli && node packages/create-qwik/dist/create-qwik.cjs && tsm scripts/validate-cli.ts --copy-local-qwik-dist",
"cli": "pnpm build.cli && node packages/create-qwik/dist/create-qwik.cjs && node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/validate-cli.ts --copy-local-qwik-dist",
"cli.qwik": "pnpm build.cli && node packages/qwik/dist/qwik-cli.cjs",
"cli.validate": "tsm scripts/validate-cli.ts",
"cli.validate": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/validate-cli.ts",
"deps": "corepack pnpm upgrade -i -r --latest && syncpack fix-mismatches && corepack pnpm dedupe",
"docs.dev": "cd packages/docs && pnpm build.repl-sw && pnpm dev",
"docs.preview": "cd packages/docs && pnpm preview",
"docs.sync": "tsm scripts/docs_sync/index.ts && pnpm fmt",
"eslint.update": "tsm scripts/eslint-docs.ts",
"docs.sync": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/docs_sync/index.ts && pnpm fmt",
"eslint.update": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/eslint-docs.ts",
"fmt": "pnpm prettier.fix && pnpm syncpack format",
"fmt.staged": "pretty-quick --staged",
"link.dist": "cd packages/qwik && pnpm link --global && cd ../qwik-city && pnpm link --global && cd ../eslint-plugin-qwik && pnpm link --global && cd ../qwik-react && pnpm link --global",
Expand All @@ -230,12 +233,12 @@
"preinstall": "npx only-allow pnpm",
"prepare": "simple-git-hooks",
"prettier.fix": "prettier --cache --write .",
"qwik-save-artifacts": "tsm ./scripts/qwik-save-artifacts.ts",
"qwik-save-artifacts": "node --loader ts-node/esm --require ./scripts/runBefore.ts ./scripts/qwik-save-artifacts.ts",
"release": "changeset publish",
"release.pkg-pr-new": "pnpm dlx pkg-pr-new@^0.0.9 publish --compact --pnpm ./packages/qwik ./packages/qwik-city ./packages/eslint-plugin-qwik ./packages/create-qwik",
"release.prepare": "pnpm build --prepare-release",
"serve": "tsm --inspect --conditions=development starters/dev-server.ts 3300",
"serve.debug": "tsm --inspect-brk --conditions=development starters/dev-server.ts 3300",
"serve": "node --loader ts-node/esm --require ./scripts/runBefore.ts --inspect --conditions=development starters/dev-server.ts 3300",
"serve.debug": "node --loader ts-node/esm --require ./scripts/runBefore.ts --inspect-brk --conditions=development starters/dev-server.ts 3300",
"start": "concurrently \"npm:build.watch\" \"npm:tsc.watch\" -n build,tsc -c green,cyan",
"test": "pnpm build.full && pnpm test.unit && pnpm test.e2e",
"test.e2e": "pnpm test.e2e.chromium && pnpm test.e2e.webkit",
Expand All @@ -253,7 +256,7 @@
"tsc.check": "tsc --noEmit",
"tsc.trace": "tsc -p tsconfig.json --traceResolution > tsc.log",
"tsc.watch": "tsc --noEmit --watch --preserveWatchOutput",
"update.qwik.builds": "tsm scripts/update-qwik-builds.ts packages/docs && tsm scripts/update-qwik-builds.ts packages/insights; pnpm install",
"update.qwik.builds": "node --loader ts-node/esm --require ./scripts/runBefore.ts scripts/update-qwik-builds.ts packages/docs && node --loader ts-node/esm scripts/update-qwik-builds.ts packages/insights; pnpm install",
"vitest": "vitest"
},
"simple-git-hooks": {
Expand Down
Loading
Loading