juisy 3.0.0-beta.2 → 3.0.0-beta.4
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/LICENSE +661 -661
- package/README.md +25 -12
- package/bin/cli/cli.js +28 -28
- package/bin/cli/cmds/index.js +11 -11
- package/bin/cli/cmds/public/print-globals.js +27 -27
- package/bin/cli/index.js +9 -9
- package/bin/scripts/prepare.js +22 -22
- package/dist/DataExporter.d.ts +133 -34
- package/dist/ReadmeTemplater-DobSI9Um.js +373 -0
- package/dist/bootstrap.d.ts +11 -3
- package/dist/bootstrap.js +15 -11
- package/dist/cli/Command.d.ts +4 -4
- package/dist/cli/OutputUtils.d.ts +1 -1
- package/dist/cli/cache-dir.d.ts +15 -0
- package/dist/cli/index.js +341 -148
- package/dist/cli/plugins/register-changelog-command/augment.d.ts +52 -34
- package/dist/cli/plugins/register-changelog-command/resolve-changelog-options.d.ts +19 -0
- package/dist/cli/plugins/register-release-command/build-temp-config.d.ts +13 -0
- package/dist/cli/plugins/register-release-command/release-args.d.ts +7 -0
- package/dist/cli/plugins/register-release-command/resolve-release-config.d.ts +40 -0
- package/dist/cli/serialize-cjs-module.d.ts +15 -0
- package/dist/cli/types.d.ts +1 -1
- package/dist/extensions.d.ts +33 -9
- package/dist/extensions.js +87 -20
- package/dist/get-package-info-CGDJsCsN.js +15 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +109 -23
- package/dist/project-globals.d.ts +8 -2
- package/dist/templater/Templater.d.ts +1 -1
- package/dist/templater/index.d.ts +2 -2
- package/dist/templater/index.js +2 -335
- package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +31 -2
- package/dist/templater/markdown-templater/index.d.ts +12 -1
- package/package.json +24 -29
- package/skills/juisy/SKILL.md +97 -0
- package/skills/juisy/references/recipes.md +85 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* juisy v3.0.0-beta.4
|
|
3
|
+
* Copyright © 2022-Present Hervé Perchec
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
import merge from 'lodash.merge';
|
|
11
|
+
import mdu from 'markdown-utils';
|
|
12
|
+
import { markdownTable } from 'markdown-table';
|
|
13
|
+
import asciitree from 'ascii-tree';
|
|
14
|
+
import GithubSlugger from 'github-slugger';
|
|
15
|
+
import { remark } from 'remark';
|
|
16
|
+
import remarkToc from 'remark-toc';
|
|
17
|
+
import remarkFrontmatter from 'remark-frontmatter';
|
|
18
|
+
import ejs from 'ejs';
|
|
19
|
+
import handlebars from 'handlebars';
|
|
20
|
+
|
|
21
|
+
class Templater {
|
|
22
|
+
constructor(engine, options) {
|
|
23
|
+
this.engine = engine;
|
|
24
|
+
options = options || {};
|
|
25
|
+
switch (engine) {
|
|
26
|
+
case "handlebars":
|
|
27
|
+
this.engine = handlebars;
|
|
28
|
+
this.methodsMap.compile = async (template) => {
|
|
29
|
+
return handlebars.compile(template, options.engineOptions);
|
|
30
|
+
};
|
|
31
|
+
this.methodsMap.render = async (template, data = void 0, opts = void 0) => {
|
|
32
|
+
const compiled = await this.methodsMap.compile(template);
|
|
33
|
+
return compiled(data);
|
|
34
|
+
};
|
|
35
|
+
break;
|
|
36
|
+
case "ejs":
|
|
37
|
+
this.engine = ejs;
|
|
38
|
+
this.methodsMap.compile = async (template) => {
|
|
39
|
+
return ejs.compile(template, options.engineOptions);
|
|
40
|
+
};
|
|
41
|
+
this.methodsMap.render = async (template, data = void 0, opts) => {
|
|
42
|
+
return ejs.render(
|
|
43
|
+
template,
|
|
44
|
+
data,
|
|
45
|
+
{
|
|
46
|
+
...options.engineOptions,
|
|
47
|
+
...opts || {}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
break;
|
|
52
|
+
/**
|
|
53
|
+
* @todo ? pug not yet supported
|
|
54
|
+
*/
|
|
55
|
+
case "pug":
|
|
56
|
+
this.engine = (template, options2) => () => "";
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Unsupported templating engine: ${engine}`);
|
|
60
|
+
}
|
|
61
|
+
if (options.defaultData) {
|
|
62
|
+
this.defaultData = options.defaultData;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
engine;
|
|
66
|
+
defaultData;
|
|
67
|
+
methodsMap = {};
|
|
68
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-function-type
|
|
69
|
+
/**
|
|
70
|
+
* @returns Get the engine
|
|
71
|
+
*/
|
|
72
|
+
getEngine() {
|
|
73
|
+
return this.engine;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Renders a template with the given context.
|
|
77
|
+
*/
|
|
78
|
+
async render(template, data = void 0, options = void 0) {
|
|
79
|
+
const mergedData = { ...this.defaultData, ...data || {} };
|
|
80
|
+
return await this.methodsMap.render(template, mergedData, options);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Renders a template file with the given context.
|
|
84
|
+
* @todo not yet implemented
|
|
85
|
+
*/
|
|
86
|
+
renderFile(filePath, context = {}) {
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
class MarkdownTemplater extends Templater {
|
|
92
|
+
constructor(engine = "ejs", options) {
|
|
93
|
+
super(engine, options);
|
|
94
|
+
this.processor = options?.processor ? options.processor === "remark" ? remark() : options.processor : remark();
|
|
95
|
+
this.processorOptions = this.buildProcessorOptions(options?.processorOptions || {});
|
|
96
|
+
this.initProcessor();
|
|
97
|
+
}
|
|
98
|
+
processor;
|
|
99
|
+
processorOptions;
|
|
100
|
+
buildProcessorOptions(options) {
|
|
101
|
+
options = options || {};
|
|
102
|
+
const defaultRemarkStringifyOptions = {};
|
|
103
|
+
const defaultRemarkTocOptions = {};
|
|
104
|
+
const defaultRemarkFrontmatterOptions = {
|
|
105
|
+
type: "yaml",
|
|
106
|
+
marker: "-"
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
use: [
|
|
110
|
+
...options.use || []
|
|
111
|
+
],
|
|
112
|
+
stringify: options.stringify !== void 0 ? options.stringify : defaultRemarkStringifyOptions,
|
|
113
|
+
toc: options.toc === true ? defaultRemarkTocOptions : options.toc !== void 0 ? options.toc : defaultRemarkTocOptions,
|
|
114
|
+
frontmatter: options.frontmatter === true ? defaultRemarkFrontmatterOptions : options.frontmatter !== void 0 ? options.frontmatter : defaultRemarkFrontmatterOptions
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
initProcessor() {
|
|
118
|
+
const processorPlugins = [];
|
|
119
|
+
if (this.processorOptions.stringify) this.processor.data("settings", this.processorOptions.stringify);
|
|
120
|
+
if (this.processorOptions.toc) processorPlugins.push([remarkToc, this.processorOptions.toc]);
|
|
121
|
+
if (this.processorOptions.frontmatter) processorPlugins.push([remarkFrontmatter, this.processorOptions.frontmatter]);
|
|
122
|
+
for (const plugin of processorPlugins.concat(this.processorOptions.use)) {
|
|
123
|
+
this.processor.use(...plugin);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Rebuild the remark pipeline from processor options.
|
|
128
|
+
*
|
|
129
|
+
* Always creates a **fresh** `remark()` instance so plugins are not stacked
|
|
130
|
+
* twice. Prefer passing `processorOptions` to the constructor when possible;
|
|
131
|
+
* use this when options are only known after construction (e.g. async config).
|
|
132
|
+
*/
|
|
133
|
+
applyProcessorOptions(options = {}) {
|
|
134
|
+
this.processorOptions = this.buildProcessorOptions(options);
|
|
135
|
+
this.processor = remark();
|
|
136
|
+
this.initProcessor();
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Renders a template with the given context.
|
|
140
|
+
*/
|
|
141
|
+
async render(template, data = void 0, options = void 0) {
|
|
142
|
+
const content = await super.render(template, data, options);
|
|
143
|
+
return (await this.processor.process(content)).toString();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
new GithubSlugger();
|
|
148
|
+
const DEFAULT_INIT_TARGET_RELATIVE_PATH = "./docs/readme";
|
|
149
|
+
const DEFAULT_AUTO_GEN_MESSAGE = "\n----\n*<%= $config.fileName %> - this file was auto generated with [juisy](https://www.npmjs.com/package/juisy) README templater. Don't edit it.*\n";
|
|
150
|
+
class ReadmeTemplater {
|
|
151
|
+
/**
|
|
152
|
+
* @param config - The user configuration file path (as string) or object
|
|
153
|
+
* @example
|
|
154
|
+
* // Path as string
|
|
155
|
+
* const templater = new ReadmeTemplater('./.docs/readme/config.js')
|
|
156
|
+
* // Pass object. See configuration below
|
|
157
|
+
* const templater = new ReadmeTemplater({ /* ... *\/ })
|
|
158
|
+
*/
|
|
159
|
+
constructor(config) {
|
|
160
|
+
this.config = config;
|
|
161
|
+
}
|
|
162
|
+
// To cache resolved config value
|
|
163
|
+
#resolvedConfig;
|
|
164
|
+
config;
|
|
165
|
+
/** Created in {@link resolveConfig} with `processor` from user config. */
|
|
166
|
+
templater;
|
|
167
|
+
get resolvedConfig() {
|
|
168
|
+
return this.#resolvedConfig;
|
|
169
|
+
}
|
|
170
|
+
set resolvedConfig(value) {
|
|
171
|
+
this.#resolvedConfig = value;
|
|
172
|
+
}
|
|
173
|
+
async resolveConfig() {
|
|
174
|
+
if (!this.resolvedConfig) {
|
|
175
|
+
this.resolvedConfig = await ReadmeTemplater.processConfig(this.config);
|
|
176
|
+
this.templater = new MarkdownTemplater("ejs", {
|
|
177
|
+
processorOptions: this.resolvedConfig.processor
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Writes rendered README markdown to file
|
|
183
|
+
* @param config - The config object to process. Can be path to config file as string.
|
|
184
|
+
* @param options - Same as render
|
|
185
|
+
* @throws Throws error if render or file writing fails
|
|
186
|
+
* @example
|
|
187
|
+
* await templater.generate() // => output to README.md file
|
|
188
|
+
* await templater.generate({ data: { foo: 'bar' } }) // pass options
|
|
189
|
+
*/
|
|
190
|
+
async generate(options = {}) {
|
|
191
|
+
await this.resolveConfig();
|
|
192
|
+
const resolvedConfig = this.resolvedConfig;
|
|
193
|
+
const targetFilePath = path.join(resolvedConfig.destFolder, resolvedConfig.fileName);
|
|
194
|
+
console.log(`Auto-generating "${resolvedConfig.fileName}" file`);
|
|
195
|
+
console.log();
|
|
196
|
+
console.log("- Syntax: " + chalk.yellow("ejs"));
|
|
197
|
+
const renderResult = await this.render(options);
|
|
198
|
+
try {
|
|
199
|
+
fs.writeFileSync(targetFilePath, renderResult);
|
|
200
|
+
} catch (error) {
|
|
201
|
+
console.log("- Status:", chalk.red("✘ FAILED"));
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
console.log("- Status:", chalk.green("✔ OK"));
|
|
205
|
+
console.log('- Written to: "' + chalk.cyan(targetFilePath) + '"');
|
|
206
|
+
console.log();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Render README markdown
|
|
210
|
+
* @param options - Options object
|
|
211
|
+
* @returns Returns the rendered markdown as string. Promise is immediately resolved except if a module is async.
|
|
212
|
+
* @example
|
|
213
|
+
* await templater.render()
|
|
214
|
+
* await templater.render({ data: { foo: 'bar' } })
|
|
215
|
+
*/
|
|
216
|
+
async render(options = {}) {
|
|
217
|
+
await this.resolveConfig();
|
|
218
|
+
const resolvedConfig = this.resolvedConfig;
|
|
219
|
+
const data = resolvedConfig.ejsDataPath ? await import(pathToFileURL(resolvedConfig.ejsDataPath).toString()).then((mod) => mod.default || mod) : {};
|
|
220
|
+
options.data = options.data || {};
|
|
221
|
+
const ejsData = merge(merge({
|
|
222
|
+
...ReadmeTemplater.defaultEjsData,
|
|
223
|
+
$config: resolvedConfig
|
|
224
|
+
}, data), options.data);
|
|
225
|
+
let template = await fs.readFile(resolvedConfig.templatePath, { encoding: "utf8" });
|
|
226
|
+
if (resolvedConfig.appendAutoGenMessage) {
|
|
227
|
+
template += resolvedConfig.autoGenMessage;
|
|
228
|
+
}
|
|
229
|
+
const templater = this.templater;
|
|
230
|
+
if (!templater) {
|
|
231
|
+
throw new Error("ReadmeTemplater: templater missing after resolveConfig");
|
|
232
|
+
}
|
|
233
|
+
return await templater.render(template, ejsData, resolvedConfig.ejsOptions);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Static methods
|
|
237
|
+
*/
|
|
238
|
+
/**
|
|
239
|
+
* Takes a custom config as unique parameter and merges it with the default configuration object.
|
|
240
|
+
* @param config - The config object to process. Can be path to config file as string.
|
|
241
|
+
* @returns Returns the processed configuration. Promise is immediately resolved except if module is async.
|
|
242
|
+
* @example
|
|
243
|
+
* readmeGenerator.processConfig({ ... }) // pass object
|
|
244
|
+
* readmeGenerator.processConfig('./.docs/readme/config.js') // pass path as string
|
|
245
|
+
* // If module.exports is a promise
|
|
246
|
+
* await readmeGenerator.processConfig('./.docs/readme/config.js') // async module
|
|
247
|
+
*/
|
|
248
|
+
static async processConfig(config) {
|
|
249
|
+
let customConfig;
|
|
250
|
+
if (typeof config === "string") {
|
|
251
|
+
const configPath = pathToFileURL(path.isAbsolute(config) ? config : path.resolve(process.cwd(), config));
|
|
252
|
+
customConfig = (await import(configPath.toString())).default;
|
|
253
|
+
} else if (typeof config !== "object") {
|
|
254
|
+
throw new TypeError("config parameter must be object or string. Received " + typeof config);
|
|
255
|
+
} else {
|
|
256
|
+
customConfig = config;
|
|
257
|
+
}
|
|
258
|
+
const result = {};
|
|
259
|
+
result.fileName = customConfig.fileName || ReadmeTemplater.defaultConfig.fileName;
|
|
260
|
+
result.destFolder = customConfig.destFolder || ReadmeTemplater.defaultConfig.destFolder;
|
|
261
|
+
result.templatePath = customConfig.templatePath || ReadmeTemplater.defaultConfig.templatePath;
|
|
262
|
+
result.ejsDataPath = customConfig.ejsDataPath || customConfig.ejsDataPath === null ? customConfig.ejsDataPath : ReadmeTemplater.defaultConfig.ejsDataPath;
|
|
263
|
+
if (customConfig.ejsOptions) {
|
|
264
|
+
result.ejsOptions = {
|
|
265
|
+
async: ReadmeTemplater.defaultConfig.ejsOptions.async,
|
|
266
|
+
// async prop see below
|
|
267
|
+
root: ReadmeTemplater.defaultConfig.ejsOptions.root,
|
|
268
|
+
// root prop see below (always array)
|
|
269
|
+
views: ReadmeTemplater.defaultConfig.ejsOptions.views,
|
|
270
|
+
// views prop see below (always array)
|
|
271
|
+
...customConfig.ejsOptions
|
|
272
|
+
};
|
|
273
|
+
} else {
|
|
274
|
+
result.ejsOptions = ReadmeTemplater.defaultConfig.ejsOptions;
|
|
275
|
+
}
|
|
276
|
+
result.appendAutoGenMessage = customConfig.appendAutoGenMessage !== void 0 ? customConfig.appendAutoGenMessage : ReadmeTemplater.defaultConfig.appendAutoGenMessage;
|
|
277
|
+
result.autoGenMessage = ReadmeTemplater.resolveAutoGenMessage(customConfig.autoGenMessage);
|
|
278
|
+
result.processor = customConfig.processor !== void 0 ? customConfig.processor : ReadmeTemplater.defaultConfig.processor;
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Resolves {@link UserConfiguration.autoGenMessage} to a concrete EJS snippet.
|
|
283
|
+
*/
|
|
284
|
+
static resolveAutoGenMessage(option) {
|
|
285
|
+
if (typeof option === "function") {
|
|
286
|
+
return option(DEFAULT_AUTO_GEN_MESSAGE);
|
|
287
|
+
}
|
|
288
|
+
if (typeof option === "string") {
|
|
289
|
+
return option;
|
|
290
|
+
}
|
|
291
|
+
return DEFAULT_AUTO_GEN_MESSAGE;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Returns the default configuration object.
|
|
295
|
+
* This base configuration is used by `processConfig` method and so `generate` and `render` methods.
|
|
296
|
+
*/
|
|
297
|
+
static defaultConfig = {
|
|
298
|
+
fileName: "README.md",
|
|
299
|
+
destFolder: process.cwd(),
|
|
300
|
+
templatePath: path.resolve(process.cwd(), DEFAULT_INIT_TARGET_RELATIVE_PATH, "template.md"),
|
|
301
|
+
ejsDataPath: path.resolve(process.cwd(), DEFAULT_INIT_TARGET_RELATIVE_PATH, "data.js"),
|
|
302
|
+
ejsOptions: {
|
|
303
|
+
/**
|
|
304
|
+
* Always render in async mode
|
|
305
|
+
*/
|
|
306
|
+
async: true,
|
|
307
|
+
/**
|
|
308
|
+
* Set project root for includes with an absolute path (e.g, /file.ejs).
|
|
309
|
+
* Can be array to try to resolve include from multiple directories.
|
|
310
|
+
*/
|
|
311
|
+
root: [
|
|
312
|
+
// User template path
|
|
313
|
+
// path.resolve(process.cwd(), DEFAULT_INIT_TARGET_RELATIVE_PATH)
|
|
314
|
+
],
|
|
315
|
+
/**
|
|
316
|
+
* An array of paths to use when resolving includes with relative paths.
|
|
317
|
+
*/
|
|
318
|
+
views: [
|
|
319
|
+
// // User template path
|
|
320
|
+
// path.resolve(process.cwd(), DEFAULT_INIT_TARGET_RELATIVE_PATH)
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
appendAutoGenMessage: true,
|
|
324
|
+
autoGenMessage: DEFAULT_AUTO_GEN_MESSAGE,
|
|
325
|
+
processor: {}
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* The default EJS data object.
|
|
329
|
+
* This base EJS data object is used by `render` methods and merged with user provided EJS data.
|
|
330
|
+
*/
|
|
331
|
+
static defaultEjsData = {
|
|
332
|
+
/**
|
|
333
|
+
* Contains the default configuration by default.
|
|
334
|
+
* Will be merged with custom configuration when using `generate` or `render` method.
|
|
335
|
+
* @example
|
|
336
|
+
* // Access configuration
|
|
337
|
+
* $config.fileName // => README.md
|
|
338
|
+
*/
|
|
339
|
+
$config: {},
|
|
340
|
+
/**
|
|
341
|
+
* Contains the following methods:
|
|
342
|
+
*
|
|
343
|
+
* - `table`: generates a markdown table
|
|
344
|
+
* - `asciiTree`: generates an "ASCII" tree
|
|
345
|
+
* - ... all methods from `markdown-utils` package
|
|
346
|
+
*
|
|
347
|
+
* > Please check the following package documentations:
|
|
348
|
+
* > - [markdown-utils](https://github.com/jonschlinkert/markdown-utils)
|
|
349
|
+
* > - [markdown-table](https://www.npmjs.com/package/markdown-table)
|
|
350
|
+
* > - [ascii-tree](https://www.npmjs.com/package/ascii-tree)
|
|
351
|
+
* @example
|
|
352
|
+
* // Generates a blockquote
|
|
353
|
+
* $utils.blockquote('This is a blockquote')
|
|
354
|
+
* // Generates a table
|
|
355
|
+
* $utils.table([
|
|
356
|
+
* [ 'Column 1', 'Column 2' ],
|
|
357
|
+
* [ 'Value 1', 'Value 2' ]
|
|
358
|
+
* ])
|
|
359
|
+
* // Generates an ascii tree
|
|
360
|
+
* $utils.asciiTree('*.\n**a\n**b\n*...')
|
|
361
|
+
*/
|
|
362
|
+
$utils: {
|
|
363
|
+
// markdown-utils
|
|
364
|
+
...mdu,
|
|
365
|
+
// markdown-table
|
|
366
|
+
table: markdownTable,
|
|
367
|
+
// ascii-tree
|
|
368
|
+
asciiTree: asciitree.generate
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export { DEFAULT_AUTO_GEN_MESSAGE as D, MarkdownTemplater as M, ReadmeTemplater as R, Templater as T };
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Internal bootstrap for the `juisy` bin: load `package.json#juisy.extensions`
|
|
3
|
+
* when `JUISY_ENABLE_EXTENSIONS` is not `"false"`.
|
|
4
|
+
*
|
|
5
|
+
* Not part of the public package API — imported by `bin/cli` from `dist/bootstrap.js`.
|
|
6
|
+
*
|
|
2
7
|
* @internal
|
|
3
|
-
* @privateRemarks
|
|
4
|
-
* Internal usage only
|
|
5
8
|
*/
|
|
6
|
-
export default function bootstrap(
|
|
9
|
+
export default function bootstrap(): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Reset bootstrap latch (unit tests).
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function resetBootstrapState(): void;
|
package/dist/bootstrap.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* juisy v3.0.0-beta.
|
|
2
|
+
* juisy v3.0.0-beta.4
|
|
3
3
|
* Copyright © 2022-Present Hervé Perchec
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { loadExtensions } from './extensions.js';
|
|
7
7
|
|
|
8
8
|
let isAlreadyBootstrapped = false;
|
|
9
|
-
async function bootstrap(
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
process.env.JUISY_ENABLE_EXTENSIONS = "true";
|
|
13
|
-
}
|
|
14
|
-
if (process.env.JUISY_ENABLE_EXTENSIONS === "true") {
|
|
15
|
-
await loadExtensions();
|
|
16
|
-
}
|
|
17
|
-
isAlreadyBootstrapped = true;
|
|
9
|
+
async function bootstrap() {
|
|
10
|
+
if (isAlreadyBootstrapped) {
|
|
11
|
+
return;
|
|
18
12
|
}
|
|
13
|
+
if (process.env.JUISY_ENABLE_EXTENSIONS === void 0) {
|
|
14
|
+
process.env.JUISY_ENABLE_EXTENSIONS = "true";
|
|
15
|
+
}
|
|
16
|
+
if (process.env.JUISY_ENABLE_EXTENSIONS === "true") {
|
|
17
|
+
await loadExtensions();
|
|
18
|
+
}
|
|
19
|
+
isAlreadyBootstrapped = true;
|
|
20
|
+
}
|
|
21
|
+
function resetBootstrapState() {
|
|
22
|
+
isAlreadyBootstrapped = false;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
export { bootstrap as default };
|
|
25
|
+
export { bootstrap as default, resetBootstrapState };
|
package/dist/cli/Command.d.ts
CHANGED
|
@@ -48,15 +48,15 @@ export declare class Command implements CommandObject {
|
|
|
48
48
|
/**
|
|
49
49
|
* Command handler
|
|
50
50
|
*/
|
|
51
|
-
handler(this: Command, argv: CommandHandlerArgs): void | Promise<void>;
|
|
51
|
+
handler(this: Command, argv: CommandHandlerArgs, positionals: Record<string, any>, options: Record<string, any>): void | Promise<void>;
|
|
52
52
|
/**
|
|
53
53
|
* Command middlewares
|
|
54
54
|
*/
|
|
55
55
|
middlewares: import('yargs').MiddlewareFunction[] | undefined;
|
|
56
56
|
/**
|
|
57
57
|
* Log a message in the console output. Uses OutputUtils.log method.
|
|
58
|
-
* @param msg The message to log. Can be empty to log blank line
|
|
59
|
-
* @param options The options to pass to OutputUtils.log second argument
|
|
58
|
+
* @param msg - The message to log. Can be empty to log blank line
|
|
59
|
+
* @param options - The options to pass to OutputUtils.log second argument
|
|
60
60
|
*/
|
|
61
61
|
log(msg?: string, options?: Parameters<typeof OutputUtils.log>[1]): void;
|
|
62
62
|
/**
|
|
@@ -79,7 +79,7 @@ export declare class Command implements CommandObject {
|
|
|
79
79
|
deprecated: string | boolean | undefined;
|
|
80
80
|
meta: Partial<import('./types').CommandMeta> | undefined;
|
|
81
81
|
builder: (cli: CLIEngine) => CLIEngine | PromiseLike<CLIEngine>;
|
|
82
|
-
handler: (argv: CommandHandlerArgs) => void | Promise<void>;
|
|
82
|
+
handler: (argv: CommandHandlerArgs, positionals: Record<string, any>, options: Record<string, any>) => void | Promise<void>;
|
|
83
83
|
middlewares: import('yargs').MiddlewareFunction[] | undefined;
|
|
84
84
|
};
|
|
85
85
|
/**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve Juisy temp/cache directory under `node_modules/.cache/juisy`.
|
|
3
|
+
* Falls back to `os.tmpdir()/juisy` when no `node_modules` is available.
|
|
4
|
+
* @param cwd - Working directory used to locate the nearest package root
|
|
5
|
+
* @returns Absolute path to the cache directory (created if missing)
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
8
|
+
export declare function getJuisyCacheDir(cwd?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Absolute path for a Juisy temporary file inside the cache directory.
|
|
11
|
+
* @param fileName - File name (e.g. `__TEMP_RELEASE_IT_CONFIG__.json`)
|
|
12
|
+
* @param cwd - Working directory used to locate the cache
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
export declare function getJuisyTempFilePath(fileName: string, cwd?: string): string;
|