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\"", "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:force": "lerna publish from-package --yes --no-git-tag-version",
"release": "lerna publish", "release": "lerna publish",
"run:example": "tsx -r dotenv/config -r tsconfig-paths/register ./examples/index.ts", "run:example": "tsx -r dotenv/config -r tsconfig-paths/register ./examples/index.ts"
"prepare": "[ -z \"$CI\" ] && echo \"packages/pro-plugins/\" > .git/info/exclude || true"
}, },
"resolutions": { "resolutions": {
"@types/react": "^17.0.0", "@types/react": "^17.0.0",

View File

@ -9,11 +9,27 @@
const { Command } = require('commander'); const { Command } = require('commander');
const { run, isDev, isPackageValid, generatePlaywrightPath } = require('../util'); const { run, isDev, isPackageValid, generatePlaywrightPath } = require('../util');
const { resolve } = require('path'); const { dirname, resolve } = require('path');
const { existsSync } = require('fs'); const { existsSync, mkdirSync, readFileSync, appendFileSync } = require('fs');
const { readFile, writeFile } = require('fs').promises; const { readFile, writeFile } = require('fs').promises;
const { createStoragePluginsSymlink, createDevPluginsSymlink } = require('@nocobase/utils/plugin-symlink'); 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 * @param {Command} cli
*/ */
@ -24,6 +40,8 @@ module.exports = (cli) => {
.allowUnknownOption() .allowUnknownOption()
.option('--skip-umi') .option('--skip-umi')
.action(async (options) => { .action(async (options) => {
writeToExclude();
generatePlaywrightPath(true); generatePlaywrightPath(true);
await createStoragePluginsSymlink(); await createStoragePluginsSymlink();
if (!isDev()) { if (!isDev()) {