juisy 2.2.0 → 3.0.0-beta.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/LICENSE +1 -1
- package/README.md +85 -0
- package/bin/cli/cli.js +3 -0
- package/bin/cli/cmds/index.js +2 -4
- package/bin/scripts/prepare.js +22 -22
- package/dist/DataExporter.d.ts +9 -4
- package/dist/bootstrap.d.ts +6 -0
- package/dist/bootstrap.js +21 -0
- package/dist/cli/CLIFactory.d.ts +1 -0
- package/dist/cli/Command.d.ts +23 -2
- package/dist/cli/GlobalSettings.schema.json +1 -1
- package/dist/cli/InterfaceUtils.d.ts +14 -12
- package/dist/cli/OutputUtils.d.ts +30 -16
- package/dist/cli/Plugin.d.ts +9 -0
- package/dist/cli/extract-usage.d.ts +8 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +210 -122
- package/dist/cli/plugins/command-meta/augment.d.ts +1 -4
- package/dist/cli/plugins/command-meta/index.d.ts +4 -0
- package/dist/cli/plugins/default-command-fallbacks/augment.d.ts +1 -1
- package/dist/cli/plugins/default-command-fallbacks/command-visitors/default-command-fallbacks.d.ts +1 -1
- package/dist/cli/plugins/default-command-fallbacks/index.d.ts +4 -0
- package/dist/cli/plugins/load-env-file/augment.d.ts +1 -1
- package/dist/cli/plugins/load-env-file/index.d.ts +4 -0
- package/dist/cli/plugins/private-commands/augment.d.ts +8 -0
- package/dist/cli/plugins/private-commands/command-visitors/private-command.d.ts +7 -3
- package/dist/cli/plugins/private-commands/index.d.ts +4 -0
- package/dist/cli/plugins/register-bump-version-command/index.d.ts +4 -0
- package/dist/cli/plugins/register-changelog-command/index.d.ts +4 -0
- package/dist/cli/plugins/register-docs-commands/index.d.ts +4 -0
- package/dist/cli/plugins/register-git-hooks-commands/index.d.ts +4 -0
- package/dist/cli/plugins/register-lint-commands/index.d.ts +4 -0
- package/dist/cli/plugins/register-lint-commands/settings.d.ts +2 -0
- package/dist/cli/plugins/register-lint-commands/types.d.ts +5 -9
- package/dist/cli/plugins/register-release-command/index.d.ts +4 -0
- package/dist/cli/plugins/register-test-command/index.d.ts +4 -0
- package/dist/cli/types.d.ts +9 -1
- package/dist/cli/utils.d.ts +3 -4
- package/dist/eject.d.ts +1 -0
- package/dist/extensions.d.ts +26 -0
- package/dist/extensions.js +44 -0
- package/dist/get-package-info.d.ts +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +23 -128
- package/dist/project-globals.d.ts +6 -2
- package/dist/shims/shims.d.ts +1440 -0
- package/dist/templater/index.d.ts +4 -1
- package/dist/templater/index.js +43 -24
- package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +12 -12
- package/dist/templater/markdown-templater/index.d.ts +10 -1
- package/package.json +43 -49
- package/bin/cli/cmds/private/docs/generate-api.js +0 -31
- package/bin/cli/cmds/private/docs/index.js +0 -20
- package/bin/cli/cmds/private/test.js +0 -33
- package/dist/utils/misc.d.ts +0 -84
- package/dist/vite/plugins/inject-css-variables/index.d.ts +0 -23
- package/dist/vite/plugins/inject-css-variables/index.js +0 -60
- package/dist/vite/plugins/inject-project-globals/index.d.ts +0 -19
- package/dist/vite/plugins/inject-project-globals/index.js +0 -58
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public API of juisy/templater library
|
|
3
|
-
* @module juisy
|
|
3
|
+
* @module juisy-templater
|
|
4
|
+
* @navigationTitle juisy/templater
|
|
5
|
+
* @importTarget ./templater
|
|
4
6
|
* @author Hervé Perchec
|
|
5
7
|
*/
|
|
6
8
|
export { Templater } from './Templater';
|
|
@@ -9,3 +11,4 @@ export { ReadmeTemplater } from './markdown-templater/ReadmeTemplater';
|
|
|
9
11
|
export type * from './types';
|
|
10
12
|
export type { MarkdownTemplaterOptions } from './markdown-templater';
|
|
11
13
|
export type { UserConfiguration as ReadmeTemplaterUserConfig, Configuration as ReadmeTemplaterConfig } from './markdown-templater/ReadmeTemplater';
|
|
14
|
+
export type * from '../shims/shims';
|
package/dist/templater/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* juisy
|
|
2
|
+
* juisy v3.0.0-beta.0
|
|
3
3
|
* Copyright © 2022-Present Hervé Perchec
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -38,10 +38,14 @@ class Templater {
|
|
|
38
38
|
return ejs.compile(template, options.engineOptions);
|
|
39
39
|
};
|
|
40
40
|
this.methodsMap.render = async (template, data = void 0, opts) => {
|
|
41
|
-
return ejs.render(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
return ejs.render(
|
|
42
|
+
template,
|
|
43
|
+
data,
|
|
44
|
+
{
|
|
45
|
+
...options.engineOptions,
|
|
46
|
+
...opts || {}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
45
49
|
};
|
|
46
50
|
break;
|
|
47
51
|
case "pug":
|
|
@@ -57,6 +61,7 @@ class Templater {
|
|
|
57
61
|
engine;
|
|
58
62
|
defaultData;
|
|
59
63
|
methodsMap = {};
|
|
64
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-function-type
|
|
60
65
|
/**
|
|
61
66
|
* @returns Get the engine
|
|
62
67
|
*/
|
|
@@ -90,6 +95,7 @@ class MarkdownTemplater extends Templater {
|
|
|
90
95
|
processorOptions;
|
|
91
96
|
buildProcessorOptions(options) {
|
|
92
97
|
options = options || {};
|
|
98
|
+
const defaultRemarkStringifyOptions = {};
|
|
93
99
|
const defaultRemarkTocOptions = {};
|
|
94
100
|
const defaultRemarkFrontmatterOptions = {
|
|
95
101
|
type: "yaml",
|
|
@@ -99,16 +105,16 @@ class MarkdownTemplater extends Templater {
|
|
|
99
105
|
use: [
|
|
100
106
|
...options.use || []
|
|
101
107
|
],
|
|
108
|
+
stringify: options.stringify !== void 0 ? options.stringify : defaultRemarkStringifyOptions,
|
|
102
109
|
toc: options.toc === true ? defaultRemarkTocOptions : options.toc !== void 0 ? options.toc : defaultRemarkTocOptions,
|
|
103
110
|
frontmatter: options.frontmatter === true ? defaultRemarkFrontmatterOptions : options.frontmatter !== void 0 ? options.frontmatter : defaultRemarkFrontmatterOptions
|
|
104
111
|
};
|
|
105
112
|
}
|
|
106
113
|
initProcessor() {
|
|
107
114
|
const processorPlugins = [];
|
|
108
|
-
if (this.processorOptions.
|
|
109
|
-
|
|
110
|
-
if (this.processorOptions.frontmatter)
|
|
111
|
-
processorPlugins.push([remarkFrontmatter, this.processorOptions.frontmatter]);
|
|
115
|
+
if (this.processorOptions.stringify) this.processor.data("settings", this.processorOptions.stringify);
|
|
116
|
+
if (this.processorOptions.toc) processorPlugins.push([remarkToc, this.processorOptions.toc]);
|
|
117
|
+
if (this.processorOptions.frontmatter) processorPlugins.push([remarkFrontmatter, this.processorOptions.frontmatter]);
|
|
112
118
|
for (const plugin of processorPlugins.concat(this.processorOptions.use)) {
|
|
113
119
|
this.processor.use(...plugin);
|
|
114
120
|
}
|
|
@@ -122,7 +128,7 @@ class MarkdownTemplater extends Templater {
|
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
|
|
125
|
-
|
|
131
|
+
new GithubSlugger();
|
|
126
132
|
const DEFAULT_INIT_TARGET_RELATIVE_PATH = "./docs/readme";
|
|
127
133
|
class ReadmeTemplater {
|
|
128
134
|
/**
|
|
@@ -137,8 +143,22 @@ class ReadmeTemplater {
|
|
|
137
143
|
this.config = config;
|
|
138
144
|
this.templater = new MarkdownTemplater("ejs", {});
|
|
139
145
|
}
|
|
146
|
+
// To cache resolved config value
|
|
147
|
+
#resolvedConfig;
|
|
140
148
|
config;
|
|
141
149
|
templater;
|
|
150
|
+
get resolvedConfig() {
|
|
151
|
+
return this.#resolvedConfig;
|
|
152
|
+
}
|
|
153
|
+
set resolvedConfig(value) {
|
|
154
|
+
this.#resolvedConfig = value;
|
|
155
|
+
}
|
|
156
|
+
async resolveConfig() {
|
|
157
|
+
if (!this.resolvedConfig) {
|
|
158
|
+
this.resolvedConfig = await ReadmeTemplater.processConfig(this.config);
|
|
159
|
+
Object.assign(this.templater.processorOptions, this.resolvedConfig.processor);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
142
162
|
/**
|
|
143
163
|
* Writes rendered README markdown to file
|
|
144
164
|
* @param config - The config object to process. Can be path to config file as string.
|
|
@@ -149,9 +169,10 @@ class ReadmeTemplater {
|
|
|
149
169
|
* await templater.generate({ data: { foo: 'bar' } }) // pass options
|
|
150
170
|
*/
|
|
151
171
|
async generate(options = {}) {
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
172
|
+
await this.resolveConfig();
|
|
173
|
+
const resolvedConfig = this.resolvedConfig;
|
|
174
|
+
const targetFilePath = path.join(resolvedConfig.destFolder, resolvedConfig.fileName);
|
|
175
|
+
console.log(`Auto-generating "${resolvedConfig.fileName}" file`);
|
|
155
176
|
console.log();
|
|
156
177
|
console.log("- Syntax: " + chalk.yellow("ejs"));
|
|
157
178
|
const renderResult = await this.render(options);
|
|
@@ -168,25 +189,25 @@ class ReadmeTemplater {
|
|
|
168
189
|
/**
|
|
169
190
|
* Render README markdown
|
|
170
191
|
* @param options - Options object
|
|
171
|
-
* @param options.data - Additionnal data object to merge with default EJS data
|
|
172
192
|
* @returns Returns the rendered markdown as string. Promise is immediately resolved except if a module is async.
|
|
173
193
|
* @example
|
|
174
194
|
* await templater.render()
|
|
175
195
|
* await templater.render({ data: { foo: 'bar' } })
|
|
176
196
|
*/
|
|
177
197
|
async render(options = {}) {
|
|
178
|
-
|
|
179
|
-
const
|
|
198
|
+
await this.resolveConfig();
|
|
199
|
+
const resolvedConfig = this.resolvedConfig;
|
|
200
|
+
const data = resolvedConfig.ejsDataPath ? await import(pathToFileURL(resolvedConfig.ejsDataPath).toString()).then((mod) => mod.default || mod) : {};
|
|
180
201
|
options.data = options.data || {};
|
|
181
202
|
const ejsData = merge(merge({
|
|
182
203
|
...ReadmeTemplater.defaultEjsData,
|
|
183
|
-
$config:
|
|
204
|
+
$config: resolvedConfig
|
|
184
205
|
}, data), options.data);
|
|
185
|
-
let template = await fs.readFile(
|
|
186
|
-
if (
|
|
206
|
+
let template = await fs.readFile(resolvedConfig.templatePath, { encoding: "utf8" });
|
|
207
|
+
if (resolvedConfig.appendAutoGenMessage) {
|
|
187
208
|
template += "\n----\n<!-- markdownlint-disable-next-line line-length -->\n*<%= $config.fileName %> - this file was auto generated with [juisy](https://www.npmjs.com/package/juisy) README templater. Don't edit it.*\n";
|
|
188
209
|
}
|
|
189
|
-
return await this.templater.render(template, ejsData,
|
|
210
|
+
return await this.templater.render(template, ejsData, resolvedConfig.ejsOptions);
|
|
190
211
|
}
|
|
191
212
|
/**
|
|
192
213
|
* Static methods
|
|
@@ -230,8 +251,7 @@ class ReadmeTemplater {
|
|
|
230
251
|
result.ejsOptions = ReadmeTemplater.defaultConfig.ejsOptions;
|
|
231
252
|
}
|
|
232
253
|
result.appendAutoGenMessage = customConfig.appendAutoGenMessage !== void 0 ? customConfig.appendAutoGenMessage : ReadmeTemplater.defaultConfig.appendAutoGenMessage;
|
|
233
|
-
result.
|
|
234
|
-
result.slugify = customConfig.slugify !== void 0 ? customConfig.slugify : ReadmeTemplater.defaultConfig.slugify;
|
|
254
|
+
result.processor = customConfig.processor !== void 0 ? customConfig.processor : ReadmeTemplater.defaultConfig.processor;
|
|
235
255
|
return result;
|
|
236
256
|
}
|
|
237
257
|
/**
|
|
@@ -265,8 +285,7 @@ class ReadmeTemplater {
|
|
|
265
285
|
]
|
|
266
286
|
},
|
|
267
287
|
appendAutoGenMessage: true,
|
|
268
|
-
|
|
269
|
-
slugify: slugger.slug.bind(slugger)
|
|
288
|
+
processor: {}
|
|
270
289
|
};
|
|
271
290
|
/**
|
|
272
291
|
* The default EJS data object.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as ejs } from 'ejs';
|
|
2
2
|
import { markdownTable } from 'markdown-table';
|
|
3
3
|
import { default as asciitree } from 'ascii-tree';
|
|
4
|
+
import { MarkdownTemplaterOptions } from './index';
|
|
4
5
|
/**
|
|
5
6
|
* @group Types
|
|
6
7
|
*/
|
|
@@ -22,7 +23,7 @@ export type Configuration = {
|
|
|
22
23
|
*/
|
|
23
24
|
ejsDataPath: string;
|
|
24
25
|
/**
|
|
25
|
-
* EJS options: see also {@link https://www.npmjs.com/package/ejs#options EJS documentation}.
|
|
26
|
+
* EJS options: see also {@link https://www.npmjs.com/package/ejs#options "EJS documentation"}.
|
|
26
27
|
* @property {string[]} [ejsOptions.root] - The path of template folder is automatically included.
|
|
27
28
|
* @property {string[]} [ejsOptions.views] - The path of template folder and the path of internal partials are automatically included.
|
|
28
29
|
*/
|
|
@@ -35,15 +36,9 @@ export type Configuration = {
|
|
|
35
36
|
*/
|
|
36
37
|
appendAutoGenMessage: boolean;
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
-
* The `markdown-toc` package is used for this feature, check the {@link https://www.npmjs.com/package/markdown-toc documentation}.
|
|
39
|
+
* The markdown processor (remark) options
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* If provided, will be used by `markdown-toc` to slugify headings id.
|
|
44
|
-
* Default uses `github-slugger`: see [**slug** method documentation](https://github.com/Flet/github-slugger#usage).
|
|
45
|
-
*/
|
|
46
|
-
slugify: Function;
|
|
41
|
+
processor: MarkdownTemplaterOptions['processorOptions'];
|
|
47
42
|
};
|
|
48
43
|
/**
|
|
49
44
|
* @group Types
|
|
@@ -55,10 +50,10 @@ export type UserConfiguration = {
|
|
|
55
50
|
ejsDataPath?: Configuration['ejsDataPath'];
|
|
56
51
|
ejsOptions?: Configuration['ejsOptions'];
|
|
57
52
|
appendAutoGenMessage?: Configuration['appendAutoGenMessage'];
|
|
58
|
-
|
|
59
|
-
slugify?: Configuration['slugify'];
|
|
53
|
+
processor?: Configuration['processor'];
|
|
60
54
|
};
|
|
61
55
|
export declare class ReadmeTemplater {
|
|
56
|
+
#private;
|
|
62
57
|
/**
|
|
63
58
|
* @param config - The user configuration file path (as string) or object
|
|
64
59
|
* @example
|
|
@@ -70,6 +65,9 @@ export declare class ReadmeTemplater {
|
|
|
70
65
|
constructor(config: Parameters<typeof ReadmeTemplater.processConfig>[0]);
|
|
71
66
|
private config;
|
|
72
67
|
private templater;
|
|
68
|
+
get resolvedConfig(): Configuration | undefined;
|
|
69
|
+
set resolvedConfig(value: Configuration | undefined);
|
|
70
|
+
private resolveConfig;
|
|
73
71
|
/**
|
|
74
72
|
* Writes rendered README markdown to file
|
|
75
73
|
* @param config - The config object to process. Can be path to config file as string.
|
|
@@ -83,13 +81,15 @@ export declare class ReadmeTemplater {
|
|
|
83
81
|
/**
|
|
84
82
|
* Render README markdown
|
|
85
83
|
* @param options - Options object
|
|
86
|
-
* @param options.data - Additionnal data object to merge with default EJS data
|
|
87
84
|
* @returns Returns the rendered markdown as string. Promise is immediately resolved except if a module is async.
|
|
88
85
|
* @example
|
|
89
86
|
* await templater.render()
|
|
90
87
|
* await templater.render({ data: { foo: 'bar' } })
|
|
91
88
|
*/
|
|
92
89
|
render(options?: {
|
|
90
|
+
/**
|
|
91
|
+
* Additionnal data object to merge with default EJS data
|
|
92
|
+
*/
|
|
93
93
|
data?: Record<any, any>;
|
|
94
94
|
}): Promise<string>;
|
|
95
95
|
/**
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { remark } from 'remark';
|
|
2
2
|
import { Templater } from '../Templater';
|
|
3
|
+
import { Options as RemarkStringifyOptions } from 'remark-stringify';
|
|
4
|
+
import { Options as RemarkTocOptions } from 'remark-toc';
|
|
5
|
+
import { Options as RemarkFrontmatterOptions } from 'remark-frontmatter';
|
|
3
6
|
import { TemplaterOptions } from '../types';
|
|
4
7
|
/**
|
|
5
8
|
* @group Types
|
|
@@ -11,6 +14,7 @@ export type MarkdownTemplaterOptions = TemplaterOptions<any> & {
|
|
|
11
14
|
*/
|
|
12
15
|
processorOptions?: {
|
|
13
16
|
use?: MarkdownTemplater['processorOptions']['use'];
|
|
17
|
+
stringify?: MarkdownTemplater['processorOptions']['stringify'];
|
|
14
18
|
toc?: MarkdownTemplater['processorOptions']['toc'];
|
|
15
19
|
frontmatter?: MarkdownTemplater['processorOptions']['frontmatter'];
|
|
16
20
|
};
|
|
@@ -18,7 +22,12 @@ export type MarkdownTemplaterOptions = TemplaterOptions<any> & {
|
|
|
18
22
|
export declare class MarkdownTemplater extends Templater {
|
|
19
23
|
constructor(engine?: ConstructorParameters<typeof Templater>[0], options?: MarkdownTemplaterOptions);
|
|
20
24
|
private processor;
|
|
21
|
-
|
|
25
|
+
processorOptions: {
|
|
26
|
+
use: Array<Parameters<typeof remark.use>>;
|
|
27
|
+
stringify: RemarkStringifyOptions;
|
|
28
|
+
toc: boolean | RemarkTocOptions;
|
|
29
|
+
frontmatter: boolean | RemarkFrontmatterOptions;
|
|
30
|
+
};
|
|
22
31
|
private buildProcessorOptions;
|
|
23
32
|
private initProcessor;
|
|
24
33
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "juisy",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Make
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
|
+
"description": "Make your JavaScript (and/or TypeScript) project juicy!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"bin",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/cli/index.d.ts",
|
|
22
22
|
"import": "./dist/cli/index.js"
|
|
23
23
|
},
|
|
24
|
+
"#juisy/parser": {
|
|
25
|
+
"types": "./dist/templater/index.d.ts",
|
|
26
|
+
"import": "./dist/templater/index.js"
|
|
27
|
+
},
|
|
24
28
|
"#juisy/templater": {
|
|
25
29
|
"types": "./dist/templater/index.d.ts",
|
|
26
30
|
"import": "./dist/templater/index.js"
|
|
@@ -38,14 +42,6 @@
|
|
|
38
42
|
"./templater": {
|
|
39
43
|
"types": "./dist/templater/index.d.ts",
|
|
40
44
|
"import": "./dist/templater/index.js"
|
|
41
|
-
},
|
|
42
|
-
"./vite-plugin-inject-css-variables": {
|
|
43
|
-
"types": "./dist/vite/plugins/inject-css-variables/index.d.ts",
|
|
44
|
-
"import": "./dist/vite/plugins/inject-css-variables/index.js"
|
|
45
|
-
},
|
|
46
|
-
"./vite-plugin-inject-project-globals": {
|
|
47
|
-
"types": "./dist/vite/plugins/inject-project-globals/index.d.ts",
|
|
48
|
-
"import": "./dist/vite/plugins/inject-project-globals/index.js"
|
|
49
45
|
}
|
|
50
46
|
},
|
|
51
47
|
"publishConfig": {
|
|
@@ -55,18 +51,13 @@
|
|
|
55
51
|
"build": "vite build",
|
|
56
52
|
"audit": "ncu && npm audit",
|
|
57
53
|
"audit:fix": "ncu --interactive",
|
|
58
|
-
"docs": "
|
|
59
|
-
"docs:api": "
|
|
60
|
-
"docs:cli": "npm run docs:cli:private && npm run docs:cli:public",
|
|
54
|
+
"docs": "pnpm docs:cli && pnpm docs:api",
|
|
55
|
+
"docs:api": "pnpm root:cli docs generate:api -c ./docs/api/typedoc/typedoc.config.js",
|
|
56
|
+
"docs:cli": "npm run -s docs:cli:private && npm run -s docs:cli:public",
|
|
61
57
|
"docs:cli:private": "node ./bin/cli docs generate:cli -c ./docs/cli/private/config.js",
|
|
62
58
|
"docs:cli:public": "node ./bin/cli docs generate:cli -c ./docs/cli/public/config.js",
|
|
63
|
-
"example:reset": "git checkout --no-overlay -- example && cd example && git clean -fdX",
|
|
64
|
-
"example:test": "npm run example:reset && cd example && npm install -D juisy@file:../ && npx juisy squeeze && npm run docs:readme",
|
|
65
|
-
"print:globals": "node --no-warnings ./bin/cli print:globals",
|
|
66
59
|
"release": "release-it --no-increment",
|
|
67
|
-
"
|
|
68
|
-
"test:dev": "npm test -- --watch",
|
|
69
|
-
"test:ui": "vitest --ui"
|
|
60
|
+
"root:cli": "node ../../bin/cli"
|
|
70
61
|
},
|
|
71
62
|
"repository": {
|
|
72
63
|
"type": "git",
|
|
@@ -74,12 +65,15 @@
|
|
|
74
65
|
},
|
|
75
66
|
"keywords": [
|
|
76
67
|
"js",
|
|
77
|
-
"
|
|
68
|
+
"easy",
|
|
69
|
+
"juisy",
|
|
70
|
+
"lint",
|
|
71
|
+
"docs",
|
|
78
72
|
"release",
|
|
79
73
|
"changelog",
|
|
80
74
|
"bin",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
75
|
+
"cli",
|
|
76
|
+
"cmd"
|
|
83
77
|
],
|
|
84
78
|
"author": {
|
|
85
79
|
"name": "Hervé Perchec",
|
|
@@ -95,21 +89,15 @@
|
|
|
95
89
|
"juisy": "bin/cli/index.js"
|
|
96
90
|
},
|
|
97
91
|
"peerDependencies": {
|
|
98
|
-
"@commitlint/cli": "^19.6.1",
|
|
99
|
-
"@commitlint/config-conventional": "^19.6.0",
|
|
100
92
|
"@github/markdownlint-github": "^0.6.3",
|
|
101
|
-
"@
|
|
102
|
-
"@
|
|
103
|
-
"@
|
|
104
|
-
"@typescript-eslint/eslint-plugin": "^8",
|
|
105
|
-
"chalk": "^5.4.1",
|
|
93
|
+
"@juisy/utils": "3.0.0-beta.0",
|
|
94
|
+
"@types/yargs": "^17.0.33",
|
|
95
|
+
"@types/yargs-parser": "^21.0.3",
|
|
106
96
|
"conventional-changelog-cli": "^5.0.0",
|
|
107
97
|
"eslint": "^9",
|
|
108
|
-
"globals": "^15",
|
|
109
98
|
"lint-staged": "^14.0.1",
|
|
110
99
|
"markdownlint-cli2": "^0.12.0",
|
|
111
100
|
"markdownlint-cli2-formatter-pretty": "^0.0.7",
|
|
112
|
-
"prompts": "^2.4.2",
|
|
113
101
|
"release-it": "^17.11.0",
|
|
114
102
|
"simple-git-hooks": "^2.9.0",
|
|
115
103
|
"yargs": "^17.7.2"
|
|
@@ -126,10 +114,7 @@
|
|
|
126
114
|
}
|
|
127
115
|
},
|
|
128
116
|
"devDependencies": {
|
|
129
|
-
"@babel/eslint-parser": "^7.25.9",
|
|
130
117
|
"@conventional-changelog/git-client": "^1.0.1",
|
|
131
|
-
"@rollup/plugin-typescript": "^12.1.2",
|
|
132
|
-
"@stylistic/eslint-plugin": "^2.12.1",
|
|
133
118
|
"@types/conventional-changelog": "^3.1.5",
|
|
134
119
|
"@types/conventional-changelog-config-spec": "^2.1.5",
|
|
135
120
|
"@types/ejs": "^3.1.5",
|
|
@@ -144,39 +129,35 @@
|
|
|
144
129
|
"@types/semver": "^7.5.8",
|
|
145
130
|
"@types/yargs": "^17.0.33",
|
|
146
131
|
"@types/yargs-parser": "^21.0.3",
|
|
147
|
-
"@typescript-eslint/eslint-plugin": "^8.18.1",
|
|
148
|
-
"@vitest/coverage-v8": "^2.1.8",
|
|
149
|
-
"@vitest/ui": "^2.1.8",
|
|
150
132
|
"cpy-cli": "^5.0.0",
|
|
151
|
-
"eslint": "^9.17.0",
|
|
152
|
-
"happy-dom": "^15.11.7",
|
|
153
133
|
"json-schema-to-ts": "^3.1.1",
|
|
154
134
|
"lint-staged": "^14.0.1",
|
|
155
135
|
"npm-check-updates": "^17.1.12",
|
|
156
136
|
"quicktype": "^23.0.170",
|
|
157
|
-
"typedoc": "^0.28.1",
|
|
158
|
-
"typedoc-plugin-frontmatter": "^1.3.0",
|
|
159
|
-
"typedoc-plugin-markdown": "^4.5.2",
|
|
160
|
-
"typedoc-vitepress-theme": "^1.1.2",
|
|
161
137
|
"typescript": "^5.7.2",
|
|
162
138
|
"vite": "^5.4.11",
|
|
163
|
-
"vite-plugin-dts": "^4.3.0"
|
|
164
|
-
"vite-plugin-generate-file": "^0.2.0",
|
|
165
|
-
"vitest": "^2.1.8"
|
|
139
|
+
"vite-plugin-dts": "^4.3.0"
|
|
166
140
|
},
|
|
167
141
|
"dependencies": {
|
|
142
|
+
"@commitlint/cli": "^19.6.1",
|
|
143
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
168
144
|
"@commitlint/types": "^19.8.0",
|
|
169
|
-
"@dotenvx/dotenvx": "
|
|
145
|
+
"@dotenvx/dotenvx": "1.32.0",
|
|
146
|
+
"@juisy/utils": "3.0.0-beta.0",
|
|
147
|
+
"@release-it/bumper": "6.0.1",
|
|
148
|
+
"@release-it/conventional-changelog": "^9.0.4",
|
|
170
149
|
"ascii-tree": "^0.3.0",
|
|
171
150
|
"chalk": "^5.4.1",
|
|
172
151
|
"conventional-recommended-bump": "^10.0.0",
|
|
173
152
|
"deepmerge": "^4.3.1",
|
|
174
153
|
"ejs": "^3.1.10",
|
|
154
|
+
"eslint": "^9.17.0",
|
|
175
155
|
"execa": "^9.5.2",
|
|
176
156
|
"find-up": "^7.0.0",
|
|
177
157
|
"fs-extra": "^11.2.0",
|
|
178
158
|
"github-slugger": "^2.0.0",
|
|
179
159
|
"glob": "^11.0.0",
|
|
160
|
+
"globals": "^16",
|
|
180
161
|
"handlebars": "^4.7.8",
|
|
181
162
|
"import-single-ts": "^1.2.0",
|
|
182
163
|
"indent-string": "^5.0.0",
|
|
@@ -195,15 +176,28 @@
|
|
|
195
176
|
"prompts": "^2.4.2",
|
|
196
177
|
"remark": "^15.0.1",
|
|
197
178
|
"remark-frontmatter": "^5.0.0",
|
|
179
|
+
"remark-stringify": "^11.0.0",
|
|
198
180
|
"remark-toc": "^9.0.0",
|
|
199
181
|
"semver": "^7.7.1",
|
|
200
182
|
"strip-ansi": "^7.1.0",
|
|
201
|
-
"
|
|
183
|
+
"strip-indent": "^4.1.1",
|
|
184
|
+
"typescript-eslint": "^8",
|
|
202
185
|
"yaml": "^2.6.1",
|
|
203
186
|
"yargs": "^17.7.2",
|
|
204
187
|
"yargs-parser": "^21.1.1"
|
|
205
188
|
},
|
|
206
189
|
"release-it": {
|
|
207
|
-
"git": false
|
|
190
|
+
"git": false,
|
|
191
|
+
"plugins": {
|
|
192
|
+
"@release-it/bumper": {
|
|
193
|
+
"out": {
|
|
194
|
+
"file": "package.json",
|
|
195
|
+
"path": [
|
|
196
|
+
"dependencies.@juisy/utils",
|
|
197
|
+
"peerDependencies.@juisy/utils"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
208
202
|
}
|
|
209
203
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
import { pathToFileURL } from 'node:url'
|
|
3
|
-
|
|
4
|
-
/** @type {import('#juisy/cli').Command} */
|
|
5
|
-
export default new CLI.Command({
|
|
6
|
-
command: 'generate:api',
|
|
7
|
-
describe: 'Generate API docs from source code',
|
|
8
|
-
builder (cli) {
|
|
9
|
-
cli
|
|
10
|
-
},
|
|
11
|
-
async handler (argv) {
|
|
12
|
-
// Utils
|
|
13
|
-
const { $style, step, substep } = CLI.OutputUtils
|
|
14
|
-
const { run } = CLI.InterfaceUtils
|
|
15
|
-
|
|
16
|
-
const config = (await import(pathToFileURL(path.resolve('./docs/api/docs.config.js')).toString())).default
|
|
17
|
-
// Process options
|
|
18
|
-
const typedocConfigPath = config.typedoc.configPath
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Generate api documentation
|
|
22
|
-
*/
|
|
23
|
-
step('Generating API documentation')
|
|
24
|
-
|
|
25
|
-
// Run typedoc command
|
|
26
|
-
await run('typedoc', [ '--options', typedocConfigPath ], { stdio: 'pipe' })
|
|
27
|
-
|
|
28
|
-
substep($style.green('✔ Successfuly generated'), { last: true })
|
|
29
|
-
this.log() // blank line
|
|
30
|
-
}
|
|
31
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import generateAPI from './generate-api.js'
|
|
2
|
-
|
|
3
|
-
/** @type {import('#juisy/cli').Command} */
|
|
4
|
-
export default new CLI.Command({
|
|
5
|
-
command: 'docs <command>',
|
|
6
|
-
describe: 'Manage project documentation',
|
|
7
|
-
meta: {
|
|
8
|
-
private: true
|
|
9
|
-
},
|
|
10
|
-
builder (cli) {
|
|
11
|
-
return cli
|
|
12
|
-
.command([
|
|
13
|
-
/**
|
|
14
|
-
* Default command are automatically injected here...
|
|
15
|
-
*/
|
|
16
|
-
generateAPI
|
|
17
|
-
])
|
|
18
|
-
},
|
|
19
|
-
handler (argv) {}
|
|
20
|
-
})
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/** @type {import('#juisy/cli').Command} */
|
|
2
|
-
export default new CLI.Command({
|
|
3
|
-
command: 'test',
|
|
4
|
-
describe: 'Run project tests',
|
|
5
|
-
meta: {
|
|
6
|
-
private: true
|
|
7
|
-
},
|
|
8
|
-
builder (cli) {
|
|
9
|
-
cli.option('watch', {
|
|
10
|
-
alias: 'w',
|
|
11
|
-
type: 'boolean',
|
|
12
|
-
default: false,
|
|
13
|
-
describe: 'Run vitest in watch mode'
|
|
14
|
-
})
|
|
15
|
-
cli.option('ui', {
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
default: false,
|
|
18
|
-
describe: 'Launch vitest UI'
|
|
19
|
-
})
|
|
20
|
-
return cli
|
|
21
|
-
},
|
|
22
|
-
async handler (args) {
|
|
23
|
-
const watchMode = args.watch || args.ui
|
|
24
|
-
const { run } = CLI.InterfaceUtils
|
|
25
|
-
/**
|
|
26
|
-
* Run tests
|
|
27
|
-
*/
|
|
28
|
-
await run('vitest', [
|
|
29
|
-
...(watchMode ? [] : [ 'run' ]),
|
|
30
|
-
...(args.ui ? [ '--ui' ] : [])
|
|
31
|
-
], { stdio: 'inherit' })
|
|
32
|
-
}
|
|
33
|
-
})
|
package/dist/utils/misc.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { GlobOptions } from 'glob';
|
|
2
|
-
/**
|
|
3
|
-
* @param pattern - Same as node-glob pattern argument
|
|
4
|
-
* @param options - Same as glob options argument
|
|
5
|
-
* @returns {string[]} Returns an array of file path
|
|
6
|
-
* @description
|
|
7
|
-
* Get file urls that match glob (see: https://github.com/isaacs/node-glob)
|
|
8
|
-
* @example
|
|
9
|
-
* utils.getFileUrls('path/to/*.js') // => [ 'path/to/file1.js', 'path/to/file2.js', ... ]
|
|
10
|
-
*/
|
|
11
|
-
export declare function getFileUrls(pattern: string, options?: GlobOptions): string[] | import('glob').Path[];
|
|
12
|
-
/**
|
|
13
|
-
* @param dir - The directory path
|
|
14
|
-
* @returns Returns an array of file path
|
|
15
|
-
* @yields {string[]} The next found files.
|
|
16
|
-
* @description
|
|
17
|
-
* Get all files in a directory (recursively)
|
|
18
|
-
* @example
|
|
19
|
-
* utils.getFiles(path) // => [ 'path/to/file1', 'path/to/file2', ... ]
|
|
20
|
-
*/
|
|
21
|
-
export declare function getFiles(dir: string): AsyncGenerator<string[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Synchronously find the root directory of the project in which juisy is installed.
|
|
24
|
-
*
|
|
25
|
-
* It is just a wrapper around the `packageDirectorySync` function
|
|
26
|
-
* from [pkg-dir](https://www.npmjs.com/package/pkg-dir) library.
|
|
27
|
-
*/
|
|
28
|
-
export declare function getRootDir(): string | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Utils related to path
|
|
31
|
-
*/
|
|
32
|
-
export declare const path: {
|
|
33
|
-
/**
|
|
34
|
-
* Convert a path to win32 format (with `\\` separator)
|
|
35
|
-
* @param val - The path to convert
|
|
36
|
-
* @example
|
|
37
|
-
* utils.path.toWin32('a/posix/path') // => 'a\posix\path'
|
|
38
|
-
* utils.path.toWin32('C:\\a\\win32\\absolute\\path') // => 'C:\a\win32\absolute\path'
|
|
39
|
-
* utils.path.toWin32('a/mixed\\path') // => 'a\mixed\path'
|
|
40
|
-
*/
|
|
41
|
-
toWin32(val: string): string;
|
|
42
|
-
/**
|
|
43
|
-
* Convert a path to posix format (with `/` separator)
|
|
44
|
-
* @param val - The path to convert
|
|
45
|
-
* @example
|
|
46
|
-
* utils.path.toPosix('a/posix/path') // => 'a/posix/path'
|
|
47
|
-
* utils.path.toPosix('C:\\a\\win32\\absolute\\path') // => 'C:/a/win32/absolute/path'
|
|
48
|
-
* utils.path.toPosix('a/mixed\\path') // => 'a/mixed/path'
|
|
49
|
-
*/
|
|
50
|
-
toPosix(val: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* Automatically convert a path to OS specific format
|
|
53
|
-
* @param val - The path to convert
|
|
54
|
-
*/
|
|
55
|
-
toOsFormat(val: string): string;
|
|
56
|
-
/**
|
|
57
|
-
* Util to resolve a relative file path
|
|
58
|
-
* @param from - The "from" absolute file path
|
|
59
|
-
* @param to - The "to" absolute file path
|
|
60
|
-
* @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
|
|
61
|
-
* @returns The resolved relative path
|
|
62
|
-
* @example
|
|
63
|
-
* const base = 'C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject'
|
|
64
|
-
*
|
|
65
|
-
* utils.path.resolveRel(base, 'C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject\\src\\index.ts') // 'src\\index.ts'
|
|
66
|
-
* utils.path.resolveRel('C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject\\src\\index.ts', base) // '..\\..'
|
|
67
|
-
* utils.path.resolveRel(base, 'C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject\\src\\index.ts', 'posix') // 'src/index.ts'
|
|
68
|
-
*/
|
|
69
|
-
resolveRel(from: string, to: string, separator?: "posix" | "win32"): string;
|
|
70
|
-
/**
|
|
71
|
-
* Util to resolve relative file path from root directory
|
|
72
|
-
* @param to - The absolute file path
|
|
73
|
-
* @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
|
|
74
|
-
* @returns The resolved relative path from root directory
|
|
75
|
-
*/
|
|
76
|
-
resolveRelFromRoot(to: string, separator?: "posix" | "win32"): string;
|
|
77
|
-
/**
|
|
78
|
-
* Util to resolve absolute file path from root directory
|
|
79
|
-
* @param to - The relative file path
|
|
80
|
-
* @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
|
|
81
|
-
* @returns The resolved absolute path from root directory
|
|
82
|
-
*/
|
|
83
|
-
resolveAbsFromRoot(to: string, separator?: "posix" | "win32"): string;
|
|
84
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
2
|
-
export type Options = {
|
|
3
|
-
/**
|
|
4
|
-
* The virtual module ID
|
|
5
|
-
*/
|
|
6
|
-
moduleId: string;
|
|
7
|
-
/**
|
|
8
|
-
* The CSS selector.
|
|
9
|
-
* @default ':root'
|
|
10
|
-
*/
|
|
11
|
-
selector?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The CSS variables object
|
|
14
|
-
*/
|
|
15
|
-
variables: Record<string, string>;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Inject CSS variables via a virtual module
|
|
19
|
-
* @param opts - The plugin options or an array of options
|
|
20
|
-
* @returns {Plugin} The vite plugin function
|
|
21
|
-
*/
|
|
22
|
-
export declare function injectCssVariables(optsArg?: Options | Array<Options>): Plugin;
|
|
23
|
-
export default injectCssVariables;
|