diff --git a/GUIDE.md b/GUIDE.md index 8ddd9bb2..03fe1afa 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -223,7 +223,7 @@ Let's say you have the following package.json files: ```js module.exports = { - packageJsons: [ + filesToBump: [ "package.json", "packages/first-package/package.json", "packages/second-package/package.json", diff --git a/packages/shipjs-lib/src/lib/config/defaultConfig.js b/packages/shipjs-lib/src/lib/config/defaultConfig.js index aad31267..260c6893 100644 --- a/packages/shipjs-lib/src/lib/config/defaultConfig.js +++ b/packages/shipjs-lib/src/lib/config/defaultConfig.js @@ -1,6 +1,6 @@ export default { remote: 'origin', - packageJsons: ['package.json'], + filesToBump: ['package.json'], updateChangelog: true, conventionalChangelogArgs: '-p angular -i CHANGELOG.md -s', installCommand: ({ isYarn }) => (isYarn ? 'yarn install' : 'npm install'), diff --git a/packages/shipjs-lib/src/lib/util/getAppName.js b/packages/shipjs-lib/src/lib/util/getAppName.js index 6d9458ed..8458cd5a 100644 --- a/packages/shipjs-lib/src/lib/util/getAppName.js +++ b/packages/shipjs-lib/src/lib/util/getAppName.js @@ -3,10 +3,10 @@ import { resolve } from 'path'; import loadConfig from '../config/loadConfig'; export default function getAppName(dir = '.') { - const { appName, packageJsons } = loadConfig(dir); + const { appName, filesToBump } = loadConfig(dir); if (appName) { return appName; } - const { name } = JSON.parse(readFileSync(resolve(dir, packageJsons[0]))); + const { name } = JSON.parse(readFileSync(resolve(dir, filesToBump[0]))); return name; } diff --git a/packages/shipjs-lib/src/lib/util/getCurrentVersion.js b/packages/shipjs-lib/src/lib/util/getCurrentVersion.js index f8037236..1f56a45f 100644 --- a/packages/shipjs-lib/src/lib/util/getCurrentVersion.js +++ b/packages/shipjs-lib/src/lib/util/getCurrentVersion.js @@ -3,7 +3,7 @@ import { resolve } from 'path'; import loadConfig from '../config/loadConfig'; export default function getCurrentVersion(dir = '.') { - const { packageJsons } = loadConfig(dir); - const { version } = JSON.parse(readFileSync(resolve(dir, packageJsons[0]))); + const { filesToBump } = loadConfig(dir); + const { version } = JSON.parse(readFileSync(resolve(dir, filesToBump[0]))); return version; } diff --git a/packages/shipjs-lib/src/lib/util/updateVersion.js b/packages/shipjs-lib/src/lib/util/updateVersion.js index 5bfc3edf..0a245baa 100644 --- a/packages/shipjs-lib/src/lib/util/updateVersion.js +++ b/packages/shipjs-lib/src/lib/util/updateVersion.js @@ -1,9 +1,9 @@ import { readFileSync, writeFileSync } from 'fs'; import { resolve } from 'path'; -export default function updateVersion(packageJsons, nextVersion, dir = '.') { - packageJsons.forEach(packageJson => { - const filePath = resolve(dir, packageJson); +export default function updateVersion(filesToBump, nextVersion, dir = '.') { + filesToBump.forEach(file => { + const filePath = resolve(dir, file); const json = JSON.parse(readFileSync(filePath).toString()); json.version = nextVersion; writeFileSync(filePath, `${JSON.stringify(json, null, 2)}\n`); diff --git a/packages/shipjs/src/step/prepare/updateVersions.js b/packages/shipjs/src/step/prepare/updateVersions.js index e6c6a723..6c6617bb 100644 --- a/packages/shipjs/src/step/prepare/updateVersions.js +++ b/packages/shipjs/src/step/prepare/updateVersions.js @@ -4,13 +4,15 @@ import wrapExecWithDir from '../../util/wrapExecWithDir'; export default async ({ config, nextVersion, dir, dryRun }) => await runStep({ title: 'Updating the version.' }, async ({ print, info }) => { - const { packageJsons, versionUpdated } = config; + const { filesToBump, versionUpdated } = config; if (dryRun) { - print(`-> ${info(packageJsons.join(', '))}`); + filesToBump.forEach(file => { + print(`-> ${info(file)}`); + }); print(`-> execute ${info('versionUpdated()')} callback.`); return; } - updateVersion(packageJsons, nextVersion, dir); + updateVersion(filesToBump, nextVersion, dir); await versionUpdated({ version: nextVersion, dir, diff --git a/ship.config.js b/ship.config.js index 44103010..2bb0abc2 100644 --- a/ship.config.js +++ b/ship.config.js @@ -1,5 +1,5 @@ module.exports = { - packageJsons: [ + filesToBump: [ "package.json", "packages/shipjs-lib/package.json", "packages/shipjs/package.json"