mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:26:21 +00:00
fix: tar bug (#3891)
This commit is contained in:
parent
85f33cedbe
commit
ea5565b571
@ -52,5 +52,5 @@ export const getCjsPackages = (packages: Package[]) =>
|
||||
.filter((item) => !CJS_EXCLUDE_PACKAGES.includes(item.location));
|
||||
|
||||
// tar
|
||||
export const tarIncludesFiles = ['package.json', 'README.md', 'LICENSE', 'dist', '!node_modules', '!src'];
|
||||
export const tarIncludesFiles = ['package.json', 'README.md', 'LICENSE', 'dist', '!node_modules'];
|
||||
export const TAR_OUTPUT_DIR = process.env.TAR_PATH ? process.env.TAR_PATH : path.join(ROOT_PATH, 'storage', 'tar');
|
||||
|
@ -12,13 +12,16 @@ export function tarPlugin(cwd: string, log: PkgLog) {
|
||||
const npmIgnore = path.join(cwd, '.npmignore');
|
||||
let files = pkg.files || [];
|
||||
if (fs.existsSync(npmIgnore)) {
|
||||
files = fs.readFileSync(npmIgnore, 'utf-8').split('\n').filter((item) => item.trim()).map(item => `!${item}`);
|
||||
files = fs.readFileSync(npmIgnore, 'utf-8')
|
||||
.split('\n')
|
||||
.filter((item) => item.trim())
|
||||
.map(item => item.startsWith('/') ? `.${item}` : item)
|
||||
.map(item => `!${item}`);
|
||||
files.push('**/*');
|
||||
}
|
||||
|
||||
// 必须包含的文件
|
||||
files.push(...tarIncludesFiles);
|
||||
|
||||
files = files.map((item: string) => item !== '**/*' && fs.existsSync(path.join(cwd, item.replace('!', ''))) && fs.statSync(path.join(cwd, item.replace('!', ''))).isDirectory() ? `${item}/**/*` : item);
|
||||
|
||||
const tarball = path.join(TAR_OUTPUT_DIR, `${pkg.name}-${pkg.version}.tgz`);
|
||||
|
Loading…
Reference in New Issue
Block a user