diff --git a/npm/ng-packs/scripts/publish.ts b/npm/ng-packs/scripts/publish.ts index 72f49db75d..50c1104e71 100644 --- a/npm/ng-packs/scripts/publish.ts +++ b/npm/ng-packs/scripts/publish.ts @@ -1,6 +1,7 @@ import execa from 'execa'; import fse from 'fs-extra'; import program from 'commander'; +import replaceWithPreview from './replace-with-preview'; program .option( @@ -48,6 +49,8 @@ const publish = async () => { await execa('yarn', ['replace-with-tilde']); + if (program.preview) await replaceWithPreview(program.nextVersion); + await execa('yarn', ['build', '--noInstall'], { stdout: 'inherit' }); await fse.rename('../lerna.publish.json', '../lerna.json'); diff --git a/npm/ng-packs/scripts/replace-with-preview.ts b/npm/ng-packs/scripts/replace-with-preview.ts new file mode 100644 index 0000000000..1f624059b2 --- /dev/null +++ b/npm/ng-packs/scripts/replace-with-preview.ts @@ -0,0 +1,19 @@ +import fse from 'fs-extra'; + +export default async function(version: string) { + const corePkgPath = '../packages/core/package.json'; + try { + const corePkg = await fse.readJSON(corePkgPath); + + await fse.writeJSON( + corePkgPath, + { + ...corePkg, + dependencies: { ...corePkg.dependencies, '@abp/utils': version }, + }, + { spaces: 2 }, + ); + } catch (error) { + console.error(error); + } +}