Skip to content

Commit

Permalink
Advanced npx nestia setup command
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Apr 13, 2023
1 parent ee6082b commit 5409371
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nestia",
"version": "4.0.11",
"version": "4.0.13",
"description": "Nestia CLI tool",
"main": "bin/index.js",
"bin": {
Expand Down
24 changes: 14 additions & 10 deletions src/NestiaSetupWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,30 @@ export namespace NestiaSetupWizard {
CommandExecutor.run("npx tsc --init");
return (args.project = "tsconfig.json");
})();
pack.install({ dev: true, modulo: "ts-node" });
pack.install({ dev: true, modulo: "ts-node", version: "latest" });

// INSTALL COMPILER
pack.install({ dev: true, modulo: args.compiler });
pack.install({ dev: true, modulo: args.compiler, version: "latest" });
if (args.compiler === "ts-patch") {
await pack.save((data) => {
data.scripts ??= {};
if (typeof data.scripts.prepare === "string")
data.scripts.prepare =
"ts-patch install && " + data.scripts.prepare;
else data.scripts.prepare = "ts-patch install";
if (
typeof data.scripts.prepare === "string" &&
data.scripts.prepare.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("npm run prepare");
}

// INSTALL AND CONFIGURE TYPIA
pack.install({ dev: false, modulo: "typia" });
pack.install({ dev: false, modulo: "@nestia/core" });
pack.install({ dev: true, modulo: "@nestia/sdk" });
pack.install({ dev: true, modulo: "nestia" });
pack.install({ dev: false, modulo: "typia", version: "latest" });
pack.install({ dev: false, modulo: "@nestia/core", version: "latest" });
pack.install({ dev: true, modulo: "@nestia/sdk", version: "latest" });

await PluginConfigurator.configure(args);
}
}
2 changes: 1 addition & 1 deletion src/internal/PackageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class PackageManager {
public install(props: {
dev: boolean;
modulo: string;
version?: string;
version: `latest` | `${number}.${number}.${number}`;
}): boolean {
const middle: string =
this.manager === "yarn"
Expand Down

0 comments on commit 5409371

Please sign in to comment.