mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-22 22:16:18 +08:00
fix: type check
fix: ci fix: ci fix: ci
This commit is contained in:
@@ -16,9 +16,6 @@
|
||||
},
|
||||
"main": "./dist/index.mjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"imports": {
|
||||
"#*": "./src/*"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"default": "./dist/index.mjs"
|
||||
|
71
scripts/vsh/src/aggregate-changelog/index.ts
Normal file
71
scripts/vsh/src/aggregate-changelog/index.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import type { CAC } from 'cac';
|
||||
|
||||
import { extname } from 'node:path';
|
||||
|
||||
import { getStagedFiles } from '@vben/node-utils';
|
||||
|
||||
import { circularDepsDetect, printCircles } from 'circular-dependency-scanner';
|
||||
|
||||
const IGNORE_DIR = [
|
||||
'dist',
|
||||
'.turbo',
|
||||
'output',
|
||||
'.cache',
|
||||
'scripts',
|
||||
'internal',
|
||||
// 'packages/@vben-core/shared/shadcn-ui/',
|
||||
'packages/@vben-core/uikit/menu-ui/src/',
|
||||
].join(',');
|
||||
|
||||
const IGNORE = [`**/{${IGNORE_DIR}}/**`];
|
||||
|
||||
interface CommandOptions {
|
||||
staged: boolean;
|
||||
verbose: boolean;
|
||||
}
|
||||
|
||||
async function checkCircular({ staged, verbose }: CommandOptions) {
|
||||
const results = await circularDepsDetect({
|
||||
absolute: staged,
|
||||
cwd: process.cwd(),
|
||||
ignore: IGNORE,
|
||||
});
|
||||
|
||||
if (staged) {
|
||||
let files = await getStagedFiles();
|
||||
|
||||
files = files.filter((file) =>
|
||||
['.cjs', '.js', '.jsx', '.mjs', '.ts', '.tsx', '.vue'].includes(
|
||||
extname(file),
|
||||
),
|
||||
);
|
||||
const circularFiles: string[][] = [];
|
||||
|
||||
for (const file of files) {
|
||||
for (const result of results) {
|
||||
const resultFiles = result.flat();
|
||||
if (resultFiles.includes(file)) {
|
||||
circularFiles.push(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
verbose && printCircles(circularFiles);
|
||||
} else {
|
||||
verbose && printCircles(results);
|
||||
}
|
||||
}
|
||||
|
||||
function defineCheckCircularCommand(cac: CAC) {
|
||||
cac
|
||||
.command('check-circular')
|
||||
.option(
|
||||
'--staged',
|
||||
'Whether it is the staged commit mode, in which mode, if there is a circular dependency, an alarm will be given.',
|
||||
)
|
||||
.usage(`Analysis of project circular dependencies.`)
|
||||
.action(async ({ staged }) => {
|
||||
await checkCircular({ staged, verbose: true });
|
||||
});
|
||||
}
|
||||
|
||||
export { defineCheckCircularCommand };
|
Reference in New Issue
Block a user