semantic-release-npm-github-publish 1.4.0 → 1.5.2

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.
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ const types = require('./types');
4
+
5
+ const COMMIT_HASH_LENGTH = 7;
6
+
7
+ /**
8
+ * Transform a parsed commit to render the changelog.
9
+ *
10
+ * @param {Object} commit commit parsed with `conventional-changelog-parser`.
11
+ * @param {Object} context `conventional-changelog` context.
12
+ * @return {Object} the transformed commit.
13
+ */
14
+ module.exports = (commit, context) => {
15
+ if (commit.notes) {
16
+ commit.notes.forEach(note => {
17
+ note.title = 'Breaking changes';
18
+ });
19
+ }
20
+
21
+ if (types.types[commit.type] && (types.types[commit.type].changelog || (commit.notes && commit.notes.length > 0))) {
22
+ commit.groupType = `${types.types[commit.type].emoji ? `${types.types[commit.type].emoji} ` : ''}${
23
+ types.types[commit.type].title
24
+ }`;
25
+ } else {
26
+ return null;
27
+ }
28
+
29
+ if (commit.scope === '*') {
30
+ commit.scope = '';
31
+ }
32
+
33
+ if (typeof commit.hash === 'string') {
34
+ commit.shortHash = commit.hash.slice(0, COMMIT_HASH_LENGTH);
35
+ }
36
+
37
+ const references = [];
38
+
39
+ if (typeof commit.subject === 'string') {
40
+ let url = context.repository ? `${context.host}/${context.owner}/${context.repository}` : context.repoUrl;
41
+
42
+ if (url) {
43
+ url += '/issues/';
44
+ // Issue URLs.
45
+ commit.subject = commit.subject.replace(/#(\d+)/g, (_, issue) => {
46
+ references.push(issue);
47
+ return `[#${issue}](${url}${issue})`;
48
+ });
49
+ }
50
+
51
+ if (context.host) {
52
+ // User URLs.
53
+ commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9]){0,38})/g, `[@$1](${context.host}/$1)`);
54
+ }
55
+ }
56
+
57
+ if (commit.references) {
58
+ // Remove references that already appear in the subject
59
+ commit.references = commit.references.filter(reference => {
60
+ if (!references.includes(reference.issue)) {
61
+ return true;
62
+ }
63
+
64
+ return false;
65
+ });
66
+ }
67
+
68
+ return commit;
69
+ };
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "author": "Oleg Koval <kvl.olg@gmail.com>",
3
3
  "dependencies": {
4
- "@semantic-release/changelog": "^3.0.4",
5
- "@semantic-release/commit-analyzer": "^6.3.0",
6
- "@semantic-release/git": "^7.0.16",
7
- "@semantic-release/github": "^5.5.1",
8
- "@semantic-release/npm": "^5.1.15",
9
- "@semantic-release/release-notes-generator": "^7.3.0"
10
- },
11
- "description": "[Github template] Sharable configuration for semantic-release, extends experience for publishing to NPM & Github: generates release-notes, changelog, publishes new version with Github actions.",
12
- "devDependencies": {
13
- "semantic-release": "^15.13.24"
4
+ "@semantic-release/changelog": "^6.0.0",
5
+ "@semantic-release/commit-analyzer": "^9.0.1",
6
+ "@semantic-release/git": "^10.0.0",
7
+ "@semantic-release/github": "^8.0.1",
8
+ "@semantic-release/npm": "^8.0.0",
9
+ "@semantic-release/release-notes-generator": "^10.0.2",
10
+ "semantic-release": "^19.0.0",
11
+ "snyk": "^1.720.0"
14
12
  },
13
+ "description": "Sharable configuration for semantic-release, extends experience for publishing to NPM & Github: generates release-notes, changelog, publishes new version with Github actions.",
14
+ "devDependencies": {},
15
15
  "files": [
16
+ "types.js",
17
+ "commit-transform.js",
16
18
  "release.config.js",
17
19
  "plugins.json"
18
20
  ],
@@ -36,7 +38,7 @@
36
38
  "main": "release.config.js",
37
39
  "name": "semantic-release-npm-github-publish",
38
40
  "peerDependencies": {
39
- "semantic-release": ">=15.13.24"
41
+ "semantic-release": ">=18.0.0"
40
42
  },
41
43
  "publishConfig": {
42
44
  "access": "public"
@@ -46,7 +48,10 @@
46
48
  "url": "https://github.com/oleg-koval/semantic-release-npm-github-publish.git"
47
49
  },
48
50
  "scripts": {
49
- "semantic-release": "semantic-release"
51
+ "semantic-release": "semantic-release",
52
+ "snyk-protect": "snyk protect",
53
+ "prepare": "npm run snyk-protect"
50
54
  },
51
- "version": "1.4.0"
55
+ "version": "1.5.2",
56
+ "snyk": true
52
57
  }
package/readme.md CHANGED
@@ -47,9 +47,7 @@ npm install --save-dev semantic-release
47
47
 
48
48
  ```json
49
49
  "scripts": {
50
- ...
51
50
  "semantic-release": "semantic-release"
52
- ...
53
51
  }
54
52
  ```
55
53
 
package/release.config.js CHANGED
@@ -1,78 +1,6 @@
1
1
  const plugins = require("./plugins");
2
+ const customTransform = require("./commit-transform");
2
3
 
3
- const transformCommitType = type => {
4
- const commitTypeMapping = {
5
- feat: "Features",
6
- fix: "Bug Fixes",
7
- perf: "Performance Improvements",
8
- revert: "Reverts",
9
- docs: "Documentation",
10
- style: "Styles",
11
- refactor: "Code Refactoring",
12
- test: "Tests",
13
- build: "Build System",
14
- ci: "Continuous Integration",
15
- chore: "Chores",
16
- default: "Miscellaneous"
17
- };
18
- return commitTypeMapping[type] || commitTypeMapping["default"];
19
- };
20
-
21
- const customTransform = (commit, context) => {
22
- const issues = [];
23
-
24
- commit.notes.forEach(note => {
25
- note.title = `BREAKING CHANGES`;
26
- });
27
-
28
- commit.type = transformCommitType(commit.type);
29
-
30
- if (commit.scope === "*") {
31
- commit.scope = "";
32
- }
33
-
34
- if (typeof commit.hash === `string`) {
35
- commit.shortHash = commit.hash.substring(0, 7);
36
- }
37
-
38
- if (typeof commit.subject === `string`) {
39
- let url = context.repository
40
- ? `${context.host}/${context.owner}/${context.repository}`
41
- : context.repoUrl;
42
- if (url) {
43
- url = `${url}/issues/`;
44
- // Issue URLs.
45
- commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
46
- issues.push(issue);
47
- return `[#${issue}](${url}${issue})`;
48
- });
49
- }
50
- if (context.host) {
51
- // User URLs.
52
- commit.subject = commit.subject.replace(
53
- /\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g,
54
- (_, username) => {
55
- if (username.includes("/")) {
56
- return `@${username}`;
57
- }
58
-
59
- return `[@${username}](${context.host}/${username})`;
60
- }
61
- );
62
- }
63
- }
64
-
65
- // remove references that already appear in the subject
66
- commit.references = commit.references.filter(reference => {
67
- if (issues.indexOf(reference.issue) === -1) {
68
- return true;
69
- }
70
-
71
- return false;
72
- });
73
-
74
- return commit;
75
- };
76
4
 
77
5
  module.exports = {
78
6
  releaseRules: plugins[0][1].releaseRules,
package/types.js ADDED
@@ -0,0 +1,123 @@
1
+ module.exports = {
2
+ maxSubjectLength: 72,
3
+ bodyLineLength: 100,
4
+ typesOrder: [
5
+ 'feat',
6
+ 'fix',
7
+ 'perf',
8
+ 'build',
9
+ 'refactor',
10
+ 'docs',
11
+ 'test',
12
+ 'ci',
13
+ 'chore',
14
+ 'style',
15
+ 'revert',
16
+ 'initial',
17
+ 'dependencies',
18
+ 'peerDependencies',
19
+ 'devDependencies',
20
+ 'metadata',
21
+ ],
22
+ types: {
23
+ feat: {
24
+ description: 'A new feature',
25
+ title: 'Features',
26
+ emoji: '✨',
27
+ changelog: true,
28
+ release: 'minor',
29
+ aliases: {initial: {description: 'Initial commit', title: 'Initial', emoji: '🎉'}},
30
+ },
31
+ fix: {
32
+ description: 'A bug fix',
33
+ title: 'Bug Fixes',
34
+ emoji: '🐛',
35
+ changelog: true,
36
+ release: 'patch',
37
+ aliases: {
38
+ dependencies: {description: 'Update dependency', title: 'Dependencies', emoji: '⬆️', scope: 'package'},
39
+ peerDependencies: {
40
+ description: 'Update peer dependency',
41
+ title: 'Peer dependencies',
42
+ emoji: '⬆️',
43
+ scope: 'package',
44
+ },
45
+ metadata: {description: 'Update metadata (package.json)', title: 'Metadata', emoji: '📦', scope: 'package'},
46
+ },
47
+ },
48
+ docs: {
49
+ description: 'Documentation only changes',
50
+ title: 'Documentation',
51
+ emoji: '📚',
52
+ changelog: true,
53
+ release: {scope: 'readme', release: 'patch'},
54
+ },
55
+ style: {
56
+ description:
57
+ 'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
58
+ title: 'Styles',
59
+ emoji: '💎',
60
+ changelog: true,
61
+ release: false,
62
+ },
63
+ refactor: {
64
+ description: 'A code change that neither fixes a bug nor adds a feature',
65
+ title: 'Code Refactoring',
66
+ emoji: '📦',
67
+ changelog: true,
68
+ release: false,
69
+ },
70
+ perf: {
71
+ description: 'A code change that improves performance',
72
+ title: 'Performance Improvements',
73
+ emoji: '🚀',
74
+ changelog: true,
75
+ release: 'patch',
76
+ },
77
+ test: {
78
+ description: 'Adding missing tests or correcting existing tests',
79
+ title: 'Tests',
80
+ emoji: '🚨',
81
+ changelog: true,
82
+ release: false,
83
+ },
84
+ build: {
85
+ description:
86
+ 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
87
+ title: 'Builds',
88
+ emoji: '🛠',
89
+ changelog: true,
90
+ release: 'patch',
91
+ },
92
+ ci: {
93
+ description:
94
+ 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
95
+ title: 'Continuous Integrations',
96
+ emoji: '⚙️',
97
+ changelog: true,
98
+ release: false,
99
+ },
100
+ chore: {
101
+ description: "Other changes that don't modify src or test files",
102
+ title: 'Chores',
103
+ emoji: '♻️',
104
+ changelog: true,
105
+ release: false,
106
+ aliases: {
107
+ devDependencies: {
108
+ description: 'Update dev dependencies',
109
+ title: 'Dev dependencies',
110
+ emoji: '⬆️',
111
+ scope: 'package',
112
+ },
113
+ },
114
+ },
115
+ revert: {
116
+ description: 'Reverts a previous commit',
117
+ title: 'Reverts',
118
+ emoji: '🗑',
119
+ changelog: true,
120
+ release: false,
121
+ },
122
+ },
123
+ };
package/CHANGELOG.md DELETED
@@ -1,132 +0,0 @@
1
- # [1.4.0](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.3.7...v1.4.0) (2019-11-26)
2
-
3
-
4
- ### Features
5
-
6
- * backwards compatibility for commits without keyword ([90deac9](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/90deac91d67dcbed0883f8619dd70b1927a37c88))
7
-
8
- ## [1.3.7](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.3.6...v1.3.7) (2019-11-03)
9
-
10
-
11
- ### Documentation
12
-
13
- * **install:** update install notes ([93d849d](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/93d849d072a29ea13f124975f7b5a0c75b937158))
14
-
15
- ## [1.3.6](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.3.5...v1.3.6) (2019-11-03)
16
-
17
-
18
- ### Documentation
19
-
20
- * **instructions:** update configuration instructions ([3c8b0fd](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/3c8b0fd9a4d96cc288e3195d00b11369bb6cc0f8))
21
-
22
- ## [1.3.5](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.3.4...v1.3.5) (2019-11-03)
23
-
24
-
25
- ### Code Refactoring
26
-
27
- * use object literal to transform commit type ([3b7ff9a](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/3b7ff9a6109de590a07392a70ac63880aad73a10))
28
-
29
- ## [1.3.4](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.3.3...v1.3.4) (2019-10-09)
30
-
31
-
32
- ### Bug Fixes
33
-
34
- * package.json & package-lock.json to reduce vulnerabilities ([b6c8ad193f17679d4307da4c63b0026b71ea6c91](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/b6c8ad193f17679d4307da4c63b0026b71ea6c91))
35
-
36
- ## [1.3.3](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.3.2...v1.3.3) (2019-10-05)
37
-
38
-
39
- ### Documentation
40
-
41
- * **readme:** update description, fix typos ([92f9b9fcb26d5747f728c267cb35c3ec3eeef435](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/92f9b9fcb26d5747f728c267cb35c3ec3eeef435))
42
-
43
- ## [1.3.2](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.3.1...v1.3.2) (2019-10-05)
44
-
45
-
46
- ### Documentation
47
-
48
- * **description:** update descriptions in package.json ([3521a76f84c61734a9172d1ca8032214b73cd54b](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/3521a76f84c61734a9172d1ca8032214b73cd54b))
49
-
50
- ## [1.3.1](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.3.0...v1.3.1) (2019-10-05)
51
-
52
-
53
- ### Documentation
54
-
55
- * **readme:** update descriptions, fix links ([7a54dcc529c107eda3388089e649254c494b9017](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/7a54dcc529c107eda3388089e649254c494b9017))
56
-
57
- # [1.3.0](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.2.1...v1.3.0) (2019-10-05)
58
-
59
-
60
- ### Features
61
-
62
- * **type:** add chore type ([3aaa92d076da1aa4a1a8c6b177c50a338ae6466e](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/3aaa92d076da1aa4a1a8c6b177c50a338ae6466e))
63
-
64
- ## [1.2.1](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.2.0...v1.2.1) (2019-10-04)
65
-
66
-
67
- ### Bug Fixes
68
-
69
- * **manifest:** add plugins.json to a bundle ([22c1a28db3a189d06a354c621e5b24c6df94f38c](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/22c1a28db3a189d06a354c621e5b24c6df94f38c))
70
-
71
- # [1.2.0](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.10...v1.2.0) (2019-10-04)
72
-
73
-
74
- ### Features
75
-
76
- * **release:** add custom release-notes generator ([ed4a8e567ec57cfed456be9af968d9918d6fe522](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/ed4a8e567ec57cfed456be9af968d9918d6fe522))
77
-
78
- ## [1.1.10](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.9...v1.1.10) (2019-09-29)
79
-
80
- ## [1.1.9](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.8...v1.1.9) (2019-09-29)
81
-
82
- ## [1.1.8](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.7...v1.1.8) (2019-09-29)
83
-
84
- ## [1.1.7](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.6...v1.1.7) (2019-09-29)
85
-
86
- ## [1.1.6](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.5...v1.1.6) (2019-09-29)
87
-
88
- ## [1.1.5](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.4...v1.1.5) (2019-09-26)
89
-
90
- ## [1.1.4](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.3...v1.1.4) (2019-09-26)
91
-
92
- ## [1.1.3](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.2...v1.1.3) (2019-09-26)
93
-
94
-
95
- ### Bug Fixes
96
-
97
- * **commit-message:** fix commit message: skip-ci ([cc7c983](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/cc7c983))
98
-
99
- ## [1.1.2](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.1...v1.1.2) (2019-09-26)
100
-
101
-
102
- ### Bug Fixes
103
-
104
- * **commit-message:** use release keyword ([a33577a](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/a33577a))
105
-
106
- ## [1.1.1](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.1.0...v1.1.1) (2019-09-26)
107
-
108
-
109
- ### Bug Fixes
110
-
111
- * **release:** change release message ([0109020](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/0109020))
112
-
113
- # [1.1.0](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.0.1...v1.1.0) (2019-09-26)
114
-
115
-
116
- ### Features
117
-
118
- * **file-format:** use json file instead of yaml ([acd3f8d](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/acd3f8d))
119
-
120
- ## [1.0.1](https://github.com/oleg-koval/semantic-release-npm-github-publish/compare/v1.0.0...v1.0.1) (2019-09-26)
121
-
122
-
123
- ### Bug Fixes
124
-
125
- * **releaserc:** remove unused fields ([24606ed](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/24606ed))
126
-
127
- # 1.0.0 (2019-09-26)
128
-
129
-
130
- ### Features
131
-
132
- * **init:** initial commit ([6fbca52](https://github.com/oleg-koval/semantic-release-npm-github-publish/commit/6fbca52))