Skip to content

Commit

Permalink
Complete documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Nov 26, 2023
1 parent 5e002e1 commit 7b154d7
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 61 deletions.
24 changes: 11 additions & 13 deletions deploy/internal/ReplicaPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ import fs from "fs";
export namespace ReplicaPublisher {
export function replica(tag: string): void {
// PREPARE DIRECTORY
if (fs.existsSync(PACKAGES)) cp.execSync(`rimraf ${PACKAGES}`);
fs.mkdirSync(PACKAGES);
fs.mkdirSync(typia);
if (fs.existsSync(LEGACY)) cp.execSync(`rimraf ${LEGACY}`);
fs.mkdirSync(LEGACY);

// COPY ESSENTIAL FILES
for (const file of ["package.json", "LICENSE", "tsconfig.json"])
fs.copyFileSync(`${ROOT}/${file}`, `${typia}/${file}`);
fs.copyFileSync(`${ROOT}/${file}`, `${LEGACY}/${file}`);
readme();

// CREATE RE-EXPORT FILES
fs.mkdirSync(`${typia}/src`);
link(LIB, `${typia}/src`);
fs.mkdirSync(`${LEGACY}/src`);
link(LIB, `${LEGACY}/src`);

// CHANGE PACKAGE.JSON CONTENT
pack();

// DO BUILD & PUBLISH
try {
cp.execSync("npx tsc", { cwd: typia });
cp.execSync("npx tsc", { cwd: LEGACY });
} catch {}

console.log("publish typescript-json (replica)");
Expand All @@ -32,7 +31,7 @@ export namespace ReplicaPublisher {
function readme(): void {
const content: string = fs.readFileSync(`${ROOT}/README.md`, "utf8");
fs.writeFileSync(
`${typia}/README.md`,
`${LEGACY}/README.md`,
"> ## Deprecated\n" +
"> `typescript-json` has been renamed to [`typia`](https://github.com/samchon/typia)" +
"\n\n" +
Expand Down Expand Up @@ -72,7 +71,7 @@ export namespace ReplicaPublisher {

function pack(): void {
const pack: any = JSON.parse(
fs.readFileSync(`${typia}/package.json`, "utf8"),
fs.readFileSync(`${LEGACY}/package.json`, "utf8"),
);

pack.name = "typescript-json";
Expand All @@ -84,7 +83,7 @@ export namespace ReplicaPublisher {
delete pack.bin;

fs.writeFileSync(
`${typia}/package.json`,
`${LEGACY}/package.json`,
JSON.stringify(pack, null, 2),
"utf8",
);
Expand All @@ -93,13 +92,12 @@ export namespace ReplicaPublisher {
function publish(command: string): void {
try {
cp.execSync(command, {
cwd: typia,
cwd: LEGACY,
});
} catch {}
}
}

const ROOT: string = __dirname + "/../..";
const PACKAGES: string = ROOT + "/packages";
const typia: string = PACKAGES + "/typescript-json";
const LEGACY: string = ROOT + "/packages/typescript-json";
const LIB = `${__dirname}/../../lib`;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typia",
"version": "5.3.0-dev.20231123",
"version": "5.3.0-dev.20231126-2",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@
"suppress-warnings": "^1.0.2",
"tstl": "^2.5.13",
"uuid": "^9.0.1",
"typia": "D:\\github\\samchon\\typia\\typia-5.3.0-dev.20231122.tgz"
"typia": "D:\\github\\samchon\\typia\\typia-5.3.0-dev.20231126-2.tgz"
}
}
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"typescript": "^5.3.2"
},
"dependencies": {
"typia": "D:\\github\\samchon\\typia\\typia-5.3.0-dev.20231123.tgz"
"typia": "D:\\github\\samchon\\typia\\typia-5.3.0-dev.20231126-2.tgz"
}
}
2 changes: 1 addition & 1 deletion packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"suppress-warnings": "^1.0.2",
"tstl": "^2.5.13",
"uuid": "^9.0.1",
"typia": "D:\\github\\samchon\\typia\\typia-5.3.0-dev.20231123.tgz"
"typia": "D:\\github\\samchon\\typia\\typia-5.3.0-dev.20231126-2.tgz"
}
}
40 changes: 12 additions & 28 deletions packages/typescript-json/package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
{
"name": "typescript-json",
"version": "5.3.0-dev.20231122",
"version": "5.3.0-dev.20231126-2",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"scripts": {
"benchmark": "npm run build:benchmark && node measure/benchmark",
"benchmark:generate": "ts-node benchmark/generate && npm run build:benchmark",
"test:generate": "npx ts-node src/executable/typia generate --input test/features --output test/generated/output --project test/tsconfig.json",
"test:template": "npx tsc && ts-node -P build/tsconfig.json build/test.ts",
"----------------------------------------------": "",
"test": "npm run package:tgz",
"-------------------------------------------------": "",
"build": "rimraf lib && tsc --removeComments --declaration false && tsc --emitDeclarationOnly",
"build:test": "rimraf bin && tsc -p test/tsconfig.json",
"build:test:actions": "rimraf bin && tsc -p test/tsconfig.actions.json",
"build:test:issues": "rimraf bin && tsc -p test/tsconfig.issue.json",
"build:benchmark": "rimraf measure && tsc -p benchmark/tsconfig.json",
"build:test:errors": "rimraf errors/bin && tsc -p errors/tsconfig.json",
"build:test:prettier": "npm run build:test && prettier --write ./bin/**/*.js",
"dev": "rimraf lib && tsc --watch",
"dev:test": "rimraf bin && tsc -p test/tsconfig.json --watch",
"eslint": "eslint ./**/*.ts",
"eslint:fix": "eslint ./**/*.ts --fix",
"prettier": "prettier --write ./**/*.ts",
"-----------------------------------------------": "",
"issue": "node test/issue",
"issue:generate": "ts-node src/executable/typia generate --input test/issues/generate/input --output test/issues/generate --project test/tsconfig.json",
"test": "node bin/test",
"test:errors": "node errors",
"test:manual": "node test/manual",
"prettier": "prettier src --write",
"------------------------------------------------": "",
"package:latest": "ts-node build/publish.ts latest",
"package:next": "ts-node build/publish.ts next",
"package:patch": "ts-node build/publish.ts patch",
"package:deprecate": "npm deprecate typescript-json \"Renamed to typia\"",
"prepare": "ts-patch install"
"package:latest": "ts-node deploy latest",
"package:next": "ts-node deploy next",
"package:patch": "ts-node deploy patch",
"package:tgz": "ts-node deploy tgz",
"package:deprecate": "npm deprecate typescript-json \"Renamed to typia\""
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -72,13 +56,13 @@
},
"homepage": "https://typia.io",
"dependencies": {
"typia": "5.3.0-dev.20231122"
"typia": "5.3.0-dev.20231126-2"
},
"peerDependencies": {
"typescript": ">=4.8.0 <5.3.0"
"typescript": ">=4.8.0 <5.4.0"
},
"stackblitzs": {
"startCommand": "npm run prepare && npm run build:test:actions && npm run build:test && npm run test"
"startCommand": "npm install && npm run build && cd packages/test && npm install && npm run build:actions && npm start"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion src/executable/TypiaSetupWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export namespace TypiaSetupWizard {
// INSTALL TYPESCRIPT COMPILERS
pack.install({ dev: true, modulo: "ts-patch", version: "latest" });
pack.install({ dev: true, modulo: "ts-node", version: "latest" });
pack.install({ dev: true, modulo: "typescript", version: "5.2.2" });
pack.install({ dev: true, modulo: "typescript", version: "5.3.2" });
args.project ??= (() => {
const runner: string = pack.manager === "npm" ? "npx" : pack.manager;
CommandExecutor.run(`${runner} tsc --init`);
Expand Down
6 changes: 3 additions & 3 deletions src/transformers/FileTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ const checkJsDocParsingMode = new Singleton(
key: "jsDocParsingMode",
category: ts.DiagnosticCategory.Warning,
message: [
`Run "npx typia setup" or "npx ts-patch install" command again.`,
`Run "npx typia setup" or "npx typia patch" command again.`,
``,
`Since TypeScript v5.3 update, "tsc" no more parses JSDoc comments. Therefore, "typia" also cannot utilize those JSDoc comments, and it would damage some features of "typia" like "comment tags" or "JSON schema" generator.`,
`Since TypeScript v5.3 update, "tsc" no more parses JSDoc comments. Therefore, "typia" also cannot utilize those JSDoc comments too, and it damages on some features of "typia" like "comment tags" or "JSON schema" generator.`,
``,
`To solve this problem, run "npx typia setup" or "ts-patch install" command again to hack the TypeScript compiler to revive the JSDoc parsing.`,
`To solve this problem, run "npx typia setup" or "npx typia patch" command to hack the TypeScript compiler to revive the JSDoc parsing feature.`,
``,
` - reference: https://github.com/microsoft/TypeScript/pull/55739`,
].join("\n"),
Expand Down
18 changes: 9 additions & 9 deletions website/package-lock.json

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

4 changes: 2 additions & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"nextra-theme-docs": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.3.0-beta"
"typescript": "^5.3.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
Expand All @@ -41,6 +41,6 @@
"prettier": "^2.8.8",
"rimraf": "^5.0.0",
"ts-node": "^10.9.1",
"typia": "^5.3.0-dev.20231117"
"typia": "^5.3.0-dev.20231126-2"
}
}
17 changes: 16 additions & 1 deletion website/pages/docs/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ As `typia` generates optimal operation code through transformation, you've to co
```json filename="package.json" copy showLineNumbers {2-4}
{
"scripts": {
"prepare": "ts-patch install"
"prepare": "ts-patch install && typia patch"
},
"dependencies": {
"typia": "^4.1.8"
Expand Down Expand Up @@ -246,6 +246,21 @@ Of course, you've to run the `npm run prepare` command after the configuration.

For reference, [`ts-patch`](https://github.com/nonara/ts-patch) is an helper library of TypeScript compiler that supporting custom transformations by plugins. From now on, whenever you run `tsc` command, your `typia` function call statements would be transformed to the optimal operation codes in the compiled JavaScript files.

<br/>
<Alert severity="warning">

<AlertTitle>
**`npx typia patch`**
</AlertTitle>

Since TypeScript v5.3 update, `tsc` no more parses `JSDocComment`s. Therefore, `typia` also cannot utilize those `JSDocComment` related features too, especially ["Comment Tags"](./validators/tags/#comment-tags) and ["JSON schema generator"](./json/schema).

The `npx typia patch` command has been developed to revive the `JSDocComment` parsing feature of `tsc`. It is temporary solution for the TypeScript v5.3 update instead of [`ts-patch`](https://github.com/nonara/ts-patch), and will be disabled after [`ts-patch`](https://github.com/nonara/ts-patch) starts supporting such TypeScript v5.3 update.

Of course, if you don't use any ["Comment Tags"](./validators/tags/#comment-tags) and ["JSON schema generator"](./json/schema), you don't need to run `npx typia patch` command. This is not mandatory command, but just optional command.

</Alert>




Expand Down

0 comments on commit 7b154d7

Please sign in to comment.