Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function (cz, commit) {
const scope = '@instructure'
const allPackages = getPackages()
const changedPackages = getChangedPackages('--cached', allPackages).map(pkg => pkg.name.replace(`${scope}/`, ''))
const packageNames = allPackages.map(pkg => pkg.name.replace(`${scope}/`, ''))
const questions = makeDefaultQuestions(packageNames, changedPackages)
// eslint-disable-next-line no-console
console.info('\n\nLine 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.\n')
cz.registerPrompt('autocomplete', autocomplete)
cz.prompt(autocompleteQuestions(questions))
.then((answers) => {
const {
body,
footer,
...rest
} = answers
async function syncRootPackageVersion (useProjectVersion) {
const project = new Project(process.cwd())
const rootPkg = getPackage()
let projectVersion
if (project.isIndependent() || useProjectVersion) {
projectVersion = project.version
} else {
// unfortunately lerna doesn't update lerna.json for canary releases,
// so we have to do this:
const pkgs = getChangedPackages()
projectVersion = pkgs[0].get('version')
}
if (projectVersion !== rootPkg.get('version')) {
rootPkg.set('version', projectVersion)
await rootPkg.serialize()
}
return projectVersion
}
async function updateCrossPackageDependencies (packageName, releaseVersion, dependencyVersion) {
const changedPackages = getChangedPackages()
const changedPackageNames = changedPackages.map(pkg => pkg.name)
info(`📦 Updating cross-package dependencies for ${packageName} to ${dependencyVersion}...`)
await Promise.all(
changedPackages.map(changedPackage => {
const pkg = changedPackage.toJSON()
let packageChanged = false
const depCollections = [
'dependencies',
'devDependencies',
'optionalDependencies',
'peerDependencies'
]
depCollections.forEach(depCollection => {