@voxgig/create-sdkgen 0.0.3 → 0.0.6
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/bin/voxgig-create-sdkgen +196 -0
- package/dist/create-sdkgen.d.ts +11 -8
- package/dist/create-sdkgen.js +61 -63
- package/dist/create-sdkgen.js.map +1 -1
- package/dist/standard/ModelSdk.js +8 -61
- package/dist/standard/ModelSdk.js.map +1 -1
- package/dist/standard/Root.js +58 -57
- package/dist/standard/Root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -10
- package/src/create-sdkgen.ts +56 -74
- package/src/standard/ModelSdk.ts +9 -71
- package/src/standard/Root.ts +26 -68
- package/bin/run-create-sdkgen.js +0 -269
- package/bin/run-create-sdkgen.js~ +0 -1
- package/src/standard/ModelSdk.ts~ +0 -1
- package/src/standard/Root.ts~ +0 -3
- package/src/utility.ts +0 -8
- package/tm/standard/.env.local +0 -2
- package/tm/standard/build/sdk.js +0 -25
- package/tm/standard/def/DEFINITION.md +0 -2
- package/tm/standard/model/.model-config/model-config.jsonic +0 -13
- package/tm/standard/model/go.jsonic +0 -6
- package/tm/standard/model/js.jsonic +0 -6
- package/tm/standard/model/php.jsonic +0 -6
- package/tm/standard/model/py.jsonic +0 -7
- package/tm/standard/model/rb.jsonic +0 -6
- package/tm/standard/model/sdk.jsonic.off +0 -60
- package/tm/standard/package.json +0 -30
- package/tm/standard/src/Root.ts +0 -60
- package/tm/standard/src/go/Entity_go.ts +0 -226
- package/tm/standard/src/go/MainEntity_go.ts +0 -26
- package/tm/standard/src/go/Main_go.ts +0 -168
- package/tm/standard/src/go/Quick_go.ts +0 -108
- package/tm/standard/src/go/ReadmeInstall_go.ts +0 -19
- package/tm/standard/src/go/ReadmeQuick_go.ts +0 -45
- package/tm/standard/src/go/TestAcceptEntity_go.ts +0 -219
- package/tm/standard/src/go/TestAccept_go.ts +0 -38
- package/tm/standard/src/go/TestEntity_go.ts +0 -79
- package/tm/standard/src/go/TestMain_go.ts +0 -61
- package/tm/standard/src/go/Test_go.ts +0 -20
- package/tm/standard/src/js/Entity_js.ts +0 -135
- package/tm/standard/src/js/MainEntity_js.ts +0 -22
- package/tm/standard/src/js/Main_js.ts +0 -128
- package/tm/standard/src/js/Quick_js.ts +0 -72
- package/tm/standard/src/js/ReadmeInstall_js.ts +0 -19
- package/tm/standard/src/js/ReadmeQuick_js.ts +0 -27
- package/tm/standard/src/js/TestAcceptEntity_js.ts +0 -101
- package/tm/standard/src/js/TestAccept_js.ts +0 -60
- package/tm/standard/src/js/TestEntity_js.ts +0 -24
- package/tm/standard/src/js/TestMain_js.ts +0 -123
- package/tm/standard/src/js/Test_js.ts +0 -24
- package/tm/standard/src/php/Entity_php.ts +0 -97
- package/tm/standard/src/php/MainEntity_php.ts +0 -43
- package/tm/standard/src/php/Main_php.ts +0 -50
- package/tm/standard/src/php/Quick_php.ts +0 -59
- package/tm/standard/src/php/TestAcceptEntity_php.ts +0 -81
- package/tm/standard/src/php/TestAccept_php.ts +0 -33
- package/tm/standard/src/php/TestEntity_php.ts +0 -64
- package/tm/standard/src/php/TestMain_php.ts +0 -120
- package/tm/standard/src/php/Test_php.ts +0 -21
- package/tm/standard/src/py/Entity_py.ts +0 -98
- package/tm/standard/src/py/MainEntity_py.ts +0 -19
- package/tm/standard/src/py/Main_py.ts +0 -211
- package/tm/standard/src/py/Quick_py.ts +0 -133
- package/tm/standard/src/py/TestAcceptEntity_py.ts +0 -47
- package/tm/standard/src/py/TestAccept_py.ts +0 -77
- package/tm/standard/src/py/TestEntity_py.ts +0 -50
- package/tm/standard/src/py/TestMain_py.ts +0 -103
- package/tm/standard/src/py/Test_py.ts +0 -28
- package/tm/standard/src/rb/Client_rb.ts +0 -142
- package/tm/standard/src/rb/Entity_rb.ts +0 -153
- package/tm/standard/src/rb/Error_rb.ts +0 -56
- package/tm/standard/src/rb/MainEntity_rb.ts +0 -16
- package/tm/standard/src/rb/Main_rb.ts +0 -55
- package/tm/standard/src/rb/Quick_rb.ts +0 -65
- package/tm/standard/src/rb/ReadmeInstall_rb.ts +0 -19
- package/tm/standard/src/rb/ReadmeQuick_rb.ts +0 -30
- package/tm/standard/src/rb/TestAcceptEntity_rb.ts +0 -83
- package/tm/standard/src/rb/TestAccept_rb.ts +0 -45
- package/tm/standard/src/rb/TestEntity_rb.ts +0 -82
- package/tm/standard/src/rb/TestMain_rb.ts +0 -67
- package/tm/standard/src/rb/Test_rb.ts +0 -27
- package/tm/standard/src/tsconfig.json +0 -15
- package/tm/standard/tm/go/.env.example +0 -2
- package/tm/standard/tm/go/LICENSE +0 -22
- package/tm/standard/tm/go/go.mod +0 -5
- package/tm/standard/tm/go/go.sum +0 -2
- package/tm/standard/tm/js/LICENSE +0 -22
- package/tm/standard/tm/js/package.json +0 -17
- package/tm/standard/tm/php/LICENSE +0 -22
- package/tm/standard/tm/py/LICENSE +0 -22
- package/tm/standard/tm/py/MANIFEST.in +0 -4
- package/tm/standard/tm/py/Makefile +0 -14
- package/tm/standard/tm/py/pyproject.toml +0 -4
- package/tm/standard/tm/py/pytest.ini +0 -3
- package/tm/standard/tm/py/requirements.txt +0 -4
- package/tm/standard/tm/py/setup.cfg +0 -2
- package/tm/standard/tm/py/setup.py +0 -82
- package/tm/standard/tm/rb/.rspec +0 -1
- package/tm/standard/tm/rb/Gemfile +0 -21
- package/tm/standard/tm/rb/LICENSE +0 -22
- package/tm/standard/tm/rb/Rakefile +0 -6
- package/tm/standard/tm/rb/spec/spec_helper.rb +0 -22
- package/tm/standard/tm/rb/tm.gemspec +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voxgig/create-sdkgen",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"main": "dist/create-sdkgen.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"types": "dist/create-sdkgen.d.ts",
|
|
@@ -17,13 +17,15 @@
|
|
|
17
17
|
"url": "git://github.com/voxgig/create-sdkgen.git"
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
|
-
"create-sdkgen": "bin/
|
|
20
|
+
"create-sdkgen": "bin/voxgig-create-sdkgen.js"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"test": "node --enable-source-maps --test dist-test",
|
|
24
24
|
"test-some": "node --enable-source-maps --test-name-pattern=\"$npm_config_pattern\" --test dist-test",
|
|
25
25
|
"watch": "tsc --build src test -w",
|
|
26
26
|
"build": "tsc --build src test",
|
|
27
|
+
"test-model": "voxgig-model project/.sdk/test/test.jsonic",
|
|
28
|
+
"test-model-watch": "voxgig-model -w project/.sdk/test/test.jsonic",
|
|
27
29
|
"clean": "rm -rf node_modules yarn.lock package-lock.json",
|
|
28
30
|
"reset": "npm run clean && npm i && npm run build && npm test",
|
|
29
31
|
"repo-tag": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo TAG: v$REPO_VERSION && git commit -a -m v$REPO_VERSION && git push && git tag v$REPO_VERSION && git push --tags;",
|
|
@@ -40,15 +42,16 @@
|
|
|
40
42
|
],
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"@hapi/code": "^9.0.3",
|
|
43
|
-
"@types/node": "22.
|
|
44
|
-
"esbuild": "^0.
|
|
45
|
-
"memfs": "^4.
|
|
46
|
-
"typescript": "^5.
|
|
45
|
+
"@types/node": "22.15.12",
|
|
46
|
+
"esbuild": "^0.25.4",
|
|
47
|
+
"memfs": "^4.17.1",
|
|
48
|
+
"typescript": "^5.8.3"
|
|
47
49
|
},
|
|
48
50
|
"dependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
51
|
+
"@voxgig/util": "^0.0.10",
|
|
52
|
+
"aontu": "^0.28.0",
|
|
53
|
+
"chokidar": "^4.0.3",
|
|
54
|
+
"gubu": "^9.0.0",
|
|
55
|
+
"jostraca": "^0.16.2"
|
|
53
56
|
}
|
|
54
57
|
}
|
package/src/create-sdkgen.ts
CHANGED
|
@@ -1,120 +1,102 @@
|
|
|
1
1
|
/* Copyright (c) 2024 Richard Rodger, MIT License */
|
|
2
2
|
|
|
3
3
|
import * as Fs from 'node:fs'
|
|
4
|
+
import Path from 'node:path'
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { prettyPino, Pino } from '@voxgig/util'
|
|
6
7
|
|
|
7
8
|
import * as JostracaModule from 'jostraca'
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
type FullCreateSdkGenOptions = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
rootpath: string
|
|
13
|
+
fs?: any
|
|
14
|
+
debug?: boolean | string
|
|
15
|
+
pino?: ReturnType<typeof Pino>
|
|
16
|
+
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
type CreateSdkGenOptions = Partial<FullCreateSdkGenOptions>
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
type GenerateSpec = {
|
|
23
|
+
name: string // Name of SDK project.
|
|
24
|
+
def: string // Path to OpenAPI definition file, copied into SDK project.
|
|
25
|
+
root: string // Path to Root template component.
|
|
26
|
+
}
|
|
23
27
|
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
const fs = opts.fs || Fs
|
|
27
|
-
const folder = opts.folder || '.'
|
|
28
|
-
const jostraca = Jostraca()
|
|
29
|
-
const rootpath = opts.rootpath as string
|
|
29
|
+
const { each, names, Jostraca } = JostracaModule
|
|
30
30
|
|
|
31
|
-
async function generate(spec: any) {
|
|
32
|
-
// console.log('CreateSdkGen.generate', spec)
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
function CreateSdkGen(opts: FullCreateSdkGenOptions) {
|
|
33
|
+
const fs = opts.fs || Fs
|
|
34
|
+
const pino = prettyPino('create', opts)
|
|
35
|
+
const log = pino.child({ cmp: 'create' })
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
const jostraca = Jostraca()
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
const
|
|
39
|
+
async function generate(spec: GenerateSpec) {
|
|
40
|
+
const start = Date.now()
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
catch (err: any) {
|
|
45
|
-
console.log('CREATE SDKGEN ERROR: ', err)
|
|
46
|
-
throw err
|
|
47
|
-
}
|
|
48
|
-
}
|
|
42
|
+
log.info({ point: 'generate-start', start })
|
|
43
|
+
log.debug({ point: 'generate-spec', spec, note: JSON.stringify(spec, null, 2) })
|
|
49
44
|
|
|
45
|
+
const rootModule: any = require(spec.root)
|
|
46
|
+
const Root = rootModule.Root
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
let last_change_time = 0
|
|
48
|
+
const name = spec.name
|
|
49
|
+
spec.def = (null == spec.def || '' === spec.def) ? name + '-openapi3.yml' : spec.def
|
|
54
50
|
|
|
55
|
-
|
|
51
|
+
const folder = Path.join(process.cwd(), name + (name.endsWith('-sdk') ? '' : '-sdk'))
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const opts = {
|
|
54
|
+
fs: () => fs,
|
|
55
|
+
folder,
|
|
56
|
+
log: log.child({ cmp: 'jostraca' }),
|
|
57
|
+
meta: { spec },
|
|
58
|
+
existing: {
|
|
59
|
+
// write: false,
|
|
60
|
+
// present: true,
|
|
61
|
+
merge: true
|
|
62
|
+
}
|
|
63
|
+
}
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
const model = {
|
|
66
|
+
name,
|
|
67
|
+
year: new Date().getFullYear(),
|
|
68
|
+
}
|
|
61
69
|
|
|
62
|
-
|
|
63
|
-
last_change_time = Date.now()
|
|
64
|
-
generate(spec)
|
|
65
|
-
}
|
|
66
|
-
})
|
|
70
|
+
names(model, model.name)
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
.map((wf: string) => (__dirname + '/' + wf))
|
|
70
|
-
// .map((wf: string) => (console.log(wf), wf))
|
|
71
|
-
.map((wf: string) => fsw.add(wf))
|
|
72
|
+
log.debug({ point: 'generate-model', model, note: JSON.stringify(model, null, 2) })
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
}
|
|
74
|
+
const info = await jostraca.generate(opts, () => Root({ model, spec }))
|
|
75
75
|
|
|
76
|
+
logfiles(info, log)
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
if (rootpath) {
|
|
79
|
-
clearRequire(rootpath)
|
|
80
|
-
}
|
|
78
|
+
log.info({ point: 'generate-end' })
|
|
81
79
|
}
|
|
82
80
|
|
|
83
|
-
|
|
84
81
|
return {
|
|
85
82
|
generate,
|
|
86
|
-
watch,
|
|
87
83
|
}
|
|
88
84
|
|
|
89
85
|
}
|
|
90
86
|
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
let filePath = require.resolve(path)
|
|
95
|
-
|
|
96
|
-
if (require.cache[filePath]) {
|
|
97
|
-
const children = require.cache[filePath].children.map(child => child.id)
|
|
98
|
-
|
|
99
|
-
// Delete module from cache
|
|
100
|
-
delete require.cache[filePath]
|
|
101
|
-
|
|
102
|
-
for (const id of children) {
|
|
103
|
-
clearRequire(id)
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
88
|
+
function logfiles(info: any, log: ReturnType<typeof Pino>) {
|
|
89
|
+
const cwd = process.cwd()
|
|
107
90
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
91
|
+
;['preserve', 'present', 'merge'].map(action => {
|
|
92
|
+
let entries = info.file[action]
|
|
93
|
+
if (0 < entries.length) {
|
|
94
|
+
log.info({
|
|
95
|
+
point: 'file-' + action, entries,
|
|
96
|
+
note: '\n' + entries.map((n: any) => n.path.replace(cwd, '.')).join('\n')
|
|
97
|
+
})
|
|
114
98
|
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
99
|
+
})
|
|
118
100
|
}
|
|
119
101
|
|
|
120
102
|
|
package/src/standard/ModelSdk.ts
CHANGED
|
@@ -1,87 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
import {
|
|
3
|
-
names,
|
|
4
3
|
cmp,
|
|
5
|
-
each,
|
|
6
|
-
|
|
7
|
-
Project,
|
|
8
|
-
Folder,
|
|
9
|
-
Copy,
|
|
10
4
|
File,
|
|
11
|
-
|
|
5
|
+
Fragment,
|
|
12
6
|
|
|
13
7
|
} from 'jostraca'
|
|
14
8
|
|
|
15
9
|
|
|
16
10
|
|
|
17
11
|
const ModelSdk = cmp(function ModelSdk(props: any) {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// console.log('ModelSdk 2', model)
|
|
22
|
-
|
|
23
|
-
// TODO: use apidef
|
|
24
|
-
// const def = ctx$.fs.readFileSync(model.def.filepath)
|
|
12
|
+
const { spec } = props
|
|
25
13
|
|
|
26
14
|
|
|
27
15
|
File({ name: 'sdk.jsonic' }, () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
main: sdk: build: js: @"js.jsonic"
|
|
37
|
-
|
|
38
|
-
main: sdk: build: rb: @"rb.jsonic"
|
|
39
|
-
|
|
40
|
-
main: sdk: build: py: @"py.jsonic"
|
|
41
|
-
|
|
42
|
-
main: sdk: build: php: @"php.jsonic"
|
|
43
|
-
|
|
44
|
-
main: sdk: build: go: @"go.jsonic"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
main: sdk: test: quick: entity: name: q
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
main: sdk: entity: $.main.api.entity
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
main: sdk: entity: &: {
|
|
55
|
-
name: .$KEY
|
|
56
|
-
publish: *true | boolean
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
main: sdk: options: &: {
|
|
62
|
-
name: .$KEY
|
|
63
|
-
publish: *true | boolean
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
main: sdk: options: {
|
|
68
|
-
|
|
69
|
-
endpoint: {
|
|
70
|
-
kind: *String | string
|
|
71
|
-
short: "${model.Name} API URL"
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
apikey: {
|
|
75
|
-
kind: *String | string
|
|
76
|
-
short: "${model.Name} API Key"
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
fetch: {
|
|
80
|
-
kind: *Any | string
|
|
81
|
-
publish: false
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
`)
|
|
16
|
+
Fragment({
|
|
17
|
+
from: __dirname + '/../../project/.sdk/model/sdk.fragment.jsonic',
|
|
18
|
+
replace: {
|
|
19
|
+
NAME: spec.name,
|
|
20
|
+
DEF: spec.def,
|
|
21
|
+
}
|
|
22
|
+
})
|
|
85
23
|
})
|
|
86
24
|
|
|
87
25
|
})
|
package/src/standard/Root.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import Path from 'node:path'
|
|
4
|
-
|
|
4
|
+
import * as Fs from 'node:fs'
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
names,
|
|
8
8
|
cmp,
|
|
9
|
-
each,
|
|
10
9
|
|
|
11
10
|
Project,
|
|
12
11
|
Folder,
|
|
@@ -20,85 +19,44 @@ import {
|
|
|
20
19
|
import { ModelSdk } from './ModelSdk'
|
|
21
20
|
|
|
22
21
|
|
|
22
|
+
// TODO: rename to RootSdk
|
|
23
23
|
const Root = cmp(function Root(props: any) {
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
const { folder, meta } = ctx$
|
|
27
|
-
const { spec } = meta
|
|
28
|
-
|
|
29
|
-
console.log('Root 5')
|
|
30
|
-
|
|
31
|
-
// console.log('SPEC', spec)
|
|
32
|
-
|
|
33
|
-
names(model, model.name)
|
|
24
|
+
const { ctx$, ctx$: { folder }, spec, model } = props
|
|
34
25
|
|
|
35
|
-
//
|
|
36
|
-
|
|
26
|
+
// TODO: move to @voxgig/util as duplicated
|
|
27
|
+
model.const = { name: model.name }
|
|
28
|
+
names(model.const, model.name)
|
|
29
|
+
model.const.year = new Date().getFullYear()
|
|
37
30
|
|
|
38
31
|
ctx$.model = model
|
|
39
32
|
|
|
40
|
-
/*
|
|
41
|
-
let createInfo = { exclude: [], last: Number.MAX_SAFE_INTEGER }
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
createInfo = JSON.parse(ctx$.fs.readFileSync(
|
|
46
|
-
Path.join(folder, '.voxgig', 'create-sdkgen.json'), 'utf8'))
|
|
47
|
-
}
|
|
48
|
-
catch (err: any) {
|
|
49
|
-
console.log(err)
|
|
50
|
-
// TODO: file not foound ignored, handle others!
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
ctx$.info = createInfo
|
|
54
|
-
|
|
55
|
-
console.log('INFO', ctx$.info)
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
33
|
Project({ folder }, () => {
|
|
34
|
+
Copy({
|
|
35
|
+
from: __dirname + '/../../project',
|
|
36
|
+
})
|
|
59
37
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// File({ name: 'foo.txt' }, () => {
|
|
65
|
-
// Content('FOO')
|
|
66
|
-
// })
|
|
67
|
-
|
|
68
|
-
// console.log('FOLDER', folder)
|
|
69
|
-
Copy({ from: __dirname + '/../../tm/standard' })
|
|
38
|
+
const origdef = spec.def
|
|
39
|
+
const projdef = Path.basename(origdef)
|
|
40
|
+
spec.def = projdef
|
|
70
41
|
|
|
71
|
-
|
|
72
|
-
if (null != def && '' !== def) {
|
|
42
|
+
Folder({ name: '.sdk' }, () => {
|
|
73
43
|
Folder({ name: 'def' }, () => {
|
|
74
|
-
|
|
44
|
+
if (Fs.existsSync(origdef)) {
|
|
45
|
+
Copy({ from: origdef, to: projdef })
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
File({ name: projdef }, () => {
|
|
49
|
+
Content('# OpenAPI Definition')
|
|
50
|
+
})
|
|
51
|
+
}
|
|
75
52
|
})
|
|
76
|
-
}
|
|
77
53
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
ModelSdk({})
|
|
54
|
+
Folder({ name: 'model' }, () => {
|
|
55
|
+
ModelSdk({ spec })
|
|
56
|
+
})
|
|
82
57
|
})
|
|
83
|
-
})
|
|
84
58
|
|
|
85
|
-
|
|
86
|
-
// TODO: need mechanism to ensure this is last
|
|
87
|
-
setTimeout(() => {
|
|
88
|
-
try {
|
|
89
|
-
const info = {
|
|
90
|
-
last: Date.now(),
|
|
91
|
-
exclude: ctx$.info.exclude,
|
|
92
|
-
}
|
|
93
|
-
ctx$.fs.writeFileSync(Path.join(folder, '.voxgig', 'create-sdkgen.json'),
|
|
94
|
-
JSON.stringify(info, null, 2))
|
|
95
|
-
}
|
|
96
|
-
catch (err: any) {
|
|
97
|
-
console.log(err)
|
|
98
|
-
// TODO: file not foound ignored, handle others!
|
|
99
|
-
}
|
|
100
|
-
}, 777)
|
|
101
|
-
*/
|
|
59
|
+
})
|
|
102
60
|
})
|
|
103
61
|
|
|
104
62
|
|