pm-auto 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { buildCommands, buildUninstallCommands } from "./build_command.js";
2
2
  import { getConfigObject } from "./config_reader.js";
3
- import { display, stopSpinner } from "./display.js";
3
+ import { display } from "./display.js";
4
4
  import { install } from "./install.js";
5
5
  import { outro } from "@clack/prompts";
6
6
  //Check if the value is an array of ConfigType objects
@@ -22,14 +22,13 @@ export const orchestrator = (command, packages, options) => {
22
22
  if (isConfigTypeArray(config)) {
23
23
  const commands = buildCommands(config);
24
24
  await install(commands);
25
- stopSpinner("Packages installed successfully");
26
- process.stdout.write("\x07");
27
25
  outro("Done!");
26
+ display("Packages installed successfully", "success");
28
27
  }
29
28
  else {
30
29
  await install(config);
31
- stopSpinner("Packages from package.json installed successfully");
32
30
  outro("Done!");
31
+ display("Packages from package.json installed successfully", "success");
33
32
  }
34
33
  });
35
34
  }
@@ -43,8 +42,8 @@ export const orchestrator = (command, packages, options) => {
43
42
  if (isConfigTypeArray(config)) {
44
43
  const commands = buildUninstallCommands(config);
45
44
  await install(commands);
46
- stopSpinner("Packages uninstalled successfully");
47
45
  outro("Done!");
46
+ display("Packages uninstalled successfully", "success");
48
47
  }
49
48
  });
50
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,sDAAsD;AACtD,SAAS,iBAAiB,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CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;gBAC3C,OAAO;YACT,CAAC;YAED,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC9B,MAAM,QAAQ,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;gBAChD,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACxB,KAAK,CAAC,OAAO,CAAC,CAAC;gBAEf,OAAO,CAAC,mCAAmC,EAAE,SAAS,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export interface ConfigType {
2
2
  name: string;
3
+ description?: string;
3
4
  packageManager: string;
4
5
  packages: {
5
6
  command: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pm-auto",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "A CLI tool to define and install your tech stack presets with one command.",
5
5
  "keywords": [
6
6
  "pm-auto",
@@ -20,7 +20,7 @@
20
20
  "dev": "nodemon --exec tsx src/index.ts",
21
21
  "start": "node dist/index.js",
22
22
  "prepublishOnly": "npm run build",
23
- "test": "vitest run"
23
+ "test": "vitest"
24
24
  },
25
25
  "dependencies": {
26
26
  "@clack/prompts": "^0.11.0",
@@ -57,7 +57,20 @@ export function buildCommands(projects: ConfigType[]) {
57
57
 
58
58
  // Batch all non-interactive packages into ONE command
59
59
  if (nonInteractive.length > 0) {
60
- const packageNames = nonInteractive.map((pkg) => pkg.command).join(" ");
60
+ const packageNames = nonInteractive
61
+ .map((pkg) => {
62
+ if (!pkg.command.includes("-")) {
63
+ return pkg.command;
64
+ }
65
+ })
66
+ .filter((item) => item !== undefined)
67
+ .join(" ");
68
+
69
+ nonInteractive.map((pkg) => {
70
+ if (pkg.command.includes("-")) {
71
+ result.nonInteractive.push(`${manager.install} ${pkg.command}`);
72
+ }
73
+ });
61
74
  result.nonInteractive.push(`${manager.install} ${packageNames}`);
62
75
  }
63
76
 
@@ -77,7 +90,7 @@ export function buildUninstallCommands(projects: ConfigType[]) {
77
90
  install: "npm uninstall",
78
91
  },
79
92
  pnpm: {
80
- install: "pnpm uninstall",
93
+ install: "pnpm remove",
81
94
  },
82
95
  yarn: {
83
96
  install: "yarn remove",
@@ -108,7 +121,9 @@ export function buildUninstallCommands(projects: ConfigType[]) {
108
121
 
109
122
  // Batch all non-interactive packages into ONE command
110
123
  if (nonInteractive.length > 0) {
111
- const packageNames = nonInteractive.map((pkg) => pkg.command).join(" ");
124
+ const packageNames = nonInteractive
125
+ .map((pkg) => pkg.command.trim().split(/\s+/)[0])
126
+ .join(" ");
112
127
  result.nonInteractive.push(`${manager.install} ${packageNames}`);
113
128
  }
114
129
 
@@ -46,9 +46,3 @@ export function getConfigPath(): string | void {
46
46
  display(`Error reading config file path: ${error.message}`, "error");
47
47
  }
48
48
  }
49
-
50
- export function clearConfigPath(): void {
51
- if (fs.existsSync(SETTINGS_FILE)) {
52
- fs.unlinkSync(SETTINGS_FILE);
53
- }
54
- }
@@ -91,21 +91,22 @@ export const getConfigObject = async (
91
91
  result.forEach((config) => {
92
92
  display(`Package name -> ${config.name}`, "info");
93
93
  config.packages.forEach((pkg) => {
94
- display(`add ${pkg.command}`, "info");
94
+ display(`running ${pkg.command}`, "info");
95
95
  });
96
96
  });
97
- const continueWithInstall = await confirm({
98
- message: "Continue with installation?",
97
+ const continuation = await confirm({
98
+ message: "Continue?",
99
99
  initialValue: true,
100
100
  });
101
101
 
102
- if (isCancel(continueWithInstall)) {
102
+ if (isCancel(continuation)) {
103
103
  cancel("Operation cancelled.");
104
104
  process.exit(0);
105
105
  }
106
106
 
107
- if (!continueWithInstall) {
108
- display("Installation cancelled ", "success");
107
+ if (!continuation) {
108
+ display("Operation cancelled. ", "success");
109
+ process.exit(0);
109
110
  }
110
111
  }
111
112
 
@@ -127,3 +128,59 @@ export const getConfigObject = async (
127
128
  return result;
128
129
  }
129
130
  };
131
+
132
+ export const getConfigKeys = async (options: any) => {
133
+ const configPath = getConfigPath();
134
+
135
+ //read config file content
136
+ let configContent = "";
137
+ try {
138
+ configContent = await fs.readFile(configPath as string, "utf8");
139
+ } catch (error) {
140
+ display(
141
+ `File not found ${error} Try updating the config file path`,
142
+ "error",
143
+ );
144
+ }
145
+
146
+ const configObject = JSON.parse(configContent);
147
+ let keys = Object.keys(configObject);
148
+
149
+ keys.forEach((key) => {
150
+ if (options.desc) {
151
+ const description = !configObject[key].description
152
+ ? "No description"
153
+ : configObject[key].description;
154
+ display(`${key} - ${description}`, "info");
155
+ } else {
156
+ display(`${key}`, "info");
157
+ }
158
+ });
159
+ };
160
+
161
+ export const getPackageDescription = async (packageName: string) => {
162
+ const configPath = getConfigPath();
163
+
164
+ //read config file content
165
+ let configContent = "";
166
+ try {
167
+ configContent = await fs.readFile(configPath as string, "utf8");
168
+ } catch (error) {
169
+ display(
170
+ `File not found ${error} Try updating the config file path`,
171
+ "error",
172
+ );
173
+ }
174
+
175
+ const configObject = JSON.parse(configContent);
176
+ const configObjectArray: ConfigType[] = Object.values(configObject);
177
+
178
+ configObjectArray.forEach((configObject) => {
179
+ if (configObject.name === packageName) {
180
+ const description = !configObject.description
181
+ ? "No description"
182
+ : configObject.description;
183
+ display(`${packageName} - ${description}`, "info");
184
+ }
185
+ });
186
+ };
package/src/display.ts CHANGED
@@ -2,18 +2,12 @@ import { log, spinner } from "@clack/prompts";
2
2
  import chalk from "chalk";
3
3
 
4
4
  type DisplayType = "error" | "success" | "warning" | "info" | "loading" | "";
5
-
6
- export const stopSpinner = (text: string, code: number = 0) => {
7
- const s = spinner();
8
- if (!s || typeof s.stop !== "function") return;
9
- s.stop(code === 0 ? chalk.green(text) : chalk.red(text));
10
- };
11
-
5
+ export const s = spinner();
12
6
  export const display = (text: string, type: DisplayType) => {
13
7
  switch (type) {
14
8
  case "error":
15
9
  log.error(chalk.red(text));
16
- process.exit(1);
10
+ process.exit(0);
17
11
 
18
12
  case "success":
19
13
  log.success(chalk.green(text)); // Use log.success instead
@@ -28,7 +22,6 @@ export const display = (text: string, type: DisplayType) => {
28
22
  break;
29
23
 
30
24
  case "loading":
31
- const s = spinner();
32
25
  s.start(text);
33
26
  return s; // Return spinner so it can be stopped later
34
27
 
package/src/index.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { Command } from "commander";
4
- import { saveConfigPath } from "./config_path.js";
4
+ import { getConfigPath, saveConfigPath } from "./config_path.js";
5
5
  import { intro } from "@clack/prompts";
6
6
  import { orchestrator } from "./orchestrator.js";
7
7
  import chalk from "chalk";
8
+ import { getConfigKeys, getPackageDescription } from "./config_reader.js";
9
+ import { display } from "./display.js";
8
10
 
9
11
  intro(chalk.inverse(" pm-auto "));
10
12
 
@@ -12,7 +14,7 @@ const program = new Command();
12
14
 
13
15
  program
14
16
  .name("pm-auto")
15
- .version("1.0.4")
17
+ .version("1.0.6")
16
18
  .description(
17
19
  "A CLI tool to define and install your tech stack presets with one command.",
18
20
  );
@@ -49,12 +51,39 @@ program
49
51
  .description(
50
52
  "Remove packages using the detected package manager (Aliases: remove, u, un)",
51
53
  )
52
- .option(
53
- "-A, --add-command <command>",
54
- "Add a custom command to all installation commands from config file",
55
- )
54
+ .option("-D, --dry-run", "Dry run - Display commands before execution")
55
+
56
56
  .action((packages, options) => {
57
57
  orchestrator("uninstall", packages, options);
58
58
  });
59
59
 
60
+ //Listing config packages
61
+ program
62
+ .command("list")
63
+ .alias("ls")
64
+ .description("List all packages from the config file")
65
+ .option("-D, --desc", "Display packages description", false)
66
+ .action((options) => {
67
+ getConfigKeys(options);
68
+ });
69
+
70
+ //Displaying config details
71
+ program
72
+ .command("describe <package>")
73
+ .alias("desc")
74
+ .description("Display description of the package")
75
+ .action((packages) => {
76
+ getPackageDescription(packages);
77
+ });
78
+
79
+ //get config path
80
+ program
81
+ .command("config-path")
82
+ .alias("cp")
83
+ .description("Display the path to the configuration file")
84
+ .action(() => {
85
+ const path = getConfigPath();
86
+ display(`Config Path: ${path}`, "info");
87
+ });
88
+
60
89
  program.parse();
package/src/install.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import { execa } from "execa";
2
2
  import type { CommandResult } from "./types/index.js";
3
- import { display, stopSpinner } from "./display.js";
3
+ import { display, s } from "./display.js";
4
4
 
5
5
  async function runCommand(command: string, interactive: boolean = false) {
6
6
  try {
7
7
  const [commandName, ...args] = command.split(" ");
8
8
 
9
9
  if (interactive) {
10
- // Stop spinner before interactive command
11
- stopSpinner("Starting interactive command...", 0);
12
10
  await execa(commandName as string, args, {
13
11
  stdio: "inherit",
14
12
  });
15
13
  } else {
14
+ s.stop();
15
+
16
16
  await execa(commandName as string, args, {
17
17
  stdio: "inherit",
18
18
  });
@@ -40,10 +40,12 @@ export async function install(commands: CommandResult[]) {
40
40
  }
41
41
 
42
42
  // Then run non-interactive
43
- if (command.nonInteractive) {
43
+ if (command.nonInteractive.length > 0) {
44
44
  // For non-interactive, we show a spinner
45
- display(`Running command: ${command.nonInteractive[0]}`, "loading");
46
- await runCommand(command.nonInteractive[0] as string, false);
45
+ for (let i = 0; i < command.nonInteractive.length; i++) {
46
+ display(`Running command: ${command.nonInteractive[i]}`, "loading");
47
+ await runCommand(command.nonInteractive[i] as string, false);
48
+ }
47
49
  }
48
50
  }
49
51
  } catch (error: any) {
@@ -1,6 +1,6 @@
1
1
  import { buildCommands, buildUninstallCommands } from "./build_command.js";
2
2
  import { getConfigObject } from "./config_reader.js";
3
- import { display, stopSpinner } from "./display.js";
3
+ import { display } from "./display.js";
4
4
  import { install } from "./install.js";
5
5
  import type { ConfigType } from "./types/index.js";
6
6
  import { outro } from "@clack/prompts";
@@ -38,15 +38,15 @@ export const orchestrator = (
38
38
 
39
39
  if (isConfigTypeArray(config)) {
40
40
  const commands = buildCommands(config);
41
+
41
42
  await install(commands);
42
- stopSpinner("Packages installed successfully");
43
- process.stdout.write("\x07");
44
43
  outro("Done!");
44
+
45
+ display("Packages installed successfully", "success");
45
46
  } else {
46
47
  await install(config);
47
-
48
- stopSpinner("Packages from package.json installed successfully");
49
48
  outro("Done!");
49
+ display("Packages from package.json installed successfully", "success");
50
50
  }
51
51
  });
52
52
  } else {
@@ -64,8 +64,9 @@ export const orchestrator = (
64
64
  if (isConfigTypeArray(config)) {
65
65
  const commands = buildUninstallCommands(config);
66
66
  await install(commands);
67
- stopSpinner("Packages uninstalled successfully");
68
67
  outro("Done!");
68
+
69
+ display("Packages uninstalled successfully", "success");
69
70
  }
70
71
  });
71
72
  }
@@ -1,16 +1,17 @@
1
- export interface ConfigType {
2
- name: string;
3
- packageManager: string;
4
- packages: { command: string; interactive: boolean }[];
5
- }
6
-
7
- export interface PackageType {
8
- command: string;
9
- interactive: boolean;
10
- }
11
-
12
- export interface CommandResult {
13
- name: string;
14
- interactive: string[];
15
- nonInteractive: string[];
16
- }
1
+ export interface ConfigType {
2
+ name: string;
3
+ description?: string;
4
+ packageManager: string;
5
+ packages: { command: string; interactive: boolean }[];
6
+ }
7
+
8
+ export interface PackageType {
9
+ command: string;
10
+ interactive: boolean;
11
+ }
12
+
13
+ export interface CommandResult {
14
+ name: string;
15
+ interactive: string[];
16
+ nonInteractive: string[];
17
+ }
package/test.json CHANGED
@@ -1,94 +1,87 @@
1
- {
2
- "sample": {
3
- "name": "sample",
4
- "packageManager": "npm",
5
- "packages": [
6
- {
7
- "command": "gsap",
8
- "interactive": false
9
- }
10
- ]
11
- },
12
-
13
- "vite": {
14
- "name": "vite",
15
- "packageManager": "npm",
16
- "packages": [
17
- {
18
- "command": "@types/three --save-dev",
19
- "interactive": false
20
- },
21
- {
22
- "command": "@react-three/fiber",
23
- "interactive": false
24
- },
25
- {
26
- "command": "gsap",
27
- "interactive": false
28
- },
29
- {
30
- "command": "create-vite@latest my-app",
31
- "interactive": true
32
- }
33
- ]
34
- },
35
-
36
- "next": {
37
- "name": "next",
38
- "packageManager": "pnpm",
39
- "packages": [
40
- {
41
- "command": "three --save-dev",
42
- "interactive": false
43
- },
44
- {
45
- "command": "@react-three/drei",
46
- "interactive": false
47
- },
48
- {
49
- "command": "framer-motion",
50
- "interactive": false
51
- },
52
- {
53
- "command": "create-next-app@latest my-app",
54
- "interactive": true
55
- }
56
- ]
57
- },
58
- "test": {
59
- "name": "test",
60
- "packageManager": "npm",
61
- "packages": [
62
- {
63
- "command": "three",
64
- "interactive": false
65
- },
66
- {
67
- "command": "gsap",
68
- "interactive": false
69
- },
70
- {
71
- "command": "@react-three/fiber",
72
- "interactive": false
73
- }
74
- ]
75
- },
76
- "test2": {
77
- "name": "test2",
78
- "packageManager": "npm",
79
- "packages": [
80
- {
81
- "command": "@react-three/drei",
82
- "interactive": false
83
- },
84
- {
85
- "command": "framer-motion",
86
- "interactive": false
87
- },
88
- {
89
- "command": "@react-three/postprocessing",
90
- "interactive": false
91
- }
92
- ]
93
- }
94
- }
1
+ {
2
+ "sample": {
3
+ "name": "sample",
4
+ "description": "",
5
+ "packageManager": "npm",
6
+ "packages": [
7
+ {
8
+ "command": "gsap",
9
+ "interactive": false
10
+ }
11
+ ]
12
+ },
13
+
14
+ "vite": {
15
+ "name": "vite",
16
+ "description": "Vite configuration",
17
+ "packageManager": "npm",
18
+ "packages": [
19
+ {
20
+ "command": "create-vite@latest my-app",
21
+ "interactive": true
22
+ }
23
+ ]
24
+ },
25
+
26
+ "next": {
27
+ "name": "next",
28
+ "description": "Next.js configuration",
29
+ "packageManager": "pnpm",
30
+ "packages": [
31
+ {
32
+ "command": "three --save-dev",
33
+ "interactive": false
34
+ },
35
+ {
36
+ "command": "@react-three/drei",
37
+ "interactive": false
38
+ },
39
+ {
40
+ "command": "framer-motion",
41
+ "interactive": false
42
+ },
43
+ {
44
+ "command": "create-next-app@latest my-app",
45
+ "interactive": true
46
+ }
47
+ ]
48
+ },
49
+ "test": {
50
+ "name": "test",
51
+ "description": "Test configuration",
52
+ "packageManager": "npm",
53
+ "packages": [
54
+ {
55
+ "command": "three",
56
+ "interactive": false
57
+ },
58
+ {
59
+ "command": "gsap",
60
+ "interactive": false
61
+ },
62
+ {
63
+ "command": "@react-three/fiber",
64
+ "interactive": false
65
+ }
66
+ ]
67
+ },
68
+ "test2": {
69
+ "name": "test2",
70
+ "description": "Test2 configuration",
71
+ "packageManager": "npm",
72
+ "packages": [
73
+ {
74
+ "command": "@react-three/drei",
75
+ "interactive": false
76
+ },
77
+ {
78
+ "command": "framer-motion",
79
+ "interactive": false
80
+ },
81
+ {
82
+ "command": "@react-three/postprocessing",
83
+ "interactive": false
84
+ }
85
+ ]
86
+ }
87
+ }
@@ -6,10 +6,15 @@ describe("buildCommand", () => {
6
6
  const mockConfig: ConfigType[] = [
7
7
  {
8
8
  name: "vite",
9
- packageManager: "npm",
9
+ packageManager: "pnpm",
10
10
  packages: [
11
11
  { command: "vite@latest", interactive: true },
12
12
  { command: "gsap@latest", interactive: false },
13
+ { command: "react-dom@latest --save-dev", interactive: false },
14
+ { command: "lodash --save-dev", interactive: false },
15
+ { command: "typescript@latest --save-dev", interactive: false },
16
+ { command: "clsx", interactive: false },
17
+ { command: "shadcn", interactive: true },
13
18
  ],
14
19
  },
15
20
  ];
@@ -18,8 +23,13 @@ describe("buildCommand", () => {
18
23
  expect(command).toEqual([
19
24
  {
20
25
  name: "vite",
21
- interactive: ["npx vite@latest"],
22
- nonInteractive: ["npm install gsap@latest"],
26
+ interactive: ["pnpm dlx vite@latest", "pnpm dlx shadcn"],
27
+ nonInteractive: [
28
+ "pnpm add react-dom@latest --save-dev",
29
+ "pnpm add lodash --save-dev",
30
+ "pnpm add typescript@latest --save-dev",
31
+ "pnpm add gsap@latest clsx",
32
+ ],
23
33
  },
24
34
  ]);
25
35
  });
@@ -30,7 +40,9 @@ describe("buildCommand", () => {
30
40
  {
31
41
  name: "vite",
32
42
  interactive: [],
33
- nonInteractive: ["npm uninstall gsap@latest"],
43
+ nonInteractive: [
44
+ "pnpm remove gsap@latest react-dom@latest lodash typescript@latest clsx",
45
+ ],
34
46
  },
35
47
  ]);
36
48
  });