@voxgig/model 4.0.0 → 5.1.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/bin/voxgig-model +152 -31
- package/dist/build.d.ts +21 -0
- package/dist/{lib/build.js → build.js} +30 -19
- package/dist/build.js.map +1 -0
- package/dist/builder/local.js +48 -0
- package/dist/builder/local.js.map +1 -0
- package/dist/{lib/builder → builder}/model.js +13 -13
- package/dist/builder/model.js.map +1 -0
- package/dist/config.d.ts +12 -0
- package/dist/{lib/config.js → config.js} +8 -6
- package/dist/config.js.map +1 -0
- package/dist/model.d.ts +8 -6
- package/dist/model.js +60 -36
- package/dist/model.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/{lib/watch.d.ts → watch.d.ts} +6 -20
- package/dist/{lib/watch.js → watch.js} +68 -66
- package/dist/watch.js.map +1 -0
- package/package.json +19 -19
- package/dist/lib/build.d.ts +0 -20
- package/dist/lib/build.js.map +0 -1
- package/dist/lib/builder/local.js +0 -76
- package/dist/lib/builder/local.js.map +0 -1
- package/dist/lib/builder/model.js.map +0 -1
- package/dist/lib/config.d.ts +0 -11
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/model-builder.d.ts +0 -0
- package/dist/lib/model-builder.js +0 -2
- package/dist/lib/model-builder.js.map +0 -1
- package/dist/lib/types.d.ts +0 -48
- package/dist/lib/types.js +0 -3
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/util.d.ts +0 -7
- package/dist/lib/util.js +0 -94
- package/dist/lib/util.js.map +0 -1
- package/dist/lib/watch.js.map +0 -1
- package/dist/model.min.js +0 -94
- package/lib/build.ts +0 -138
- package/lib/builder/local.ts +0 -130
- package/lib/builder/model.ts +0 -37
- package/lib/config.ts +0 -50
- package/lib/types.ts +0 -67
- package/lib/watch.ts +0 -301
- package/model.ts +0 -147
- /package/dist/{lib/builder → builder}/local.d.ts +0 -0
- /package/dist/{lib/builder → builder}/model.d.ts +0 -0
package/bin/voxgig-model
CHANGED
|
@@ -1,52 +1,173 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const { parseArgs } = require('node:util')
|
|
4
|
+
const Fs = require('node:fs')
|
|
5
|
+
const Path = require('node:path')
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
const Pkg = require('../package.json')
|
|
8
|
+
const { Model } = require('../dist/model.js')
|
|
7
9
|
|
|
10
|
+
const { Gubu, Fault, One } = require('gubu')
|
|
8
11
|
|
|
9
|
-
let path = process.argv[2]
|
|
10
|
-
let once = '--once' === process.argv[3]
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
let CONSOLE = console
|
|
14
|
+
|
|
15
|
+
run()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
async function run() {
|
|
19
|
+
try {
|
|
20
|
+
let options = resolveOptions()
|
|
21
|
+
|
|
22
|
+
if(options.version) {
|
|
23
|
+
version()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if(options.help) {
|
|
27
|
+
help()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if(options.version || options.help) {
|
|
31
|
+
exit()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
options = validateOptions(options)
|
|
35
|
+
|
|
36
|
+
await generate(options)
|
|
37
|
+
}
|
|
38
|
+
catch(err) {
|
|
39
|
+
handleError(err)
|
|
40
|
+
}
|
|
15
41
|
}
|
|
16
42
|
|
|
17
|
-
let fstats = Fs.statSync(path)
|
|
18
|
-
// let base = path
|
|
19
|
-
let base = Path.resolve(path)
|
|
20
43
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
44
|
+
function resolveOptions() {
|
|
45
|
+
|
|
46
|
+
const args = parseArgs({
|
|
47
|
+
allowPositionals: true,
|
|
48
|
+
options: {
|
|
49
|
+
model: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
short: 'm',
|
|
52
|
+
default: '',
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
watch: {
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
short: 'w',
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
debug: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
short: 'g',
|
|
63
|
+
default: 'info'
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
help: {
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
short: 'h',
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
version: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
short: 'v',
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const options = {
|
|
80
|
+
model: '' === args.values.model ? args.positionals[0] : args.values.model,
|
|
81
|
+
watch: !!args.values.watch,
|
|
82
|
+
debug: args.values.debug,
|
|
83
|
+
help: !!args.values.help,
|
|
84
|
+
version: !!args.values.version,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return options
|
|
24
88
|
}
|
|
25
89
|
|
|
26
|
-
path = Path.resolve(path)
|
|
27
90
|
|
|
28
|
-
|
|
91
|
+
function validateOptions(rawOptions) {
|
|
92
|
+
const optShape = Gubu({
|
|
93
|
+
model: Fault('The first command line argument must be the model file path.', String),
|
|
94
|
+
watch: Boolean,
|
|
95
|
+
debug: One(String,Boolean),
|
|
96
|
+
help: Boolean,
|
|
97
|
+
version: Boolean,
|
|
98
|
+
})
|
|
29
99
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
100
|
+
const err = []
|
|
101
|
+
const options = optShape(rawOptions,{err})
|
|
102
|
+
|
|
103
|
+
if(err[0]) {
|
|
104
|
+
const errtext = 'ERROR: '+err.map(err=>err.text).join('\n')
|
|
105
|
+
console.error(errtext)
|
|
106
|
+
exit(1)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return options
|
|
35
110
|
}
|
|
36
111
|
|
|
37
|
-
let model = new Model(spec)
|
|
38
112
|
|
|
39
|
-
async function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
113
|
+
async function handleError(err) {
|
|
114
|
+
CONSOLE.error(err)
|
|
115
|
+
exit(err)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
function version() {
|
|
120
|
+
CONSOLE.log(Pkg.version)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
function help() {
|
|
125
|
+
const s = 'TODO'
|
|
126
|
+
CONSOLE.log(s)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
function exit(err) {
|
|
131
|
+
let code = 0
|
|
132
|
+
if(err) {
|
|
133
|
+
code = 1
|
|
45
134
|
}
|
|
46
|
-
|
|
135
|
+
process.exit(code)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
async function generate(options) {
|
|
140
|
+
let path = options.model
|
|
141
|
+
|
|
142
|
+
if(!Fs.existsSync(path)) {
|
|
143
|
+
console.error('ERROR: model file does not exist: '+(path.replace(process.cwd(),'.')))
|
|
144
|
+
exit(1)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let fstats = Fs.statSync(path)
|
|
148
|
+
let base = Path.resolve(path)
|
|
149
|
+
|
|
150
|
+
if (fstats.isFile()) {
|
|
151
|
+
let basedesc = Path.parse(base)
|
|
152
|
+
base = basedesc.dir
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
path = Path.resolve(path)
|
|
156
|
+
|
|
157
|
+
let spec = {
|
|
158
|
+
path,
|
|
159
|
+
base,
|
|
160
|
+
require: process.cwd(),
|
|
161
|
+
debug: options.debug,
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let model = new Model(spec)
|
|
165
|
+
|
|
166
|
+
if(options.watch) {
|
|
47
167
|
model.start()
|
|
48
168
|
}
|
|
169
|
+
else {
|
|
170
|
+
await model.run()
|
|
171
|
+
}
|
|
49
172
|
}
|
|
50
173
|
|
|
51
|
-
|
|
52
|
-
run()
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Val } from 'aontu';
|
|
2
|
+
import type { Build, BuildResult, BuildContext, BuildSpec, RunSpec, Log } from './types';
|
|
3
|
+
declare class BuildImpl implements Build {
|
|
4
|
+
id: string;
|
|
5
|
+
base: string;
|
|
6
|
+
path: string;
|
|
7
|
+
root: any;
|
|
8
|
+
opts: any;
|
|
9
|
+
res: any[];
|
|
10
|
+
spec: BuildSpec;
|
|
11
|
+
model: any;
|
|
12
|
+
use: {};
|
|
13
|
+
errs: any[];
|
|
14
|
+
ctx: BuildContext;
|
|
15
|
+
log: Log;
|
|
16
|
+
fs: any;
|
|
17
|
+
constructor(spec: BuildSpec, log: Log);
|
|
18
|
+
run(rspec: RunSpec): Promise<BuildResult>;
|
|
19
|
+
}
|
|
20
|
+
declare function makeBuild(spec: BuildSpec, log: Log): BuildImpl;
|
|
21
|
+
export { makeBuild, BuildSpec, Val };
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* Copyright © 2021-
|
|
2
|
+
/* Copyright © 2021-2024 Voxgig Ltd, MIT License. */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.makeBuild = makeBuild;
|
|
5
5
|
const aontu_1 = require("aontu");
|
|
6
6
|
class BuildImpl {
|
|
7
|
-
constructor(spec) {
|
|
7
|
+
constructor(spec, log) {
|
|
8
8
|
this.root = aontu_1.Nil.make();
|
|
9
9
|
this.use = {};
|
|
10
|
-
this.
|
|
10
|
+
this.errs = [];
|
|
11
11
|
this.id = String(Math.random()).substring(3, 9);
|
|
12
|
+
this.log = log;
|
|
12
13
|
this.spec = spec;
|
|
13
|
-
this.
|
|
14
|
+
this.fs = spec.fs;
|
|
14
15
|
this.base = null == spec.base ? '' : spec.base;
|
|
15
16
|
this.path = null == spec.path ? '' : spec.path;
|
|
16
17
|
this.opts = {};
|
|
17
|
-
this.ctx = { step: 'pre', state: {} };
|
|
18
|
+
this.ctx = { step: 'pre', watch: false, state: {} };
|
|
18
19
|
if (null != spec.base) {
|
|
19
20
|
this.opts.base = spec.base;
|
|
20
21
|
this.opts.path = spec.path;
|
|
@@ -25,10 +26,9 @@ class BuildImpl {
|
|
|
25
26
|
this.res = spec.res || [];
|
|
26
27
|
Object.assign(this.use, spec.use || {});
|
|
27
28
|
}
|
|
28
|
-
async run() {
|
|
29
|
+
async run(rspec) {
|
|
29
30
|
let hasErr = false;
|
|
30
|
-
|
|
31
|
-
this.ctx = { step: 'pre', state: {} };
|
|
31
|
+
this.ctx = { step: 'pre', state: {}, watch: rspec.watch };
|
|
32
32
|
const brlog = [];
|
|
33
33
|
for (let builder of this.res) {
|
|
34
34
|
try {
|
|
@@ -38,17 +38,28 @@ class BuildImpl {
|
|
|
38
38
|
br.builder = builder.build.name;
|
|
39
39
|
brlog.push(br);
|
|
40
40
|
}
|
|
41
|
-
catch (
|
|
42
|
-
this.
|
|
41
|
+
catch (err) {
|
|
42
|
+
this.errs.push(err);
|
|
43
43
|
hasErr = true;
|
|
44
44
|
break;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
let src = '';
|
|
47
48
|
if (!hasErr) {
|
|
48
|
-
|
|
49
|
+
try {
|
|
50
|
+
src = this.fs.readFileSync(this.path, 'utf8');
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
hasErr = true;
|
|
54
|
+
this.errs.push(err);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (!hasErr) {
|
|
58
|
+
this.root = (0, aontu_1.Aontu)(src, this.opts);
|
|
49
59
|
hasErr = this.root.err && 0 < this.root.err.length;
|
|
50
60
|
if (hasErr) {
|
|
51
|
-
this.
|
|
61
|
+
this.errs.push(...this.root.err);
|
|
62
|
+
// console.log('AONTU ERRS', this.errs)
|
|
52
63
|
}
|
|
53
64
|
}
|
|
54
65
|
if (!hasErr) {
|
|
@@ -56,10 +67,9 @@ class BuildImpl {
|
|
|
56
67
|
this.model = this.root.gen(genctx);
|
|
57
68
|
hasErr = genctx.err && 0 < genctx.err.length;
|
|
58
69
|
if (hasErr) {
|
|
59
|
-
this.
|
|
70
|
+
this.errs.push(...genctx.err);
|
|
60
71
|
}
|
|
61
72
|
else {
|
|
62
|
-
// TODO: only call if path value has changed
|
|
63
73
|
this.ctx.step = 'post';
|
|
64
74
|
for (let builder of this.res) {
|
|
65
75
|
try {
|
|
@@ -69,18 +79,19 @@ class BuildImpl {
|
|
|
69
79
|
br.builder = builder.build.name;
|
|
70
80
|
brlog.push(br);
|
|
71
81
|
}
|
|
72
|
-
catch (
|
|
73
|
-
|
|
82
|
+
catch (err) {
|
|
83
|
+
hasErr = true;
|
|
84
|
+
this.errs.push(err);
|
|
74
85
|
break;
|
|
75
86
|
}
|
|
76
87
|
}
|
|
77
88
|
}
|
|
78
89
|
}
|
|
79
|
-
const br = { ok: !hasErr, build: this, builders: brlog,
|
|
90
|
+
const br = { ok: !hasErr, build: this, builders: brlog, errs: this.errs };
|
|
80
91
|
return br;
|
|
81
92
|
}
|
|
82
93
|
}
|
|
83
|
-
function makeBuild(spec) {
|
|
84
|
-
return new BuildImpl(spec);
|
|
94
|
+
function makeBuild(spec, log) {
|
|
95
|
+
return new BuildImpl(spec, log);
|
|
85
96
|
}
|
|
86
97
|
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":";AAAA,oDAAoD;;AA6IlD,8BAAS;AA1IX,iCAAgD;AAchD,MAAM,SAAS;IAeb,YAAY,IAAe,EAAE,GAAQ;QAXrC,SAAI,GAAQ,WAAG,CAAC,IA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K,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;oBAChB,CAAC;oBACD,OAAO,GAAQ,EAAE,CAAC;wBAChB,MAAM,GAAG,IAAI,CAAA;wBACb,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;wBACnB,MAAK;oBACP,CAAC;gBACH,CAAC;YAEH,CAAC;QACH,CAAC;QAED,MAAM,EAAE,GAAgB,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;QAEtF,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAGD,SAAS,SAAS,CAAC,IAAe,EAAE,GAAQ;IAC1C,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.local_builder = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
// Runs any builders local to the repo.
|
|
9
|
+
const local_builder = async (build, ctx) => {
|
|
10
|
+
ctx.state.local = (ctx.state.local || {});
|
|
11
|
+
let actionDefs = ctx.state.local.actionDefs;
|
|
12
|
+
if (null == actionDefs) {
|
|
13
|
+
actionDefs = ctx.state.local.actionDefs = [];
|
|
14
|
+
// TODO: need to provide project root via build
|
|
15
|
+
let root = path_1.default.resolve(build.path, '..', '..');
|
|
16
|
+
// TODO: build should do this
|
|
17
|
+
let configbuild = build.use.config;
|
|
18
|
+
let config = configbuild.watch.last?.build.model || {};
|
|
19
|
+
let builders = config.sys?.model.builders || {};
|
|
20
|
+
// TODO: order by comma sep string
|
|
21
|
+
// Load builders
|
|
22
|
+
for (let name in builders) {
|
|
23
|
+
let builder = builders[name];
|
|
24
|
+
let action_path = path_1.default.join(root, builder.load);
|
|
25
|
+
let action = require(action_path);
|
|
26
|
+
if (action instanceof Promise) {
|
|
27
|
+
action = await action;
|
|
28
|
+
}
|
|
29
|
+
const step = action.step || 'post';
|
|
30
|
+
actionDefs.push({ name, builder, action, step });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const runActionDefs = actionDefs.filter((ad) => ctx.step === ad.step || 'all' === ad.step);
|
|
34
|
+
build.log.info({
|
|
35
|
+
point: ctx.step + '-actions', step: ctx.step, actions: runActionDefs,
|
|
36
|
+
note: runActionDefs.map((ad) => ad.name).join(';')
|
|
37
|
+
});
|
|
38
|
+
let ok = true;
|
|
39
|
+
let areslog = [];
|
|
40
|
+
for (let actionDef of runActionDefs) {
|
|
41
|
+
let ares = await actionDef.action(build.model, build, ctx);
|
|
42
|
+
ok = ok && null != ares && ares.ok;
|
|
43
|
+
areslog.push(ares);
|
|
44
|
+
}
|
|
45
|
+
return { ok: true, step: ctx.step, active: true };
|
|
46
|
+
};
|
|
47
|
+
exports.local_builder = local_builder;
|
|
48
|
+
//# sourceMappingURL=local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/builder/local.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AAKvB,uCAAuC;AACvC,MAAM,aAAa,GAAY,KAAK,EAAE,KAAY,EAAE,GAAiB,EAAE,EAAE;IACvE,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;IACzC,IAAI,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAA;IAE3C,IAAI,IAAI,IAAI,UAAU,EAAE,CAAC;QACvB,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU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AG,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa;QACpE,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;KACxD,CAAC,CAAA;IAEF,IAAI,EAAE,GAAG,IAAI,CAAA;IACb,IAAI,OAAO,GAAG,EAAE,CAAA;IAEhB,KAAK,IAAI,SAAS,IAAI,aAAa,EAAE,CAAC;QACpC,IAAI,IAAI,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;QAC1D,EAAE,GAAG,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAA;QAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACnD,CAAC,CAAA;AAIC,sCAAa"}
|
|
@@ -11,20 +11,20 @@ const model_builder = async (build, ctx) => {
|
|
|
11
11
|
if ('post' !== ctx.step) {
|
|
12
12
|
return { ok: true, step: ctx.step, active: false };
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
filename = filenameparts[1];
|
|
20
|
-
}
|
|
21
|
-
let file = build.opts.base + '/' + filename + '.json';
|
|
22
|
-
await (0, promises_1.writeFile)(file, json);
|
|
23
|
-
return { ok: true, step: ctx.step, active: true };
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
throw e;
|
|
14
|
+
let json = JSON.stringify(build.root.gen(), null, 2);
|
|
15
|
+
let filename = path_1.default.basename(build.path);
|
|
16
|
+
let filenameparts = filename.match(/^(.*)\.[^.]+$/);
|
|
17
|
+
if (filenameparts) {
|
|
18
|
+
filename = filenameparts[1];
|
|
27
19
|
}
|
|
20
|
+
let file = build.opts.base + '/' + filename + '.json';
|
|
21
|
+
build.log.info({
|
|
22
|
+
point: 'write-model',
|
|
23
|
+
path: file,
|
|
24
|
+
note: file.replace(process.cwd(), '.')
|
|
25
|
+
});
|
|
26
|
+
await (0, promises_1.writeFile)(file, json);
|
|
27
|
+
return { ok: true, step: ctx.step, active: true };
|
|
28
28
|
};
|
|
29
29
|
exports.model_builder = model_builder;
|
|
30
30
|
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/builder/model.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AAEvB,0CAAuC;AAKvC,iDAAiD;AACjD,MAAM,aAAa,GAAY,KAAK,EAAE,KAAY,EAAE,GAAiB,EAAE,EAAE;IACvE,IAAI,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;IACpD,CAAC;IAED,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAEpD,IAAI,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACxC,IAAI,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IACnD,IAAI,aAAa,EAAE,CAAC;QAClB,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,GAAG,OAAO,CAAA;IAErD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;QACb,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,MAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAE3B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACnD,CAAC,CAAA;AAGC,sCAAa"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BuildResult, BuildSpec, Log } from './types';
|
|
2
|
+
import { Watch } from './watch';
|
|
3
|
+
declare class Config {
|
|
4
|
+
build: BuildSpec;
|
|
5
|
+
watch: Watch;
|
|
6
|
+
log: Log;
|
|
7
|
+
constructor(spec: BuildSpec, log: Log);
|
|
8
|
+
run(watch: boolean): Promise<BuildResult>;
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
stop(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export { Config, BuildSpec };
|
|
@@ -4,20 +4,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Config = void 0;
|
|
5
5
|
const watch_1 = require("./watch");
|
|
6
6
|
class Config {
|
|
7
|
-
constructor(spec) {
|
|
7
|
+
constructor(spec, log) {
|
|
8
|
+
this.log = log;
|
|
8
9
|
this.build = {
|
|
9
|
-
src: spec.src,
|
|
10
10
|
path: spec.path,
|
|
11
11
|
base: spec.base,
|
|
12
12
|
res: [
|
|
13
13
|
...(spec.res || [])
|
|
14
14
|
],
|
|
15
|
-
require: spec.require
|
|
15
|
+
require: spec.require,
|
|
16
|
+
log: this.log,
|
|
17
|
+
fs: spec.fs
|
|
16
18
|
};
|
|
17
|
-
this.watch = new watch_1.Watch(this.build);
|
|
19
|
+
this.watch = new watch_1.Watch(this.build, this.log);
|
|
18
20
|
}
|
|
19
|
-
async run() {
|
|
20
|
-
return this.watch.run(
|
|
21
|
+
async run(watch) {
|
|
22
|
+
return this.watch.run('config', watch, '<config>');
|
|
21
23
|
}
|
|
22
24
|
async start() {
|
|
23
25
|
return this.watch.start();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAKpD,mCAA+B;AAI/B,MAAM,MAAM;IAKV,YAAY,IAAe,EAAE,GAAQ;QACnC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QAEd,IAAI,CAAC,KAAK,GAAG;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,EAAE;gBACH,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;aACpB;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,EAAE,EAAE,IAAI,CAAC,EAAE;SACZ,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,KAAc;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;IACpD,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC3B,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IAC1B,CAAC;CACF;AAGQ,wBAAM"}
|
package/dist/model.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import type { BuildResult,
|
|
2
|
-
import { Config } from './
|
|
3
|
-
import { Watch } from './
|
|
1
|
+
import type { BuildResult, BuildSpec, ModelSpec, Log } from './types';
|
|
2
|
+
import { Config } from './config';
|
|
3
|
+
import { Watch } from './watch';
|
|
4
4
|
declare class Model {
|
|
5
5
|
config: Config;
|
|
6
|
-
build:
|
|
6
|
+
build: BuildSpec;
|
|
7
7
|
watch: Watch;
|
|
8
8
|
trigger_model: boolean;
|
|
9
|
-
|
|
9
|
+
log: Log;
|
|
10
|
+
fs: any;
|
|
11
|
+
constructor(mspec: ModelSpec);
|
|
10
12
|
run(): Promise<BuildResult>;
|
|
11
13
|
start(): Promise<void | BuildResult>;
|
|
12
14
|
stop(): Promise<void>;
|
|
13
15
|
}
|
|
14
|
-
export { Model,
|
|
16
|
+
export { Model, BuildSpec, };
|
package/dist/model.js
CHANGED
|
@@ -1,54 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* Copyright © 2021-
|
|
2
|
+
/* Copyright © 2021-2024 Voxgig Ltd, MIT License. */
|
|
3
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.Model = void 0;
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const config_1 = require("./
|
|
11
|
-
const watch_1 = require("./
|
|
12
|
-
const model_1 = require("./
|
|
13
|
-
const local_1 = require("./
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const util_1 = require("@voxgig/util");
|
|
10
|
+
const config_1 = require("./config");
|
|
11
|
+
const watch_1 = require("./watch");
|
|
12
|
+
const model_1 = require("./builder/model");
|
|
13
|
+
const local_1 = require("./builder/local");
|
|
14
14
|
class Model {
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(mspec) {
|
|
16
16
|
this.trigger_model = false;
|
|
17
17
|
const self = this;
|
|
18
|
+
self.fs = mspec.fs || node_fs_1.default;
|
|
19
|
+
const pino = (0, util_1.prettyPino)('model', mspec);
|
|
20
|
+
this.log = pino.child({ cmp: 'model' });
|
|
21
|
+
this.log.info({ point: 'model-init' });
|
|
22
|
+
this.log.debug({
|
|
23
|
+
point: 'model-spec', mspec, note: '\n' +
|
|
24
|
+
JSON.stringify({ ...mspec, src: '<NOT-SHOWN>' }, null, 2)
|
|
25
|
+
.replace(/"/g, '')
|
|
26
|
+
.replaceAll(process.cwd(), '.')
|
|
27
|
+
});
|
|
18
28
|
// Config is a special Watch to handle model config.
|
|
19
|
-
this.config = makeConfig(
|
|
29
|
+
this.config = makeConfig(mspec, this.log, this.fs, {
|
|
20
30
|
path: '/',
|
|
21
31
|
build: async function trigger_model(build, ctx) {
|
|
22
|
-
var _a, _b, _c;
|
|
23
32
|
if ('post' !== ctx.step) {
|
|
24
33
|
return { ok: true };
|
|
25
34
|
}
|
|
26
35
|
let res;
|
|
27
|
-
// console.log('TRIGGER', build.id, self.trigger_model, ctx)
|
|
28
|
-
// console.log(new Error().stack)
|
|
29
36
|
if (self.trigger_model) {
|
|
30
|
-
// TODO:
|
|
31
|
-
self.build.use
|
|
32
|
-
|
|
37
|
+
// TODO: better design
|
|
38
|
+
if (self.build.use) {
|
|
39
|
+
self.build.use.config.watch.last.build = build;
|
|
40
|
+
}
|
|
41
|
+
res = self.watch.run('model', true);
|
|
33
42
|
}
|
|
34
43
|
else {
|
|
35
44
|
self.trigger_model = true;
|
|
36
45
|
res = { ok: true };
|
|
37
46
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
if (ctx.watch) {
|
|
48
|
+
const watchmap = build.model?.sys?.model?.watch;
|
|
49
|
+
if (watchmap) {
|
|
50
|
+
Object.keys(watchmap).map((file) => {
|
|
51
|
+
self.watch.add(file);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
43
54
|
}
|
|
44
55
|
return res;
|
|
45
56
|
}
|
|
46
57
|
});
|
|
47
58
|
// The actual model.
|
|
48
59
|
this.build = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
base: spec.base,
|
|
60
|
+
path: mspec.path,
|
|
61
|
+
base: mspec.base,
|
|
52
62
|
use: { config: self.config },
|
|
53
63
|
res: [
|
|
54
64
|
{
|
|
@@ -60,19 +70,22 @@ class Model {
|
|
|
60
70
|
build: local_1.local_builder
|
|
61
71
|
}
|
|
62
72
|
],
|
|
63
|
-
require:
|
|
73
|
+
require: mspec.require,
|
|
74
|
+
log: this.log,
|
|
75
|
+
fs: this.fs
|
|
64
76
|
};
|
|
65
|
-
this.watch = new watch_1.Watch(self.build);
|
|
77
|
+
this.watch = new watch_1.Watch(self.build, this.log);
|
|
66
78
|
}
|
|
79
|
+
// Run once.
|
|
67
80
|
async run() {
|
|
68
81
|
this.trigger_model = false;
|
|
69
|
-
const br = await this.config.run();
|
|
70
|
-
return br.ok ? this.watch.run(
|
|
82
|
+
const br = await this.config.run(false);
|
|
83
|
+
return br.ok ? this.watch.run('model', false, '<start>') : br;
|
|
71
84
|
}
|
|
85
|
+
// Start watching for file changes. Run once initially.
|
|
72
86
|
async start() {
|
|
73
87
|
this.trigger_model = false;
|
|
74
|
-
const br = await this.config.run();
|
|
75
|
-
// console.log('MODEL CONFIG START', br.ok)
|
|
88
|
+
const br = await this.config.run(true);
|
|
76
89
|
return br.ok ? this.watch.start() : br;
|
|
77
90
|
}
|
|
78
91
|
async stop() {
|
|
@@ -80,13 +93,22 @@ class Model {
|
|
|
80
93
|
}
|
|
81
94
|
}
|
|
82
95
|
exports.Model = Model;
|
|
83
|
-
function makeConfig(
|
|
84
|
-
let cbase =
|
|
96
|
+
function makeConfig(mspec, log, fs, trigger_model_build) {
|
|
97
|
+
let cbase = mspec.base + '/.model-config';
|
|
85
98
|
let cpath = cbase + '/model-config.jsonic';
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
/*
|
|
100
|
+
try {
|
|
101
|
+
src = Fs.readFileSync(cpath).toString()
|
|
102
|
+
}
|
|
103
|
+
catch (err: any) {
|
|
104
|
+
log.error({
|
|
105
|
+
fail: 'read-file', point: 'model-config', path: cpath, err
|
|
106
|
+
})
|
|
107
|
+
throw err
|
|
108
|
+
}
|
|
109
|
+
*/
|
|
88
110
|
let cspec = {
|
|
89
|
-
|
|
111
|
+
name: 'config',
|
|
90
112
|
path: cpath,
|
|
91
113
|
base: cbase,
|
|
92
114
|
res: [
|
|
@@ -98,8 +120,10 @@ function makeConfig(spec, trigger_model_build) {
|
|
|
98
120
|
// Trigger main model build.
|
|
99
121
|
trigger_model_build
|
|
100
122
|
],
|
|
101
|
-
require:
|
|
123
|
+
require: mspec.require,
|
|
124
|
+
log,
|
|
125
|
+
fs,
|
|
102
126
|
};
|
|
103
|
-
return new config_1.Config(cspec);
|
|
127
|
+
return new config_1.Config(cspec, log);
|
|
104
128
|
}
|
|
105
129
|
//# sourceMappingURL=model.js.map
|