@release-it/keep-a-changelog 2.5.0 → 3.0.0-esm.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.
Files changed (3) hide show
  1. package/index.js +7 -7
  2. package/package.json +9 -8
  3. package/test.js +8 -8
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- const { Plugin } = require('release-it');
2
- const fs = require('fs');
3
- const path = require('path');
4
- const detectNewline = require('detect-newline');
5
- var format = require('string-template');
1
+ import { Plugin } from 'release-it';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { detectNewline } from 'detect-newline';
5
+ import format from 'string-template';
6
6
 
7
7
  const pad = num => ('0' + num).slice(-2);
8
8
 
@@ -107,7 +107,7 @@ class KeepAChangelog extends Plugin {
107
107
  }
108
108
 
109
109
  // Add a link for the first tagged version
110
- if (!latestTag) {
110
+ if (!latestTag || latestTag === '0.0.0') {
111
111
  const firstVersionUrl = format(this.versionUrlFormats.firstVersionUrl, { repositoryUrl, tagName });
112
112
  const firstVersionLink = `[${version}]: ${firstVersionUrl}`;
113
113
  return `${updatedChangelog}${this.EOL}${firstVersionLink}`;
@@ -142,4 +142,4 @@ class KeepAChangelog extends Plugin {
142
142
  }
143
143
  }
144
144
 
145
- module.exports = KeepAChangelog;
145
+ export default KeepAChangelog;
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@release-it/keep-a-changelog",
3
- "version": "2.5.0",
3
+ "version": "3.0.0-esm.0",
4
4
  "description": "Keep-a-changelog plugin for release-it",
5
- "main": "index.js",
5
+ "type": "module",
6
+ "exports": "./index.js",
6
7
  "scripts": {
7
8
  "test": "bron test.js",
8
9
  "release": "release-it"
@@ -29,20 +30,20 @@
29
30
  "url": "https://webpro.nl"
30
31
  },
31
32
  "dependencies": {
32
- "detect-newline": "^3.1.0",
33
+ "detect-newline": "^4.0.0",
33
34
  "string-template": "^1.0.0"
34
35
  },
35
36
  "devDependencies": {
36
- "bron": "^1.1.1",
37
+ "bron": "^2.0.3",
37
38
  "mock-fs": "^5.0.0",
38
- "release-it": "^14.13.1",
39
- "sinon": "^11.1.1"
39
+ "release-it": "^15.0.0-esm.4",
40
+ "sinon": "^13.0.2"
40
41
  },
41
42
  "peerDependencies": {
42
- "release-it": "^14.13.1"
43
+ "release-it": "^15.0.0-esm.4"
43
44
  },
44
45
  "engines": {
45
- "node": ">=10"
46
+ "node": ">=14"
46
47
  },
47
48
  "release-it": {
48
49
  "github": {
package/test.js CHANGED
@@ -1,10 +1,10 @@
1
- const fs = require('fs');
2
- const test = require('bron');
3
- const assert = require('assert').strict;
4
- const mock = require('mock-fs');
5
- const sinon = require('sinon');
6
- const { factory, runTasks } = require('release-it/test/util');
7
- const Plugin = require('.');
1
+ import fs from 'fs';
2
+ import test from 'bron';
3
+ import { strict as assert } from 'assert';
4
+ import mock from 'mock-fs';
5
+ import sinon from 'sinon';
6
+ import { factory, runTasks } from 'release-it/test/util';
7
+ import Plugin from './index.js';
8
8
 
9
9
  const initialDryRunFileContents =
10
10
  '\n\n## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D';
@@ -263,6 +263,6 @@ test('should add links to the end of a new changelog', async t => {
263
263
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
264
264
  assert.match(
265
265
  readFile('./CHANGELOG-VERSION_URL_NEW.md'),
266
- /^## \[1\.0\.0] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n\[unreleased]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.0\.\.\.HEAD\n\[1.0.0]: https:\/\/github\.com\/user\/project\/releases\/tag\/1\.0\.0\n$/
266
+ /^## \[1\.0\.0] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n\[unreleased]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.0\.\.\.HEAD\n\[1\.0\.0]: https:\/\/github\.com\/user\/project\/releases\/tag\/1\.0\.0\n$/
267
267
  );
268
268
  });