Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: trigger version bumps via ncc / main diff
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Jan 11, 2019
1 parent 4597f20 commit 29ce0b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.ncc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meetalva/core",
"version": "0.9.1",
"version": "0.9.0",
"description": "Create living prototypes with code components",
"main": "./index.js",
"repository": {
Expand Down
19 changes: 12 additions & 7 deletions packages/tools/alva-trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,20 @@ async function main(cli) {
}

const projectPath = Path.resolve(process.cwd(), cli.project);
const mainManifest = require(Path.join(projectPath, 'package.json'));
const manifest = require(Path.join(projectPath, 'package.ncc.json'));

if (semver.gt(mainManifest.version, manifest.version)) {
console.log(`${prefix}trigger full draft release for ${manifest.name}@${manifest.version}`);

if (!cli.dryRun) {
manifest.version = mainManifest.version;
await writeFile(Path.join(projectPath, 'package.ncc.json'), JSON.stringify(manifest, null, ' '));
}

return;
}

const giturl =
typeof manifest.repository === 'object' ? manifest.repository.url : manifest.repository;

Expand All @@ -45,8 +57,6 @@ async function main(cli) {
return semver.rcompare(a.tag_name, b.tag_name);
});

const latestRelease = sortedReleases[0];

if (cli.data) {
const releases = sortedReleases.map(release => ({
parsed: semverUtils.parse(release.tag_name),
Expand All @@ -63,11 +73,6 @@ async function main(cli) {
return;
}

if (latestRelease && semver.gt(manifest.version, latestRelease.tag_name)) {
console.log(`${prefix}trigger full draft release for ${manifest.name}@${manifest.version}`);
return;
}

const [branch] = (await execa('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout.split('\n');
const [hash] = (await execa('git', ['rev-parse', '--short', 'HEAD'])).stdout.split('\n');

Expand Down

1 comment on commit 29ce0b6

@marionebl
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.