-
-
Notifications
You must be signed in to change notification settings - Fork 223
feat(ttsc): finalize ttsc and ttsx.
#1817
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
Changes from all commits
f58a51c
e4c730d
0ef970d
24b82c9
18ab812
bedf0a8
e866bbc
e7f53ac
5b5e70e
3da4472
9799bfe
6ec419b
68083f9
bf4c781
8db473e
ccfe434
bc19d3e
2f58d59
41650da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -31,12 +31,13 @@ | |||
| /* Modules */ | ||||
| "module": "commonjs" /* Specify what module code is generated. */, | ||||
| // "rootDir": "./", /* Specify the root folder within your source files. */ | ||||
| "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ | ||||
| "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */ | ||||
| "ignoreDeprecations": "6.0", | ||||
| // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ | ||||
| // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ | ||||
| // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ | ||||
| // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ | ||||
| // "types": [], /* Specify type package names to be included without being referenced in a source file. */ | ||||
| "types": ["*"], /* Specify type package names to be included without being referenced in a source file. */ | ||||
|
||||
| "types": ["*"], /* Specify type package names to be included without being referenced in a source file. */ |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |||||
| "version": "12.0.2", | ||||||
| "description": "Example codes for typia website", | ||||||
| "scripts": { | ||||||
| "build": "rimraf bin && ttsc build && prettier --write bin/**/*.js", | ||||||
| "build": "rimraf bin && ttsc && prettier --write --ignore-path /dev/null \"bin/**/*.js\"", | ||||||
|
||||||
| "build": "rimraf bin && ttsc && prettier --write --ignore-path /dev/null \"bin/**/*.js\"", | |
| "build": "rimraf bin && ttsc && node -e \"const fs=require('fs'); const os=require('os'); const path=require('path'); const {execFileSync}=require('child_process'); const ignorePath=path.join(os.tmpdir(), 'typia-empty-prettierignore'); fs.writeFileSync(ignorePath, ''); try { execFileSync(process.platform === 'win32' ? 'prettier.cmd' : 'prettier', ['--write', '--ignore-path', ignorePath, 'bin/**/*.js'], { stdio: 'inherit' }); } finally { fs.rmSync(ignorePath, { force: true }); }\"", |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -29,12 +29,12 @@ | |||
| /* Modules */ | ||||
| "module": "esnext", /* Specify what module code is generated. */ | ||||
| // "rootDir": "./", /* Specify the root folder within your source files. */ | ||||
| "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ | ||||
| "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */ | ||||
|
||||
| // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ | ||||
| // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ | ||||
| // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ | ||||
| // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ | ||||
| // "types": [], /* Specify type package names to be included without being referenced in a source file. */ | ||||
| "types": ["*"], /* Specify type package names to be included without being referenced in a source file. */ | ||||
|
||||
| "types": ["*"], /* Specify type package names to be included without being referenced in a source file. */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| .tmp/ | ||
| node_modules/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Setup Wizard Experiment | ||
|
|
||
| This experiment validates the published-package path of `typia setup` with npm. | ||
|
|
||
| It builds local `.tgz` packages, installs them into a temporary npm project, runs | ||
| the built `typia` setup wizard, and verifies that: | ||
|
|
||
| - npm installed the local tarballs into `node_modules`; | ||
| - `@typescript/native-preview`, `@typia/ttsc`, and `@typia/ttsx` are installed | ||
| by valid setup runs; | ||
| - `typia/lib/transform` is the only setup plugin path; | ||
| - `typia/lib/ttsc/plugin` is not exported as a package path; | ||
| - `bin/ttsc-typia.js` is not included in the installed package; | ||
| - the setup wizard writes a valid `tsconfig.json`. | ||
| - legacy `ts-patch` prepare steps, `dependencies.ts-patch`, and | ||
| `devDependencies.ts-patch` are removed after a valid setup. | ||
| - existing `tsconfig.json` files without `compilerOptions` receive a new | ||
| `compilerOptions` object while preserving unrelated fields such as `extends`. | ||
| - invalid `compilerOptions.plugins` values fail before dependency installation | ||
| or package.json cleanup. | ||
|
|
||
| The failure rule is intentional: an invalid plugin configuration must not leave | ||
| a partially migrated package behind. Error scenarios assert both rejection and | ||
| absence of npm install/package.json side effects. | ||
|
|
||
| The entrypoint is `src/index.js`. Scenario cases live under `src/features/*.js` | ||
| and are executed through `@nestia/e2e`. | ||
|
|
||
| Run: | ||
|
|
||
| ```bash | ||
| npm run start | ||
| ``` | ||
|
|
||
| To reuse already-built tarballs: | ||
|
|
||
| ```bash | ||
| npm run start -- --skip-pack | ||
| ``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "private": true, | ||
| "name": "@typia/experiment-setup", | ||
| "version": "0.0.0", | ||
| "description": "Experiment for typia setup wizard with npm and local tgz installation", | ||
| "scripts": { | ||
| "start": "node src/index.js" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/samchon/typia" | ||
| }, | ||
| "author": "Jeongho Nam", | ||
| "license": "MIT", | ||
| "devDependencies": { | ||
| "@nestia/e2e": "^11.0.2" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| const { TestValidator } = require("@nestia/e2e"); | ||
| const { runScenario } = require("../internal/runScenario"); | ||
|
|
||
| async function test_auto_detects_single_tsconfig(context) { | ||
| runScenario(context, { | ||
| name: "auto-detects-single-tsconfig", | ||
| project: "auto", | ||
| packageJson: {}, | ||
| tsconfig: { | ||
| compilerOptions: {}, | ||
| }, | ||
| verify: ({ tsconfig }) => { | ||
| TestValidator.equals( | ||
| "plugin list is created in auto-detected tsconfig", | ||
| [{ transform: "typia/lib/transform" }], | ||
| tsconfig.compilerOptions.plugins, | ||
| ); | ||
| TestValidator.equals( | ||
| "strict is enabled in auto-detected tsconfig", | ||
| true, | ||
| tsconfig.compilerOptions.strict, | ||
| ); | ||
| TestValidator.equals( | ||
| "skipLibCheck is enabled in auto-detected tsconfig", | ||
| true, | ||
| tsconfig.compilerOptions.skipLibCheck, | ||
| ); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| module.exports = { | ||
| test_auto_detects_single_tsconfig, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| const { TestValidator } = require("@nestia/e2e"); | ||
| const { runScenario } = require("../internal/runScenario"); | ||
|
|
||
| async function test_mixed_legacy_prepare(context) { | ||
| runScenario(context, { | ||
| name: "mixed-legacy-prepare", | ||
| scripts: { | ||
| prepare: "npm run before && ts-patch install && echo keep && typia patch", | ||
| postinstall: "echo keep-postinstall", | ||
| }, | ||
| devDependencies: { | ||
| "ts-patch": "^3.3.0", | ||
| vitest: "^3.0.0", | ||
| }, | ||
| tsconfig: { | ||
| compilerOptions: { | ||
| plugins: [ | ||
| { transform: "typia/lib/transform" }, | ||
| { name: "keep-me" }, | ||
| { transform: "typia/lib/transform" }, | ||
| ], | ||
| skipLibCheck: false, | ||
| strictNullChecks: false, | ||
| }, | ||
| }, | ||
| verify: ({ manifest, tsconfig }) => { | ||
| TestValidator.equals( | ||
| "mixed legacy prepare is cleaned", | ||
| "npm run before && echo keep", | ||
| manifest.scripts.prepare, | ||
| ); | ||
| TestValidator.equals( | ||
| "postinstall script is preserved", | ||
| "echo keep-postinstall", | ||
| manifest.scripts.postinstall, | ||
| ); | ||
| TestValidator.equals( | ||
| "ts-patch dev dependency is removed", | ||
| undefined, | ||
| manifest.devDependencies["ts-patch"], | ||
| ); | ||
| TestValidator.equals( | ||
| "unrelated dev dependency is preserved", | ||
| "^3.0.0", | ||
| manifest.devDependencies.vitest, | ||
| ); | ||
| TestValidator.equals( | ||
| "plugin list is normalized", | ||
| [{ name: "keep-me" }, { transform: "typia/lib/transform" }], | ||
| tsconfig.compilerOptions.plugins, | ||
| ); | ||
| TestValidator.equals( | ||
| "skipLibCheck is enabled", | ||
| true, | ||
| tsconfig.compilerOptions.skipLibCheck, | ||
| ); | ||
| TestValidator.equals( | ||
| "strictNullChecks is enabled", | ||
| true, | ||
| tsconfig.compilerOptions.strictNullChecks, | ||
| ); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| module.exports = { | ||
| test_mixed_legacy_prepare, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| const { TestValidator } = require("@nestia/e2e"); | ||
| const { runScenario } = require("../internal/runScenario"); | ||
|
|
||
| async function test_no_existing_tsconfig(context) { | ||
| runScenario(context, { | ||
| name: "no-existing-tsconfig", | ||
| scripts: undefined, | ||
| devDependencies: { | ||
| "ts-patch": "^3.3.0", | ||
| eslint: "^9.0.0", | ||
| }, | ||
| tsconfig: null, | ||
| verify: ({ manifest, tsconfig }) => { | ||
| TestValidator.equals( | ||
| "scripts remain absent", | ||
| undefined, | ||
| manifest.scripts, | ||
| ); | ||
| TestValidator.equals( | ||
| "ts-patch dev dependency is removed", | ||
| undefined, | ||
| manifest.devDependencies["ts-patch"], | ||
| ); | ||
| TestValidator.equals( | ||
| "unrelated dev dependency is preserved", | ||
| "^9.0.0", | ||
| manifest.devDependencies.eslint, | ||
| ); | ||
| TestValidator.equals( | ||
| "plugin list is created", | ||
| [{ transform: "typia/lib/transform" }], | ||
| tsconfig.compilerOptions.plugins, | ||
| ); | ||
| TestValidator.equals( | ||
| "strict is enabled", | ||
| true, | ||
| tsconfig.compilerOptions.strict, | ||
| ); | ||
| TestValidator.equals( | ||
| "strictNullChecks is enabled", | ||
| true, | ||
| tsconfig.compilerOptions.strictNullChecks, | ||
| ); | ||
| TestValidator.equals( | ||
| "skipLibCheck is enabled", | ||
| true, | ||
| tsconfig.compilerOptions.skipLibCheck, | ||
| ); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| module.exports = { | ||
| test_no_existing_tsconfig, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| const { TestValidator } = require("@nestia/e2e"); | ||
| const { runScenario } = require("../internal/runScenario"); | ||
|
|
||
| async function test_package_json_deletes_empty_dependencies(context) { | ||
| runScenario(context, { | ||
| name: "package-json-deletes-empty-dependencies", | ||
| packageJson: { | ||
| dependencies: { | ||
| "ts-patch": "^3.3.0", | ||
| }, | ||
| devDependencies: { | ||
| vitest: "^3.0.0", | ||
| }, | ||
| }, | ||
| tsconfig: { | ||
| compilerOptions: {}, | ||
| }, | ||
| verify: ({ manifest, tsconfig }) => { | ||
| TestValidator.equals( | ||
| "empty dependencies object is removed", | ||
| undefined, | ||
| manifest.dependencies, | ||
| ); | ||
| TestValidator.equals( | ||
| "unrelated devDependencies are preserved", | ||
| { | ||
| vitest: "^3.0.0", | ||
| }, | ||
| manifest.devDependencies, | ||
| ); | ||
| TestValidator.equals( | ||
| "plugin list is created", | ||
| [{ transform: "typia/lib/transform" }], | ||
| tsconfig.compilerOptions.plugins, | ||
| ); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| module.exports = { | ||
| test_package_json_deletes_empty_dependencies, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"types": [""]
is not a valid way to “include all types” in TypeScript; it can triggerTS2688: Cannot find type definition file for ''. If the intent is to use default type inclusion behavior, remove thetypesfield entirely; if the intent is explicit inclusion, list actual package names undertypes(e.g."node"`).