juisy 2.0.0-beta.0 → 2.0.0-beta.1

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 (110) hide show
  1. package/bin/cli/cli.js +6 -4
  2. package/bin/cli/cmds/index.js +10 -10
  3. package/bin/cli/cmds/private/docs/generate-api.js +31 -0
  4. package/bin/cli/cmds/{docs → private/docs}/index.js +4 -6
  5. package/bin/cli/cmds/{print-globals.js → public/print-globals.js} +0 -1
  6. package/bin/scripts/prepare.js +22 -0
  7. package/dist/DataExporter.d.ts +6 -0
  8. package/dist/cli/CLIFactory.d.ts +48 -11
  9. package/dist/cli/Command.d.ts +23 -13
  10. package/dist/cli/GlobalSettings.schema.json +1 -0
  11. package/dist/cli/InterfaceUtils.d.ts +8 -2
  12. package/dist/cli/OutputUtils.d.ts +3 -3
  13. package/dist/cli/Plugin.d.ts +21 -0
  14. package/dist/cli/extract-usage.d.ts +7 -1
  15. package/dist/cli/index.d.ts +19 -6
  16. package/dist/cli/index.js +1160 -138
  17. package/dist/cli/plugins/command-handler-injections/augment.d.ts +29 -0
  18. package/dist/cli/{command-visitors → plugins/command-handler-injections/command-visitors}/command-handler-injections.d.ts +1 -1
  19. package/dist/cli/plugins/command-handler-injections/index.d.ts +3 -0
  20. package/dist/cli/plugins/command-meta/augment.d.ts +23 -0
  21. package/dist/cli/{command-visitors/get-command-meta.d.ts → plugins/command-meta/command-visitors/command-meta.d.ts} +1 -1
  22. package/dist/cli/plugins/command-meta/index.d.ts +3 -0
  23. package/dist/cli/plugins/default-command-fallbacks/augment.d.ts +3 -0
  24. package/dist/cli/plugins/default-command-fallbacks/command-visitors/default-command-fallbacks.d.ts +10 -0
  25. package/dist/cli/plugins/default-command-fallbacks/index.d.ts +3 -0
  26. package/dist/cli/plugins/load-env-file/augment.d.ts +9 -0
  27. package/dist/cli/plugins/load-env-file/index.d.ts +3 -0
  28. package/dist/cli/plugins/private-commands/augment.d.ts +6 -0
  29. package/dist/cli/{command-visitors → plugins/private-commands/command-visitors}/private-command.d.ts +1 -1
  30. package/dist/cli/plugins/private-commands/index.d.ts +3 -0
  31. package/dist/cli/plugins/register-changelog-command/augment.d.ts +110 -0
  32. package/dist/cli/plugins/register-changelog-command/cmds/index.d.ts +3 -0
  33. package/dist/cli/plugins/register-changelog-command/index.d.ts +3 -0
  34. package/dist/cli/plugins/register-docs-commands/augment.d.ts +18 -0
  35. package/dist/cli/plugins/register-docs-commands/cmds/generate-api.d.ts +3 -0
  36. package/dist/cli/plugins/register-docs-commands/cmds/generate-cli.d.ts +3 -0
  37. package/dist/cli/plugins/register-docs-commands/cmds/generate-readme.d.ts +3 -0
  38. package/dist/cli/plugins/register-docs-commands/cmds/index.d.ts +3 -0
  39. package/dist/cli/plugins/register-docs-commands/index.d.ts +3 -0
  40. package/dist/cli/plugins/register-git-hooks-commands/augment.d.ts +40 -0
  41. package/dist/cli/plugins/register-git-hooks-commands/cmds/index.d.ts +3 -0
  42. package/dist/cli/plugins/register-git-hooks-commands/cmds/reset.d.ts +3 -0
  43. package/dist/cli/plugins/register-git-hooks-commands/cmds/sync.d.ts +3 -0
  44. package/dist/cli/plugins/register-git-hooks-commands/index.d.ts +3 -0
  45. package/dist/cli/plugins/register-lint-commands/augment.d.ts +39 -0
  46. package/dist/cli/plugins/register-lint-commands/cmds/commit.d.ts +3 -0
  47. package/dist/cli/plugins/register-lint-commands/cmds/default.d.ts +3 -0
  48. package/dist/cli/plugins/register-lint-commands/cmds/markdown.d.ts +3 -0
  49. package/dist/cli/plugins/register-lint-commands/cmds/staged.d.ts +3 -0
  50. package/dist/cli/plugins/register-lint-commands/index.d.ts +3 -0
  51. package/dist/cli/plugins/register-lint-commands/settings.d.ts +11 -0
  52. package/dist/cli/plugins/register-lint-commands/types.d.ts +26 -0
  53. package/dist/cli/plugins/register-release-command/augment.d.ts +9 -0
  54. package/dist/cli/plugins/register-release-command/cmds/index.d.ts +3 -0
  55. package/dist/cli/plugins/register-release-command/index.d.ts +3 -0
  56. package/dist/cli/plugins/register-test-command/augment.d.ts +3 -0
  57. package/dist/cli/plugins/register-test-command/cmds/index.d.ts +3 -0
  58. package/dist/cli/plugins/register-test-command/index.d.ts +3 -0
  59. package/dist/cli/types.d.ts +73 -44
  60. package/dist/cli/utils.d.ts +3 -3
  61. package/dist/eject.d.ts +11 -4
  62. package/dist/index.d.ts +8 -2
  63. package/dist/index.js +80 -76
  64. package/dist/project-globals.d.ts +9 -0
  65. package/dist/templater/index.d.ts +6 -1
  66. package/dist/templater/index.js +27 -40
  67. package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +28 -28
  68. package/dist/templater/markdown-templater/index.d.ts +3 -0
  69. package/dist/templater/types.d.ts +6 -0
  70. package/dist/utils/misc.d.ts +1 -1
  71. package/package.json +69 -55
  72. package/README.md +0 -211
  73. package/bin/cli/cmds/changelog.js +0 -41
  74. package/bin/cli/cmds/docs/generate-api.js +0 -22
  75. package/bin/cli/cmds/docs/generate-cli.js +0 -11
  76. package/bin/cli/cmds/docs/generate-readme.js +0 -11
  77. package/bin/cli/cmds/eject.js +0 -28
  78. package/bin/cli/cmds/git-hooks/index.js +0 -20
  79. package/bin/cli/cmds/git-hooks/reset.js +0 -48
  80. package/bin/cli/cmds/git-hooks/sync.js +0 -19
  81. package/bin/cli/cmds/release.js +0 -231
  82. package/bin/cli/lib/docs/generate-api-doc.js +0 -78
  83. package/bin/cli/lib/version/update-version.js +0 -52
  84. package/bin/scripts/commit-msg.js +0 -32
  85. package/bin/scripts/pre-commit.js +0 -24
  86. package/dist/cli/command-visitors/index.d.ts +0 -9
  87. package/src/index.js +0 -507
  88. package/template/CHANGELOG.md +0 -0
  89. package/template/bin/cli/cli.js +0 -27
  90. package/template/bin/cli/cmds/changelog.js +0 -71
  91. package/template/bin/cli/cmds/docs.js +0 -30
  92. package/template/bin/cli/cmds/docs_cmds/generate-api.js +0 -75
  93. package/template/bin/cli/cmds/docs_cmds/generate-readme.js +0 -51
  94. package/template/bin/cli/cmds/git-hooks.js +0 -30
  95. package/template/bin/cli/cmds/git_hooks_cmds/reset.js +0 -76
  96. package/template/bin/cli/cmds/git_hooks_cmds/sync.js +0 -44
  97. package/template/bin/cli/cmds/release.js +0 -219
  98. package/template/bin/cli/index.js +0 -7
  99. package/template/bin/cli/lib/docs/generate-api-doc.js +0 -33
  100. package/template/bin/cli/lib/release/generate-release-note.js +0 -3
  101. package/template/bin/cli/lib/version/update-version.js +0 -51
  102. package/template/bin/scripts/commit-msg.js +0 -42
  103. package/template/bin/scripts/pre-commit.js +0 -32
  104. package/template/docs/api/docs.config.js +0 -10
  105. package/template/docs/readme/config.js +0 -22
  106. package/template/docs/readme/readme.js +0 -70
  107. package/template/docs/readme/template.md +0 -53
  108. /package/bin/cli/cmds/{docs → private/docs}/lint.js +0 -0
  109. /package/bin/cli/cmds/{test.js → private/test.js} +0 -0
  110. /package/bin/cli/cmds/{squeeze.js → public/squeeze.js} +0 -0
@@ -1,5 +1,10 @@
1
1
  import { default as ejs } from 'ejs';
2
- type Configuration = {
2
+ import { markdownTable } from 'markdown-table';
3
+ import { default as asciitree } from 'ascii-tree';
4
+ /**
5
+ * @group Types
6
+ */
7
+ export type Configuration = {
3
8
  /**
4
9
  * Output file name: `README.md` by default. Only for **generate** method
5
10
  */
@@ -40,6 +45,9 @@ type Configuration = {
40
45
  */
41
46
  slugify: Function;
42
47
  };
48
+ /**
49
+ * @group Types
50
+ */
43
51
  export type UserConfiguration = {
44
52
  fileName?: Configuration['fileName'];
45
53
  destFolder?: Configuration['destFolder'];
@@ -51,25 +59,25 @@ export type UserConfiguration = {
51
59
  slugify?: Configuration['slugify'];
52
60
  };
53
61
  export declare class ReadmeTemplater {
62
+ /**
63
+ * @param config - The user configuration file path (as string) or object
64
+ * @example
65
+ * // Path as string
66
+ * const templater = new ReadmeTemplater('./.docs/readme/config.js')
67
+ * // Pass object. See configuration below
68
+ * const templater = new ReadmeTemplater({ /* ... *\/ })
69
+ */
54
70
  constructor(config: Parameters<typeof ReadmeTemplater.processConfig>[0]);
55
71
  private config;
56
72
  private templater;
57
73
  /**
58
- * @param {Configuration|string} config - The config object to process. Can be path to config file as string.
59
- * @param {object} [options] - Same as render
60
- * @returns {void|Promise<void>} Promise is immediately resolved except if a module is async.
61
- * @throws Throws error if render or file writing fails
62
- * @description
63
74
  * Writes rendered README markdown to file
75
+ * @param config - The config object to process. Can be path to config file as string.
76
+ * @param options - Same as render
77
+ * @throws Throws error if render or file writing fails
64
78
  * @example
65
- * readmeGenerator.generate(config) // => output to README.md file
66
- * readmeGenerator.generate('./.docs/readme/config.js') // pass config path
67
- * readmeGenerator.generate(config, { data: { foo: 'bar' } }) // pass options
68
- * // Async
69
- * await readmeGenerator.generate('./.docs/readme/config.js') // async module
70
- * await readmeGenerator.generate({
71
- * ejsDataPath: '/path/to/ejs/data.js' // async module
72
- * })
79
+ * await templater.generate() // => output to README.md file
80
+ * await templater.generate({ data: { foo: 'bar' } }) // pass options
73
81
  */
74
82
  generate(options?: {}): Promise<void>;
75
83
  /**
@@ -78,14 +86,8 @@ export declare class ReadmeTemplater {
78
86
  * @param options.data - Additionnal data object to merge with default EJS data
79
87
  * @returns Returns the rendered markdown as string. Promise is immediately resolved except if a module is async.
80
88
  * @example
81
- * const result = readmeGenerator.render(config)
82
- * const result = readmeGenerator.render('./.docs/readme/config.js')
83
- * const result = readmeGenerator.render(config, { data: { foo: 'bar' } })
84
- * // Async
85
- * const result = await readmeGenerator.render('./.docs/readme/config.js') // async module
86
- * const result = await readmeGenerator.render({
87
- * ejsDataPath: '/path/to/ejs/data.js' // async module
88
- * })
89
+ * await templater.render()
90
+ * await templater.render({ data: { foo: 'bar' } })
89
91
  */
90
92
  render(options?: {
91
93
  data?: Record<any, any>;
@@ -105,12 +107,8 @@ export declare class ReadmeTemplater {
105
107
  */
106
108
  static processConfig(config: UserConfiguration | string): Promise<Configuration>;
107
109
  /**
108
- * @alias module:readme-generator.defaultConfig
109
- * @type {Configuration}
110
- * @description
111
110
  * Returns the default configuration object.
112
111
  * This base configuration is used by `processConfig` method and so `generate` and `render` methods.
113
- * See also {@link module:readme-generator~Configuration Configuration} defaults.
114
112
  */
115
113
  static defaultConfig: Configuration;
116
114
  /**
@@ -148,7 +146,9 @@ export declare class ReadmeTemplater {
148
146
  * // Generates an ascii tree
149
147
  * $utils.asciiTree('*.\n**a\n**b\n*...')
150
148
  */
151
- $utils: any;
149
+ $utils: {
150
+ table: typeof markdownTable;
151
+ asciiTree: typeof asciitree.generate;
152
+ };
152
153
  };
153
154
  }
154
- export {};
@@ -1,6 +1,9 @@
1
1
  import { remark } from 'remark';
2
2
  import { Templater } from '../Templater';
3
3
  import { TemplaterOptions } from '../types';
4
+ /**
5
+ * @group Types
6
+ */
4
7
  export type MarkdownTemplaterOptions = TemplaterOptions<any> & {
5
8
  processor?: 'remark' | typeof remark;
6
9
  /**
@@ -1,6 +1,12 @@
1
1
  import { Options as EJSOptions } from 'ejs';
2
2
  import { compile as HandlebarsCompiler } from 'handlebars';
3
+ /**
4
+ * @group Types
5
+ */
3
6
  export type SupportedEngines = ['handlebars', 'ejs', 'pug'];
7
+ /**
8
+ * @group Types
9
+ */
4
10
  export type TemplaterOptions<E extends SupportedEngines[number]> = {
5
11
  engineOptions?: E extends 'handlebars' ? Parameters<typeof HandlebarsCompiler>[1] : E extends 'ejs' ? EJSOptions : unknown;
6
12
  /**
@@ -8,7 +8,7 @@ import { GlobOptions } from 'glob';
8
8
  * @example
9
9
  * utils.getFileUrls('path/to/*.js') // => [ 'path/to/file1.js', 'path/to/file2.js', ... ]
10
10
  */
11
- export declare function getFileUrls(pattern: string, options?: GlobOptions): string[] | import('path-scurry').Path[];
11
+ export declare function getFileUrls(pattern: string, options?: GlobOptions): string[] | import('glob').Path[];
12
12
  /**
13
13
  * @param dir - The directory path
14
14
  * @returns Returns an array of file path
package/package.json CHANGED
@@ -1,38 +1,40 @@
1
1
  {
2
2
  "name": "juisy",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "Make your JavaScript (and/or TypeScript) project juicy!",
5
- "main": "src/index.js",
6
5
  "type": "module",
7
6
  "files": [
8
7
  "bin",
9
8
  "dist",
10
9
  "template"
11
10
  ],
12
- "exports": {
13
- ".": {
11
+ "engines": {
12
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
13
+ },
14
+ "imports": {
15
+ "#juisy": {
14
16
  "types": "./dist/index.d.ts",
15
17
  "import": "./dist/index.js"
16
18
  },
17
- "./cli": {
19
+ "#juisy/cli": {
18
20
  "types": "./dist/cli/index.d.ts",
19
21
  "import": "./dist/cli/index.js"
20
22
  },
21
- "./templater": {
23
+ "#juisy/templater": {
22
24
  "types": "./dist/templater/index.d.ts",
23
25
  "import": "./dist/templater/index.js"
24
26
  }
25
27
  },
26
- "imports": {
27
- "#juisy": {
28
+ "exports": {
29
+ ".": {
28
30
  "types": "./dist/index.d.ts",
29
31
  "import": "./dist/index.js"
30
32
  },
31
- "#juisy/cli": {
33
+ "./cli": {
32
34
  "types": "./dist/cli/index.d.ts",
33
35
  "import": "./dist/cli/index.js"
34
36
  },
35
- "#juisy/templater": {
37
+ "./templater": {
36
38
  "types": "./dist/templater/index.d.ts",
37
39
  "import": "./dist/templater/index.js"
38
40
  }
@@ -44,27 +46,18 @@
44
46
  "build": "vite build",
45
47
  "audit": "ncu && npm audit",
46
48
  "audit:fix": "ncu --interactive",
47
- "docs:api": "npx cross-env CLI_ENV=private node ./bin/cli docs generate:api",
48
- "docs:readme": "npx cross-env CLI_ENV=private node ./bin/cli docs generate:readme",
49
- "docs:cli": "npx cross-env CLI_ENV=private node ./bin/cli docs generate:cli",
50
- "docs:lint": "npx cross-env CLI_ENV=private node ./bin/cli docs lint -c ./docs/.markdownlint-cli2.cjs",
51
- "docs:lint:fix": "npm run docs:lint -- --fix",
52
- "docs": "npm run docs:readme && npm run docs:cli && npm run docs:api && npm run docs:lint",
53
- "lint": "eslint .",
54
- "lint:fix": "npm run lint -- --fix",
55
- "lint:markdown": "npm run docs:lint",
56
- "lint:markdown:fix": "npm run docs:lint:fix",
57
- "release": "npx cross-env CLI_ENV=private NODE_ENV=development node ./bin/cli release",
58
- "changelog": "npx cross-env CLI_ENV=private NODE_ENV=development node ./bin/cli changelog",
49
+ "docs": "npm run docs:cli && npm run docs:api",
50
+ "docs:api": "node ./bin/cli docs generate:api",
51
+ "docs:cli": "npm run docs:cli:private && npm run docs:cli:public",
52
+ "docs:cli:private": "node ./bin/cli docs generate:cli -c ./docs/cli/private/config.js",
53
+ "docs:cli:public": "node ./bin/cli docs generate:cli -c ./docs/cli/public/config.js",
59
54
  "example:reset": "git checkout --no-overlay -- example && cd example && git clean -fdX",
60
- "example:test": "npm run example:reset && cd example && npm install -D @hperchec/juisy@file:../ && npx juisy squeeze && npm run docs:readme",
61
- "git-hooks:reset": "npx cross-env CLI_ENV=private NODE_ENV=development node ./bin/cli git-hooks reset",
62
- "git-hooks:sync": "npx cross-env CLI_ENV=private NODE_ENV=development node ./bin/cli git-hooks sync",
55
+ "example:test": "npm run example:reset && cd example && npm install -D juisy@file:../ && npx juisy squeeze && npm run docs:readme",
63
56
  "print:globals": "node --no-warnings ./bin/cli print:globals",
64
- "test": "npx cross-env CLI_ENV=private node ./bin/cli test",
57
+ "release": "release-it",
58
+ "test": "node ./bin/cli test",
65
59
  "test:dev": "npm test -- --watch",
66
- "test:ui": "npm test -- --ui",
67
- "__prepare": "npm run git-hooks:sync"
60
+ "test:ui": "npm test -- --ui"
68
61
  },
69
62
  "repository": {
70
63
  "type": "git",
@@ -84,7 +77,7 @@
84
77
  "email": "contact@herve-perchec.com",
85
78
  "url": "https://gitlab.com/herveperchec"
86
79
  },
87
- "license": "ISC",
80
+ "license": "GPL-3.0-only",
88
81
  "bugs": {
89
82
  "url": "https://gitlab.com/hperchec/juisy/issues"
90
83
  },
@@ -92,76 +85,88 @@
92
85
  "bin": {
93
86
  "juisy": "./bin/cli/index.js"
94
87
  },
95
- "simple-git-hooks": {
96
- "pre-commit": "node ./bin/scripts/pre-commit.js",
97
- "commit-msg": "node ./bin/scripts/commit-msg.js ${1}"
98
- },
99
- "lint-staged": {
100
- "*.{js,cjs,ts}": [
101
- "eslint --fix",
102
- "git add"
103
- ]
104
- },
105
88
  "peerDependencies": {
106
- "@commitlint/cli": "^17.7.2",
107
- "@commitlint/config-conventional": "^17.7.0",
108
- "@github/markdownlint-github": "^0.6.0",
109
- "@hperchec/readme-generator": "^3.0.0",
89
+ "@commitlint/cli": "^19.6.1",
90
+ "@commitlint/config-conventional": "^19.6.0",
91
+ "@github/markdownlint-github": "^0.7.0",
92
+ "@release-it/conventional-changelog": "^9.0.4",
110
93
  "@stylistic/eslint-plugin": "^2",
111
94
  "@typescript-eslint/eslint-plugin": "^8",
112
95
  "chalk": "^4.1.2",
113
- "conventional-changelog-cli": "^4.1.0",
96
+ "conventional-changelog-cli": "^5.0.0",
114
97
  "eslint": "^9",
115
- "execa": "^5.1.1",
116
98
  "lint-staged": "^14.0.1",
117
- "markdownlint-cli2": "^0.12.1",
118
- "markdownlint-cli2-formatter-pretty": "^0.0.6",
99
+ "markdownlint-cli2": "^0.12.0",
100
+ "markdownlint-cli2-formatter-pretty": "^0.0.7",
119
101
  "prompts": "^2.4.2",
102
+ "release-it": "^17.11.0",
120
103
  "simple-git-hooks": "^2.9.0",
121
104
  "yargs": "^17.7.2"
122
105
  },
106
+ "peerDependenciesMeta": {
107
+ "@github/markdownlint-github": {
108
+ "optional": true
109
+ },
110
+ "markdownlint-cli2-formatter-pretty": {
111
+ "optional": true
112
+ }
113
+ },
123
114
  "devDependencies": {
124
- "@commitlint/cli": "^19.6.1",
125
- "@commitlint/config-conventional": "^19.6.0",
126
- "@github/markdownlint-github": "^0.6.3",
115
+ "@babel/eslint-parser": "^7.25.9",
116
+ "@conventional-changelog/git-client": "^1.0.1",
127
117
  "@rollup/plugin-typescript": "^12.1.2",
128
118
  "@stylistic/eslint-plugin": "^2.12.1",
119
+ "@types/conventional-changelog": "^3.1.5",
120
+ "@types/conventional-changelog-config-spec": "^2.1.5",
129
121
  "@types/ejs": "^3.1.5",
130
122
  "@types/fs-extra": "^11.0.4",
123
+ "@types/lint-staged": "^13.3.0",
124
+ "@types/lodash.get": "^4.4.9",
125
+ "@types/lodash.kebabcase": "^4.1.9",
131
126
  "@types/lodash.merge": "^4.6.9",
127
+ "@types/lodash.set": "^4.3.9",
128
+ "@types/node": "^22.10.2",
132
129
  "@types/prompts": "^2.4.9",
133
130
  "@types/yargs": "^17.0.33",
131
+ "@types/yargs-parser": "^21.0.3",
134
132
  "@typescript-eslint/eslint-plugin": "^8.18.1",
135
133
  "@vitest/coverage-v8": "^2.1.8",
136
134
  "@vitest/ui": "^2.1.8",
137
- "conventional-changelog-cli": "^5.0.0",
135
+ "cpy-cli": "^5.0.0",
138
136
  "eslint": "^9.17.0",
139
137
  "happy-dom": "^15.11.7",
138
+ "json-schema-to-ts": "^3.1.1",
140
139
  "lint-staged": "^14.0.1",
141
140
  "markdown-table": "^3.0.4",
142
- "markdownlint-cli2": "^0.16.0",
143
- "markdownlint-cli2-formatter-pretty": "^0.0.7",
144
141
  "npm-check-updates": "^17.1.12",
142
+ "quicktype": "^23.0.170",
145
143
  "typescript": "^5.7.2",
146
144
  "vite": "^5.4.11",
147
145
  "vite-plugin-dts": "^4.3.0",
146
+ "vite-plugin-generate-file": "^0.2.0",
148
147
  "vitest": "^2.1.8"
149
148
  },
150
149
  "dependencies": {
151
150
  "@dotenvx/dotenvx": "^1.31.0",
152
151
  "ascii-tree": "^0.3.0",
153
152
  "chalk": "^4.1.2",
153
+ "conventional-recommended-bump": "^10.0.0",
154
154
  "deepmerge": "^4.3.1",
155
155
  "ejs": "^3.1.10",
156
- "execa": "^5.1.1",
156
+ "execa": "^8",
157
157
  "find-up": "^7.0.0",
158
158
  "fs-extra": "^11.2.0",
159
159
  "github-slugger": "^2.0.0",
160
160
  "glob": "^11.0.0",
161
+ "handlebars": "^4.7.8",
162
+ "import-single-ts": "^1.2.0",
161
163
  "indent-string": "^5.0.0",
162
164
  "json-2-csv": "^5.5.7",
163
165
  "jstoxml": "^5.0.2",
166
+ "lodash.get": "^4.4.2",
167
+ "lodash.kebabcase": "^4.1.1",
164
168
  "lodash.merge": "^4.6.2",
169
+ "lodash.set": "^4.3.2",
165
170
  "loglevel": "^1.9.2",
166
171
  "markdown-toc": "^1.2.0",
167
172
  "markdown-utils": "^1.0.0",
@@ -173,7 +178,16 @@
173
178
  "remark-toc": "^9.0.0",
174
179
  "simple-git-hooks": "^2.9.0",
175
180
  "strip-ansi": "^7.1.0",
181
+ "ts-json-schema-generator": "^2.3.0",
182
+ "typedoc": "^0.27.5",
183
+ "typedoc-plugin-frontmatter": "^1.1.2",
184
+ "typedoc-plugin-markdown": "^4.3.3",
185
+ "typedoc-vitepress-theme": "^1.1.1",
176
186
  "yaml": "^2.6.1",
177
- "yargs": "^17.7.2"
187
+ "yargs": "^17.7.2",
188
+ "yargs-parser": "^21.1.1"
189
+ },
190
+ "release-it": {
191
+ "git": false
178
192
  }
179
193
  }
package/README.md DELETED
@@ -1,211 +0,0 @@
1
- <!--
2
- ⚠ IMPORTANT
3
- This file is generated with **@hperchec/readme-generator**. Don't edit it.
4
- -->
5
-
6
- # 🍊 juisy
7
-
8
- <!-- markdownlint-disable line-length -->
9
-
10
- ![author](https://img.shields.io/static/v1?label=\&message=Author:\&color=black)
11
- [![herve-perchec](http://herve-perchec.com/badge.svg)](http://herve-perchec.com/)
12
-
13
- [![release](https://img.shields.io/gitlab/v/release/hperchec/juisy?include_prereleases\&logo=gitlab\&sort=semver)](https://gitlab.com/hperchec/juisy/-/releases)
14
- [![pipeline-status](https://gitlab.com/hperchec/juisy/badges/main/pipeline.svg)](https://gitlab.com/hperchec/juisy/commits/main)
15
- [![package](https://img.shields.io/npm/v/juisy?logo=npm)](https://www.npmjs.com/package/juisy)
16
- [![downloads](https://img.shields.io/npm/dw/juisy?logo=npm)](https://www.npmjs.com/package/juisy)
17
- [![issues](https://img.shields.io/gitlab/issues/open/hperchec/juisy?gitlab_url=https%3A%2F%2Fgitlab.com)](https://gitlab.com/hperchec/juisy/issues)
18
- ![license](https://img.shields.io/gitlab/license/hperchec/juisy?gitlab_url=https%3A%2F%2Fgitlab.com)
19
-
20
- <!-- markdownlint-enable line-length -->
21
-
22
- ## Table of contents
23
-
24
- * [What is juisy?](#what-is-juisy)
25
- * [🚀 Get started](#-get-started)
26
- * [Features](#features)
27
- * [Embedded CLI](#embedded-cli)
28
- * [Project-level global variables](#project-level-global-variables)
29
- * [🧱 Dependencies](#-dependencies)
30
- * [📙 Documentation](#-documentation)
31
- * [API](#api)
32
- * [Utils](#utils)
33
- * [✍ Author](#-author)
34
- * [📄 License](#-license)
35
-
36
- ## What is juisy?
37
-
38
- * 🔧 [Embedded CLI tool](https://gitlab.com/hperchec/juisy/-/blob/main/documentation/api.md#juisycli--yargs) that uses yargs under the ground
39
- * 📕 Generate your project documentation and README file with [@hperchec/readme-generator](https://www.npmjs.com/package/@hperchec/readme-generator)
40
- * 🕵️‍♂️ Automatic linting with [lint-staged](https://www.npmjs.com/package/lint-staged) at pre-commit git hook
41
- * 🦾 Respect [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) with [commitlint](https://commitlint.js.org/) at commit-msg git hook
42
-
43
- ## 🚀 Get started
44
-
45
- Install package:
46
-
47
- ```sh
48
- npm install juisy
49
- ```
50
-
51
- Squeeze!
52
-
53
- ```sh
54
- npx juisy squeeze
55
- ```
56
-
57
- You will get:
58
-
59
- ```sh
60
- ./
61
- ├─ bin/ # contains CLI
62
- │ └─ cli/
63
- │ ├─ cmds/ # commands dir
64
- │ ├─ lib/ # libraries used by commands
65
- │ └─ index.js # CLI entry file
66
- ├─ docs/
67
- │ └─ readme # contains configuration for @hperchec/readme-generator
68
- └─ ...
69
- ```
70
-
71
- ...and some new scripts in your `package.json` file:
72
-
73
- ```js
74
- "docs", // generate documentation
75
- "docs:api", // only api
76
- "docs:readme", // only README file
77
- "release", // make a release
78
- "changelog" // generate CHANGELOG file
79
- "postinstall" // for git hook
80
- ```
81
-
82
- Just use `--help` option to show help:
83
-
84
- ```sh
85
- node ./bin/cli --help
86
- ```
87
-
88
- ## Features
89
-
90
- ### Embedded CLI
91
-
92
- PRIVATE AND PUBLIC COMMANDS
93
- Work in progress...
94
-
95
- ### Project-level global variables
96
-
97
- > > > INSERT MERMAID CHART for file level
98
- > > > LEVEL 0 : package.json / env ==== hard coded
99
- > > > LEVEL 1 : globals.config.js
100
- > > > LEVEL 2 : builder / cli
101
- > > > LEVEL 4 : Web app ...
102
-
103
- Assuming you have a `.env` file in the root of your project:
104
-
105
- ```sh
106
- # .env
107
- MY_ENV_VAR=foo
108
- ```
109
-
110
- And the following content in your `globals.config.js` file:
111
-
112
- ```js
113
- // globals.config.js
114
- import { defineGlobals } from '@hperchec/juisy'
115
-
116
- export default defineGlobals(
117
- {
118
- // The environment variables to auto includes in "ENV" property
119
- env: { map: [ 'MY_ENV_VAR' ] }
120
- },
121
- // Access to all environment variables and package.json info
122
- ({ env, pkg }) => {
123
- return {
124
- // Set any variable you want to use globally
125
- MY_GLOBAL_VARIABLE: 'bar'
126
- }
127
- }
128
- )
129
- ```
130
-
131
- Will result to:
132
-
133
- ```js
134
- {
135
- ENV: {
136
- MY_ENV_VAR: 'foo'
137
- },
138
- PACKAGE: {
139
- NAME: '@hperchec/juisy',
140
- URL: 'https://www.npmjs.com/package/@hperchec/juisy'
141
- },
142
- VERSION: '2.0.0',
143
- AUTHOR: {
144
- EMAIL: 'contact@herve-perchec.com',
145
- NAME: 'Hervé Perchec',
146
- URL: 'https://gitlab.com/herveperchec'
147
- },
148
- REPOSITORY: {
149
- TYPE: 'git',
150
- URL: 'git+https://gitlab.com/hperchec/juisy.git'
151
- },
152
- ISSUES_URL: 'https://gitlab.com/hperchec/juisy/issues',
153
- HOMEPAGE: 'https://gitlab.com/hperchec/juisy#readme',
154
- MY_GLOBAL_VARIABLE: 'bar'
155
- }
156
- ```
157
-
158
- You can also print the globals object by running the following command:
159
-
160
- ```sh
161
- npx juisy print:globals
162
- ```
163
-
164
- ## 🧱 Dependencies
165
-
166
- It will install the following packages as peer dependencies:
167
-
168
- | name | version |
169
- | ---------------------------------- | ------- |
170
- | @commitlint/cli | ^17.7.2 |
171
- | @commitlint/config-conventional | ^17.7.0 |
172
- | @github/markdownlint-github | ^0.6.0 |
173
- | @hperchec/readme-generator | ^3.0.0 |
174
- | @stylistic/eslint-plugin | ^2 |
175
- | @typescript-eslint/eslint-plugin | ^8 |
176
- | chalk | ^4.1.2 |
177
- | conventional-changelog-cli | ^4.1.0 |
178
- | eslint | ^9 |
179
- | execa | ^5.1.1 |
180
- | lint-staged | ^14.0.1 |
181
- | markdownlint-cli2 | ^0.12.1 |
182
- | markdownlint-cli2-formatter-pretty | ^0.0.6 |
183
- | prompts | ^2.4.2 |
184
- | simple-git-hooks | ^2.9.0 |
185
- | yargs | ^17.7.2 |
186
-
187
- ## 📙 Documentation
188
-
189
- ### API
190
-
191
- > See \[API] documentation]\(https://gitlab.com/hperchec/juisy/-/blob/main/documentation/api.md)
192
-
193
- ### Utils
194
-
195
- > See [utils documentation](https://gitlab.com/hperchec/juisy/-/blob/main/documentation/utils.md)
196
-
197
- ## ✍ Author
198
-
199
- [Hervé Perchec](https://gitlab.com/herveperchec)
200
-
201
- ## 📄 License
202
-
203
- ISC
204
-
205
- ***
206
-
207
- Made with ❤ by [Hervé Perchec](https://gitlab.com/herveperchec)
208
-
209
- ***
210
-
211
- *README.md - this file was auto generated with [juisy](https://www.npmjs.com/package/juisy) README templater. Don't edit it.*
@@ -1,41 +0,0 @@
1
- /** @type {import('#juisy/cli').Command} */
2
- export default new CLI.Command({
3
- command: 'changelog',
4
- describe: 'Generate CHANGELOG file',
5
- builder: function (cli) {
6
- return cli.option('i', {
7
- alias: 'infile',
8
- type: 'string',
9
- describe: 'Same as conventional-changelog option',
10
- default: 'CHANGELOG.md',
11
- requiresArg: true
12
- })
13
- },
14
- async handler (argv) {
15
- // Utils
16
- const { $style, step, substep, error } = CLI.OutputUtils
17
- const { run, wait } = CLI.InterfaceUtils
18
- /**
19
- * Generate changelog file
20
- */
21
- step('Generating changelog')
22
- await wait('Generating', async () => {
23
- try {
24
- await run(
25
- 'npx',
26
- [
27
- 'conventional-changelog',
28
- '-p', 'angular',
29
- '-i', argv.infile,
30
- '-s' // same file to output
31
- ],
32
- { stdio: 'pipe' }
33
- )
34
- } catch (e) {
35
- error('Unable to generate changelog', e)
36
- }
37
- })
38
- substep($style.green('✔ Success'), { last: true })
39
- this.log() // Blank line
40
- }
41
- })
@@ -1,22 +0,0 @@
1
- import path from 'node:path'
2
- import generateApiDoc from '../../lib/docs/generate-api-doc.js'
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
- let options = {}
13
- const configPath = path.resolve('./docs/api/docs.config.js')
14
-
15
- options = require(configPath)
16
-
17
- /**
18
- * If everything is okay generate doc
19
- */
20
- await generateApiDoc(options)
21
- }
22
- })
@@ -1,11 +0,0 @@
1
- import { ReadmeTemplater } from '#juisy/templater'
2
-
3
- /** @type {import('#juisy/cli').Command} */
4
- export default new CLI.Command({
5
- command: 'generate:cli',
6
- describe: 'Generate CLI docs',
7
- async handler (argv) {
8
- const templater = new ReadmeTemplater('./docs/cli/config.js')
9
- await templater.generate()
10
- }
11
- })
@@ -1,11 +0,0 @@
1
- import { ReadmeTemplater } from '#juisy/templater'
2
-
3
- /** @type {import('#juisy/cli').Command} */
4
- export default new CLI.Command({
5
- command: 'generate:readme',
6
- describe: 'Generate README.md',
7
- async handler (argv) {
8
- const templater = new ReadmeTemplater('./docs/readme/config.js')
9
- await templater.generate()
10
- }
11
- })