starten 0.0.1

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.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # starten
2
+
3
+ execute (npm) script
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ import { autocomplete, cancel, intro, isCancel } from "@clack/prompts";
3
+ import spawn from "cross-spawn";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+ async function main() {
7
+ intro("XSC - execute package.json scripts");
8
+ const packageJsonPath = path.join(process.cwd(), "package.json");
9
+ if (!fs.existsSync(packageJsonPath))
10
+ return cancel("No package.json found in the current directory.");
11
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
12
+ const scripts = packageJson.scripts;
13
+ if (!scripts || Object.keys(scripts).length === 0)
14
+ return cancel("No scripts found in package.json.");
15
+ const scriptNames = Object.keys(scripts);
16
+ const selected = await autocomplete({
17
+ message: "Select a script to run",
18
+ options: scriptNames.map(name => ({ value: name, label: name })),
19
+ });
20
+ if (isCancel(selected))
21
+ return cancel("No script selected.");
22
+ await runScript(selected);
23
+ process.exit(0);
24
+ }
25
+ async function runScript(script) {
26
+ return new Promise((resolve, reject) => {
27
+ const child = spawn("npm", ["run", script], {
28
+ stdio: ["pipe", "pipe", "pipe"]
29
+ });
30
+ child.stdout?.pipe(process.stdout);
31
+ child.stderr?.pipe(process.stderr);
32
+ process.once("SIGINT", () => child.kill("SIGINT"));
33
+ child.on("error", reject);
34
+ child.on("close", resolve);
35
+ });
36
+ }
37
+ main();
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "starten",
3
+ "version": "0.0.1",
4
+ "description": "execute package.json script",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "bin": {
11
+ "xsc": "dist/index.js"
12
+ },
13
+ "keywords": [
14
+ "cli",
15
+ "dev-tools"
16
+ ],
17
+ "author": "FCQCarryOut",
18
+ "scripts": {
19
+ "build": "rm -R -f ./dist && tsc && sed -i '1i\\#!/usr/bin/env node' ./dist/index.js",
20
+ "prepack": "npm run build"
21
+ },
22
+ "dependencies": {
23
+ "@clack/prompts": "^1.5.1",
24
+ "cross-spawn": "^7.0.6"
25
+ },
26
+ "devDependencies": {
27
+ "@types/cross-spawn": "^6.0.6",
28
+ "@types/node": "^25.9.3",
29
+ "typescript": "^6.0.3"
30
+ }
31
+ }