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();
|
const version = await askVersion();
|
||||||
await checkTagVersion(version);
|
await checkTagVersion(version);
|
||||||
|
|
||||||
|
// compiler and verify projects (read-only)
|
||||||
await prepareProject('core', version);
|
await prepareProject('core', version);
|
||||||
await prepareProject('angular', version, ['@ionic/core']);
|
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);
|
await generateChangeLog(version);
|
||||||
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log('\n', chalk.red(err), '\n');
|
console.log('\n', chalk.red(err), '\n');
|
||||||
@ -172,17 +181,21 @@ async function prepareProject(project, version, dependencies) {
|
|||||||
{
|
{
|
||||||
title: 'Linking',
|
title: 'Linking',
|
||||||
task: () => execa('npm', ['link'], { cwd: projectRoot })
|
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 });
|
const listr = new Listr(tasks, { showSubtasks: false });
|
||||||
await listr.run();
|
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() {
|
async function generateChangeLog() {
|
||||||
const rootDir = common.rootPath();
|
const rootDir = common.rootPath();
|
||||||
|
|||||||
@ -12,15 +12,16 @@ async function main() {
|
|||||||
try {
|
try {
|
||||||
const {version} = common.readPkg('core');
|
const {version} = common.readPkg('core');
|
||||||
|
|
||||||
|
// repo must be clean
|
||||||
await common.checkGit();
|
await common.checkGit();
|
||||||
|
|
||||||
await publishProject('core', version);
|
// publish each project in NPM
|
||||||
await publishProject('angular', version);
|
await publishProjects(['core', 'angular'], version);
|
||||||
|
|
||||||
|
// push commits and tags to git remote
|
||||||
await publishGit(version);
|
await publishGit(version);
|
||||||
|
|
||||||
console.log(`\n @ionic/core ${version} published!! 🎉`);
|
console.log(`\n${version} published!! 🎉\n`);
|
||||||
console.log(`@ionic/angular ${version} published!! 🎉\n`);
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|
||||||
} catch (err) {
|
} 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 projectRoot = common.projectPath(project);
|
||||||
const listr = new Listr([{
|
tasks.push({
|
||||||
title: `Publish (latest) ${project} (v${version})`,
|
title: `Publish (latest) ${project} (v${newVersion})`,
|
||||||
task: () => execa('npm', ['publish', '--tag', 'latest'], { cwd: projectRoot })
|
task: () => execa('npm', ['publish', '--tag', 'latest'], { cwd: projectRoot })
|
||||||
}], { showSubtasks: false });
|
});
|
||||||
|
});
|
||||||
|
const listr = new Listr(tasks);
|
||||||
await listr.run();
|
await listr.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
ion-modal {
|
ion-modal {
|
||||||
@include position(0, null, null, 0);
|
@include position(0);
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user