Socket
Socket
Sign inDemoInstall

nestia

Package Overview
Dependencies
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestia - npm Package Compare versions

Comparing version 6.0.2 to 6.0.3-dev.20240910

2

bin/index.d.ts
#!/usr/bin/env node
declare const USAGE = "Wrong command has been detected. Use like below:\n\nnpx nestia [command] [options?]\n\n 1. npx nestia start <directory>\n 2. npx nestia template <directory>\n 3. npx nestia setup\n 4. npx nestia dependencies\n 5. npx nestia init\n 6. npx nestia sdk\n 7. npx nestia swagger\n 8. npx nestia openai\n 9. npx nestia e2e\n 10. npx nestia all\n";
declare const USAGE = "Wrong command has been detected. Use like below:\n\nnpx nestia [command] [options?]\n\n 1. npx nestia start <directory>\n 2. npx nestia template <directory>\n 3. npx nestia setup\n 4. npx nestia dependencies\n 5. npx nestia init\n 6. npx nestia sdk\n 7. npx nestia swagger\n 9. npx nestia e2e\n 10. npx nestia all\n";
declare function halt(desc: string): never;
declare function main(): Promise<void>;

@@ -46,3 +46,2 @@ #!/usr/bin/env node

7. npx nestia swagger
8. npx nestia openai
9. npx nestia e2e

@@ -79,3 +78,2 @@ 10. npx nestia all

type === "sdk" ||
type === "openai" ||
type === "swagger" ||

@@ -82,0 +80,0 @@ type === "e2e" ||

import { PackageManager } from "./PackageManager";
export declare namespace ArgumentParser {
interface IArguments {
manager: "npm" | "pnpm" | "yarn";
manager: "npm" | "pnpm" | "yarn" | "bun";
project: string | null;

@@ -6,0 +6,0 @@ runtime: boolean;

@@ -19,2 +19,3 @@ "use strict";

const inquirer_1 = __importDefault(require("inquirer"));
const package_manager_detector_1 = require("package-manager-detector");
var ArgumentParser;

@@ -75,12 +76,13 @@ (function (ArgumentParser) {

return action((options) => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
(_a = options.manager) !== null && _a !== void 0 ? _a : (options.manager = yield select("manager")("Package Manager")([
var _a, _b, _c, _d;
(_a = options.manager) !== null && _a !== void 0 ? _a : (options.manager = (_b = (yield detectManager())) !== null && _b !== void 0 ? _b : (yield select("manager")("Package Manager")([
"npm",
"pnpm",
"yarn (berry is not supported)",
], (value) => value.split(" ")[0]));
"bun",
], (value) => value.split(" ")[0])));
pack.manager = options.manager;
(_b = options.project) !== null && _b !== void 0 ? _b : (options.project = yield configure());
(_c = options.project) !== null && _c !== void 0 ? _c : (options.project = yield configure());
options.runtime =
((_c = options.runtime) !== null && _c !== void 0 ? _c : (yield select("runtime")("Transform Runtime Swagger")([
((_d = options.runtime) !== null && _d !== void 0 ? _d : (yield select("runtime")("Transform Runtime Swagger")([
"true",

@@ -96,3 +98,10 @@ "false",

ArgumentParser.parse = parse;
const detectManager = () => __awaiter(this, void 0, void 0, function* () {
var _a;
const result = yield (0, package_manager_detector_1.detect)({ cwd: process.cwd() });
if ((result === null || result === void 0 ? void 0 : result.name) === "npm")
return null; // NPM case is still selectable
return (_a = result === null || result === void 0 ? void 0 : result.name) !== null && _a !== void 0 ? _a : null;
});
})(ArgumentParser || (exports.ArgumentParser = ArgumentParser = {}));
//# sourceMappingURL=ArgumentParser.js.map
export declare class PackageManager {
readonly directory: string;
data: Package.Data;
manager: string;
manager: Manager;
get file(): string;

@@ -11,3 +11,3 @@ static mount(): Promise<PackageManager>;

modulo: string;
version?: `latest` | `next` | `${number}.${number}.${number}`;
version?: `latest` | `next` | `^${number}.${number}.${number}` | (string & {});
force?: boolean;

@@ -25,1 +25,3 @@ }): boolean;

}
type Manager = "npm" | "pnpm" | "yarn" | "bun";
export {};

@@ -41,6 +41,6 @@ "use strict";

install(props) {
const symbol = this.manager === "yarn"
? `add${props.dev ? " -D" : ""}`
: `install ${props.dev ? "--save-dev" : "--save"}`;
CommandExecutor_1.CommandExecutor.run(`${this.manager} ${symbol}${props.force === true ? " --force" : ""} ${props.modulo}${props.version ? `@${props.version}` : ""}`);
const cmd = installCmdTable[this.manager];
const option = props.dev ? devOptionTable[this.manager] : "";
const middle = `${cmd} ${option}`;
CommandExecutor_1.CommandExecutor.run(`${this.manager} ${middle} ${props.modulo}${props.version ? `@${props.version}` : ""}`);
return true;

@@ -61,2 +61,14 @@ }

exports.PackageManager = PackageManager;
const installCmdTable = {
npm: "install",
pnpm: "add",
yarn: "add",
bun: "add",
};
const devOptionTable = {
npm: "--save-dev",
pnpm: "--save-dev",
yarn: "--dev",
bun: "--dev",
};
//# sourceMappingURL=PackageManager.js.map

@@ -11,4 +11,8 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NestiaSetupWizard = void 0;
const fs_1 = __importDefault(require("fs"));
const ArgumentParser_1 = require("./internal/ArgumentParser");

@@ -44,3 +48,7 @@ const CommandExecutor_1 = require("./internal/CommandExecutor");

pack.install({ dev: true, modulo: "ts-node", version: "latest" });
pack.install({ dev: true, modulo: "typescript", version: "5.5.2" });
pack.install({
dev: true,
modulo: "typescript",
version: yield getTypeScriptVersion(),
});
(_a = args.project) !== null && _a !== void 0 ? _a : (args.project = (() => {

@@ -86,3 +94,8 @@ const runner = pack.manager === "npm" ? "npx" : pack.manager;

NestiaSetupWizard.setup = setup;
const getTypeScriptVersion = () => __awaiter(this, void 0, void 0, function* () {
const content = yield fs_1.default.promises.readFile(`${__dirname}/../package.json`, "utf-8");
const json = JSON.parse(content);
return json.devDependencies.typescript;
});
})(NestiaSetupWizard || (exports.NestiaSetupWizard = NestiaSetupWizard = {}));
//# sourceMappingURL=NestiaSetupWizard.js.map
{
"name": "nestia",
"version": "6.0.2",
"version": "6.0.3-dev.20240910",
"description": "Nestia CLI tool",

@@ -36,3 +36,4 @@ "main": "bin/index.js",

"comment-json": "^4.2.3",
"inquirer": "^8.2.5"
"inquirer": "^8.2.5",
"package-manager-detector": "^0.2.0"
},

@@ -45,3 +46,3 @@ "devDependencies": {

"rimraf": "^3.0.2",
"typescript": "^5.5.3"
"typescript": "^5.6.2"
},

@@ -48,0 +49,0 @@ "files": [

@@ -13,3 +13,2 @@ #!/usr/bin/env node

7. npx nestia swagger
8. npx nestia openai
9. npx nestia e2e

@@ -49,3 +48,2 @@ 10. npx nestia all

type === "sdk" ||
type === "openai" ||
type === "swagger" ||

@@ -52,0 +50,0 @@ type === "e2e" ||

import commander from "commander";
import fs from "fs";
import inquirer from "inquirer";
import { DetectResult, detect } from "package-manager-detector";

@@ -9,3 +10,3 @@ import { PackageManager } from "./PackageManager";

export interface IArguments {
manager: "npm" | "pnpm" | "yarn";
manager: "npm" | "pnpm" | "yarn" | "bun";
project: string | null;

@@ -89,10 +90,13 @@ runtime: boolean;

return action(async (options) => {
options.manager ??= await select("manager")("Package Manager")(
[
"npm" as const,
"pnpm" as const,
"yarn (berry is not supported)" as "yarn",
],
(value) => value.split(" ")[0] as "yarn",
);
options.manager ??=
(await detectManager()) ??
(await select("manager")("Package Manager")(
[
"npm" as const,
"pnpm" as const,
"yarn (berry is not supported)" as "yarn",
"bun" as const,
],
(value) => value.split(" ")[0] as "yarn",
));
pack.manager = options.manager;

@@ -111,2 +115,10 @@ options.project ??= await configure();

}
const detectManager = async (): Promise<
"npm" | "pnpm" | "yarn" | "bun" | null
> => {
const result: DetectResult | null = await detect({ cwd: process.cwd() });
if (result?.name === "npm") return null; // NPM case is still selectable
return result?.name ?? null;
};
}

@@ -8,3 +8,3 @@ import fs from "fs";

export class PackageManager {
public manager: string = "npm";
public manager: Manager = "npm";
public get file(): string {

@@ -42,13 +42,16 @@ return path.join(this.directory, "package.json");

modulo: string;
version?: `latest` | `next` | `${number}.${number}.${number}`;
version?:
| `latest`
| `next`
| `^${number}.${number}.${number}`
| (string & {});
force?: boolean;
}): boolean {
const symbol: string =
this.manager === "yarn"
? `add${props.dev ? " -D" : ""}`
: `install ${props.dev ? "--save-dev" : "--save"}`;
const cmd = installCmdTable[this.manager];
const option = props.dev ? devOptionTable[this.manager] : "";
const middle: string = `${cmd} ${option}` as const;
CommandExecutor.run(
`${this.manager} ${symbol}${props.force === true ? " --force" : ""} ${
props.modulo
}${props.version ? `@${props.version}` : ""}`,
`${this.manager} ${middle} ${props.modulo}${
props.version ? `@${props.version}` : ""
}`,
);

@@ -75,1 +78,17 @@ return true;

}
type Manager = "npm" | "pnpm" | "yarn" | "bun";
const installCmdTable = {
npm: "install",
pnpm: "add",
yarn: "add",
bun: "add",
} as const satisfies Record<Manager, string>;
const devOptionTable = {
npm: "--save-dev",
pnpm: "--save-dev",
yarn: "--dev",
bun: "--dev",
} as const satisfies Record<Manager, string>;

@@ -0,1 +1,3 @@

import fs from "fs";
import { ArgumentParser } from "./internal/ArgumentParser";

@@ -32,3 +34,7 @@ import { CommandExecutor } from "./internal/CommandExecutor";

pack.install({ dev: true, modulo: "ts-node", version: "latest" });
pack.install({ dev: true, modulo: "typescript", version: "5.5.2" });
pack.install({
dev: true,
modulo: "typescript",
version: await getTypeScriptVersion(),
});
args.project ??= (() => {

@@ -79,2 +85,12 @@ const runner: string = pack.manager === "npm" ? "npx" : pack.manager;

}
const getTypeScriptVersion = async (): Promise<string> => {
const content: string = await fs.promises.readFile(
`${__dirname}/../package.json`,
"utf-8",
);
const json: { devDependencies: { typescript: string } } =
JSON.parse(content);
return json.devDependencies.typescript;
};
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc