Skip to content

Commit 98886af

Browse files
committed
refactor(tests): standardize import quotes and improve test readability
test(tests): enhance DevCommand tests for better clarity and consistency test(tests): update ResolveStubsDir tests to use consistent quote style test(tests): refactor RouteList tests for improved readability and consistency test(tests): streamline CreateDatabaseClient tests with consistent formatting test(tests): refine CommandSurface integration tests for clarity and consistency fix(utils): clean up findUpConfig and exists functions for better readability chore: add ESLint configuration for consistent code style across the project chore: introduce ESLint configuration for express module chore: add ESLint configuration for h3 module
1 parent 169ce55 commit 98886af

File tree

92 files changed

+2428
-1905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2428
-1905
lines changed

.vscode/settings.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
22
"editor.formatOnSave": true,
3-
"editor.defaultFormatter": "oxc.oxc-vscode",
4-
"oxc.path.oxfmt": "node_modules/.bin/oxfmt",
5-
"oxc.fmt.configPath": ".oxfmtrc.json",
6-
"oxc.trace.server": "verbose",
7-
"oxc.enable": true,
83
"[typescript]": {
94
"editor.defaultFormatter": "vscode.typescript-language-features"
105
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ npm run dev
4040

4141
## Project Structure
4242

43-
```
43+
```txt
4444
src/
4545
├── app/
4646
│ ├── http/
@@ -101,7 +101,7 @@ Arkstack uses structured error classes and centralized error middleware.
101101
Example:
102102

103103
```ts
104-
throw new RequestError("Profile not found", 404);
104+
throw new RequestError('Profile not found', 404);
105105
```
106106

107107
All errors return consistent JSON:
@@ -122,8 +122,8 @@ Standardized API responses:
122122

123123
```ts
124124
return new UserResource(req, res, user).json().status(200).additional({
125-
status: "success",
126-
message: "User retrieved",
125+
status: 'success',
126+
message: 'User retrieved',
127127
});
128128
```
129129

Lines changed: 88 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { Command } from "@h3ravel/musket";
2-
import { altLogo } from "src/logo";
3-
import inquirer from "inquirer";
4-
import { AbortPromptError, ExitPromptError } from "@inquirer/core";
5-
import { basename, join } from "node:path";
6-
import { templates } from "src/templates";
7-
import { Str } from "@h3ravel/support";
8-
import Actions from "src/actions";
9-
import ora from "ora";
10-
import { Logger } from "@h3ravel/shared";
11-
import { cleanDirectoryExcept, hoistDirectoryContents } from "src/utils";
1+
import { Command } from '@h3ravel/musket'
2+
import { altLogo } from 'src/logo'
3+
import inquirer from 'inquirer'
4+
import { AbortPromptError, ExitPromptError } from '@inquirer/core'
5+
import { basename, join } from 'node:path'
6+
import { templates } from 'src/templates'
7+
import { Str } from '@h3ravel/support'
8+
import Actions from 'src/actions'
9+
import ora from 'ora'
10+
import { Logger } from '@h3ravel/shared'
11+
import { cleanDirectoryExcept, hoistDirectoryContents } from 'src/utils'
1212

1313
export class CreateArkstackCommand extends Command {
1414
protected signature = `create-arkstack
@@ -20,163 +20,167 @@ export class CreateArkstackCommand extends Command {
2020
{--k|kit?: Starter template kit.}
2121
{--p|pre: Download prerelease version if available.}
2222
{--o|overwrite: Overwrite the installation directory if it is not empty.}
23-
`;
24-
protected description = "Display a personalized greeting.";
23+
`
24+
protected description = 'Display a personalized greeting.'
2525

2626
async handle () {
27-
const options = this.options();
28-
const pathName = this.argument("location");
27+
const options = this.options()
28+
const pathName = this.argument('location')
2929
// const defaultName = pathName ? Str.of(pathName).afterLast("/") : undefined;
3030

31-
console.log(altLogo, `font-family: monospace`);
31+
console.log(altLogo, 'font-family: monospace')
3232

3333
let { template } = await inquirer
3434
.prompt([
3535
{
36-
type: "list",
37-
name: "template",
38-
message: "Choose starter template kit:",
36+
type: 'list',
37+
name: 'template',
38+
message: 'Choose starter template kit:',
3939
choices: <never>templates.map((e) => ({
4040
name: e.name,
4141
value: e.alias,
42-
disabled: !e.source ? "(Unavailable at this time)" : false,
42+
disabled: !e.source ? '(Unavailable at this time)' : false,
4343
})),
44-
default: "full",
44+
default: 'full',
4545
when: () => !options.kit,
4646
},
4747
])
4848
.catch((err) => {
4949
if (err instanceof AbortPromptError || err instanceof ExitPromptError) {
50-
this.info("Thanks for trying out our starter kit.");
51-
process.exit(0);
50+
this.info('Thanks for trying out our starter kit.')
51+
process.exit(0)
5252
}
53-
return err;
54-
});
53+
54+
return err
55+
})
5556

5657
let { appName, description } = await inquirer
5758
.prompt([
5859
{
59-
type: "input",
60-
name: "appName",
61-
message: "What is the name of your project:",
60+
type: 'input',
61+
name: 'appName',
62+
message: 'What is the name of your project:',
6263
default: `arkstack-${template}`,
6364
// default: defaultName ?? `arkstack-${template}`,
6465
when: () => !options.name,
6566
},
6667
{
67-
type: "input",
68-
name: "description",
69-
message: "Project Description:",
68+
type: 'input',
69+
name: 'description',
70+
message: 'Project Description:',
7071
default: `Simple ${Str.of(template).ucfirst()}.js project created with Arkstack.`,
7172
when: () => !options.desc,
7273
},
7374
])
7475
.catch((err) => {
7576
if (err instanceof AbortPromptError || err instanceof ExitPromptError) {
76-
this.info("Thanks for trying out our starter kit.");
77-
process.exit(0);
77+
this.info('Thanks for trying out our starter kit.')
78+
process.exit(0)
7879
}
79-
return err;
80-
});
80+
81+
return err
82+
})
8183

8284
let { location } = await inquirer
8385
.prompt([
8486
{
85-
type: "input",
86-
name: "location",
87-
message: "Installation location relative to the current dir:",
88-
default: Str.slugify(options.name ?? appName ?? basename(process.cwd()), "-"),
87+
type: 'input',
88+
name: 'location',
89+
message: 'Installation location relative to the current dir:',
90+
default: Str.slugify(options.name ?? appName ?? basename(process.cwd()), '-'),
8991
when: () => !pathName,
9092
},
9193
])
9294
.catch((err) => {
9395
if (err instanceof AbortPromptError || err instanceof ExitPromptError) {
94-
this.info("Thanks for trying out our starter kit.");
95-
process.exit(0);
96+
this.info('Thanks for trying out our starter kit.')
97+
process.exit(0)
9698
}
97-
return err;
98-
});
99+
100+
return err
101+
})
99102

100103
/**
101104
* Find selected template kit
102105
*/
103-
const kit = templates.find((e) => e.alias === template)!;
106+
const kit = templates.find((e) => e.alias === template)!
104107

105108
let { install, token, pre } = await inquirer
106109
.prompt([
107110
{
108-
type: "confirm",
109-
name: "pre",
110-
message: `An alpha version of the ${kit.name.replace(/\s*kit$/i, "").trim()} kit is available. Would you like to use it instead?`,
111+
type: 'confirm',
112+
name: 'pre',
113+
message: `An alpha version of the ${kit.name.replace(/\s*kit$/i, '').trim()} kit is available. Would you like to use it instead?`,
111114
default: false,
112115
when: () => kit.prereleaseSource && !options.pre,
113116
} as never,
114117
{
115-
type: "input",
116-
name: "token",
117-
message: "Authentication token:",
118+
type: 'input',
119+
name: 'token',
120+
message: 'Authentication token:',
118121
when: () => options.kit && !options.token,
119122
},
120123
{
121-
type: "confirm",
122-
name: "install",
123-
message: "Would you want to install node_modules right away:",
124+
type: 'confirm',
125+
name: 'install',
126+
message: 'Would you want to install node_modules right away:',
124127
default: true,
125128
when: () => !options.install,
126129
},
127130
])
128131
.catch((err) => {
129132
if (err instanceof AbortPromptError || err instanceof ExitPromptError) {
130-
this.info("Thanks for trying out our starter kit.");
131-
process.exit(0);
133+
this.info('Thanks for trying out our starter kit.')
134+
process.exit(0)
132135
}
133-
return err;
134-
});
135-
136-
pre = options.pre ?? pre;
137-
token = options.token ?? token;
138-
appName = options.name ?? appName;
139-
install = options.install ?? install;
140-
template = options.kit ?? template;
141-
location = pathName ?? location;
142-
description = options.description ?? description;
136+
137+
return err
138+
})
139+
140+
pre = options.pre ?? pre
141+
token = options.token ?? token
142+
appName = options.name ?? appName
143+
install = options.install ?? install
144+
template = options.kit ?? template
145+
location = pathName ?? location
146+
description = options.description ?? description
143147

144148
/**
145149
* Validate selected kit
146150
*/
147151
if (kit && !kit.source) {
148-
this.error(`ERROR: The ${kit.name} kit is not currently available`);
149-
process.exit(1);
152+
this.error(`ERROR: The ${kit.name} kit is not currently available`)
153+
process.exit(1)
150154
}
151155

152-
const source: string = pre && kit.prereleaseSource ? kit.prereleaseSource! : kit.source;
153-
const selectedAlias = (kit.baseAlias ?? kit.alias).replace(/-lean$/i, "") as "express" | "h3";
154-
const actions = new Actions(join(process.cwd(), location), appName, description);
155-
const spinner = ora(`Loading Template...`).start();
156+
const source: string = pre && kit.prereleaseSource ? kit.prereleaseSource! : kit.source
157+
const selectedAlias = (kit.baseAlias ?? kit.alias).replace(/-lean$/i, '') as 'express' | 'h3'
158+
const actions = new Actions(join(process.cwd(), location), appName, description)
159+
const spinner = ora('Loading Template...').start()
156160

157-
const result = await actions.download(source, install, token, options.overwrite);
161+
const result = await actions.download(source, install, token, options.overwrite)
158162

159163
if (result.dir && selectedAlias) {
160-
await cleanDirectoryExcept(result.dir, selectedAlias);
161-
await hoistDirectoryContents(result.dir, join(result.dir, selectedAlias));
164+
await cleanDirectoryExcept(result.dir, selectedAlias)
165+
await hoistDirectoryContents(result.dir, join(result.dir, selectedAlias))
162166
}
163167

164168
if (kit.lean) {
165169
spinner.info(Logger.parse([[
166-
"Applying lean profile...",
167-
"green",
168-
]], "", false)).start();
169-
await actions.makeLeanProfile(selectedAlias);
170+
'Applying lean profile...',
171+
'green',
172+
]], '', false)).start()
173+
await actions.makeLeanProfile(selectedAlias)
170174
}
171175

172-
spinner.info(Logger.parse([["Cleaning Up...", "green"]], "", false)).start();
173-
await actions.cleanup();
176+
spinner.info(Logger.parse([['Cleaning Up...', 'green']], '', false)).start()
177+
await actions.cleanup()
174178

175-
spinner.info(Logger.parse([["Initializing Project...", "green"]], "", false)).start();
176-
await actions.copyExampleEnv();
179+
spinner.info(Logger.parse([['Initializing Project...', 'green']], '', false)).start()
180+
await actions.copyExampleEnv()
177181

178-
spinner.succeed(Logger.parse([["Project initialization complete!", "green"]], "", false));
182+
spinner.succeed(Logger.parse([['Project initialization complete!', 'green']], '', false))
179183

180-
await actions.complete(install);
184+
await actions.complete(install)
181185
}
182186
}

0 commit comments

Comments
 (0)