Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .github/workflows/experiments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ jobs:
- name: Test Experiments (unplugin)
working-directory: experiments/unplugin
run: npm install && npm start

- name: Test Experiments (setup)
working-directory: experiments/setup
run: npm install && npm start
5 changes: 5 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
# pnpm install
# pnpm run package:tgz

- name: Toolchain
run: |
pnpm install
pnpm build:toolchain

- name: Build
working-directory: website
run: |
Expand Down
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@
.codex/
bin/
!/bin
!toolchain/ttsc/bin/
!toolchain/ttsc/bin/ttsc.js
!toolchain/ttsc/bin/ttsc-dev.js
!toolchain/ttsx/bin/
!toolchain/ttsx/bin/ttsx.js
!packages/typia/bin/
!packages/typia/bin/ttsc-typia.js
node_modules/

packages/*/lib/
packages/*/dist/
toolchain/*/lib/
tests/*/bin/
toolchain-tests/*/bin/
toolchain/ttsc/native/
toolchain-tests/test-typia-ttsc/fixtures/*/dist/
toolchain-tests/test-typia-ttsc/fixtures/*/build/output/
wiki/memo/

package-lock.json
!experiments/setup/package-lock.json

*.env
*.log
Expand Down
9 changes: 5 additions & 4 deletions config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Comment on lines +34 to +35
Copy link

Copilot AI Apr 24, 2026

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 the typesfield entirely; if the intent is explicit inclusion, list actual package names undertypes(e.g."node"`).

Copilot uses AI. Check for mistakes.
// "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. */
Copy link

Copilot AI Apr 24, 2026

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 the typesfield entirely; if the intent is explicit inclusion, list actual package names undertypes(e.g."node"`).

Suggested change
"types": ["*"], /* Specify type package names to be included without being referenced in a source file. */

Copilot uses AI. Check for mistakes.
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
Expand Down Expand Up @@ -98,8 +99,8 @@
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
Expand Down
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\"",
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Using --ignore-path /dev/null is not portable (e.g., Windows runners/environments). If the goal is to disable ignores, consider checking in a dedicated ignore file (e.g., examples/.prettierignore) and referencing it, or adjust the command so it works cross-platform.

Suggested change
"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 }); }\"",

Copilot uses AI. Check for mistakes.
"dev": "ttsc --watch"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Same issue as in config/tsconfig.json: "types": ["*"] is not a valid TypeScript configuration and may break the sample project with Cannot find type definition file for '*'. Remove types (preferred) or replace with a concrete list of type packages.

Copilot uses AI. Check for mistakes.
// "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. */
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Same issue as in config/tsconfig.json: "types": ["*"] is not a valid TypeScript configuration and may break the sample project with Cannot find type definition file for '*'. Remove types (preferred) or replace with a concrete list of type packages.

Suggested change
"types": ["*"], /* Specify type package names to be included without being referenced in a source file. */

Copilot uses AI. Check for mistakes.
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "resolveJsonModule": true, /* Enable importing .json files */
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
Expand Down
2 changes: 2 additions & 0 deletions experiments/setup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.tmp/
node_modules/
39 changes: 39 additions & 0 deletions experiments/setup/README.md
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
```
23 changes: 23 additions & 0 deletions experiments/setup/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions experiments/setup/package.json
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,
};
68 changes: 68 additions & 0 deletions experiments/setup/src/features/test_mixed_legacy_prepare.js
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,
};
55 changes: 55 additions & 0 deletions experiments/setup/src/features/test_no_existing_tsconfig.js
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,
};
Loading
Loading