mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-14 08:45:20 +08:00
chore(scripts): update main and dist package files for angular
This commit is contained in:
@ -268,11 +268,7 @@ function updatePackageVersions(tasks, packages, version) {
|
||||
}
|
||||
|
||||
function updatePackageVersion(tasks, package, version) {
|
||||
let projectRoot = projectPath(package);
|
||||
|
||||
if (package === 'packages/angular-server' || package === 'angular') {
|
||||
projectRoot = path.join(projectRoot, 'dist')
|
||||
}
|
||||
const projectRoot = projectPath(package);
|
||||
|
||||
tasks.push({
|
||||
title: `${package}: update package.json ${tc.dim(`(${version})`)}`,
|
||||
@ -282,6 +278,22 @@ function updatePackageVersion(tasks, package, version) {
|
||||
});
|
||||
}
|
||||
|
||||
function copyPackageToDist(tasks, packages) {
|
||||
packages.forEach(package => {
|
||||
const projectRoot = projectPath(package);
|
||||
|
||||
// angular and angular-server are the only packages that publish dist
|
||||
if (package !== 'angular' && package !== 'packages/angular-server') {
|
||||
return;
|
||||
}
|
||||
|
||||
tasks.push({
|
||||
title: `${package}: Copy package.json to dist`,
|
||||
task: () => execa('node', ['copy-package.js', package], { cwd: path.join(rootDir, '.scripts') })
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function publishPackages(tasks, packages, version, tag = 'latest') {
|
||||
// first verify version
|
||||
packages.forEach(package => {
|
||||
@ -351,6 +363,7 @@ module.exports = {
|
||||
isValidVersion,
|
||||
isVersionGreater,
|
||||
copyCDNLoader,
|
||||
copyPackageToDist,
|
||||
packages,
|
||||
packagePath,
|
||||
prepareDevPackage,
|
||||
|
12
.scripts/copy-package.js
Normal file
12
.scripts/copy-package.js
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
// copy the package.json to the directory to dist to publish it
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const package = process.argv[2];
|
||||
|
||||
const srcPath = path.join(__dirname, '..', package, 'package.json');
|
||||
let packageContent = fs.readFileSync(srcPath, 'utf-8');
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, '..', package, 'dist', 'package.json'), packageContent);
|
@ -113,6 +113,9 @@ async function preparePackages(packages, version, install) {
|
||||
// add update package.json of each project
|
||||
common.updatePackageVersions(tasks, packages, version);
|
||||
|
||||
// copy package.json to dist
|
||||
common.copyPackageToDist(tasks, packages);
|
||||
|
||||
// generate changelog
|
||||
generateChangeLog(tasks);
|
||||
|
||||
|
Reference in New Issue
Block a user