Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await execPromise('npx', [
'lerna',
'publish',
...tag,
'--yes',
// Plugins can add as many commits as they want, lerna will still
// publish the changed package versions. from-git broke when HEAD
// didn't contain the tags
'from-package',
...verboseArgs
]);
} else {
const { private: isPrivate, name } = await loadPackageJson();
const isScopedPackage = name.match(/@\S+\/\S+/);
await execPromise(
'npm',
!isPrivate && isScopedPackage
? ['publish', '--access', 'public', ...tag, ...verboseArgs]
: ['publish', ...tag, ...verboseArgs]
);
}
await execPromise('git', [
'push',
'--follow-tags',
'--set-upstream',
'origin',
branch || auto.baseBranch
]);
auto.logger.verbose.info('Successfully published repo');
});
const newVersion =
// After release we bump the version by a patch and add -SNAPSHOT
// Given that we do not need to increment when versioning, since
// it has already been done
version === 'patch'
? previousVersion
: inc(previousVersion, version as ReleaseType);
if (!newVersion) {
throw new Error(
`Could not increment previous version: ${previousVersion}`
);
}
await execPromise('mvn', ['clean']);
await execPromise('mvn', [
'-B',
'release:prepare',
`-Dtag=v${newVersion}`,
`-DreleaseVersion=${newVersion}`,
'-DpushChanges=false'
]);
await execPromise('git', ['checkout', '-b', 'dev-snapshot']);
await execPromise('git', ['checkout', 'master']);
await execPromise('git', ['reset', '--hard', 'HEAD~1']);
});
auto.hooks.publish.tapPromise(this.name, async () => {
// publish extension
await execPromise('webstore', [
'upload',
'--extension-id',
this.options.id,
'--source',
this.options.build,
'--auto-publish'
]);
// push to github
await execPromise('git', [
'push',
'--follow-tags',
'--set-upstream',
'origin',
auto.baseBranch
]);
auto.hooks.afterShipIt.tapPromise(this.name, async () => {
// prepare for next development iteration
await execPromise('git', ['reset', '--hard', 'dev-snapshot']);
await execPromise('git', ['branch', '-d', 'dev-snapshot']);
await execPromise('git', ['push', 'origin', auto.baseBranch]);
});
}
auto.hooks.version.tapPromise(this.name, async version => {
const isBaseBranch = branch === auto.baseBranch;
if (isMonorepo()) {
auto.logger.verbose.info('Detected monorepo, using lerna');
const isIndependent = getLernaJson().version === 'independent';
const monorepoBump =
isIndependent || !isBaseBranch
? undefined
: await bumpLatest(getMonorepoPackage(), version);
await execPromise('npx', [
'lerna',
'version',
monorepoBump || version,
!isIndependent && this.forcePublish && '--force-publish',
'--no-commit-hooks',
'--yes',
'--no-push',
'-m',
VERSION_COMMIT_MESSAGE,
...verboseArgs
]);
auto.logger.verbose.info('Successfully versioned repo');
return;
}
const latestBump = isBaseBranch
auto.hooks.version.tapPromise(this.name, async version => {
if (!auto.git) {
return;
}
const lastTag = await auto.git.getLatestTagInBranch();
const newTag = inc(lastTag, version as ReleaseType);
const branch = getCurrentBranch() || '';
if (!newTag) {
return;
}
await execPromise('git', ['tag', newTag]);
await execPromise('git', [
'push',
'--follow-tags',
'--set-upstream',
'origin',
branch || auto.baseBranch
]);
});
auto.hooks.publish.tapPromise(this.name, async () => {
auto.logger.log.info('Publishing via cargo');
await execPromise('cargo', ['publish']);
auto.logger.log.info('Publish complete');
auto.logger.log.info('Pushing local git changes to origin remote');
await execPromise('git', [
'push',
'--follow-tags',
'--set-upstream',
'origin',
auto.baseBranch
]);
auto.logger.log.info('Push complete');
});
}
'from-package',
...verboseArgs
]);
} else {
const { private: isPrivate, name } = await loadPackageJson();
const isScopedPackage = name.match(/@\S+\/\S+/);
await execPromise(
'npm',
!isPrivate && isScopedPackage
? ['publish', '--access', 'public', ...tag, ...verboseArgs]
: ['publish', ...tag, ...verboseArgs]
);
}
await execPromise('git', [
'push',
'--follow-tags',
'--set-upstream',
'origin',
branch || auto.baseBranch
]);
auto.logger.verbose.info('Successfully published repo');
});
}
async function gitReset() {
await execPromise('git', ['reset', '--hard', 'HEAD']);
}
auto.hooks.version.tapPromise(this.name, async version => {
const versionNew = bumpVersion(version);
auto.logger.log.info(`Bumped version to: ${versionNew}`);
auto.logger.log.info('Building to update Cargo.lock');
await execPromise('cargo', ['build']);
auto.logger.verbose.info('Committing files');
await execPromise('git', ['add', 'Cargo.toml', 'Cargo.lock']);
await execPromise('git', [
'commit',
'-m',
`'Bump version to: ${versionNew} [skip ci]'`,
'--no-verify'
]);
auto.logger.log.info('Create git commit for new version');
});