mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
feat(infra): route package (#10353)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./path": "./src/path.ts",
|
||||
"./workspace": "./src/workspace.ts",
|
||||
"./process": "./src/process.ts",
|
||||
@@ -16,6 +17,7 @@
|
||||
"@types/node": "^22.0.0",
|
||||
"chalk": "^5.3.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"prettier": "^3.3.3",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
17
tools/utils/src/format.ts
Normal file
17
tools/utils/src/format.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
import { once } from 'lodash-es';
|
||||
import { type BuiltInParserName, format } from 'prettier';
|
||||
|
||||
import { ProjectRoot } from './path';
|
||||
|
||||
const readConfig = once(() => {
|
||||
const path = ProjectRoot.join('.prettierrc').value;
|
||||
const config = JSON.parse(readFileSync(path, 'utf-8'));
|
||||
return config;
|
||||
});
|
||||
|
||||
export function prettier(content: string, parser: BuiltInParserName) {
|
||||
const config = readConfig();
|
||||
return format(content, { parser, ...config });
|
||||
}
|
||||
2
tools/utils/src/index.ts
Normal file
2
tools/utils/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './format';
|
||||
export * from './path';
|
||||
@@ -1165,6 +1165,11 @@ export const PackageList = [
|
||||
name: '@affine/native',
|
||||
workspaceDependencies: [],
|
||||
},
|
||||
{
|
||||
location: 'packages/frontend/routes',
|
||||
name: '@affine/routes',
|
||||
workspaceDependencies: ['tools/cli', 'tools/utils'],
|
||||
},
|
||||
{
|
||||
location: 'packages/frontend/templates',
|
||||
name: '@affine/templates',
|
||||
@@ -1349,6 +1354,7 @@ export type PackageName =
|
||||
| '@affine/i18n'
|
||||
| '@affine/media-capture-playground'
|
||||
| '@affine/native'
|
||||
| '@affine/routes'
|
||||
| '@affine/templates'
|
||||
| '@affine/track'
|
||||
| '@affine-test/affine-cloud'
|
||||
|
||||
Reference in New Issue
Block a user