juisy 2.1.0 → 2.3.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.
Files changed (56) hide show
  1. package/LICENSE +1 -1
  2. package/bin/cli/cli.js +14 -0
  3. package/bin/cli/cmds/index.js +6 -4
  4. package/bin/cli/cmds/public/AddExt.js +49 -0
  5. package/bin/cli/cmds/public/RemoveExt.js +49 -0
  6. package/bin/cli/index.js +1 -0
  7. package/bin/cli/init.js +1 -0
  8. package/bin/cli/lib/index.js +71 -0
  9. package/dist/DataExporter.d.ts +1 -0
  10. package/dist/bootstrap.d.ts +1 -0
  11. package/dist/cli/CLIFactory.d.ts +1 -0
  12. package/dist/cli/Command.d.ts +23 -2
  13. package/dist/cli/InterfaceUtils.d.ts +11 -9
  14. package/dist/cli/OutputUtils.d.ts +30 -16
  15. package/dist/cli/Plugin.d.ts +9 -0
  16. package/dist/cli/extract-usage.d.ts +8 -0
  17. package/dist/cli/index.d.ts +1 -0
  18. package/dist/cli/index.js +193 -113
  19. package/dist/cli/plugins/command-meta/augment.d.ts +0 -3
  20. package/dist/cli/plugins/command-meta/index.d.ts +4 -0
  21. package/dist/cli/plugins/default-command-fallbacks/command-visitors/default-command-fallbacks.d.ts +1 -1
  22. package/dist/cli/plugins/default-command-fallbacks/index.d.ts +4 -0
  23. package/dist/cli/plugins/load-env-file/index.d.ts +4 -0
  24. package/dist/cli/plugins/private-commands/augment.d.ts +8 -0
  25. package/dist/cli/plugins/private-commands/command-visitors/private-command.d.ts +7 -3
  26. package/dist/cli/plugins/private-commands/index.d.ts +4 -0
  27. package/dist/cli/plugins/register-bump-version-command/index.d.ts +4 -0
  28. package/dist/cli/plugins/register-changelog-command/index.d.ts +4 -0
  29. package/dist/cli/plugins/register-docs-commands/index.d.ts +4 -0
  30. package/dist/cli/plugins/register-git-hooks-commands/index.d.ts +4 -0
  31. package/dist/cli/plugins/register-lint-commands/index.d.ts +4 -0
  32. package/dist/cli/plugins/register-lint-commands/settings.d.ts +2 -0
  33. package/dist/cli/plugins/register-lint-commands/types.d.ts +5 -9
  34. package/dist/cli/plugins/register-release-command/index.d.ts +4 -0
  35. package/dist/cli/plugins/register-test-command/index.d.ts +4 -0
  36. package/dist/cli/types.d.ts +7 -0
  37. package/dist/cli/utils.d.ts +3 -4
  38. package/dist/eject.d.ts +1 -0
  39. package/dist/get-package-info.d.ts +1 -0
  40. package/dist/index.d.ts +5 -1
  41. package/dist/index.js +192 -13
  42. package/dist/project-globals.d.ts +2 -0
  43. package/dist/shims/shims.d.ts +1440 -0
  44. package/dist/templater/index.d.ts +4 -1
  45. package/dist/templater/index.js +42 -23
  46. package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +8 -10
  47. package/dist/templater/markdown-templater/index.d.ts +10 -1
  48. package/dist/utils/misc.d.ts +92 -10
  49. package/package.json +38 -44
  50. package/bin/cli/cmds/private/docs/generate-api.js +0 -31
  51. package/bin/cli/cmds/private/docs/index.js +0 -20
  52. package/bin/cli/cmds/private/test.js +0 -33
  53. package/dist/vite/plugins/inject-css-variables/index.d.ts +0 -23
  54. package/dist/vite/plugins/inject-css-variables/index.js +0 -60
  55. package/dist/vite/plugins/inject-project-globals/index.d.ts +0 -19
  56. 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\/templater
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';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * juisy v2.1.0
2
+ * juisy v2.3.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(template, data, {
42
- ...options.engineOptions,
43
- ...opts || {}
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":
@@ -90,6 +94,7 @@ class MarkdownTemplater extends Templater {
90
94
  processorOptions;
91
95
  buildProcessorOptions(options) {
92
96
  options = options || {};
97
+ const defaultRemarkStringifyOptions = {};
93
98
  const defaultRemarkTocOptions = {};
94
99
  const defaultRemarkFrontmatterOptions = {
95
100
  type: "yaml",
@@ -99,16 +104,16 @@ class MarkdownTemplater extends Templater {
99
104
  use: [
100
105
  ...options.use || []
101
106
  ],
107
+ stringify: options.stringify !== void 0 ? options.stringify : defaultRemarkStringifyOptions,
102
108
  toc: options.toc === true ? defaultRemarkTocOptions : options.toc !== void 0 ? options.toc : defaultRemarkTocOptions,
103
109
  frontmatter: options.frontmatter === true ? defaultRemarkFrontmatterOptions : options.frontmatter !== void 0 ? options.frontmatter : defaultRemarkFrontmatterOptions
104
110
  };
105
111
  }
106
112
  initProcessor() {
107
113
  const processorPlugins = [];
108
- if (this.processorOptions.toc)
109
- processorPlugins.push([remarkToc, this.processorOptions.toc]);
110
- if (this.processorOptions.frontmatter)
111
- processorPlugins.push([remarkFrontmatter, this.processorOptions.frontmatter]);
114
+ if (this.processorOptions.stringify) this.processor.data("settings", this.processorOptions.stringify);
115
+ if (this.processorOptions.toc) processorPlugins.push([remarkToc, this.processorOptions.toc]);
116
+ if (this.processorOptions.frontmatter) processorPlugins.push([remarkFrontmatter, this.processorOptions.frontmatter]);
112
117
  for (const plugin of processorPlugins.concat(this.processorOptions.use)) {
113
118
  this.processor.use(...plugin);
114
119
  }
@@ -122,7 +127,7 @@ class MarkdownTemplater extends Templater {
122
127
  }
123
128
  }
124
129
 
125
- const slugger = new GithubSlugger();
130
+ new GithubSlugger();
126
131
  const DEFAULT_INIT_TARGET_RELATIVE_PATH = "./docs/readme";
127
132
  class ReadmeTemplater {
128
133
  /**
@@ -137,8 +142,22 @@ class ReadmeTemplater {
137
142
  this.config = config;
138
143
  this.templater = new MarkdownTemplater("ejs", {});
139
144
  }
145
+ // To cache resolved config value
146
+ #resolvedConfig;
140
147
  config;
141
148
  templater;
149
+ get resolvedConfig() {
150
+ return this.#resolvedConfig;
151
+ }
152
+ set resolvedConfig(value) {
153
+ this.#resolvedConfig = value;
154
+ }
155
+ async resolveConfig() {
156
+ if (!this.resolvedConfig) {
157
+ this.resolvedConfig = await ReadmeTemplater.processConfig(this.config);
158
+ Object.assign(this.templater.processorOptions, this.resolvedConfig.processor);
159
+ }
160
+ }
142
161
  /**
143
162
  * Writes rendered README markdown to file
144
163
  * @param config - The config object to process. Can be path to config file as string.
@@ -149,9 +168,10 @@ class ReadmeTemplater {
149
168
  * await templater.generate({ data: { foo: 'bar' } }) // pass options
150
169
  */
151
170
  async generate(options = {}) {
152
- const processedConfig = await ReadmeTemplater.processConfig(this.config);
153
- const targetFilePath = path.join(processedConfig.destFolder, processedConfig.fileName);
154
- console.log(`Auto-generating "${processedConfig.fileName}" file`);
171
+ await this.resolveConfig();
172
+ const resolvedConfig = this.resolvedConfig;
173
+ const targetFilePath = path.join(resolvedConfig.destFolder, resolvedConfig.fileName);
174
+ console.log(`Auto-generating "${resolvedConfig.fileName}" file`);
155
175
  console.log();
156
176
  console.log("- Syntax: " + chalk.yellow("ejs"));
157
177
  const renderResult = await this.render(options);
@@ -175,18 +195,19 @@ class ReadmeTemplater {
175
195
  * await templater.render({ data: { foo: 'bar' } })
176
196
  */
177
197
  async render(options = {}) {
178
- const processedConfig = await ReadmeTemplater.processConfig(this.config);
179
- const data = processedConfig.ejsDataPath ? await import(pathToFileURL(processedConfig.ejsDataPath).toString()).then((mod) => mod.default || mod) : {};
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: processedConfig
204
+ $config: resolvedConfig
184
205
  }, data), options.data);
185
- let template = await fs.readFile(processedConfig.templatePath, { encoding: "utf8" });
186
- if (processedConfig.appendAutoGenMessage) {
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, processedConfig.ejsOptions);
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.autoToc = customConfig.autoToc !== void 0 ? customConfig.autoToc : ReadmeTemplater.defaultConfig.autoToc;
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
- autoToc: true,
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
  */
@@ -35,15 +36,9 @@ export type Configuration = {
35
36
  */
36
37
  appendAutoGenMessage: boolean;
37
38
  /**
38
- * If true, parse `<!-- toc -->` special comment to automatically inject generated table of contents. Default is **true**.
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
- autoToc: boolean;
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
- autoToc?: Configuration['autoToc'];
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.
@@ -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
- private processorOptions;
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
  /**
@@ -1,24 +1,51 @@
1
1
  import { GlobOptions } from 'glob';
2
2
  /**
3
+ * Get file urls that match glob (see: https://github.com/isaacs/node-glob)
3
4
  * @param pattern - Same as node-glob pattern argument
4
5
  * @param options - Same as glob options argument
5
6
  * @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
7
  * @example
9
8
  * utils.getFileUrls('path/to/*.js') // => [ 'path/to/file1.js', 'path/to/file2.js', ... ]
10
9
  */
11
10
  export declare function getFileUrls(pattern: string, options?: GlobOptions): string[] | import('glob').Path[];
12
11
  /**
12
+ * Get all files in a directory (recursively).
13
+ *
14
+ * Prefer using this function over `getFilesSync` for directories with
15
+ * a large number of files, to avoid blocking the event loop.
16
+ *
13
17
  * @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
+ * @returns An async generator that yields file paths
19
+ * @yields {string} The next found files.
20
+ *
18
21
  * @example
19
- * utils.getFiles(path) // => [ 'path/to/file1', 'path/to/file2', ... ]
22
+ * const files = []
23
+ * for await (const file of utils.getFiles(path)) {
24
+ * files.push(file)
25
+ * }
26
+ * console.log(files) // => [ 'path/to/file1', 'path/to/file2', ... ]
27
+ */
28
+ export declare function getFiles(dir: string): AsyncGenerator<string>;
29
+ /**
30
+ * Get all files in a directory (recursively and synchronously).
31
+ *
32
+ * For directories with a large number of files, prefer using `getFiles`
33
+ * over this function to avoid blocking the event loop.
34
+ *
35
+ * @param dir - The directory path
36
+ * @returns Returns an array of file paths
37
+ *
38
+ * @example
39
+ * utils.getFilesSync(path) // => [ 'path/to/file1', 'path/to/file2', ... ]
40
+ */
41
+ export declare function getFilesSync(dir: string): string[];
42
+ /**
43
+ * Synchronously find the root directory of the project in which juisy is installed.
44
+ *
45
+ * It is just a wrapper around the `packageDirectorySync` function
46
+ * from [pkg-dir](https://www.npmjs.com/package/pkg-dir) library.
20
47
  */
21
- export declare function getFiles(dir: string): AsyncGenerator<string[]>;
48
+ export declare function getRootDir(): string | undefined;
22
49
  /**
23
50
  * Utils related to path
24
51
  */
@@ -47,11 +74,38 @@ export declare const path: {
47
74
  */
48
75
  toOsFormat(val: string): string;
49
76
  /**
50
- * Util to resolve relative file path to root directory
77
+ * Check if the given path is win32 format
78
+ * @param val - The path to check
79
+ * @example
80
+ * utils.path.isWin32('a/posix/path') // => false
81
+ * utils.path.isWin32('C:\\a\\win32\\absolute\\path') // => true
82
+ * utils.path.isWin32('a/mixed\\path') // => true
83
+ */
84
+ isWin32(val: string): boolean;
85
+ /**
86
+ * Check if the given path is posix format
87
+ * @param val - The path to check
88
+ * @example
89
+ * utils.path.isPosix('a/posix/path') // => true
90
+ * utils.path.isPosix('C:\\a\\win32\\absolute\\path') // => false
91
+ * utils.path.isPosix('a/mixed\\path') // => false
92
+ */
93
+ isPosix(val: string): boolean;
94
+ /**
95
+ * Normalize a path depending on base format
96
+ * @param val - The path to normalize
97
+ * @example
98
+ * utils.path.normalize('a/Posix/path') // => 'a/Posix/path'
99
+ * utils.path.normalize('C:\\a\\Win32\\Absolute\\path\\') // => 'c:\a\win32\absolute\path'
100
+ * utils.path.normalize('a/Mixed\\Path') // => 'a\mixed\path'
101
+ */
102
+ normalize(val: string): string;
103
+ /**
104
+ * Util to resolve a relative file path
51
105
  * @param from - The "from" absolute file path
52
106
  * @param to - The "to" absolute file path
53
107
  * @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
54
- * @returns The resolved relative path to root directory
108
+ * @returns The resolved relative path
55
109
  * @example
56
110
  * const base = 'C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject'
57
111
  *
@@ -60,4 +114,32 @@ export declare const path: {
60
114
  * utils.path.resolveRel(base, 'C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject\\src\\index.ts', 'posix') // 'src/index.ts'
61
115
  */
62
116
  resolveRel(from: string, to: string, separator?: "posix" | "win32"): string;
117
+ /**
118
+ * Util to resolve relative file path from root directory
119
+ * @param to - The absolute file path
120
+ * @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
121
+ * @returns The resolved relative path from root directory
122
+ */
123
+ resolveRelFromRoot(to: string, separator?: "posix" | "win32"): string;
124
+ /**
125
+ * Util to resolve absolute file path from root directory
126
+ * @param to - The relative file path
127
+ * @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
128
+ * @returns The resolved absolute path from root directory
129
+ */
130
+ resolveAbsFromRoot(to: string, separator?: "posix" | "win32"): string;
131
+ /**
132
+ * Util function to compare two file paths
133
+ * @param a - The first file path to compare
134
+ * @param b - The second file path to compare
135
+ * @returns True if the two paths are the same
136
+ * @example
137
+ * utils.path.isSameAs('src/index.ts', 'src\\index.ts') // true
138
+ * utils.path.isSameAs('../src/index.ts', '..\\src\\index.ts') // true
139
+ * utils.path.isSameAs('C:\\a\\Win32\\Absolute\\path\\', 'c:/a/Win32/Absolute/path') // true
140
+ * utils.path.isSameAs('C:\\a\\Win32\\Absolute\\path\\', '/a/Win32/Absolute/path')// false
141
+ * utils.path.isSameAs('/a/posix/absolute/path', '/a/posix/absolute/path/../../absolute/path') // true
142
+ * utils.path.isSameAs('/a/posix/absolute/path', '/a/Posix/Absolute/path') // false
143
+ */
144
+ isSameAs(a: string, b: string): boolean;
63
145
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "juisy",
3
- "version": "2.1.0",
4
- "description": "Make you JavaScript (and/or TypeScript) project juicy!",
3
+ "version": "2.3.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": "npm run docs:cli && npm run docs:api",
59
- "docs:api": "node ./bin/cli docs generate: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
- "test": "node ./bin/cli test",
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
- "build",
68
+ "easy",
69
+ "juisy",
70
+ "lint",
71
+ "docs",
78
72
  "release",
79
73
  "changelog",
80
74
  "bin",
81
- "cmd",
82
- "easy"
75
+ "cli",
76
+ "cmd"
83
77
  ],
84
78
  "author": {
85
79
  "name": "Hervé Perchec",
@@ -95,21 +89,14 @@
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
- "@release-it/bumper": "6.0.1",
102
- "@release-it/conventional-changelog": "^9.0.4",
103
- "@stylistic/eslint-plugin": "^2",
104
- "@typescript-eslint/eslint-plugin": "^8",
105
- "chalk": "^5.4.1",
93
+ "@types/yargs": "^17.0.33",
94
+ "@types/yargs-parser": "^21.0.3",
106
95
  "conventional-changelog-cli": "^5.0.0",
107
96
  "eslint": "^9",
108
- "globals": "^15",
109
97
  "lint-staged": "^14.0.1",
110
98
  "markdownlint-cli2": "^0.12.0",
111
99
  "markdownlint-cli2-formatter-pretty": "^0.0.7",
112
- "prompts": "^2.4.2",
113
100
  "release-it": "^17.11.0",
114
101
  "simple-git-hooks": "^2.9.0",
115
102
  "yargs": "^17.7.2"
@@ -128,8 +115,6 @@
128
115
  "devDependencies": {
129
116
  "@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",
@@ -145,28 +130,24 @@
145
130
  "@types/yargs": "^17.0.33",
146
131
  "@types/yargs-parser": "^21.0.3",
147
132
  "@typescript-eslint/eslint-plugin": "^8.18.1",
148
- "@vitest/coverage-v8": "^2.1.8",
149
- "@vitest/ui": "^2.1.8",
150
133
  "cpy-cli": "^5.0.0",
151
134
  "eslint": "^9.17.0",
152
- "happy-dom": "^15.11.7",
153
135
  "json-schema-to-ts": "^3.1.1",
154
136
  "lint-staged": "^14.0.1",
155
137
  "npm-check-updates": "^17.1.12",
156
138
  "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
139
  "typescript": "^5.7.2",
162
140
  "vite": "^5.4.11",
163
- "vite-plugin-dts": "^4.3.0",
164
- "vite-plugin-generate-file": "^0.2.0",
165
- "vitest": "^2.1.8"
141
+ "vite-plugin-dts": "^4.3.0"
166
142
  },
167
143
  "dependencies": {
144
+ "@commitlint/cli": "^19.6.1",
145
+ "@commitlint/config-conventional": "^19.6.0",
168
146
  "@commitlint/types": "^19.8.0",
169
147
  "@dotenvx/dotenvx": "^1.31.0",
148
+ "@release-it/bumper": "6.0.1",
149
+ "@release-it/conventional-changelog": "^9.0.4",
150
+ "@stylistic/eslint-plugin": "^5",
170
151
  "ascii-tree": "^0.3.0",
171
152
  "chalk": "^5.4.1",
172
153
  "conventional-recommended-bump": "^10.0.0",
@@ -177,6 +158,7 @@
177
158
  "fs-extra": "^11.2.0",
178
159
  "github-slugger": "^2.0.0",
179
160
  "glob": "^11.0.0",
161
+ "globals": "^16",
180
162
  "handlebars": "^4.7.8",
181
163
  "import-single-ts": "^1.2.0",
182
164
  "indent-string": "^5.0.0",
@@ -190,20 +172,32 @@
190
172
  "markdown-table": "^3.0.4",
191
173
  "markdown-toc": "^1.2.0",
192
174
  "markdown-utils": "^1.0.0",
175
+ "mri": "^1.2.0",
193
176
  "package-json-type": "^1.0.3",
194
177
  "pkg-dir": "^8.0.0",
195
178
  "prompts": "^2.4.2",
196
179
  "remark": "^15.0.1",
197
180
  "remark-frontmatter": "^5.0.0",
181
+ "remark-stringify": "^11.0.0",
198
182
  "remark-toc": "^9.0.0",
199
183
  "semver": "^7.7.1",
200
184
  "strip-ansi": "^7.1.0",
201
- "ts-json-schema-generator": "^2.3.0",
185
+ "strip-indent": "^4.1.1",
186
+ "to-vfile": "^8.0.0",
187
+ "typescript-eslint": "^8",
188
+ "unist-util-is": "^6.0.1",
189
+ "unist-util-source": "^5.0.0",
190
+ "unist-util-visit": "^5.0.0",
202
191
  "yaml": "^2.6.1",
203
192
  "yargs": "^17.7.2",
204
193
  "yargs-parser": "^21.1.1"
205
194
  },
206
195
  "release-it": {
207
196
  "git": false
197
+ },
198
+ "juisy": {
199
+ "extensions": [
200
+ "../cli-plugin-build-entries/dist/index.js"
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
- })
@@ -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;