server-up-ndot 1.2.5 → 1.3.0

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/bin/cli.js CHANGED
@@ -4,6 +4,8 @@ const create = require("../lib/create");
4
4
 
5
5
  const dev = require("../lib/dev");
6
6
 
7
+ const build = require("../lib/build");
8
+
7
9
  const args = process.argv.slice(2);
8
10
 
9
11
  if (args[0] === "create") {
@@ -11,6 +13,9 @@ if (args[0] === "create") {
11
13
  }
12
14
  else if (args[0] === "dev") {
13
15
  dev()
16
+ }
17
+ else if (args[0] === "build") {
18
+ build()
14
19
  } else {
15
20
  console.log("Usage:");
16
21
  console.log("server-up-ndot create <project-name>");
package/build.sh ADDED
@@ -0,0 +1,3 @@
1
+ git clone https://github.com/ppccpcpcpc-byte/server-up-ndot
2
+ cd server-up-ndot
3
+ npm link
package/lib/build.js ADDED
@@ -0,0 +1,12 @@
1
+ const { exec } = require("child_process");
2
+ function build() {
3
+ // ../build.sh 실행
4
+ exec("sh ./build.sh", (error, stdout, stderr) => {
5
+ if (error) {
6
+ console.error(`runt<ime> error: ${error.message}`);
7
+ return;
8
+ }
9
+ console.log(stdout);
10
+ });
11
+ }
12
+ module.exports = build;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "server-up-ndot",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "description": "server toolkit",
5
5
  "main": "index.js",
6
6
  "bin": {
package/readme.md CHANGED
@@ -45,6 +45,16 @@ npx server-up-ndot create myserver
45
45
 
46
46
  ## Patch Notes
47
47
 
48
+ ## 1.3.x
49
+
50
+ ### 1.3.0
51
+ - add a local build(usage:)
52
+ ```bash
53
+ npx server-up-ndot build
54
+ ```
55
+
56
+ ## 1.2.x
57
+
48
58
  ### 1.2.5
49
59
  - Specify OS and compatibility
50
60
 
@@ -79,6 +89,8 @@ npx server-up-ndot create myserver
79
89
  ### 1.2.0-alpha.1
80
90
  - Prevent port overlap(alhpa)
81
91
 
92
+ ## 1.1.x
93
+
82
94
  ### 1.1.8
83
95
  - typo correction
84
96
 
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+
3
+ const create = require("../lib/create");
4
+
5
+ const dev = require("../lib/dev");
6
+
7
+ const args = process.argv.slice(2);
8
+
9
+ if (args[0] === "create") {
10
+ create(args[1] || "server-app");
11
+ }
12
+ else if (args[0] === "dev") {
13
+ dev()
14
+ } else {
15
+ console.log("Usage:");
16
+ console.log("server-up-ndot create <project-name>");
17
+ }
@@ -0,0 +1,46 @@
1
+ /** MIT License
2
+
3
+ Copyright (c) 2026 ndot
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+ */
23
+ const express = require('express');
24
+ const cors = require('cors');
25
+ require('dotenv').config();
26
+
27
+ const app = express();
28
+ const PORT = process.env.PORT || 3000;
29
+
30
+ app.use(cors());
31
+ app.use(express.json());
32
+
33
+ // GET
34
+ app.get('/', (req, res) => {
35
+ res.send('segfaultandsegmentationfault');
36
+ });
37
+
38
+ // POST
39
+ app.post('/api', (req, res) => {
40
+ res.json({ received: req.body });
41
+ });
42
+
43
+ // server start
44
+ app.listen(PORT, () => {
45
+ console.log(`Server running on http://localhost:${PORT}`);
46
+ });
@@ -0,0 +1,38 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ module.exports = function create(name){
5
+
6
+ const projectPath = path.join(process.cwd(), name);
7
+ const templatePath = path.join(__dirname, "../templates/basic");
8
+
9
+ if(fs.existsSync(projectPath)){
10
+ console.log("Folder already exists");
11
+ return;
12
+ }
13
+
14
+ fs.mkdirSync(projectPath);
15
+ copyFolder(templatePath, projectPath);
16
+
17
+ console.log("Server created:", name);
18
+ };
19
+
20
+ function copyFolder(src,dest){
21
+
22
+ const files = fs.readdirSync(src);
23
+
24
+ files.forEach(file=>{
25
+
26
+ const srcPath = path.join(src,file);
27
+ const destPath = path.join(dest,file);
28
+
29
+ if(fs.statSync(srcPath).isDirectory()){
30
+ fs.mkdirSync(destPath);
31
+ copyFolder(srcPath,destPath);
32
+ }else{
33
+ fs.copyFileSync(srcPath,destPath);
34
+ }
35
+
36
+ });
37
+
38
+ }
@@ -0,0 +1,8 @@
1
+ const { spawn } = require("child_process");
2
+
3
+ function dev() {
4
+ const child = spawn("node", ["app.js"], {
5
+ stdio: "inherit"
6
+ });
7
+ }
8
+ module.exports = dev;