@open-norantec/herbal 1.0.2-alpha.18 → 1.0.2-alpha.19
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/dist/cli/herbal.js +50 -49
- package/package.json +2 -2
package/dist/cli/herbal.js
CHANGED
|
@@ -115,8 +115,7 @@ var createHandleOutputFile = function (disableWriteFile) { return function (file
|
|
|
115
115
|
}
|
|
116
116
|
}; };
|
|
117
117
|
command
|
|
118
|
-
.addCommand((0, forge_1.createCommand)({
|
|
119
|
-
name: 'build',
|
|
118
|
+
.addCommand((0, forge_1.createCommand)('build', {
|
|
120
119
|
hiddenOptions: ['--watch', '--execute-after-build'],
|
|
121
120
|
onLog: log,
|
|
122
121
|
defaultOptions: function (source, output, options) { return ({
|
|
@@ -126,8 +125,7 @@ command
|
|
|
126
125
|
onOutputFile: createHandleOutputFile(!!(options === null || options === void 0 ? void 0 : options.disableWriteFile)),
|
|
127
126
|
}); },
|
|
128
127
|
}))
|
|
129
|
-
.addCommand((0, forge_1.createCommand)({
|
|
130
|
-
name: 'watch',
|
|
128
|
+
.addCommand((0, forge_1.createCommand)('watch', {
|
|
131
129
|
hiddenOptions: [
|
|
132
130
|
'--watch',
|
|
133
131
|
'--execute-after-build',
|
|
@@ -146,51 +144,54 @@ command
|
|
|
146
144
|
onOutputFile: createHandleOutputFile(true),
|
|
147
145
|
}); },
|
|
148
146
|
}))
|
|
149
|
-
.addCommand((0, forge_1.createCommand)({
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
147
|
+
.addCommand((0, forge_1.createCommand)('generate-client', function (_a) {
|
|
148
|
+
var addOption = _a.addOption;
|
|
149
|
+
addOption('--group', 'Client group name to generate');
|
|
150
|
+
return {
|
|
151
|
+
onLog: log,
|
|
152
|
+
hiddenOptions: [
|
|
153
|
+
'--watch',
|
|
154
|
+
'--execute-after-build',
|
|
155
|
+
'--obfuscate',
|
|
156
|
+
'--obfuscator-config-file <string>',
|
|
157
|
+
'--disable-write-file',
|
|
158
|
+
],
|
|
159
|
+
defaultOptions: function (source, output, options) { return ({
|
|
160
|
+
watch: false,
|
|
161
|
+
executeAfterBuild: false,
|
|
162
|
+
obfuscate: false,
|
|
163
|
+
customTransformers: function (program) {
|
|
164
|
+
return {
|
|
165
|
+
before: [(0, reflect_declaration_1.transformer)(program)],
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
getWatcher: handleGetWatcher,
|
|
169
|
+
onGetFileContent: handleGetFileContent,
|
|
170
|
+
onOutputFile: createHandleOutputFile(false),
|
|
171
|
+
getVirtualEntryFileContent: function (buildEntryFilePath) {
|
|
172
|
+
return [
|
|
173
|
+
"const entry = require('".concat(buildEntryFilePath, "')"),
|
|
174
|
+
"const { isClient } = require(\'@open-norantec/herbal\')",
|
|
175
|
+
'module.exports = () => {',
|
|
176
|
+
' let client = entry;',
|
|
177
|
+
' if (!isClient(client)) { client = entry?.default; }',
|
|
178
|
+
" if (!isClient(client)) return '';",
|
|
179
|
+
" try { return client.instance.generateClientSourceFile() ?? ''; } catch (error) { throw error; }",
|
|
180
|
+
'};',
|
|
181
|
+
].join('\n');
|
|
182
|
+
},
|
|
183
|
+
rewriteOutputFile: function (code) {
|
|
184
|
+
try {
|
|
185
|
+
var generateCodeMethod = requireFromString(code);
|
|
186
|
+
if (typeof generateCodeMethod !== 'function')
|
|
187
|
+
return '';
|
|
188
|
+
return generateCodeMethod({ group: options === null || options === void 0 ? void 0 : options.group });
|
|
189
|
+
}
|
|
190
|
+
catch (_a) {
|
|
187
191
|
return '';
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
}); },
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
}); },
|
|
195
|
+
};
|
|
195
196
|
}));
|
|
196
197
|
command.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-norantec/herbal",
|
|
3
|
-
"version": "1.0.2-alpha.
|
|
3
|
+
"version": "1.0.2-alpha.19",
|
|
4
4
|
"description": "Herbal is a builder and toolchain for Nest.js applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@nestjs/common": "^10.0.0",
|
|
39
39
|
"@nestjs/core": "^10.4.19",
|
|
40
40
|
"@nestjs/sequelize": "^10.0.1",
|
|
41
|
-
"@open-norantec/forge": "
|
|
41
|
+
"@open-norantec/forge": "^2.0.0-alpha.9",
|
|
42
42
|
"@open-norantec/utilities": "latest",
|
|
43
43
|
"commander": "^12.1.0",
|
|
44
44
|
"fs-extra": "^11.3.4",
|