Skip to content

Commit fa1dbd8

Browse files
committed
fix(lint): resolve linting errors in create-app
1 parent d540fe8 commit fa1dbd8

File tree

11 files changed

+120
-96
lines changed

11 files changed

+120
-96
lines changed

.github/workflows/ci-release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ jobs:
5252

5353
- run: npm test
5454

55-
56-
5755
publish:
5856
runs-on: ubuntu-latest
5957
if: startsWith(github.ref, 'refs/tags/v') # Only run on version tags

.github/workflows/njsscan.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @format
2+
13
# This workflow uses actions that are not certified by GitHub.
24
# They are provided by a third-party and are governed by
35
# separate terms of service, privacy policy, and support
@@ -10,10 +12,10 @@ name: njsscan sarif
1012

1113
on:
1214
push:
13-
branches: [ "main" ]
15+
branches: ['main']
1416
pull_request:
1517
# The branches below must be a subset of the branches above
16-
branches: [ "main" ]
18+
branches: ['main']
1719
schedule:
1820
- cron: '18 11 * * 4'
1921

@@ -29,14 +31,14 @@ jobs:
2931
runs-on: ubuntu-latest
3032
name: njsscan code scanning
3133
steps:
32-
- name: Checkout the code
33-
uses: actions/checkout@v4
34-
- name: nodejsscan scan
35-
id: njsscan
36-
uses: ajinabraham/njsscan-action@7237412fdd36af517e2745077cedbf9d6900d711
37-
with:
38-
args: '. --sarif --output results.sarif || true'
39-
- name: Upload njsscan report
40-
uses: github/codeql-action/upload-sarif@v3
41-
with:
42-
sarif_file: results.sarif
34+
- name: Checkout the code
35+
uses: actions/checkout@v4
36+
- name: nodejsscan scan
37+
id: njsscan
38+
uses: ajinabraham/njsscan-action@7237412fdd36af517e2745077cedbf9d6900d711
39+
with:
40+
args: '. --sarif --output results.sarif || true'
41+
- name: Upload njsscan report
42+
uses: github/codeql-action/upload-sarif@v3
43+
with:
44+
sarif_file: results.sarif

CHANGELOG.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
## [3.5.1](https://github.com/involvex/create-wizard/compare/v3.5.0...v3.5.1) (2025-09-20)
1+
<!-- @format -->
22

3+
## [3.5.1](https://github.com/involvex/create-wizard/compare/v3.5.0...v3.5.1) (2025-09-20)
34

45
### Bug Fixes
56

6-
* **ci:** add .gitattributes to prevent line ending issues ([eed9869](https://github.com/involvex/create-wizard/commit/eed9869de11011a67c4d25cef2af2afd2f6356e4))
7-
* **cli:** resolve multiple issues in create-app wizard ([013ee97](https://github.com/involvex/create-wizard/commit/013ee97cf971a00f4c37b0dfda4df48f12af63a1))
8-
7+
- **ci:** add .gitattributes to prevent line ending issues ([eed9869](https://github.com/involvex/create-wizard/commit/eed9869de11011a67c4d25cef2af2afd2f6356e4))
8+
- **cli:** resolve multiple issues in create-app wizard ([013ee97](https://github.com/involvex/create-wizard/commit/013ee97cf971a00f4c37b0dfda4df48f12af63a1))
99

1010
### Features
1111

12-
* **cli:** overhaul UI and add project name argument ([7f1031e](https://github.com/involvex/create-wizard/commit/7f1031ebfa1c643f1cfcd9f4f7b11c5ab19e902c))
13-
14-
12+
- **cli:** overhaul UI and add project name argument ([7f1031e](https://github.com/involvex/create-wizard/commit/7f1031ebfa1c643f1cfcd9f4f7b11c5ab19e902c))
1513

1614
<!-- @format -->
1715

dist/create-wizard.js

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7638,6 +7638,7 @@ var Ce = async (t, n2) => {
76387638

76397639
// scripts/create-app.js
76407640
import debug2 from "debug";
7641+
import { createRequire } from "module";
76417642

76427643
// scripts/create-plugin.js
76437644
import { join } from "path";
@@ -7897,14 +7898,7 @@ export default [
78977898
{
78987899
templates: () => fe({
78997900
message: "Select .gitignore templates:",
7900-
options: [
7901-
"node",
7902-
"visualstudiocode",
7903-
"windows",
7904-
"macos",
7905-
"linux",
7906-
"jetbrain"
7907-
],
7901+
options: ["node", "visualstudiocode", "windows", "macos", "linux", "jetbrain"],
79087902
initialValue: ["node", "visualstudiocode"]
79097903
})
79107904
},
@@ -10872,16 +10866,41 @@ describe('Example Test', () => {
1087210866
function updatePackageJsonScripts(newScripts) {
1087310867
const packageJsonPath = join3(process.cwd(), "package.json");
1087410868
if (fs.existsSync(packageJsonPath)) {
10875-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
10876-
packageJson.scripts = { ...packageJson.scripts, ...newScripts };
10877-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
10869+
const packageJson2 = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
10870+
packageJson2.scripts = { ...packageJson2.scripts, ...newScripts };
10871+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson2, null, 2));
1087810872
} else {
1087910873
console.error("package.json not found. Please run npm init first.");
1088010874
}
1088110875
}
1088210876

1088310877
// scripts/create-app.js
10878+
var require2 = createRequire(import.meta.url);
10879+
var packageJson = require2("../package.json");
1088410880
var args = process.argv.slice(2);
10881+
if (args.includes("-h") || args.includes("--help")) {
10882+
console.log(`
10883+
Usage: create-wizard [projectName] [options]
10884+
10885+
Initializes a new project using an interactive wizard.
10886+
10887+
Arguments:
10888+
projectName The name of the project to create. If provided, the wizard will skip the project name prompt.
10889+
10890+
Options:
10891+
-v, --version Output the current version and exit.
10892+
-h, --help Display this help message and exit.
10893+
--plugin Configure and install a new plugin (e.g., Prettier, ESLint).
10894+
--create-test Set up a new test framework for the project.
10895+
--license Generate a new LICENSE file.
10896+
--debug=TRUE Enable debug logging.
10897+
`);
10898+
process.exit(0);
10899+
}
10900+
if (args.includes("-v") || args.includes("--version")) {
10901+
console.log(packageJson.version);
10902+
process.exit(0);
10903+
}
1088510904
var debugFlag = args.find((arg) => arg.startsWith("--debug="));
1088610905
var isDebugEnabled = debugFlag === "--debug=TRUE" || process.env.DEBUG === "TRUE";
1088710906
if (isDebugEnabled) {
@@ -11122,21 +11141,21 @@ async function main4(deps) {
1112211141
}
1112311142
}
1112411143
const packageJsonPath = join4(projectDir, "package.json");
11125-
let packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
11144+
let packageJson2 = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
1112611145
const userDependencies = answers.dependencies.reduce((acc, dep) => {
1112711146
acc[dep.name] = dep.version;
1112811147
return acc;
1112911148
}, {});
11130-
packageJson.dependencies = {
11131-
...packageJson.dependencies,
11149+
packageJson2.dependencies = {
11150+
...packageJson2.dependencies,
1113211151
...userDependencies
1113311152
};
11134-
packageJson.devDependencies = {
11135-
...packageJson.devDependencies
11153+
packageJson2.devDependencies = {
11154+
...packageJson2.devDependencies
1113611155
};
1113711156
if (answers.includeTypeScript) {
11138-
packageJson.devDependencies = {
11139-
...packageJson.devDependencies,
11157+
packageJson2.devDependencies = {
11158+
...packageJson2.devDependencies,
1114011159
typescript: "^5.3.3"
1114111160
};
1114211161
fs2.writeFileSync(
@@ -11158,13 +11177,13 @@ async function main4(deps) {
1115811177
);
1115911178
}
1116011179
if (answers.includeEslint) {
11161-
packageJson.devDependencies = {
11162-
...packageJson.devDependencies,
11180+
packageJson2.devDependencies = {
11181+
...packageJson2.devDependencies,
1116311182
eslint: "^8.56.0",
1116411183
globals: "^15.2.0"
1116511184
};
1116611185
if (answers.includePrettier) {
11167-
packageJson.devDependencies["eslint-config-prettier"] = "^9.1.0";
11186+
packageJson2.devDependencies["eslint-config-prettier"] = "^9.1.0";
1116811187
}
1116911188
const isESM = [
1117011189
"vite",
@@ -11176,10 +11195,10 @@ async function main4(deps) {
1117611195
"docusaurus-site"
1117711196
].includes(answers.template);
1117811197
if (isESM) {
11179-
packageJson.type = "module";
11198+
packageJson2.type = "module";
1118011199
}
1118111200
let eslintConfigContent;
11182-
if (packageJson.type === "module") {
11201+
if (packageJson2.type === "module") {
1118311202
eslintConfigContent = `import js from "@eslint/js";
1118411203
import globals from "globals";
1118511204
${answers.includePrettier ? "import prettierConfig from 'eslint-config-prettier';\n" : ""}
@@ -11201,15 +11220,15 @@ module.exports = [
1120111220
`;
1120211221
}
1120311222
fs2.writeFileSync(join4(projectDir, "eslint.config.js"), eslintConfigContent);
11204-
packageJson.scripts = {
11205-
...packageJson.scripts,
11223+
packageJson2.scripts = {
11224+
...packageJson2.scripts,
1120611225
lint: "eslint .",
1120711226
"lint:fix": "eslint . --fix"
1120811227
};
1120911228
}
1121011229
if (answers.includePrettier) {
11211-
packageJson.devDependencies = {
11212-
...packageJson.devDependencies,
11230+
packageJson2.devDependencies = {
11231+
...packageJson2.devDependencies,
1121311232
prettier: "^3.2.5"
1121411233
};
1121511234
fs2.writeFileSync(
@@ -11224,8 +11243,8 @@ module.exports = [
1122411243
2
1122511244
)
1122611245
);
11227-
packageJson.scripts = {
11228-
...packageJson.scripts,
11246+
packageJson2.scripts = {
11247+
...packageJson2.scripts,
1122911248
"format:check": "prettier --check .",
1123011249
format: "prettier --write ."
1123111250
};
@@ -11320,7 +11339,7 @@ test-job:
1132011339
`
1132111340
);
1132211341
}
11323-
fs2.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
11342+
fs2.writeFileSync(packageJsonPath, JSON.stringify(packageJson2, null, 2));
1132411343
if (answers.includeDebugConfig) {
1132511344
const vscodeDir = join4(projectDir, ".vscode");
1132611345
fs2.mkdirSync(vscodeDir, { recursive: true });
@@ -11344,10 +11363,10 @@ test-job:
1134411363
)
1134511364
);
1134611365
}
11347-
const allDependencies = Object.entries(packageJson.dependencies || {}).map(
11366+
const allDependencies = Object.entries(packageJson2.dependencies || {}).map(
1134811367
([name, version]) => `${name}@${version}`
1134911368
);
11350-
const allDevDependencies = Object.entries(packageJson.devDependencies || {}).map(
11369+
const allDevDependencies = Object.entries(packageJson2.devDependencies || {}).map(
1135111370
([name, version]) => `${name}@${version}`
1135211371
);
1135311372
if (allDependencies.length > 0) {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040
"lint:fix": "npx eslint . --config eslint.config.js --fix",
4141
"check": "npm run lint:fix && npm run format",
4242
"coverage": "vitest run --coverage",
43-
"prebuild": "npm run check",
43+
"prebuild": "npm run check",
4444
"build": "npx esbuild scripts/create-app.js --bundle --platform=node --target=node22 --format=esm --external:yoctocolors-cjs --external:mute-stream --external:safer-buffer --external:iconv-lite --external:cross-spawn --external:graceful-fs --external:fs-extra --external:inquirer --external:cli-progress --external:debug --outfile=dist/create-wizard.js --banner:js=\"#!/usr/bin/env node\"",
4545
"start": "node scripts/create-app.js",
4646
"docs:start": "cd docs && npm start",
4747
"docs:build": "cd docs && npm run build",
4848
"docs:serve": "cd docs && npm run serve",
4949
"template:create": "node scripts/create-template.js",
50-
"prerelease": "npm run check",
50+
"prerelease": "npm run check",
5151
"release": "node scripts/release.js",
5252
"debug": "cross-env DEBUG=TRUE && node scripts/create-app.js --debug=TRUE ",
5353
"review": "node scripts/ai-review.js"

scripts/ai-review.js

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
1-
import ModelClient, { isUnexpected } from "@azure-rest/ai-inference";
2-
import { AzureKeyCredential } from "@azure/core-auth";
3-
import env from 'dotenv';
4-
env.config();
1+
/** @format */
52

6-
const token = env.GH_TOKEN || process.env["GH_TOKEN"];
7-
const endpoint = "https://models.github.ai/inference";
8-
const model = "openai/gpt-4.1";
3+
import ModelClient, { isUnexpected } from '@azure-rest/ai-inference'
4+
import { AzureKeyCredential } from '@azure/core-auth'
5+
import env from 'dotenv'
6+
env.config()
97

10-
export async function main() {
8+
const token = env.GH_TOKEN || process.env['GH_TOKEN']
9+
const endpoint = 'https://models.github.ai/inference'
10+
const model = 'openai/gpt-4.1'
1111

12-
const client = ModelClient(
13-
endpoint,
14-
new AzureKeyCredential(token),
15-
);
12+
export async function main() {
13+
const client = ModelClient(endpoint, new AzureKeyCredential(token))
1614

17-
const response = await client.path("/chat/completions").post({
15+
const response = await client.path('/chat/completions').post({
1816
body: {
1917
messages: [
20-
{ role:"system", content: "you are a helpful code review assistant" },
21-
{ role:"user", content: "summarize the project " + '../package.json' + './create-app.js' + './create-plugin.js' + './create-test-setup.js' + '../CHANGELOG.md' + '../README.md' + '../docs/docs/installation.md' + '../docs/docs/usage.md' }
18+
{ role: 'system', content: 'you are a helpful code review assistant' },
19+
{
20+
role: 'user',
21+
content:
22+
'summarize the project ' +
23+
'../package.json' +
24+
'./create-app.js' +
25+
'./create-plugin.js' +
26+
'./create-test-setup.js' +
27+
'../CHANGELOG.md' +
28+
'../README.md' +
29+
'../docs/docs/installation.md' +
30+
'../docs/docs/usage.md',
31+
},
2232
],
2333
temperature: 1,
2434
top_p: 1,
25-
model: model
26-
}
27-
});
35+
model: model,
36+
},
37+
})
2838

2939
if (isUnexpected(response)) {
30-
throw response.body.error;
40+
throw response.body.error
3141
}
3242

33-
console.log(response.body.choices[0].message.content);
43+
console.log(response.body.choices[0].message.content)
3444
}
3545

36-
main().catch((err) => {
37-
console.error("The sample encountered an error:", err);
38-
});
39-
46+
main().catch(err => {
47+
console.error('The sample encountered an error:', err)
48+
})

scripts/create-app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export async function main(deps) {
140140
}
141141
}
142142

143-
p.intro('Let\'s create a new project!')
143+
p.intro("Let's create a new project!")
144144

145145
const cliArgs = process.argv.slice(2).filter(arg => !arg.startsWith('--'))
146146
const projectNameFromArg = cliArgs[0]
@@ -650,4 +650,4 @@ if (process.argv[1] === fileURLToPath(import.meta.url)) {
650650
// If no specific flags are provided by the user, run main
651651
main({})
652652
}
653-
}
653+
}

scripts/create-plugin.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ export default [
235235
options: ['CommonJS', 'ESNext', 'NodeNext'],
236236
initialValue: 'CommonJS',
237237
}),
238-
strict: () => p.confirm({ message: 'Enable strict type-checking?', initialValue: true }),
238+
strict: () =>
239+
p.confirm({ message: 'Enable strict type-checking?', initialValue: true }),
239240
esModuleInterop: () =>
240241
p.confirm({ message: 'Enable esModuleInterop?', initialValue: true }),
241242
},
@@ -301,14 +302,7 @@ export default [
301302
templates: () =>
302303
p.multiselect({
303304
message: 'Select .gitignore templates:',
304-
options: [
305-
'node',
306-
'visualstudiocode',
307-
'windows',
308-
'macos',
309-
'linux',
310-
'jetbrain',
311-
],
305+
options: ['node', 'visualstudiocode', 'windows', 'macos', 'linux', 'jetbrain'],
312306
initialValue: ['node', 'visualstudiocode'],
313307
}),
314308
},
@@ -348,4 +342,4 @@ export default [
348342
p.log.success('Dependencies installed successfully.')
349343
}
350344
p.outro('Done!')
351-
}
345+
}

0 commit comments

Comments
 (0)