@gls_spain/gps-common 34.9.6 → 34.9.7
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 +9 -2
- package/README.md +1 -1
- package/open-api-spec/index.js +4 -2
- package/package.json +9 -5
- package/scripts/build-documentation.js +4 -5
- package/scripts/build-json-schemas.js +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
## [34.9.
|
|
1
|
+
## [34.9.7](https://github.com/GLS-Spain/gps-common/compare/v34.9.6...v34.9.7) (2021-03-18)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* update dependencias and generate documentation ([45ef47c](https://github.com/GLS-Spain/gps-common/commit/45ef47ca8bd0474576fcf6aab2b4ab0704c4dd48))
|
|
7
7
|
|
|
8
|
+
## [34.9.6](https://github.com/GLS-Spain/gps-common/compare/v34.9.5...v34.9.6) (2021-03-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add to definition schema observation field ([fe1b5b9](https://github.com/GLS-Spain/gps-common/commit/fe1b5b961a80b2a73cba39b1d1ffe18bdeecde91))
|
|
14
|
+
|
|
8
15
|
## [34.9.5](https://github.com/GLS-Spain/gps-common/compare/v34.9.4...v34.9.5) (2021-03-11)
|
|
9
16
|
|
|
10
17
|
|
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ console.log(openApiSpec);
|
|
|
81
81
|
info: {
|
|
82
82
|
title: 'GLS Parcel Shops API',
|
|
83
83
|
description: 'This is the API backend for the GLS Parcel Shops project.',
|
|
84
|
-
contact: { name: '
|
|
84
|
+
contact: { name: 'GLS Innovation', email: 'gls-innovation@gls-spain.es' },
|
|
85
85
|
license: { name: 'NO LICENSE', url: 'https://choosealicense.com/no-permission/' },
|
|
86
86
|
version: 'v1.0.0',
|
|
87
87
|
},
|
package/open-api-spec/index.js
CHANGED
|
@@ -193,6 +193,8 @@ const {
|
|
|
193
193
|
downloadSaleLabelResponse,
|
|
194
194
|
} = require('../schemas/definitions/sales');
|
|
195
195
|
|
|
196
|
+
const pkg = require('../package.json');
|
|
197
|
+
|
|
196
198
|
const openApiSpec = { openapi: '3.0.2' };
|
|
197
199
|
|
|
198
200
|
openApiSpec.info = {
|
|
@@ -201,9 +203,9 @@ openApiSpec.info = {
|
|
|
201
203
|
This API is versioned using [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) and follows the semver specification.
|
|
202
204
|
|
|
203
205
|
You can see what's new and the latest changes to the API in the [changelog](/help/changelog).`,
|
|
204
|
-
contact: { name: '
|
|
206
|
+
contact: { name: 'GLS Innovation', email: 'gls-innovation@gls-spain.es' },
|
|
205
207
|
license: { name: 'NO LICENSE', url: 'https://choosealicense.com/no-permission/' },
|
|
206
|
-
version:
|
|
208
|
+
version: pkg.version,
|
|
207
209
|
};
|
|
208
210
|
|
|
209
211
|
openApiSpec.servers = [
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gls_spain/gps-common",
|
|
3
|
-
"version": "34.9.
|
|
3
|
+
"version": "34.9.7",
|
|
4
4
|
"description": "Errors, schemas and documentation for the Parcel Shops project",
|
|
5
|
-
"main": "index.js",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"gls"
|
|
8
7
|
],
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"private": false,
|
|
9
10
|
"author": {
|
|
10
|
-
"name": "
|
|
11
|
+
"name": "GLS Innovation"
|
|
11
12
|
},
|
|
12
13
|
"license": "UNLICENSED",
|
|
13
14
|
"homepage": "https://github.com/GLS-Spain/gps-common",
|
|
@@ -37,7 +38,8 @@
|
|
|
37
38
|
"husky": "^4.3.8",
|
|
38
39
|
"jest": "^25.5.4",
|
|
39
40
|
"prettier": "^1.19.1",
|
|
40
|
-
"redoc-cli": "^0.
|
|
41
|
+
"redoc-cli": "^0.10.4",
|
|
42
|
+
"rimraf": "^2.6.3",
|
|
41
43
|
"semantic-release": "^17.4.1"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
@@ -55,7 +57,9 @@
|
|
|
55
57
|
"semantic-release": "semantic-release",
|
|
56
58
|
"test": "jest",
|
|
57
59
|
"build-json-schemas": "node scripts/build-json-schemas.js --output=build/schemas",
|
|
58
|
-
"build-documentation": "node scripts/build-documentation.js --output=build/documentation/documentation.html"
|
|
60
|
+
"build-documentation": "node scripts/build-documentation.js --output=build/documentation/documentation.html",
|
|
61
|
+
"__build-documentation": "redoc-cli bundle build/open-api-definition.json --output=build/documentation/documentation.html --options.noAutoAuth --options.hideDownloadButton --options.menuToggle=true",
|
|
62
|
+
"generate-documentation": "rimraf build && npm run build-json-schemas && redoc-cli bundle build/open-api-definition.json --output=build/documentation/documentation.html --options.noAutoAuth --options.hideDownloadButton --options.menuToggle=true"
|
|
59
63
|
},
|
|
60
64
|
"bin": {
|
|
61
65
|
"build-gps-schemas": "scripts/build-json-schemas.js",
|
|
@@ -19,8 +19,8 @@ const { argv } = yargs
|
|
|
19
19
|
const logger = winston.createLogger({ transports: new ColorConsoleTransport() });
|
|
20
20
|
|
|
21
21
|
async function buildDocumentation() {
|
|
22
|
-
const
|
|
23
|
-
const jsonPath = path.resolve(
|
|
22
|
+
const outDirPath = path.resolve(__dirname, '../build');;
|
|
23
|
+
const jsonPath = path.resolve(outDirPath, 'open-api-definition.json');
|
|
24
24
|
|
|
25
25
|
logger.info(`output file is: ${argv.output}`);
|
|
26
26
|
logger.info('creating output directory...');
|
|
@@ -28,10 +28,9 @@ async function buildDocumentation() {
|
|
|
28
28
|
|
|
29
29
|
logger.info('writing html file...');
|
|
30
30
|
fs.writeFileSync(jsonPath, JSON.stringify(openApiSpec, null, 2));
|
|
31
|
-
const redocCli = require.resolve('redoc-cli');
|
|
32
31
|
await exec(
|
|
33
|
-
`
|
|
34
|
-
);
|
|
32
|
+
`redoc-cli bundle ${jsonPath} --output ${argv.output} --options.noAutoAuth --options.hideDownloadButton --options.menuToggle=true --title="GLS Parcel Shops API"`,
|
|
33
|
+
).catch(err => logger.warn(JSON.stringify(err)));
|
|
35
34
|
logger.info('done');
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -7,6 +7,7 @@ const kebabCase = require('lodash/kebabCase');
|
|
|
7
7
|
const yargs = require('yargs');
|
|
8
8
|
const { ColorConsoleTransport } = require('@gls_spain/winston-transports');
|
|
9
9
|
const schemas = require('../schemas');
|
|
10
|
+
const openapispec = require('../open-api-spec');
|
|
10
11
|
|
|
11
12
|
const { argv } = yargs
|
|
12
13
|
.option('output', { string: true, required: true, describe: 'directory path to put the json schemas in' })
|
|
@@ -17,16 +18,23 @@ const logger = winston.createLogger({ transports: new ColorConsoleTransport() })
|
|
|
17
18
|
async function buildJsonSchemas() {
|
|
18
19
|
const schemasArray = Object.values(schemas);
|
|
19
20
|
logger.info(`found ${schemasArray.length} schemas`);
|
|
20
|
-
|
|
21
|
-
const outDirPath = path.resolve(
|
|
21
|
+
logger.info(`Path: ${path.resolve(__dirname, '../build')}`)
|
|
22
|
+
const outDirPath = path.resolve(__dirname, '../build');
|
|
22
23
|
logger.info(`output directory is: ${outDirPath}`);
|
|
23
24
|
|
|
24
25
|
logger.info('creating output directory...');
|
|
26
|
+
|
|
25
27
|
fs.mkdirSync(outDirPath, { recursive: true });
|
|
28
|
+
|
|
26
29
|
logger.info(`writing ${schemasArray.length} new files...`);
|
|
30
|
+
|
|
27
31
|
schemasArray.forEach(schema =>
|
|
28
32
|
fs.writeFileSync(path.resolve(outDirPath, `${kebabCase(schema.$id)}.json`), JSON.stringify(schema, null, 2)),
|
|
29
33
|
);
|
|
34
|
+
|
|
35
|
+
logger.info('Writing open-api-denition file');
|
|
36
|
+
fs.writeFileSync(path.resolve(outDirPath, `open-api-definition.json`), JSON.stringify(openapispec, null, 2))
|
|
37
|
+
|
|
30
38
|
logger.info('done');
|
|
31
39
|
}
|
|
32
40
|
|