mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:26:21 +00:00
fix: deps check error when dev add production plugin (#3848)
* fix: deps check error when dev add production plugin * fix: bug
This commit is contained in:
parent
28ca702ab9
commit
88b317f937
@ -505,15 +505,24 @@ export interface DepCompatible {
|
||||
}
|
||||
export async function getCompatible(packageName: string) {
|
||||
let externalVersion: Record<string, string>;
|
||||
if (!process.env.IS_DEV_CMD) {
|
||||
const hasSrc = fs.existsSync(path.join(getPackageDir(packageName), 'src'));
|
||||
let hasError = false;
|
||||
if (hasSrc) {
|
||||
try {
|
||||
externalVersion = await getExternalVersionFromSource(packageName);
|
||||
} catch (error) {
|
||||
console.log('getExternalVersionFromSource error:', error);
|
||||
hasError = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasError || !hasSrc) {
|
||||
const res = await getExternalVersionFromDistFile(packageName);
|
||||
if (!res) {
|
||||
return false;
|
||||
} else {
|
||||
externalVersion = res;
|
||||
}
|
||||
} else {
|
||||
externalVersion = await getExternalVersionFromSource(packageName);
|
||||
}
|
||||
|
||||
return Object.keys(externalVersion).reduce<DepCompatible[]>((result, packageName) => {
|
||||
@ -521,8 +530,8 @@ export async function getCompatible(packageName: string) {
|
||||
const globalPackageName = deps[packageName]
|
||||
? packageName
|
||||
: deps[packageName.split('/')[0]] // @nocobase and @formily
|
||||
? packageName.split('/')[0]
|
||||
: undefined;
|
||||
? packageName.split('/')[0]
|
||||
: undefined;
|
||||
|
||||
if (globalPackageName) {
|
||||
const versionRange = deps[globalPackageName];
|
||||
|
2
packages/plugins/@nocobase/plugin-cas/.npmignore
Normal file
2
packages/plugins/@nocobase/plugin-cas/.npmignore
Normal file
@ -0,0 +1,2 @@
|
||||
/node_modules
|
||||
/src
|
Loading…
Reference in New Issue
Block a user