sprint-es 0.0.30 ā 0.0.32
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/dist/cjs/cli.cjs +72 -0
- package/dist/esm/cli.js +71 -0
- package/package.json +9 -10
- package/bin/sprint-es +0 -18
package/dist/cjs/cli.cjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const child_process = require("child_process");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const command = args[0];
|
|
8
|
+
if (!command) {
|
|
9
|
+
console.log("\nš Sprint CLI\n");
|
|
10
|
+
console.log("Usage: sprint-es <command>");
|
|
11
|
+
console.log("\nCommands:");
|
|
12
|
+
console.log(" dev Start development server");
|
|
13
|
+
console.log(" build Build for production");
|
|
14
|
+
console.log(" start Start production server");
|
|
15
|
+
console.log("\nOptions:");
|
|
16
|
+
console.log(" --help Show this help message");
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
if (command === "--help" || command === "-h") {
|
|
20
|
+
console.log("\nš Sprint CLI\n");
|
|
21
|
+
console.log("Usage: sprint-es <command>");
|
|
22
|
+
console.log("\nCommands:");
|
|
23
|
+
console.log(" dev Start development server");
|
|
24
|
+
console.log(" build Build for production");
|
|
25
|
+
console.log(" start Start production server");
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
function getProjectRoot() {
|
|
29
|
+
let dir = process.cwd();
|
|
30
|
+
while (dir !== path.resolve(dir, "..")) {
|
|
31
|
+
if (fs.existsSync(path.join(dir, "sprint.config.ts")) || fs.existsSync(path.join(dir, "sprint.config.js"))) {
|
|
32
|
+
return dir;
|
|
33
|
+
}
|
|
34
|
+
dir = path.resolve(dir, "..");
|
|
35
|
+
}
|
|
36
|
+
return process.cwd();
|
|
37
|
+
}
|
|
38
|
+
const projectRoot = getProjectRoot();
|
|
39
|
+
function runCommand(cmd, envVars) {
|
|
40
|
+
const child = child_process.spawn(cmd, args.slice(1), {
|
|
41
|
+
cwd: projectRoot,
|
|
42
|
+
stdio: "inherit",
|
|
43
|
+
shell: true,
|
|
44
|
+
env: { ...process.env, ...envVars }
|
|
45
|
+
});
|
|
46
|
+
child.on("exit", (code) => {
|
|
47
|
+
process.exit(code || 0);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
switch (command) {
|
|
51
|
+
case "dev":
|
|
52
|
+
console.log("š Starting development server...");
|
|
53
|
+
runCommand("tsx", { NODE_ENV: "development" });
|
|
54
|
+
break;
|
|
55
|
+
case "build":
|
|
56
|
+
console.log("š Building for production...");
|
|
57
|
+
const hasViteConfig = fs.existsSync(path.join(projectRoot, "vite.config.ts")) || fs.existsSync(path.join(projectRoot, "vite.config.js"));
|
|
58
|
+
if (hasViteConfig) runCommand("vite build", { NODE_ENV: "production" });
|
|
59
|
+
else {
|
|
60
|
+
console.error("ā Error: no vite config found.");
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
case "start":
|
|
65
|
+
console.log("š Starting production server...");
|
|
66
|
+
runCommand("node dist/index.js", { NODE_ENV: "production" });
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
console.error(`Unknown command: ${command}`);
|
|
70
|
+
console.log("Use --help for usage information");
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
package/dist/esm/cli.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import { existsSync } from "fs";
|
|
4
|
+
import { join, resolve } from "path";
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const command = args[0];
|
|
7
|
+
if (!command) {
|
|
8
|
+
console.log("\nš Sprint CLI\n");
|
|
9
|
+
console.log("Usage: sprint-es <command>");
|
|
10
|
+
console.log("\nCommands:");
|
|
11
|
+
console.log(" dev Start development server");
|
|
12
|
+
console.log(" build Build for production");
|
|
13
|
+
console.log(" start Start production server");
|
|
14
|
+
console.log("\nOptions:");
|
|
15
|
+
console.log(" --help Show this help message");
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
if (command === "--help" || command === "-h") {
|
|
19
|
+
console.log("\nš Sprint CLI\n");
|
|
20
|
+
console.log("Usage: sprint-es <command>");
|
|
21
|
+
console.log("\nCommands:");
|
|
22
|
+
console.log(" dev Start development server");
|
|
23
|
+
console.log(" build Build for production");
|
|
24
|
+
console.log(" start Start production server");
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
function getProjectRoot() {
|
|
28
|
+
let dir = process.cwd();
|
|
29
|
+
while (dir !== resolve(dir, "..")) {
|
|
30
|
+
if (existsSync(join(dir, "sprint.config.ts")) || existsSync(join(dir, "sprint.config.js"))) {
|
|
31
|
+
return dir;
|
|
32
|
+
}
|
|
33
|
+
dir = resolve(dir, "..");
|
|
34
|
+
}
|
|
35
|
+
return process.cwd();
|
|
36
|
+
}
|
|
37
|
+
const projectRoot = getProjectRoot();
|
|
38
|
+
function runCommand(cmd, envVars) {
|
|
39
|
+
const child = spawn(cmd, args.slice(1), {
|
|
40
|
+
cwd: projectRoot,
|
|
41
|
+
stdio: "inherit",
|
|
42
|
+
shell: true,
|
|
43
|
+
env: { ...process.env, ...envVars }
|
|
44
|
+
});
|
|
45
|
+
child.on("exit", (code) => {
|
|
46
|
+
process.exit(code || 0);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
switch (command) {
|
|
50
|
+
case "dev":
|
|
51
|
+
console.log("š Starting development server...");
|
|
52
|
+
runCommand("tsx", { NODE_ENV: "development" });
|
|
53
|
+
break;
|
|
54
|
+
case "build":
|
|
55
|
+
console.log("š Building for production...");
|
|
56
|
+
const hasViteConfig = existsSync(join(projectRoot, "vite.config.ts")) || existsSync(join(projectRoot, "vite.config.js"));
|
|
57
|
+
if (hasViteConfig) runCommand("vite build", { NODE_ENV: "production" });
|
|
58
|
+
else {
|
|
59
|
+
console.error("ā Error: no vite config found.");
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case "start":
|
|
64
|
+
console.log("š Starting production server...");
|
|
65
|
+
runCommand("node dist/index.js", { NODE_ENV: "production" });
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
console.error(`Unknown command: ${command}`);
|
|
69
|
+
console.log("Use --help for usage information");
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprint-es",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Sprint - Quickly API",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"bin": "
|
|
9
|
+
"bin": "dist/esm/cli.js",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/types/index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"require": "./dist/cjs/modules/telemetry/index.cjs",
|
|
29
29
|
"import": "./dist/esm/modules/telemetry/index.js"
|
|
30
30
|
},
|
|
31
|
-
"./
|
|
32
|
-
"types": "./dist/types/modules/
|
|
33
|
-
"require": "./dist/cjs/modules/
|
|
34
|
-
"import": "./dist/esm/modules/
|
|
31
|
+
"./schemas": {
|
|
32
|
+
"types": "./dist/types/modules/schemas/index.d.ts",
|
|
33
|
+
"require": "./dist/cjs/modules/schemas/index.cjs",
|
|
34
|
+
"import": "./dist/esm/modules/schemas/index.js"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
43
|
"clean": "rimraf dist",
|
|
44
|
-
"build": "vite build",
|
|
44
|
+
"build": "vite build && node -e \"const fs=require('fs');const p='dist/esm/cli.js';let c=fs.readFileSync(p,'utf8');if(!c.startsWith('#!')){fs.writeFileSync(p,'#!/usr/bin/env node\\n'+c)}\"",
|
|
45
45
|
"dev": "NODE_ENV=development ts-node src/index.ts",
|
|
46
46
|
"start": "NODE_ENV=production ts-node src/index.ts",
|
|
47
47
|
"prepublishOnly": "npm run build",
|
|
@@ -63,11 +63,10 @@
|
|
|
63
63
|
"url": "https://github.com/TPEOficial/sprint/issues"
|
|
64
64
|
},
|
|
65
65
|
"homepage": "https://dymo.tpeoficial.com",
|
|
66
|
-
"dependencies": {
|
|
66
|
+
"dependencies": {
|
|
67
67
|
"axios": "^1.13.2",
|
|
68
68
|
"cors": "^2.8.5",
|
|
69
69
|
"express": "^5.1.0",
|
|
70
|
-
"jose": "^6.0.11",
|
|
71
70
|
"morgan": "^1.10.1",
|
|
72
71
|
"path": "^0.12.7",
|
|
73
72
|
"serve-favicon": "^2.5.1",
|
|
@@ -99,4 +98,4 @@
|
|
|
99
98
|
"tabWidth": 4,
|
|
100
99
|
"useTabs": false
|
|
101
100
|
}
|
|
102
|
-
}
|
|
101
|
+
}
|
package/bin/sprint-es
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { spawn } from "child_process";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
import { dirname, join } from "path";
|
|
6
|
-
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = dirname(__filename);
|
|
9
|
-
|
|
10
|
-
const cliPath = join(__dirname, "../src/cli.ts");
|
|
11
|
-
const tsx = spawn("tsx", [cliPath, ...process.argv.slice(2)], {
|
|
12
|
-
stdio: "inherit",
|
|
13
|
-
shell: true
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
tsx.on("exit", (code) => {
|
|
17
|
-
process.exit(code || 0);
|
|
18
|
-
});
|