Skip to content

Commit 01622b5

Browse files
committed
fix(vue-wizard): resolve e2e test failures
1 parent 78d110c commit 01622b5

34 files changed

Lines changed: 944 additions & 145 deletions

dist/create-wizard.js

Lines changed: 135 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -11084,45 +11084,25 @@ async function main4(deps) {
1108411084
answers.projectName = projectNameFromArg;
1108511085
M2.info(`Using project name from argument: ${projectNameFromArg}`);
1108611086
}
11087-
const group = await Ce(
11088-
{
11089-
...!projectNameFromArg && {
11090-
projectName: () => he({
11091-
message: "Project name:",
11092-
placeholder: "my-awesome-project",
11093-
validate: (value) => {
11094-
if (!value) return "Please enter a project name.";
11095-
}
11096-
})
11097-
},
11098-
template: async () => ve({
11099-
message: "Select a project template:",
11100-
options: (await getTemplates()).map((t) => ({ value: t, label: t }))
11101-
})
11102-
},
11103-
{
11104-
onCancel: () => {
11105-
xe("Operation cancelled.");
11106-
process.exit(0);
11107-
}
11108-
}
11109-
);
11110-
Object.assign(answers, group);
11111-
if (answers.template === "discord-bot") {
11112-
const discordGroup = await Ce(
11087+
const answersArg = args.find((arg) => arg.startsWith("--answers="));
11088+
if (answersArg) {
11089+
const answersJSON = answersArg.split("=")[1];
11090+
Object.assign(answers, JSON.parse(answersJSON));
11091+
} else {
11092+
const group = await Ce(
1111311093
{
11114-
discordFeatures: () => fe({
11115-
message: "Select Discord bot features:",
11116-
options: [
11117-
{ value: "welcome", label: "Include welcome messages for new users" },
11118-
{ value: "logging", label: "Include message logging" },
11119-
{ value: "moderation", label: "Include moderation commands (kick/ban)" }
11120-
],
11121-
required: false
11122-
}),
11123-
discordRPC: () => ye({
11124-
message: "Include Discord RPC (activity status)?",
11125-
initialValue: false
11094+
...!projectNameFromArg && {
11095+
projectName: () => he({
11096+
message: "Project name:",
11097+
placeholder: "my-awesome-project",
11098+
validate: (value) => {
11099+
if (!value) return "Please enter a project name.";
11100+
}
11101+
})
11102+
},
11103+
template: async () => ve({
11104+
message: "Select a project template:",
11105+
options: (await getTemplates()).map((t) => ({ value: t, label: t }))
1112611106
})
1112711107
},
1112811108
{
@@ -11132,29 +11112,127 @@ async function main4(deps) {
1113211112
}
1113311113
}
1113411114
);
11135-
Object.assign(answers, discordGroup);
11136-
}
11137-
if (answers.template === "vue-wizard") {
11138-
const vueWizardGroup = await Ce(
11115+
Object.assign(answers, group);
11116+
if (answers.template === "discord-bot") {
11117+
const discordGroup = await Ce(
11118+
{
11119+
discordFeatures: () => fe({
11120+
message: "Select Discord bot features:",
11121+
options: [
11122+
{ value: "welcome", label: "Include welcome messages for new users" },
11123+
{ value: "logging", label: "Include message logging" },
11124+
{ value: "moderation", label: "Include moderation commands (kick/ban)" }
11125+
],
11126+
required: false
11127+
}),
11128+
discordRPC: () => ye({
11129+
message: "Include Discord RPC (activity status)?",
11130+
initialValue: false
11131+
})
11132+
},
11133+
{
11134+
onCancel: () => {
11135+
xe("Operation cancelled.");
11136+
process.exit(0);
11137+
}
11138+
}
11139+
);
11140+
Object.assign(answers, discordGroup);
11141+
}
11142+
if (answers.template === "vue-wizard") {
11143+
const vueWizardGroup = await Ce(
11144+
{
11145+
isPublic: () => ye({
11146+
message: "Make the repository public?",
11147+
initialValue: true
11148+
}),
11149+
addLicense: () => ye({
11150+
message: "Add a LICENSE file?",
11151+
initialValue: true
11152+
}),
11153+
addFunding: () => ye({
11154+
message: "Add a FUNDING.yml file?",
11155+
initialValue: false
11156+
}),
11157+
addDocs: () => ye({
11158+
message: "Set up a docs/ directory?",
11159+
initialValue: false
11160+
}),
11161+
useGhPages: () => ye({
11162+
message: "Set up a GitHub Pages deployment workflow?",
11163+
initialValue: false
11164+
})
11165+
},
11166+
{
11167+
onCancel: () => {
11168+
xe("Operation cancelled.");
11169+
process.exit(0);
11170+
}
11171+
}
11172+
);
11173+
Object.assign(answers, vueWizardGroup);
11174+
}
11175+
const customizationGroup = await Ce(
1113911176
{
11140-
isPublic: () => ye({
11141-
message: "Make the repository public?",
11177+
...!answers.template.startsWith("vue-wizard") && {
11178+
dependencies: () => fe({
11179+
message: "Which packages should be installed?",
11180+
options: [
11181+
{ value: { name: "express", version: "^4.18.2" }, label: "express" },
11182+
{ value: { name: "discord.js", version: "^14.14.1" }, label: "discord.js" },
11183+
{ value: { name: "axios", version: "^1.6.2" }, label: "axios" },
11184+
{ value: { name: "eslint", version: "^8.56.0" }, label: "eslint" },
11185+
{ value: { name: "dotenv", version: "^16.3.1" }, label: "dotenv" }
11186+
],
11187+
required: false
11188+
})
11189+
},
11190+
initGit: () => ye({
11191+
message: "Initialize a Git repository?",
1114211192
initialValue: true
1114311193
}),
11144-
addLicense: () => ye({
11145-
message: "Add a LICENSE file?",
11146-
initialValue: true
11194+
includeTestFramework: () => ye({
11195+
message: "Include a testing framework?",
11196+
initialValue: false
11197+
}),
11198+
testFramework: ({ results }) => {
11199+
if (results.includeTestFramework) {
11200+
return ve({
11201+
message: "Which testing framework?",
11202+
options: [
11203+
{ value: "Jest", label: "Jest" },
11204+
{ value: "Vitest", label: "Vitest" },
11205+
{ value: "Mocha/Chai", label: "Mocha/Chai" }
11206+
]
11207+
});
11208+
}
11209+
},
11210+
includeTypeScript: () => ye({
11211+
message: "Include TypeScript?",
11212+
initialValue: false
1114711213
}),
11148-
addFunding: () => ye({
11149-
message: "Add a FUNDING.yml file?",
11214+
includeEslint: () => ye({
11215+
message: "Include ESLint for linting?",
1115011216
initialValue: false
1115111217
}),
11152-
addDocs: () => ye({
11153-
message: "Set up a docs/ directory?",
11218+
includePrettier: () => ye({
11219+
message: "Include Prettier for code formatting?",
1115411220
initialValue: false
1115511221
}),
11156-
useGhPages: () => ye({
11157-
message: "Set up a GitHub Pages deployment workflow?",
11222+
includeDocker: () => ye({
11223+
message: "Include Docker support?",
11224+
initialValue: false
11225+
}),
11226+
includeGithubActions: () => ye({
11227+
message: "Include GitHub Actions workflow?",
11228+
initialValue: false
11229+
}),
11230+
includeGitlabCi: () => ye({
11231+
message: "Include GitLab CI/CD pipeline?",
11232+
initialValue: false
11233+
}),
11234+
includeDebugConfig: () => ye({
11235+
message: "Include VS Code debug configuration?",
1115811236
initialValue: false
1115911237
})
1116011238
},
@@ -11165,80 +11243,8 @@ async function main4(deps) {
1116511243
}
1116611244
}
1116711245
);
11168-
Object.assign(answers, vueWizardGroup);
11246+
Object.assign(answers, customizationGroup);
1116911247
}
11170-
const customizationGroup = await Ce(
11171-
{
11172-
...!answers.template.startsWith("vue-wizard") && {
11173-
dependencies: () => fe({
11174-
message: "Which packages should be installed?",
11175-
options: [
11176-
{ value: { name: "express", version: "^4.18.2" }, label: "express" },
11177-
{ value: { name: "discord.js", version: "^14.14.1" }, label: "discord.js" },
11178-
{ value: { name: "axios", version: "^1.6.2" }, label: "axios" },
11179-
{ value: { name: "eslint", version: "^8.56.0" }, label: "eslint" },
11180-
{ value: { name: "dotenv", version: "^16.3.1" }, label: "dotenv" }
11181-
],
11182-
required: false
11183-
})
11184-
},
11185-
initGit: () => ye({
11186-
message: "Initialize a Git repository?",
11187-
initialValue: true
11188-
}),
11189-
includeTestFramework: () => ye({
11190-
message: "Include a testing framework?",
11191-
initialValue: false
11192-
}),
11193-
testFramework: ({ results }) => {
11194-
if (results.includeTestFramework) {
11195-
return ve({
11196-
message: "Which testing framework?",
11197-
options: [
11198-
{ value: "Jest", label: "Jest" },
11199-
{ value: "Vitest", label: "Vitest" },
11200-
{ value: "Mocha/Chai", label: "Mocha/Chai" }
11201-
]
11202-
});
11203-
}
11204-
},
11205-
includeTypeScript: () => ye({
11206-
message: "Include TypeScript?",
11207-
initialValue: false
11208-
}),
11209-
includeEslint: () => ye({
11210-
message: "Include ESLint for linting?",
11211-
initialValue: false
11212-
}),
11213-
includePrettier: () => ye({
11214-
message: "Include Prettier for code formatting?",
11215-
initialValue: false
11216-
}),
11217-
includeDocker: () => ye({
11218-
message: "Include Docker support?",
11219-
initialValue: false
11220-
}),
11221-
includeGithubActions: () => ye({
11222-
message: "Include GitHub Actions workflow?",
11223-
initialValue: false
11224-
}),
11225-
includeGitlabCi: () => ye({
11226-
message: "Include GitLab CI/CD pipeline?",
11227-
initialValue: false
11228-
}),
11229-
includeDebugConfig: () => ye({
11230-
message: "Include VS Code debug configuration?",
11231-
initialValue: false
11232-
})
11233-
},
11234-
{
11235-
onCancel: () => {
11236-
xe("Operation cancelled.");
11237-
process.exit(0);
11238-
}
11239-
}
11240-
);
11241-
Object.assign(answers, customizationGroup);
1124211248
const projectDir = join4(process.cwd(), answers.projectName);
1124311249
if (fs2.existsSync(projectDir)) {
1124411250
xe("Error: Project folder already exists.");
@@ -11275,6 +11281,9 @@ async function main4(deps) {
1127511281
}
1127611282
const packageJsonPath = join4(projectDir, "package.json");
1127711283
let packageJson2 = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
11284+
if (!answers.dependencies) {
11285+
answers.dependencies = [];
11286+
}
1127811287
const userDependencies = answers.dependencies.reduce((acc, dep) => {
1127911288
acc[dep.name] = dep.version;
1128011289
return acc;

e2e-test-project/.eslintrc.cjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
root: true,
3+
env: { node: true },
4+
extends: [
5+
'plugin:vue/vue3-essential',
6+
'eslint:recommended',
7+
'@vue/eslint-config-typescript',
8+
],
9+
parserOptions: {
10+
ecmaVersion: 'latest',
11+
},
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# @format
2+
3+
# These are supported funding model platforms
4+
5+
github: [your-github-username]
6+
patreon: # Replace with a single Patreon username
7+
open_collective: # Replace with a single Open Collective username
8+
ko_fi: # Replace with a single Ko-fi username
9+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
10+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
11+
liberapay: # Replace with a single Liberapay username
12+
issuehunt: # Replace with a single IssueHunt username
13+
otechie: # Replace with a single Otechie username
14+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Use Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run tests
26+
run: npm test
27+
28+
- name: Lint code
29+
run: npm run lint
30+
31+
- name: Type check
32+
run: npm run typecheck
33+
34+
- name: AI Review (Placeholder)
35+
run: echo "This is a placeholder for an AI code review. Replace with your AI review tool."
36+
37+
- name: Build project
38+
run: npm run build
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# @format
2+
3+
name: Deploy to GitHub Pages
4+
5+
on:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
environment:
17+
name: github-pages
18+
url: ${{ steps.deployment.outputs.page_url }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: 'npm'
25+
- run: npm ci
26+
- run: npm run build
27+
- uses: actions/configure-pages@v4
28+
- uses: actions/upload-pages-artifact@v3
29+
with:
30+
path: 'dist'
31+
- name: Deploy to GitHub Pages
32+
id: deployment
33+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)