2022-12-31 15:21:57 +00:00
|
|
|
import fs from 'fs';
|
|
|
|
|
import path from 'path';
|
2022-01-03 08:50:03 +00:00
|
|
|
|
2022-12-31 15:29:45 +00:00
|
|
|
export function joinPackagePath(...args: string[]) {
|
2022-12-31 15:21:57 +00:00
|
|
|
const pathList = Array.from(args);
|
2022-12-31 15:29:45 +00:00
|
|
|
const baseDir = path.join(joinProjectPath(), 'packages');
|
2022-01-03 08:50:03 +00:00
|
|
|
return path.join(baseDir, ...pathList);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-31 15:29:45 +00:00
|
|
|
export function joinProjectPath(...args: string[]) {
|
2022-12-31 15:21:57 +00:00
|
|
|
const pathList = Array.from(args);
|
2022-01-03 08:50:03 +00:00
|
|
|
const baseDir = path.join(__dirname, '..', '..');
|
|
|
|
|
return path.join(baseDir, ...pathList);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-31 15:21:57 +00:00
|
|
|
export function getTsConfig() {
|
2023-02-12 03:39:24 +00:00
|
|
|
const configPath = joinProjectPath('tsconfig.web.json');
|
2022-01-03 14:51:25 +00:00
|
|
|
const configStr = fs.readFileSync(configPath, { encoding: 'utf8' });
|
|
|
|
|
const config = JSON.parse(configStr);
|
|
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-03 08:50:03 +00:00
|
|
|
module.exports = {
|
2022-12-31 15:29:45 +00:00
|
|
|
joinProjectPath,
|
|
|
|
|
joinPackagePath,
|
2022-12-31 15:21:57 +00:00
|
|
|
getTsConfig
|
|
|
|
|
};
|