commit-and-tag-version 11.2.0 → 11.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [11.2.1](https://github.com/absolute-version/commit-and-tag-version/compare/v11.2.0...v11.2.1) (2023-04-05)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **dep:** add stringify-package to project source, removing the deprecation warning on npm install ([#65](https://github.com/absolute-version/commit-and-tag-version/issues/65)) ([3a959a7](https://github.com/absolute-version/commit-and-tag-version/commit/3a959a7eba86ad42b98592167df7c67f00b661a0))
11
+
5
12
  ## [11.2.0](https://github.com/absolute-version/commit-and-tag-version/compare/v11.1.0...v11.2.0) (2023-03-15)
6
13
 
7
14
 
package/README.md CHANGED
@@ -552,6 +552,32 @@ module.exports.writeVersion = function (contents, version) {
552
552
  };
553
553
  ```
554
554
 
555
+ ### Why do breaking changes before 1.0.0 not trigger a 1.0.0 release?
556
+
557
+ Below 1.0.0, the semver specification doesn't give any guarantees about the
558
+ meaning of version numbers. However, with npm there is a community convention,
559
+ and implementation-defined behaviour: If your version is between 0.1.0 and
560
+ 1.0.0, npm treats an update to the minor version as a breaking change - that is
561
+ ^0.1.0 will match 0.1.2 but not 0.2.0. Rust's cargo package manager also behaves
562
+ the same way.
563
+
564
+ This tool (via conventional-commits) also follows that convention - breaking
565
+ changes below v1.0.0 are treated as a minor version bump. Here's an example
566
+ series of commits with tagged versions:
567
+
568
+ ```
569
+ 1017b00 chore: initial commit
570
+ 9e2ba95 (tag: v0.0.2) chore(release): 0.0.2
571
+ 3598012 fix!: Example breaking change
572
+ 1a4994a (tag: v0.1.0) chore(release): 0.1.0
573
+ ```
574
+
575
+ Semver's only guarantee is "all bets are off", but npm has made a choice about
576
+ what bets to make. `commit-and-tag-version` follows the same convention (along
577
+ with other package managers for other ecosystems).
578
+
579
+ When you are ready to release v1.0.0, add `--release-as 1.0.0` to the options.
580
+
555
581
  ## License
556
582
 
557
583
  ISC
@@ -0,0 +1,36 @@
1
+ /*
2
+ Copyright npm, Inc
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted, provided that the above
6
+ copyright notice and this permission notice appear in all copies.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
+
16
+ https://github.com/npm/stringify-package/blob/main/LICENSE
17
+ */
18
+
19
+ 'use strict'
20
+
21
+ module.exports = stringifyPackage
22
+
23
+ const DEFAULT_INDENT = 2
24
+ const CRLF = '\r\n'
25
+ const LF = '\n'
26
+
27
+ function stringifyPackage (data, indent, newline) {
28
+ indent = indent || (indent === 0 ? 0 : DEFAULT_INDENT)
29
+ const json = JSON.stringify(data, null, indent)
30
+
31
+ if (newline === CRLF) {
32
+ return json.replace(/\n/g, CRLF) + CRLF
33
+ }
34
+
35
+ return json + LF
36
+ }
@@ -1,4 +1,4 @@
1
- const stringifyPackage = require('stringify-package')
1
+ const stringifyPackage = require('../../stringify-package')
2
2
  const detectIndent = require('detect-indent')
3
3
  const detectNewline = require('detect-newline')
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commit-and-tag-version",
3
- "version": "11.2.0",
3
+ "version": "11.2.1",
4
4
  "description": "replacement for `npm version` with automatic CHANGELOG generation",
5
5
  "bin": "bin/cli.js",
6
6
  "scripts": {
@@ -52,7 +52,6 @@
52
52
  "find-up": "^5.0.0",
53
53
  "git-semver-tags": "^4.0.0",
54
54
  "semver": "^7.1.1",
55
- "stringify-package": "^1.0.1",
56
55
  "yargs": "^17.0.0"
57
56
  },
58
57
  "devDependencies": {
@@ -0,0 +1,39 @@
1
+ /* global describe it */
2
+
3
+ 'use strict'
4
+
5
+ const stringifyPackage = require('../lib/stringify-package')
6
+
7
+ require('chai').should()
8
+
9
+ describe('stringifyPackage()', function () {
10
+ const dummy = { name: 'dummy' }
11
+
12
+ it('with no params uses \\n', function () {
13
+ stringifyPackage(dummy).should.match(/\n$/m)
14
+ })
15
+
16
+ it('uses \\n', function () {
17
+ stringifyPackage(dummy, 2, '\n').should.match(/\n$/m)
18
+ })
19
+
20
+ it('uses \\r\\n', function () {
21
+ stringifyPackage(dummy, 2, '\r\n').should.match(/\r\n$/m)
22
+ })
23
+
24
+ it('with no params uses 2-space indent', function () {
25
+ stringifyPackage(dummy).should.match(/^ {2}"name": "dummy"/m)
26
+ })
27
+
28
+ it('uses 2-space indent', function () {
29
+ stringifyPackage(dummy, 2, '\n').should.match(/^ {2}"name": "dummy"/m)
30
+ })
31
+
32
+ it('uses 4-space indent', function () {
33
+ stringifyPackage(dummy, 4, '\n').should.match(/^ {4}"name": "dummy"/m)
34
+ })
35
+
36
+ it('0 works', function () {
37
+ stringifyPackage(dummy, 0).split(/\r\n|\r|\n/).length.should.equal(2)
38
+ })
39
+ })