@oneblink/release-cli 3.2.2 → 3.3.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -34,6 +34,8 @@ ${chalk.grey('Release a single repository.')}
34
34
 
35
35
  --no-git ....... Skip committing changes and creating an annotated git tag.
36
36
 
37
+ --increment .... Increment the version automatically using "major" | "minor" | "patch".
38
+
37
39
  --name ......... Skip the question to enter a name for the release by passing
38
40
  a release name as a flag.
39
41
 
@@ -49,6 +51,9 @@ ${chalk.bold('Examples')}
49
51
  oneblink-release repository
50
52
  oneblink-release repository --no-name
51
53
  oneblink-release repository --name="Inappropriate Release Name"
54
+ oneblink-release repository --increment="major"
55
+ oneblink-release repository --increment="minor"
56
+ oneblink-release repository --increment="patch"
52
57
  oneblink-release repository 1.1.1
53
58
  oneblink-release repository 1.1.1 --cwd ../path/to/code
54
59
  oneblink-release repository 1.1.1-uat.1 --no-git
@@ -83,6 +88,10 @@ ${chalk.bold('Examples')}
83
88
  name: {
84
89
  type: 'string',
85
90
  },
91
+ increment: {
92
+ type: 'string',
93
+ choices: ['major', 'minor', 'patch'],
94
+ },
86
95
  cwd: {
87
96
  type: 'string',
88
97
  default: process.cwd(),
@@ -129,6 +138,14 @@ async function run() {
129
138
  const repositoryPlugin = await getRepositoryPlugin({
130
139
  cwd,
131
140
  });
141
+ if (cli.flags.increment) {
142
+ const currentVersion = await repositoryPlugin.getCurrentVersion();
143
+ const currentSemverVersion = semver.parse(currentVersion);
144
+ const nextSemverVersion = currentSemverVersion?.inc(cli.flags.increment);
145
+ if (nextSemverVersion) {
146
+ input = nextSemverVersion.version;
147
+ }
148
+ }
132
149
  if (!semver.valid(input)) {
133
150
  const { nextVersion } = await promptForNextVersion({
134
151
  repositoryPlugin,
@@ -20,14 +20,14 @@ export default async function startUpdateDependents({ cwd }) {
20
20
  }
21
21
  const dependency = dependencyResult.packageJson.name;
22
22
  console.log('Beginning to update the dependents of:', dependency);
23
- const { jiraTicket } = await enquirer.prompt({
23
+ const { ticket } = await enquirer.prompt({
24
24
  type: 'input',
25
- name: 'jiraTicket',
26
- message: `JIRA ticket to associate with pull requests? (e.g. ON-4323)`,
25
+ name: 'ticket',
26
+ message: `Ticket to associate with pull requests? (e.g. ON-4323, OB-4323)`,
27
27
  required: true,
28
28
  validate: (input) => {
29
- if (!/^ON-\d+$/.test(input)) {
30
- return 'JIRA ticket must be "ON-" followed by a number';
29
+ if (!/^(ON-|OB-)\d+$/.test(input)) {
30
+ return 'Ticket must be "ON-" or "OB-" followed by a number';
31
31
  }
32
32
  return true;
33
33
  },
@@ -87,7 +87,7 @@ export default async function startUpdateDependents({ cwd }) {
87
87
  if (isUpdating === 'no') {
88
88
  return;
89
89
  }
90
- await executeCommand('git', ['checkout', '-b', jiraTicket], repositoryWorkingDirectory);
90
+ await executeCommand('git', ['checkout', '-b', ticket], repositoryWorkingDirectory);
91
91
  if (isUpdatingTypes === 'yes') {
92
92
  await executeCommand('npm', ['install', '--package-lock-only', '-D', '@oneblink/types'], repositoryWorkingDirectory);
93
93
  }
@@ -98,9 +98,9 @@ export default async function startUpdateDependents({ cwd }) {
98
98
  `${dependency}@${dependencyResult.packageJson.version}`,
99
99
  ], repositoryWorkingDirectory);
100
100
  await executeCommand('git', ['add', '-A'], repositoryWorkingDirectory);
101
- await executeCommand('git', ['commit', '--message', `${jiraTicket} # Bumped ${dependency}`], repositoryWorkingDirectory);
102
- await executeCommand('git', ['push', '-u', 'origin', jiraTicket], repositoryWorkingDirectory);
103
- createPullRequestUrls.push(`https://github.com/oneblink/${productRepository.repositoryName}/pull/new/${jiraTicket}`);
101
+ await executeCommand('git', ['commit', '--message', `${ticket} # Bumped ${dependency}`], repositoryWorkingDirectory);
102
+ await executeCommand('git', ['push', '-u', 'origin', ticket], repositoryWorkingDirectory);
103
+ createPullRequestUrls.push(`https://github.com/oneblink/${productRepository.repositoryName}/pull/new/${ticket}`);
104
104
  });
105
105
  if (createPullRequestUrls.length) {
106
106
  console.log(boxen(`The following Pull Requests can be created:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oneblink/release-cli",
3
3
  "description": "Used internally by OneBlink to release repositories quickly and consistently",
4
- "version": "3.2.2",
4
+ "version": "3.3.1-beta.1",
5
5
  "author": "OneBlink <developers@oneblink> (https://github.com/oneblink)",
6
6
  "bin": {
7
7
  "oneblink-release": "dist/bin.js"