diff --git a/app/core/event/SyncPackageVersionFile.ts b/app/core/event/SyncPackageVersionFile.ts index 6cf38c61..5dc7d20d 100644 --- a/app/core/event/SyncPackageVersionFile.ts +++ b/app/core/event/SyncPackageVersionFile.ts @@ -16,7 +16,9 @@ class SyncPackageVersionFileEvent { private readonly packageVersionFileService: PackageVersionFileService; protected async syncPackageVersionFile(fullname: string, version: string) { + // must set enableUnpkg and enableSyncUnpkgFiles = true both if (!this.config.cnpmcore.enableUnpkg) return; + if (!this.config.cnpmcore.enableSyncUnpkgFiles) return; // ignore sync on unittest if (this.config.env === 'unittest' && fullname !== '@cnpm/unittest-unpkg-demo') return; const [ scope, name ] = getScopeAndName(fullname); diff --git a/app/port/config.ts b/app/port/config.ts index 8a763afe..867f2424 100644 --- a/app/port/config.ts +++ b/app/port/config.ts @@ -145,6 +145,10 @@ export type CnpmcoreConfig = { * enable unpkg features, https://github.com/cnpm/cnpmcore/issues/452 */ enableUnpkg: boolean, + /** + * enable sync unpkg files + */ + enableSyncUnpkgFiles: boolean; /** * enable this would make sync specific version task not append latest version into this task automatically,it would mark the local latest stable version as latest tag. * in most cases, you should set to false to keep the same behavior as source registry. diff --git a/config/config.default.ts b/config/config.default.ts index cc6729a0..1c090583 100644 --- a/config/config.default.ts +++ b/config/config.default.ts @@ -53,6 +53,7 @@ export const cnpmcoreConfig: CnpmcoreConfig = { syncNotFound: false, redirectNotFound: true, enableUnpkg: true, + enableSyncUnpkgFiles: true, strictSyncSpecivicVersion: false, enableElasticsearch: !!process.env.CNPMCORE_CONFIG_ENABLE_ES, elasticsearchIndex: 'cnpmcore_packages',