mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 23:26:30 +08:00
chore: standardize tsconfig (#9568)
This commit is contained in:
@@ -49,11 +49,15 @@ export class Workspace {
|
||||
return this.packageJson.dependencies ?? {};
|
||||
}
|
||||
|
||||
constructor() {
|
||||
get isTsProject() {
|
||||
return this.join('tsconfig.json').exists();
|
||||
}
|
||||
|
||||
constructor(list: typeof PackageList = PackageList) {
|
||||
this.packageJson = readPackageJson(ProjectRoot);
|
||||
const packages = new Map<string, Package>();
|
||||
|
||||
for (const meta of PackageList) {
|
||||
for (const meta of list) {
|
||||
try {
|
||||
const pkg = new Package(meta.name as PackageName, meta);
|
||||
// @ts-expect-error internal api
|
||||
@@ -70,6 +74,7 @@ export class Workspace {
|
||||
} catch (e) {
|
||||
if (e instanceof CircularDependenciesError) {
|
||||
const inProcessPackages = Array.from(building);
|
||||
console.log(inProcessPackages, e.currentName);
|
||||
const circle = inProcessPackages
|
||||
.slice(inProcessPackages.indexOf(e.currentName))
|
||||
.concat(e.currentName);
|
||||
@@ -127,7 +132,7 @@ export class Workspace {
|
||||
}
|
||||
|
||||
if (building.has(dep.name)) {
|
||||
throw new CircularDependenciesError(pkg.name);
|
||||
throw new CircularDependenciesError(dep.name);
|
||||
}
|
||||
|
||||
if (!pkg.packageJson.private && dep.packageJson.private) {
|
||||
@@ -158,44 +163,6 @@ export class Workspace {
|
||||
return packageList.filter(p => p.location !== '.');
|
||||
});
|
||||
|
||||
genWorkspaceInfo() {
|
||||
const list = this.yarnList();
|
||||
|
||||
const names = list.map(p => p.name);
|
||||
|
||||
const content = [
|
||||
'// Auto generated content',
|
||||
'// DO NOT MODIFY THIS FILE MANUALLY',
|
||||
`export const PackageList = ${JSON.stringify(list, null, 2)}`,
|
||||
'',
|
||||
`export type PackageName = ${names.map(n => `'${n}'`).join(' | ')}`,
|
||||
];
|
||||
|
||||
return content.join('\n');
|
||||
}
|
||||
|
||||
genProjectTsConfig() {
|
||||
const content = [
|
||||
'// Auto generated content',
|
||||
'// DO NOT MODIFY THIS FILE MANUALLY',
|
||||
'{',
|
||||
' "compilerOptions": {',
|
||||
' "noEmit": true',
|
||||
' },',
|
||||
' "include": [],',
|
||||
' "references": [',
|
||||
this.packages
|
||||
.filter(p => p.isTsProject)
|
||||
.map(p => ` { "path": "${p.path.relativePath}" }`)
|
||||
.join(',\n'),
|
||||
' ]',
|
||||
'}',
|
||||
'',
|
||||
];
|
||||
|
||||
return content.join('\n');
|
||||
}
|
||||
|
||||
forEach(callback: (pkg: Package) => void) {
|
||||
this.packages.forEach(callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user