2023-09-03 02:59:33 +00:00
|
|
|
import { Package } from '@lerna/package';
|
2023-11-01 14:32:34 +00:00
|
|
|
import path from 'path';
|
2023-09-03 02:59:33 +00:00
|
|
|
|
|
|
|
export const globExcludeFiles = [
|
|
|
|
'!src/**/__tests__',
|
|
|
|
'!src/**/__test__',
|
2023-12-13 06:14:33 +00:00
|
|
|
'!src/**/__e2e__',
|
2023-09-03 02:59:33 +00:00
|
|
|
'!src/**/demos',
|
|
|
|
'!src/**/fixtures',
|
|
|
|
'!src/**/*.mdx',
|
|
|
|
'!src/**/*.md',
|
|
|
|
'!src/**/*.+(test|e2e|spec).+(js|jsx|ts|tsx)',
|
|
|
|
];
|
|
|
|
export const EsbuildSupportExts = [
|
|
|
|
'.ts',
|
|
|
|
'.tsx',
|
|
|
|
'.js',
|
|
|
|
'.jsx',
|
|
|
|
'.json',
|
|
|
|
'.css',
|
|
|
|
'.less',
|
|
|
|
'.sass',
|
|
|
|
'.scss',
|
|
|
|
'.styl',
|
|
|
|
'.txt',
|
|
|
|
'.data',
|
|
|
|
];
|
|
|
|
export const ROOT_PATH = path.join(__dirname, '../../../../');
|
2024-03-26 23:45:29 +00:00
|
|
|
export const NODE_MODULES = path.join(ROOT_PATH, 'node_modules');
|
2023-09-03 02:59:33 +00:00
|
|
|
export const PACKAGES_PATH = path.join(ROOT_PATH, 'packages');
|
2023-11-02 02:25:21 +00:00
|
|
|
export const PLUGINS_DIR = ['plugins', 'samples', 'pro-plugins']
|
2023-11-01 14:32:34 +00:00
|
|
|
.concat((process.env.PLUGINS_DIRS || '').split(','))
|
|
|
|
.filter(Boolean)
|
|
|
|
.map((name) => path.join(PACKAGES_PATH, name));
|
2023-09-03 02:59:33 +00:00
|
|
|
export const PRESETS_DIR = path.join(PACKAGES_PATH, 'presets');
|
|
|
|
export const getPluginPackages = (packages: Package[]) =>
|
|
|
|
packages.filter((item) => PLUGINS_DIR.some((pluginDir) => item.location.startsWith(pluginDir)));
|
|
|
|
export const getPresetsPackages = (packages: Package[]) =>
|
|
|
|
packages.filter((item) => item.location.startsWith(PRESETS_DIR));
|
|
|
|
export const CORE_APP = path.join(PACKAGES_PATH, 'core/app');
|
|
|
|
export const CORE_CLIENT = path.join(PACKAGES_PATH, 'core/client');
|
2024-03-28 03:08:08 +00:00
|
|
|
export const ESM_PACKAGES = ['@nocobase/test'];
|
2023-09-03 02:59:33 +00:00
|
|
|
export const CJS_EXCLUDE_PACKAGES = [
|
|
|
|
path.join(PACKAGES_PATH, 'core/build'),
|
|
|
|
path.join(PACKAGES_PATH, 'core/cli'),
|
|
|
|
CORE_CLIENT,
|
|
|
|
];
|
|
|
|
export const getCjsPackages = (packages: Package[]) =>
|
|
|
|
packages
|
|
|
|
.filter((item) => !PLUGINS_DIR.some((dir) => item.location.startsWith(dir)))
|
|
|
|
.filter((item) => !item.location.startsWith(PRESETS_DIR))
|
|
|
|
.filter((item) => !CJS_EXCLUDE_PACKAGES.includes(item.location));
|
2023-09-12 14:39:23 +00:00
|
|
|
|
|
|
|
// tar
|
|
|
|
export const tarIncludesFiles = ['package.json', 'README.md', 'LICENSE', 'dist', '!node_modules', '!src'];
|
|
|
|
export const TAR_OUTPUT_DIR = process.env.TAR_PATH ? process.env.TAR_PATH : path.join(ROOT_PATH, 'storage', 'tar');
|