Skip to content

Commit de6f626

Browse files
CopilotmaximizeIT
andcommitted
fix: Apply code review suggestions
- Fix yargs v18 migration by adding .argv to complete the builder chain - Downgrade Jest from alpha (^30.0.0-alpha.6) to stable version (^29.7.0) - Remove body-parser dependency and use Express 5.x built-in middleware - Replace bodyParser.json() with express.json() - Replace bodyParser.urlencoded() with express.urlencoded() - Remove body-parser from scaffoldTpl/package.json Co-authored-by: maximizeIT <8626039+maximizeIT@users.noreply.github.com>
1 parent 4933fd2 commit de6f626

5 files changed

Lines changed: 666 additions & 938 deletions

File tree

csss.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ const yargv = yargs(process.argv.slice(2))
2424
.string("name")
2525
.describe("name", "a specific package.json name of your app")
2626
.version("0.0.1")
27-
.help("help").epilogue(`for more information,\please see the README at:
28-
https://github.com/Staffbase/create-staffbase-plugin-nodejs/blob/main/README.MD`);
29-
// console.log('YARGS Parsed Data:\n', yargv.argv);
27+
.help("help")
28+
.epilogue(`for more information,\please see the README at:
29+
https://github.com/Staffbase/create-staffbase-plugin-nodejs/blob/main/README.MD`)
30+
.argv;
31+
// console.log('YARGS Parsed Data:\n', yargv);
3032
const packageJSON = fs.readJSONSync(path.join(scaffoldFolder, "package.json"));
3133
// Defaults package name to current folder name
32-
const nameParam = yargv.argv.N || yargv.argv.name || defaultNPMName;
34+
const nameParam = yargv.N || yargv.name || defaultNPMName;
3335
prompt.override = {
34-
name: yargv.argv.N,
35-
path: yargv.argv._[0],
36+
name: yargv.N,
37+
path: yargv._[0],
3638
};
3739
/**
3840
* Prompts user for just the npm name value.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"eslint-plugin-simple-import-sort": "^12.1.1",
4343
"highlight.js": "^11.11.1",
4444
"husky": "^9.1.7",
45-
"jest": "^30.0.0-alpha.6",
45+
"jest": "^29.7.0",
4646
"markdown-it": "^12.3.2",
4747
"marked": "^4.0.10",
4848
"typescript": "^5.9.3"

scaffoldTpl/app.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ let path = require("path");
33
let favicon = require("serve-favicon");
44
let logger = require("morgan");
55
let cookieParser = require("cookie-parser");
6-
let bodyParser = require("body-parser");
76

87
let index = require("./routes/index");
98
let users = require("./routes/users");
@@ -25,8 +24,8 @@ app.set("view engine", "pug");
2524
// uncomment after placing your favicon in /public
2625
// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
2726
app.use(logger("dev"));
28-
app.use(bodyParser.json());
29-
app.use(bodyParser.urlencoded({ extended: false }));
27+
app.use(express.json());
28+
app.use(express.urlencoded({ extended: false }));
3029
app.use(cookieParser());
3130
app.use(express.static(path.join(__dirname, "public")));
3231

scaffoldTpl/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
},
88
"dependencies": {
99
"@staffbase/staffbase-plugin-sdk": "^1.3.1",
10-
"body-parser": "^2.2.1",
1110
"cookie-parser": "^1.4.7",
1211
"debug": "^4.4.3",
1312
"express": "^5.2.1",

0 commit comments

Comments
 (0)