ag-common 0.0.360 → 0.0.362
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.
|
@@ -8,6 +8,7 @@ const pathV = require('path');
|
|
|
8
8
|
const cwd = process.cwd();
|
|
9
9
|
const resolvePath = (p) => pathV.resolve(cwd, p);
|
|
10
10
|
function run() {
|
|
11
|
+
console.log('running openapi postfixes');
|
|
11
12
|
const files = fs
|
|
12
13
|
.readdirSync(resolvePath('./dist/api'))
|
|
13
14
|
.filter((r) => r.endsWith('.js') || r.endsWith('.d.ts'))
|
|
@@ -63,11 +63,21 @@ function generateJs() {
|
|
|
63
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
64
|
try {
|
|
65
65
|
console.log('generating openapi ts');
|
|
66
|
-
|
|
66
|
+
var p = resolvePath('./openapi.yml');
|
|
67
|
+
if (!fs.existsSync(p)) {
|
|
68
|
+
p = resolvePath('./openapi/index.yml');
|
|
69
|
+
process.chdir(resolvePath('./openapi'));
|
|
70
|
+
}
|
|
71
|
+
if (!fs.existsSync(p)) {
|
|
72
|
+
console.error('cant generate swagger, expecting openapi.yml or openapi/index.yml');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const yml = load(fs.readFileSync(p, 'utf8'));
|
|
67
76
|
// eslint-disable-next-line
|
|
68
77
|
const schema = yield SwaggerParser.validate(yml);
|
|
69
78
|
const content = `var ret=${JSON.stringify(schema)};\nmodule.exports.default=ret`;
|
|
70
79
|
fs.writeFileSync(resolvePath('./openapi.generated.js'), content);
|
|
80
|
+
console.log('generated');
|
|
71
81
|
}
|
|
72
82
|
catch (e) {
|
|
73
83
|
// eslint-disable-next-line no-console
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.362",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"styled-components": ">=5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@babel/core": "7.20.
|
|
35
|
+
"@babel/core": "7.20.5",
|
|
36
36
|
"@storybook/addon-actions": "6.5.13",
|
|
37
37
|
"@storybook/addon-docs": "6.5.13",
|
|
38
38
|
"@storybook/addon-essentials": "6.5.13",
|