Skip to content

Commit

Permalink
A llittle bit refactoring not affected to the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Oct 11, 2023
1 parent 1a6d4b9 commit 1dca205
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/typescript-json/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-json",
"version": "5.2.1-dev.20231011",
"version": "5.2.1",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
20 changes: 9 additions & 11 deletions src/executable/TypiaSetupWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ export namespace TypiaSetupWizard {

// SETUP TRANSFORMER
await pack.save((data) => {
// COMPOSE POSTINSTALL COMMAND
// COMPOSE PREPARE COMMAND
data.scripts ??= {};
if (
typeof data.scripts.prepare === "string" &&
data.scripts.prepare.trim().length
) {
if (data.scripts.prepare.indexOf("ts-patch install") === -1)
data.scripts.prepare =
"ts-patch install && " + data.scripts.prepare;
} else data.scripts.prepare = "ts-patch install";

// FOR OLDER VERSIONS
if (typeof data.scripts.postinstall === "string") {
Expand All @@ -46,16 +54,6 @@ export namespace TypiaSetupWizard {
if (data.scripts.postinstall.length === 0)
delete data.scripts.postinstall;
}

// THE PREPARE SCRIPT
if (
typeof data.scripts.prepare === "string" &&
data.scripts.prepare.trim().length
) {
if (data.scripts.prepare.indexOf("ts-patch install") === -1)
data.scripts.prepare =
"ts-patch install && " + data.scripts.prepare;
} else data.scripts.prepare = "ts-patch install";
});
CommandExecutor.run(`${pack.manager} run prepare`);

Expand Down

0 comments on commit 1dca205

Please sign in to comment.