mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +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) {
|
function updatePackageVersion(tasks, package, version) {
|
||||||
let projectRoot = projectPath(package);
|
const projectRoot = projectPath(package);
|
||||||
|
|
||||||
if (package === 'packages/angular-server' || package === 'angular') {
|
|
||||||
projectRoot = path.join(projectRoot, 'dist')
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.push({
|
tasks.push({
|
||||||
title: `${package}: update package.json ${tc.dim(`(${version})`)}`,
|
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') {
|
function publishPackages(tasks, packages, version, tag = 'latest') {
|
||||||
// first verify version
|
// first verify version
|
||||||
packages.forEach(package => {
|
packages.forEach(package => {
|
||||||
@ -351,6 +363,7 @@ module.exports = {
|
|||||||
isValidVersion,
|
isValidVersion,
|
||||||
isVersionGreater,
|
isVersionGreater,
|
||||||
copyCDNLoader,
|
copyCDNLoader,
|
||||||
|
copyPackageToDist,
|
||||||
packages,
|
packages,
|
||||||
packagePath,
|
packagePath,
|
||||||
prepareDevPackage,
|
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
|
// add update package.json of each project
|
||||||
common.updatePackageVersions(tasks, packages, version);
|
common.updatePackageVersions(tasks, packages, version);
|
||||||
|
|
||||||
|
// copy package.json to dist
|
||||||
|
common.copyPackageToDist(tasks, packages);
|
||||||
|
|
||||||
// generate changelog
|
// generate changelog
|
||||||
generateChangeLog(tasks);
|
generateChangeLog(tasks);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user