mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
chore(): improve publish scripts
This commit is contained in:
@ -18,10 +18,19 @@ async function main() {
|
||||
|
||||
const version = await askVersion();
|
||||
await checkTagVersion(version);
|
||||
|
||||
// compiler and verify projects (read-only)
|
||||
await prepareProject('core', version);
|
||||
await prepareProject('angular', version, ['@ionic/core']);
|
||||
|
||||
// writes start here
|
||||
// update package.json of each project
|
||||
await updateVersion('core', version);
|
||||
await updateVersion('angular', version);
|
||||
|
||||
// generate changelog
|
||||
await generateChangeLog(version);
|
||||
|
||||
process.exit(0);
|
||||
} catch(err) {
|
||||
console.log('\n', chalk.red(err), '\n');
|
||||
@ -172,17 +181,21 @@ async function prepareProject(project, version, dependencies) {
|
||||
{
|
||||
title: 'Linking',
|
||||
task: () => execa('npm', ['link'], { cwd: projectRoot })
|
||||
},
|
||||
{
|
||||
title: `Updating ${project}/package.json version ${chalk.dim(`(${version})`)}`,
|
||||
task: () => execa('npm', ['version', version], { cwd: projectRoot }),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const listr = new Listr(tasks, { showSubtasks: false });
|
||||
await listr.run();
|
||||
}
|
||||
|
||||
async function updateVersion(project, version) {
|
||||
const projectRoot = common.projectPath(project);
|
||||
const listr = new Listr([{
|
||||
title: `Updating ${project}/package.json version ${chalk.dim(`(${version})`)}`,
|
||||
task: () => execa('npm', ['version', version], { cwd: projectRoot }),
|
||||
}]);
|
||||
await listr.run();
|
||||
}
|
||||
|
||||
async function generateChangeLog() {
|
||||
const rootDir = common.rootPath();
|
||||
|
||||
@ -12,15 +12,16 @@ async function main() {
|
||||
try {
|
||||
const {version} = common.readPkg('core');
|
||||
|
||||
// repo must be clean
|
||||
await common.checkGit();
|
||||
|
||||
await publishProject('core', version);
|
||||
await publishProject('angular', version);
|
||||
// publish each project in NPM
|
||||
await publishProjects(['core', 'angular'], version);
|
||||
|
||||
// push commits and tags to git remote
|
||||
await publishGit(version);
|
||||
|
||||
console.log(`\n @ionic/core ${version} published!! 🎉`);
|
||||
console.log(`@ionic/angular ${version} published!! 🎉\n`);
|
||||
console.log(`\n${version} published!! 🎉\n`);
|
||||
process.exit(0);
|
||||
|
||||
} catch (err) {
|
||||
@ -29,12 +30,28 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
async function publishProject(project, version) {
|
||||
async function publishProjects(projects, newVersion) {
|
||||
const tasks = [];
|
||||
projects.forEach((project) => {
|
||||
const {name, version} = common.readPkg(project);
|
||||
tasks.push({
|
||||
title: `Checking version of name (must match: ${version})`,
|
||||
task: () => {
|
||||
if(newVersion !== version) {
|
||||
throw new Error('version does not match');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
projects.forEach((project) => {
|
||||
const projectRoot = common.projectPath(project);
|
||||
const listr = new Listr([{
|
||||
title: `Publish (latest) ${project} (v${version})`,
|
||||
tasks.push({
|
||||
title: `Publish (latest) ${project} (v${newVersion})`,
|
||||
task: () => execa('npm', ['publish', '--tag', 'latest'], { cwd: projectRoot })
|
||||
}], { showSubtasks: false });
|
||||
});
|
||||
});
|
||||
const listr = new Listr(tasks);
|
||||
await listr.run();
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-modal {
|
||||
@include position(0, null, null, 0);
|
||||
@include position(0);
|
||||
|
||||
position: absolute;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user