jru-express 1.0.2 → 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.
- package/.github/workflows/publish.yml +30 -29
- package/README.md +1 -1
- package/index.js +91 -91
- package/package.json +5 -1
- package/templates/README.md +10 -10
- package/templates/server.js +6 -6
- package/templates/src/app.js +12 -12
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
name: Publish JruExpress
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "v*.*.*"
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
id-token: write
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
publish:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: Setup Node
|
|
21
|
-
uses: actions/setup-node@
|
|
22
|
-
with:
|
|
23
|
-
node-version:
|
|
24
|
-
registry-url: https://registry.npmjs.org
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
name: Publish JruExpress
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Node
|
|
21
|
+
uses: actions/setup-node@v7
|
|
22
|
+
with:
|
|
23
|
+
node-version: "24"
|
|
24
|
+
registry-url: "https://registry.npmjs.org"
|
|
25
|
+
package-manager-cache: false
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: npm ci
|
|
29
|
+
|
|
30
|
+
- name: Publish
|
|
30
31
|
run: npm publish
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const { execSync } = require("child_process");
|
|
6
|
-
const { Command } = require("commander");
|
|
7
|
-
|
|
8
|
-
const program = new Command();
|
|
9
|
-
|
|
10
|
-
program
|
|
11
|
-
.name("jru-express")
|
|
12
|
-
.description("Generate a basic Express.js backend")
|
|
13
|
-
.argument("<project-name>", "Name of the project")
|
|
14
|
-
.action((projectName) => {
|
|
15
|
-
|
|
16
|
-
const projectPath = path.join(process.cwd(), projectName);
|
|
17
|
-
const templatePath = path.join(__dirname, "templates");
|
|
18
|
-
|
|
19
|
-
// Check if project already exists
|
|
20
|
-
if (fs.existsSync(projectPath)) {
|
|
21
|
-
console.error(`Project "${projectName}" already exists.`);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
console.log("\nCreating JruExpress project...\n");
|
|
26
|
-
|
|
27
|
-
// Create project directory
|
|
28
|
-
fs.mkdirSync(projectPath, { recursive: true });
|
|
29
|
-
|
|
30
|
-
// Copy template structure
|
|
31
|
-
fs.cpSync(templatePath, projectPath, {
|
|
32
|
-
recursive: true
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
console.log("✔ Folder structure created");
|
|
36
|
-
|
|
37
|
-
// Move into project directory
|
|
38
|
-
process.chdir(projectPath);
|
|
39
|
-
|
|
40
|
-
// Initialize npm
|
|
41
|
-
console.log("✔ Initializing npm...");
|
|
42
|
-
execSync("npm init -y", { stdio: "inherit" });
|
|
43
|
-
|
|
44
|
-
// Install Express
|
|
45
|
-
console.log("\n✔ Installing Express...");
|
|
46
|
-
execSync("npm install express", { stdio: "inherit" });
|
|
47
|
-
|
|
48
|
-
// Install Nodemon
|
|
49
|
-
console.log("\n✔ Installing Nodemon...");
|
|
50
|
-
execSync("npm install --save-dev nodemon", {
|
|
51
|
-
stdio: "inherit"
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// Update package.json scripts
|
|
55
|
-
const packageJsonPath = path.join(projectPath, "package.json");
|
|
56
|
-
|
|
57
|
-
const packageJson = JSON.parse(
|
|
58
|
-
fs.readFileSync(packageJsonPath, "utf8")
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
packageJson.scripts = {
|
|
62
|
-
start: "node server.js",
|
|
63
|
-
dev: "nodemon server.js"
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
fs.writeFileSync(
|
|
67
|
-
packageJsonPath,
|
|
68
|
-
JSON.stringify(packageJson, null, 2)
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
console.log("\n✔ Scripts configured");
|
|
72
|
-
|
|
73
|
-
console.log(`
|
|
74
|
-
╔══════════════════════════════════════╗
|
|
75
|
-
║ JruExpress Project Ready ║
|
|
76
|
-
╚══════════════════════════════════════╝
|
|
77
|
-
|
|
78
|
-
Project: ${projectName}
|
|
79
|
-
|
|
80
|
-
Run:
|
|
81
|
-
|
|
82
|
-
cd ${projectName}
|
|
83
|
-
|
|
84
|
-
Development:
|
|
85
|
-
npm run dev
|
|
86
|
-
|
|
87
|
-
Production:
|
|
88
|
-
npm start
|
|
89
|
-
|
|
90
|
-
`);
|
|
91
|
-
});
|
|
92
|
-
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { execSync } = require("child_process");
|
|
6
|
+
const { Command } = require("commander");
|
|
7
|
+
|
|
8
|
+
const program = new Command();
|
|
9
|
+
|
|
10
|
+
program
|
|
11
|
+
.name("jru-express")
|
|
12
|
+
.description("Generate a basic Express.js backend")
|
|
13
|
+
.argument("<project-name>", "Name of the project")
|
|
14
|
+
.action((projectName) => {
|
|
15
|
+
|
|
16
|
+
const projectPath = path.join(process.cwd(), projectName);
|
|
17
|
+
const templatePath = path.join(__dirname, "templates");
|
|
18
|
+
|
|
19
|
+
// Check if project already exists
|
|
20
|
+
if (fs.existsSync(projectPath)) {
|
|
21
|
+
console.error(`Project "${projectName}" already exists.`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
console.log("\nCreating JruExpress project...\n");
|
|
26
|
+
|
|
27
|
+
// Create project directory
|
|
28
|
+
fs.mkdirSync(projectPath, { recursive: true });
|
|
29
|
+
|
|
30
|
+
// Copy template structure
|
|
31
|
+
fs.cpSync(templatePath, projectPath, {
|
|
32
|
+
recursive: true
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
console.log("✔ Folder structure created");
|
|
36
|
+
|
|
37
|
+
// Move into project directory
|
|
38
|
+
process.chdir(projectPath);
|
|
39
|
+
|
|
40
|
+
// Initialize npm
|
|
41
|
+
console.log("✔ Initializing npm...");
|
|
42
|
+
execSync("npm init -y", { stdio: "inherit" });
|
|
43
|
+
|
|
44
|
+
// Install Express
|
|
45
|
+
console.log("\n✔ Installing Express...");
|
|
46
|
+
execSync("npm install express", { stdio: "inherit" });
|
|
47
|
+
|
|
48
|
+
// Install Nodemon
|
|
49
|
+
console.log("\n✔ Installing Nodemon...");
|
|
50
|
+
execSync("npm install --save-dev nodemon", {
|
|
51
|
+
stdio: "inherit"
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Update package.json scripts
|
|
55
|
+
const packageJsonPath = path.join(projectPath, "package.json");
|
|
56
|
+
|
|
57
|
+
const packageJson = JSON.parse(
|
|
58
|
+
fs.readFileSync(packageJsonPath, "utf8")
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
packageJson.scripts = {
|
|
62
|
+
start: "node server.js",
|
|
63
|
+
dev: "nodemon server.js"
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
fs.writeFileSync(
|
|
67
|
+
packageJsonPath,
|
|
68
|
+
JSON.stringify(packageJson, null, 2)
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
console.log("\n✔ Scripts configured");
|
|
72
|
+
|
|
73
|
+
console.log(`
|
|
74
|
+
╔══════════════════════════════════════╗
|
|
75
|
+
║ JruExpress Project Ready ║
|
|
76
|
+
╚══════════════════════════════════════╝
|
|
77
|
+
|
|
78
|
+
Project: ${projectName}
|
|
79
|
+
|
|
80
|
+
Run:
|
|
81
|
+
|
|
82
|
+
cd ${projectName}
|
|
83
|
+
|
|
84
|
+
Development:
|
|
85
|
+
npm run dev
|
|
86
|
+
|
|
87
|
+
Production:
|
|
88
|
+
npm start
|
|
89
|
+
|
|
90
|
+
`);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
93
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jru-express",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "My basic Express backend generator",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
],
|
|
18
18
|
"author": "The Great RAR",
|
|
19
19
|
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/RAR2025/JruExpress"
|
|
23
|
+
},
|
|
20
24
|
"dependencies": {
|
|
21
25
|
"commander": "^14.0.0"
|
|
22
26
|
}
|
package/templates/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# JruExpress Backend
|
|
2
|
-
|
|
3
|
-
Backend generated using JruExpress.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
npm install
|
|
8
|
-
|
|
9
|
-
## Run
|
|
10
|
-
|
|
1
|
+
# JruExpress Backend
|
|
2
|
+
|
|
3
|
+
Backend generated using JruExpress.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
npm install
|
|
8
|
+
|
|
9
|
+
## Run
|
|
10
|
+
|
|
11
11
|
node server.js
|
package/templates/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const app = require("./src/app");
|
|
2
|
-
|
|
3
|
-
const PORT = process.env.PORT || 3000;
|
|
4
|
-
|
|
5
|
-
app.listen(PORT, () => {
|
|
6
|
-
console.log(`Server running on port https://localhost:${PORT}`);
|
|
1
|
+
const app = require("./src/app");
|
|
2
|
+
|
|
3
|
+
const PORT = process.env.PORT || 3000;
|
|
4
|
+
|
|
5
|
+
app.listen(PORT, () => {
|
|
6
|
+
console.log(`Server running on port https://localhost:${PORT}`);
|
|
7
7
|
});
|
package/templates/src/app.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const express = require("express");
|
|
2
|
-
|
|
3
|
-
const app = express();
|
|
4
|
-
|
|
5
|
-
app.use(express.json());
|
|
6
|
-
|
|
7
|
-
app.get("/", (req, res) => {
|
|
8
|
-
res.json({
|
|
9
|
-
message: "JruExpress API is running"
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
1
|
+
const express = require("express");
|
|
2
|
+
|
|
3
|
+
const app = express();
|
|
4
|
+
|
|
5
|
+
app.use(express.json());
|
|
6
|
+
|
|
7
|
+
app.get("/", (req, res) => {
|
|
8
|
+
res.json({
|
|
9
|
+
message: "JruExpress API is running"
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
13
|
module.exports = app;
|