chore: bump prettier v3 and format all code (#12111)
* chore: bump prettier v3 and format all code * chore: mjs config * chore: revert * chore: revert * chore: update lock
This commit is contained in:
@@ -27,27 +27,27 @@ program
|
||||
.description('Run unit tests through jest')
|
||||
.option(
|
||||
'--watch',
|
||||
'Watch files for changes and rerun tests related to changed files'
|
||||
'Watch files for changes and rerun tests related to changed files',
|
||||
)
|
||||
.option(
|
||||
'--clearCache',
|
||||
'Clears the configured Jest cache directory and then exits'
|
||||
'Clears the configured Jest cache directory and then exits',
|
||||
)
|
||||
.option(
|
||||
'--changedSince <changedSince>',
|
||||
'Runs tests related to the changes since the provided branch or commit hash'
|
||||
'Runs tests related to the changes since the provided branch or commit hash',
|
||||
)
|
||||
.option(
|
||||
'--logHeapUsage',
|
||||
'Logs the heap usage after every test. Useful to debug memory leaks'
|
||||
'Logs the heap usage after every test. Useful to debug memory leaks',
|
||||
)
|
||||
.option(
|
||||
'--runInBand',
|
||||
'Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests'
|
||||
'Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests',
|
||||
)
|
||||
.option(
|
||||
'--updateSnapshot',
|
||||
'Re-record every snapshot that fails during this test run'
|
||||
'Re-record every snapshot that fails during this test run',
|
||||
)
|
||||
.option('--debug', 'Print debugging info about your Jest config')
|
||||
.action(async (options) => {
|
||||
|
||||
@@ -66,7 +66,7 @@ async function preCompileDir(dir: string) {
|
||||
return compileSfc(filePath);
|
||||
}
|
||||
return Promise.resolve();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ async function compileDir(dir: string, format: Format) {
|
||||
return isDir(filePath)
|
||||
? compileDir(filePath, format)
|
||||
: compileFile(filePath, format);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export async function changelog(): Promise<void> {
|
||||
headerPartial,
|
||||
commitPartial,
|
||||
transform,
|
||||
}
|
||||
},
|
||||
)
|
||||
.pipe(createWriteStream(DIST_FILE))
|
||||
.on('close', () => {
|
||||
|
||||
@@ -11,7 +11,7 @@ type RunCommandMessages = {
|
||||
function runCommand(
|
||||
cmd: string,
|
||||
options: string[],
|
||||
messages: RunCommandMessages
|
||||
messages: RunCommandMessages,
|
||||
) {
|
||||
const spinner = createSpinner(messages.start).start();
|
||||
|
||||
@@ -40,7 +40,7 @@ function eslint() {
|
||||
start: 'Running eslint...',
|
||||
succeed: 'ESLint Passed.',
|
||||
failed: 'ESLint failed!',
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,6 @@ const IMPORT_STYLE_RE = /import\s+?(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)/g;
|
||||
// "import 'a.less';" => "import 'a.css';"
|
||||
export function replaceCSSImportExt(code: string) {
|
||||
return code.replace(IMPORT_STYLE_RE, (str) =>
|
||||
str.replace(`.${CSS_LANG}`, '.css')
|
||||
str.replace(`.${CSS_LANG}`, '.css'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export function getComponents() {
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export function camelize(str: string): string {
|
||||
export function pascalize(str: string): string {
|
||||
return camelize(str).replace(
|
||||
pascalizeRE,
|
||||
(_, c1, c2) => c1.toUpperCase() + c2
|
||||
(_, c1, c2) => c1.toUpperCase() + c2,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ export function smartOutputFile(filePath: string, content: string) {
|
||||
|
||||
export async function mergeCustomViteConfig(
|
||||
config: InlineConfig,
|
||||
mode: 'production' | 'development'
|
||||
mode: 'production' | 'development',
|
||||
): Promise<InlineConfig> {
|
||||
const vantConfig = getVantConfig();
|
||||
const configureVite = vantConfig.build?.configureVite;
|
||||
@@ -127,7 +127,7 @@ export async function mergeCustomViteConfig(
|
||||
command: mode === 'development' ? 'serve' : 'build',
|
||||
},
|
||||
undefined,
|
||||
process.cwd()
|
||||
process.cwd(),
|
||||
);
|
||||
|
||||
if (configureVite) {
|
||||
|
||||
@@ -38,9 +38,9 @@ export async function compileBundles() {
|
||||
build(
|
||||
await mergeCustomViteConfig(
|
||||
getViteConfigForPackage(config),
|
||||
'production'
|
||||
)
|
||||
)
|
||||
)
|
||||
'production',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const { readFileSync, removeSync, outputFileSync } = fse;
|
||||
|
||||
export async function compileScript(
|
||||
filePath: string,
|
||||
format: Format
|
||||
format: Format,
|
||||
): Promise<void> {
|
||||
if (filePath.includes('.d.ts')) {
|
||||
return;
|
||||
|
||||
@@ -127,7 +127,7 @@ export async function compileSfc(filePath: string): Promise<any> {
|
||||
}
|
||||
|
||||
outputFile(scriptFilePath, script).then(resolve);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ export async function compileSfc(filePath: string): Promise<any> {
|
||||
// }
|
||||
|
||||
return outputFile(cssFilePath, styleSource);
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
return Promise.all(tasks);
|
||||
|
||||
@@ -31,13 +31,13 @@ export async function compileSite(production = false) {
|
||||
if (production) {
|
||||
const config = await mergeCustomViteConfig(
|
||||
getViteConfigForSiteProd(),
|
||||
'production'
|
||||
'production',
|
||||
);
|
||||
await build(config);
|
||||
} else {
|
||||
const config = await mergeCustomViteConfig(
|
||||
getViteConfigForSiteDev(),
|
||||
'development'
|
||||
'development',
|
||||
);
|
||||
const server = await createServer(config);
|
||||
await server.listen(config.server?.port);
|
||||
|
||||
@@ -81,7 +81,7 @@ function genEntry(params: {
|
||||
}
|
||||
|
||||
export function genComponentStyle(
|
||||
options: { cache: boolean } = { cache: true }
|
||||
options: { cache: boolean } = { cache: true },
|
||||
) {
|
||||
if (!options.cache) {
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
@@ -20,7 +20,7 @@ function getPathByName(name: string, pathResolver?: PathResolver) {
|
||||
function genImports(
|
||||
names: string[],
|
||||
pathResolver?: PathResolver,
|
||||
namedExport?: boolean
|
||||
namedExport?: boolean,
|
||||
): string {
|
||||
return names
|
||||
.map((name) => {
|
||||
@@ -36,7 +36,7 @@ function genImports(
|
||||
function genExports(
|
||||
names: string[],
|
||||
pathResolver?: PathResolver,
|
||||
namedExport?: boolean
|
||||
namedExport?: boolean,
|
||||
): string {
|
||||
if (namedExport) {
|
||||
const exports = names
|
||||
|
||||
@@ -38,7 +38,7 @@ function genConfig(demos: DemoItem[]) {
|
||||
function demoFilter(nav: any[]) {
|
||||
return nav.filter((group) => {
|
||||
group.items = group.items.filter((item: any) =>
|
||||
demoNames.includes(item.path)
|
||||
demoNames.includes(item.path),
|
||||
);
|
||||
return group.items.length;
|
||||
});
|
||||
|
||||
@@ -106,13 +106,13 @@ export async function genStyleDepsMap() {
|
||||
|
||||
Object.keys(map).forEach((key) => {
|
||||
map[key] = map[key].sort(
|
||||
(a, b) => sequence.indexOf(a) - sequence.indexOf(b)
|
||||
(a, b) => sequence.indexOf(a) - sequence.indexOf(b),
|
||||
);
|
||||
});
|
||||
|
||||
smartOutputFile(
|
||||
STYLE_DEPS_JSON_FILE,
|
||||
JSON.stringify({ map, sequence }, null, 2)
|
||||
JSON.stringify({ map, sequence }, null, 2),
|
||||
);
|
||||
|
||||
resolve();
|
||||
|
||||
@@ -105,7 +105,7 @@ export function getDeps(filePath: string) {
|
||||
export function replaceScriptImportExt(
|
||||
code: string,
|
||||
filePath: string,
|
||||
ext: string
|
||||
ext: string,
|
||||
) {
|
||||
const imports = [...matchImports(code), ...matchExportFroms(code)];
|
||||
|
||||
@@ -132,7 +132,6 @@ export function replaceScriptImportExt(
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const pathInfo = getPathByImport(line, filePath);
|
||||
|
||||
if (pathInfo) {
|
||||
@@ -141,7 +140,7 @@ export function replaceScriptImportExt(
|
||||
if (pathInfo.isIndex) {
|
||||
const newLine = line.replace(
|
||||
relativePath,
|
||||
`${relativePath}/index${ext}`
|
||||
`${relativePath}/index${ext}`,
|
||||
);
|
||||
|
||||
updateImport(index, newLine);
|
||||
|
||||
@@ -77,7 +77,7 @@ function findTag(vueTags: VueTag[], name: string) {
|
||||
export function formatter(
|
||||
vueTags: VueTag[],
|
||||
articles: Articles,
|
||||
tagPrefix = ''
|
||||
tagPrefix = '',
|
||||
) {
|
||||
if (!articles.length) {
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function parseAndWrite(options: Options) {
|
||||
const webTypes = genWebTypes(vueTags, options);
|
||||
fse.outputFileSync(
|
||||
join(options.outputDir, 'web-types.json'),
|
||||
JSON.stringify(webTypes)
|
||||
JSON.stringify(webTypes),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
export function toKebabCase(input: string): string {
|
||||
return input.replace(
|
||||
/[A-Z]/g,
|
||||
(val, index) => (index === 0 ? '' : '-') + val.toLowerCase()
|
||||
(val, index) => (index === 0 ? '' : '-') + val.toLowerCase(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user