release-it 15.7.0 → 15.8.0

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.
@@ -31,6 +31,12 @@ const parseErrormsg = err => {
31
31
  return msg;
32
32
  };
33
33
 
34
+ const truncateBody = body => {
35
+ // https://github.com/release-it/release-it/issues/965
36
+ if (body && body.length >= 124000) return body.substring(0, 124000) + '...';
37
+ return body;
38
+ };
39
+
34
40
  class GitHub extends Release {
35
41
  constructor(...args) {
36
42
  super(...args);
@@ -200,7 +206,7 @@ class GitHub extends Release {
200
206
  const { version, releaseNotes, isUpdate } = this.getContext();
201
207
  const { isPreRelease } = parseVersion(version);
202
208
  const name = format(releaseName, this.config.getContext());
203
- const body = autoGenerate ? (isUpdate ? null : '') : releaseNotes;
209
+ const body = autoGenerate ? (isUpdate ? null : '') : truncateBody(releaseNotes);
204
210
 
205
211
  return Object.assign(options, {
206
212
  owner,
@@ -91,6 +91,7 @@ class npm extends Plugin {
91
91
 
92
92
  release() {
93
93
  if (this.options.publish === false) return false;
94
+ if (this.getContext('private')) return false;
94
95
  const publish = () => this.publish({ otpCallback });
95
96
  const otpCallback =
96
97
  this.config.isCI && !this.config.isPromptOnlyVersion ? null : task => this.step({ prompt: 'otp', task });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-it",
3
- "version": "15.7.0",
3
+ "version": "15.8.0",
4
4
  "description": "Generic CLI tool to automate versioning and package publishing related tasks.",
5
5
  "keywords": [
6
6
  "build",
@@ -67,7 +67,7 @@
67
67
  "execa": "7.0.0",
68
68
  "git-url-parse": "13.1.0",
69
69
  "globby": "13.1.3",
70
- "got": "12.5.3",
70
+ "got": "12.6.0",
71
71
  "inquirer": "9.1.4",
72
72
  "is-ci": "3.0.1",
73
73
  "lodash": "4.17.21",
@@ -90,7 +90,7 @@
90
90
  "@octokit/request-error": "3.0.3",
91
91
  "ava": "5.2.0",
92
92
  "eslint": "8.35.0",
93
- "eslint-config-prettier": "8.6.0",
93
+ "eslint-config-prettier": "8.7.0",
94
94
  "eslint-plugin-ava": "14.0.0",
95
95
  "eslint-plugin-import": "2.27.5",
96
96
  "eslint-plugin-prettier": "4.2.1",
package/test/github.js CHANGED
@@ -425,3 +425,34 @@ test('should generate GitHub web release url for enterprise host', async t => {
425
425
  );
426
426
  exec.restore();
427
427
  });
428
+
429
+ // eslint-disable-next-line ava/no-skip-test
430
+ test.skip('should truncate long body', async t => {
431
+ const releaseNotes = 'a'.repeat(125001);
432
+ const body = 'a'.repeat(124000) + '...';
433
+ const options = {
434
+ git,
435
+ github: {
436
+ pushRepo,
437
+ tokenRef,
438
+ release: true,
439
+ releaseName: 'Release ${tagName}',
440
+ releaseNotes: 'echo ' + releaseNotes
441
+ }
442
+ };
443
+ const github = factory(GitHub, { options });
444
+ const exec = sinon.stub(github.shell, 'exec').callThrough();
445
+ exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
446
+ exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
447
+
448
+ interceptAuthentication();
449
+ interceptCollaborator();
450
+ interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', body } });
451
+
452
+ await runTasks(github);
453
+
454
+ const { isReleased, releaseUrl } = github.getContext();
455
+ t.true(isReleased);
456
+ t.is(releaseUrl, 'https://github.com/user/repo/releases/tag/2.0.2');
457
+ exec.restore();
458
+ });
package/test/tasks.js CHANGED
@@ -384,7 +384,7 @@ test.serial('should handle private package correctly, bump lockfile', async t =>
384
384
  const npmArgs = getArgs(container.shell.exec.args, 'npm');
385
385
  t.deepEqual(npmArgs, ['npm version 1.0.1 --no-git-tag-version']);
386
386
  t.true(log.obtrusive.firstCall.args[0].endsWith(`release ${pkgName} (1.0.0...1.0.1)`));
387
- t.is(log.warn.lastCall.args[0], 'Skip publish: package is private.');
387
+ t.is(log.warn.length, 0);
388
388
  t.regex(log.log.firstCall.args[0], /Done \(in [0-9]+s\.\)/);
389
389
 
390
390
  exec.restore();