semantic-release-openapi 2.1.0 → 2.2.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.
- package/README.md +3 -5
- package/package.json +5 -8
- package/prepare.d.ts +2 -2
- package/prepare.js +5 -3
- package/prepare.js.map +1 -1
- package/verifyConditions.d.ts +2 -2
- package/verifyConditions.js +5 -3
- package/verifyConditions.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# semantic-release-openapi
|
|
2
2
|
|
|
3
3
|
[][npm]
|
|
4
|
-
[][npm]
|
|
5
4
|
[](https://github.com/aensley/semantic-release-openapi/blob/main/LICENSE)
|
|
6
|
-
[](https://packagephobia.com/result?p=semantic-release-openapi)
|
|
6
|
+
[][npm]<br>
|
|
7
|
+
[][npm]
|
|
9
8
|
[](https://github.com/aensley/semantic-release-openapi/actions/workflows/ci.yml)
|
|
10
9
|
[][qltysh]
|
|
11
10
|
[][qltysh]
|
|
12
|
-
[][npm]
|
|
13
11
|
|
|
14
12
|
A Semantic Release plugin to update versions in OpenAPI / Swagger specification files.
|
|
15
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-release-openapi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A Semantic Release plugin to update versions in OpenAPI / Swagger specification files",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,14 +42,11 @@
|
|
|
42
42
|
"platform": "node",
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@semantic-release/error": "^4.0.0",
|
|
45
|
+
"fdir": "^6.5.0",
|
|
45
46
|
"fs-extra": "^11.3.5",
|
|
46
|
-
"
|
|
47
|
-
"replace-in-file": "^8.4.0",
|
|
48
|
-
"semantic-release": "^25.0.3"
|
|
47
|
+
"replace-in-file": "^8.4.0"
|
|
49
48
|
},
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
53
|
-
}
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"semantic-release": ">=20.0.0"
|
|
54
51
|
}
|
|
55
52
|
}
|
package/prepare.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ import PluginConfig from './@types/pluginConfig.js';
|
|
|
5
5
|
*
|
|
6
6
|
* @throws {SemanticReleaseError}
|
|
7
7
|
*/
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const prepare: ({ apiSpecFiles }: PluginConfig, { nextRelease, logger }: PrepareContext) => any;
|
|
9
|
+
export default prepare;
|
package/prepare.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import SemanticReleaseError from '@semantic-release/error';
|
|
2
2
|
import { readJsonSync, writeJsonSync } from 'fs-extra';
|
|
3
3
|
import { replaceInFileSync } from 'replace-in-file';
|
|
4
|
-
import {
|
|
4
|
+
import { fdir } from 'fdir';
|
|
5
5
|
/**
|
|
6
6
|
* Prepare the API Spec files
|
|
7
7
|
*
|
|
@@ -14,7 +14,8 @@ import { globSync } from 'glob';
|
|
|
14
14
|
const prepareApiSpecFiles = (apiSpecFiles, version, logger) => {
|
|
15
15
|
try {
|
|
16
16
|
apiSpecFiles.forEach((fileNameGlob) => {
|
|
17
|
-
|
|
17
|
+
// eslint-disable-next-line new-cap
|
|
18
|
+
const fileNames = new fdir().glob(fileNameGlob).withBasePath().crawl('.').sync();
|
|
18
19
|
fileNames.forEach((fileName) => {
|
|
19
20
|
let results;
|
|
20
21
|
if (fileName.split('.').pop() === 'json') {
|
|
@@ -70,11 +71,12 @@ const prepareApiSpecFileJson = (apiSpecFile, version) => {
|
|
|
70
71
|
*
|
|
71
72
|
* @throws {SemanticReleaseError}
|
|
72
73
|
*/
|
|
73
|
-
|
|
74
|
+
const prepare = ({ apiSpecFiles }, { nextRelease, logger }) => {
|
|
74
75
|
const version = nextRelease?.version ?? '';
|
|
75
76
|
if (version.length < 1) {
|
|
76
77
|
throw new SemanticReleaseError('Could not determine the version from semantic release.');
|
|
77
78
|
}
|
|
78
79
|
prepareApiSpecFiles(apiSpecFiles, version, logger);
|
|
79
80
|
};
|
|
81
|
+
export default prepare;
|
|
80
82
|
//# sourceMappingURL=prepare.js.map
|
package/prepare.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAGnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAGnD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B;;;;;;;;GAQG;AACH,MAAM,mBAAmB,GAAG,CAAC,YAAsB,EAAE,OAAe,EAAE,MAAgC,EAAO,EAAE;IAC7G,IAAI,CAAC;QACH,YAAY,CAAC,OAAO,CAAC,CAAC,YAAoB,EAAE,EAAE;YAC5C,mCAAmC;YACnC,MAAM,SAAS,GAAa,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAc,CAAA;YACtG,SAAS,CAAC,OAAO,CAAC,CAAC,QAAgB,EAAE,EAAE;gBACrC,IAAI,OAAiB,CAAA;gBACrB,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC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ACnD,OAAO,CAAC,WAAW,CAAC,CAAA;AACtB,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,OAAO,GAAG,CAAC,EAAE,YAAY,EAAgB,EAAE,EAAE,WAAW,EAAE,MAAM,EAAkB,EAAO,EAAE;IAC/F,MAAM,OAAO,GAAG,WAAW,EAAE,OAAO,IAAI,EAAE,CAAA;IAC1C,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,oBAAoB,CAAC,wDAAwD,CAAC,CAAA;IAC1F,CAAC;IAED,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AACpD,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
|
package/verifyConditions.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ import PluginConfig from './@types/pluginConfig.js';
|
|
|
4
4
|
*
|
|
5
5
|
* @throws {SemanticReleaseError}
|
|
6
6
|
*/
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
7
|
+
declare const verifyConditions: ({ apiSpecFiles }: PluginConfig) => Promise<any>;
|
|
8
|
+
export default verifyConditions;
|
package/verifyConditions.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import SemanticReleaseError from '@semantic-release/error';
|
|
2
|
-
import {
|
|
2
|
+
import { fdir } from 'fdir';
|
|
3
3
|
import { extname } from 'node:path';
|
|
4
4
|
/**
|
|
5
5
|
* verifyConditions hook for semantic release
|
|
6
6
|
*
|
|
7
7
|
* @throws {SemanticReleaseError}
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
const verifyConditions = async ({ apiSpecFiles }) => {
|
|
10
10
|
if (apiSpecFiles.length < 1) {
|
|
11
11
|
throw new SemanticReleaseError('Option "apiSpecFiles" was not included in the plugin config. See the README for instructions.', 'ENOAPISPECFILES');
|
|
12
12
|
}
|
|
13
13
|
const expectedExts = ['json', 'yaml', 'yml'];
|
|
14
14
|
let specFilesFound = false;
|
|
15
15
|
apiSpecFiles.forEach((fileNameGlob) => {
|
|
16
|
-
|
|
16
|
+
// eslint-disable-next-line new-cap
|
|
17
|
+
const fileNames = new fdir().glob(fileNameGlob).withBasePath().crawl('.').sync();
|
|
17
18
|
if (fileNames.length > 0) {
|
|
18
19
|
specFilesFound = true;
|
|
19
20
|
fileNames.forEach((fileName) => {
|
|
@@ -27,4 +28,5 @@ export default async ({ apiSpecFiles }) => {
|
|
|
27
28
|
throw new SemanticReleaseError('No files match the paths in "apiSpecFiles". Check your plugin config and try again.', 'EINVALIDAPISPECFILES');
|
|
28
29
|
}
|
|
29
30
|
};
|
|
31
|
+
export default verifyConditions;
|
|
30
32
|
//# sourceMappingURL=verifyConditions.js.map
|
package/verifyConditions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyConditions.js","sourceRoot":"","sources":["../src/verifyConditions.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"verifyConditions.js","sourceRoot":"","sources":["../src/verifyConditions.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,KAAK,EAAE,EAAE,YAAY,EAAgB,EAAgB,EAAE;IAC9E,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,oBAAoB,CAC5B,+FAA+F,EAC/F,iBAAiB,CAClB,CAAA;IACH,CAAC;IAED,MAAM,YAAY,GAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IACtD,IAAI,cAAc,GAAY,KAAK,CAAA;IACnC,YAAY,CAAC,OAAO,CAAC,CAAC,YAAoB,EAAE,EAA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