fix: exclude packages/pro-plugins

This commit is contained in:
chenos 2024-08-05 13:28:40 +08:00
parent 816616cca0
commit dd9f5d5e52
2 changed files with 21 additions and 4 deletions

View File

@ -41,8 +41,7 @@
"version:alpha": "lerna version prerelease --preid alpha --force-publish=* --no-git-tag-version -m \"chore(versions): publish packages %s\"",
"release:force": "lerna publish from-package --yes --no-git-tag-version",
"release": "lerna publish",
"run:example": "tsx -r dotenv/config -r tsconfig-paths/register ./examples/index.ts",
"prepare": "[ -z \"$CI\" ] && echo \"packages/pro-plugins/\" > .git/info/exclude || true"
"run:example": "tsx -r dotenv/config -r tsconfig-paths/register ./examples/index.ts"
},
"resolutions": {
"@types/react": "^17.0.0",

View File

@ -9,11 +9,27 @@
const { Command } = require('commander');
const { run, isDev, isPackageValid, generatePlaywrightPath } = require('../util');
const { resolve } = require('path');
const { existsSync } = require('fs');
const { dirname, resolve } = require('path');
const { existsSync, mkdirSync, readFileSync, appendFileSync } = require('fs');
const { readFile, writeFile } = require('fs').promises;
const { createStoragePluginsSymlink, createDevPluginsSymlink } = require('@nocobase/utils/plugin-symlink');
function writeToExclude() {
const excludePath = resolve(process.cwd(), '.git', 'info', 'exclude');
const content = 'packages/pro-plugins/\n';
const dirPath = dirname(excludePath);
if (!existsSync(dirPath)) {
mkdirSync(dirPath, { recursive: true });
}
let fileContent = '';
if (existsSync(excludePath)) {
fileContent = readFileSync(excludePath, 'utf-8');
}
if (!fileContent.includes(content)) {
appendFileSync(excludePath, content);
}
}
/**
* @param {Command} cli
*/
@ -24,6 +40,8 @@ module.exports = (cli) => {
.allowUnknownOption()
.option('--skip-umi')
.action(async (options) => {
writeToExclude();
generatePlaywrightPath(true);
await createStoragePluginsSymlink();
if (!isDev()) {