create-juisy 2.0.0-beta.10 → 2.0.0-beta.11
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/index.js +21 -9
- package/package.json +3 -3
- package/template/.env.example +1 -1
- package/template/COMMIT_CONVENTION.md +116 -0
- package/template/CONTRIBUTING.md +21 -0
- package/template/bin/cli/cli.js +11 -14
- package/template/bin/cli/cmds/index.js +0 -2
- package/template/bin/cli/cmds/private/docs/index.js +1 -0
- package/template/bin/cli/index.js +4 -2
- package/template/bin/scripts/commit-msg.js +13 -18
- package/template/bin/scripts/pre-commit.js +13 -11
- package/template/dev.config.js +20 -8
- package/template/dev.config.json +19 -1
- package/template/dev.config.ts +20 -1
- package/template/docs/.markdownlint-cli2.mjs +21 -0
- package/template/docs/cli/private/config.js +37 -0
- package/template/docs/cli/private/data.js +14 -0
- package/template/docs/cli/private/partials/child-command.md +26 -0
- package/template/docs/cli/private/template.md +26 -0
- package/template/docs/cli/public/config.js +21 -0
- package/template/docs/cli/public/template.md +19 -0
- package/template/docs/readme/config.js +24 -13
- package/template/docs/readme/data.js +45 -0
- package/template/docs/readme/template.md +10 -6
- package/template/eslint.config.js +47 -0
- package/template/package.json +2 -4
- package/template/project.globals.js +20 -29
- package/template/bin/cli/cmds/private/changelog.js +0 -44
- package/template/bin/cli/cmds/private/docs/generate-cli.js +0 -11
- package/template/bin/cli/cmds/private/docs/generate-readme.js +0 -11
- package/template/bin/cli/cmds/private/docs/lint.js +0 -42
- package/template/bin/cli/cmds/private/git-hooks/index.js +0 -20
- package/template/bin/cli/cmds/private/git-hooks/reset.js +0 -48
- package/template/bin/cli/cmds/private/git-hooks/sync.js +0 -19
- package/template/bin/cli/cmds/private/release.js +0 -223
- package/template/bin/cli/lib/docs/generate-api-doc.js +0 -33
- package/template/bin/cli/lib/release/generate-release-note.js +0 -3
- package/template/bin/cli/lib/version/update-version.js +0 -51
- package/template/docs/readme/readme.js +0 -70
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const __filename = fileURLToPath(import.meta.url)
|
|
|
17
17
|
const __dirname = dirname(__filename)
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
|
+
abort,
|
|
20
21
|
run,
|
|
21
22
|
prompts
|
|
22
23
|
} = InterfaceUtils
|
|
@@ -64,7 +65,11 @@ async function main () {
|
|
|
64
65
|
initial: defaultTargetDir,
|
|
65
66
|
name: 'projectName'
|
|
66
67
|
}
|
|
67
|
-
]
|
|
68
|
+
], {
|
|
69
|
+
onCancel: () => {
|
|
70
|
+
abort(1)
|
|
71
|
+
}
|
|
72
|
+
})
|
|
68
73
|
targetDir = rmTrailingSlashes(promptsResult.projectName)
|
|
69
74
|
}
|
|
70
75
|
|
|
@@ -81,7 +86,11 @@ async function main () {
|
|
|
81
86
|
initial: 0,
|
|
82
87
|
name: 'devConfigFormat'
|
|
83
88
|
}
|
|
84
|
-
]
|
|
89
|
+
], {
|
|
90
|
+
onCancel: () => {
|
|
91
|
+
abort(1)
|
|
92
|
+
}
|
|
93
|
+
})
|
|
85
94
|
devConfigFormat = promptsResult.devConfigFormat
|
|
86
95
|
|
|
87
96
|
/**
|
|
@@ -100,7 +109,9 @@ async function main () {
|
|
|
100
109
|
logLevel: 'warn',
|
|
101
110
|
processor: (content, identifier) => {
|
|
102
111
|
if (identifier === 'package.json') {
|
|
103
|
-
|
|
112
|
+
let newContent = content.replace(/__PROJECT_NAME__/g, targetDir)
|
|
113
|
+
newContent = newContent.replace(/__JUISY_VERSION__/g, JUISY_VERSION)
|
|
114
|
+
return newContent
|
|
104
115
|
} else {
|
|
105
116
|
return content
|
|
106
117
|
}
|
|
@@ -116,15 +127,16 @@ async function main () {
|
|
|
116
127
|
* Update package.json file
|
|
117
128
|
*/
|
|
118
129
|
const scripts = {
|
|
119
|
-
'docs:api': `${targetCliCommand} docs generate
|
|
130
|
+
'docs:api': `${targetCliCommand} docs generate:api`,
|
|
120
131
|
'docs:readme': `${targetCliCommand} docs generate:readme`,
|
|
121
|
-
'docs:
|
|
122
|
-
'docs:
|
|
123
|
-
'docs':
|
|
132
|
+
'docs:cli': 'npm run docs:cli:private && npm run docs:cli:public',
|
|
133
|
+
'docs:cli:private': `${targetCliCommand} docs generate:cli -c ./docs/cli/private/config.js`,
|
|
134
|
+
'docs:cli:public': `${targetCliCommand} docs generate:cli -c ./docs/cli/public/config.js`,
|
|
135
|
+
'docs': 'npm run docs:readme && npm run docs:cli && npm run docs:api && npm run lint:markdown:fix',
|
|
124
136
|
'lint': `${targetCliCommand} lint`,
|
|
125
137
|
'lint:fix': 'npm run lint -- --fix',
|
|
126
|
-
'lint:markdown': '
|
|
127
|
-
'lint:markdown:fix': 'npm run
|
|
138
|
+
'lint:markdown': 'node ./bin/cli lint:markdown',
|
|
139
|
+
'lint:markdown:fix': 'npm run lint:markdown -- --fix',
|
|
128
140
|
'release': `${targetCliCommand} release`,
|
|
129
141
|
'changelog': `${targetCliCommand} changelog`,
|
|
130
142
|
'git-hooks:reset': `${targetCliCommand} git-hooks reset`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-juisy",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.11",
|
|
4
4
|
"description": "Juisy boilerplate for npm init",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"release": "release-it",
|
|
17
|
+
"release": "release-it --no-increment",
|
|
18
18
|
"test": "echo No test found..."
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://hperchec.gitlab.io/juisy",
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"juisy": "2.0.0-beta.
|
|
44
|
+
"juisy": "2.0.0-beta.11"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"execa": "^8",
|
package/template/.env.example
CHANGED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Commit Message Format
|
|
2
|
+
|
|
3
|
+
> ❗ IMPORTANT
|
|
4
|
+
>
|
|
5
|
+
> This documentation is based on Angular [commit message guidelines](https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md)
|
|
6
|
+
|
|
7
|
+
We have very precise rules over how our Git commit messages must be formatted.
|
|
8
|
+
This format leads to **easier to read commit history** and makes it analyzable for changelog generation.
|
|
9
|
+
|
|
10
|
+
Each commit message consists of a **header**, a **body**, and a **footer**.
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
<header>
|
|
14
|
+
<BLANK LINE>
|
|
15
|
+
<body>
|
|
16
|
+
<BLANK LINE>
|
|
17
|
+
<footer>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The `header` is mandatory and must conform to the [Commit Message Header](#commit-header) format.
|
|
21
|
+
|
|
22
|
+
The `body` is mandatory for all commits except for those of type "docs".
|
|
23
|
+
When the body is present it must be at least 20 characters long and must conform to the [Commit Message Body](#commit-body) format.
|
|
24
|
+
|
|
25
|
+
The `footer` is optional. The [Commit Message Footer](#commit-footer) format describes what the footer is used for and the structure it must have.
|
|
26
|
+
|
|
27
|
+
## Commit Message Header
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
<type>(<scope>): <short summary>
|
|
31
|
+
│ │ │
|
|
32
|
+
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
|
|
33
|
+
│ │
|
|
34
|
+
│ └─⫸ Commit Scope: see below
|
|
35
|
+
│
|
|
36
|
+
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The `<type>` and `<summary>` fields are mandatory, the `(<scope>)` field is optional.
|
|
40
|
+
|
|
41
|
+
### Type
|
|
42
|
+
|
|
43
|
+
Must be one of the following:
|
|
44
|
+
|
|
45
|
+
| Type | Description |
|
|
46
|
+
|--------------|-----------------------------------------------------------------------------------------------------|
|
|
47
|
+
| **build** | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) |
|
|
48
|
+
| **ci** | Changes to our CI configuration files and scripts (examples: Github Actions, SauceLabs) |
|
|
49
|
+
| **docs** | Documentation only changes |
|
|
50
|
+
| **feat** | A new feature |
|
|
51
|
+
| **fix** | A bug fix |
|
|
52
|
+
| **perf** | A code change that improves performance |
|
|
53
|
+
| **refactor** | A code change that neither fixes a bug nor adds a feature |
|
|
54
|
+
| **test** | Adding missing tests or correcting existing tests |
|
|
55
|
+
|
|
56
|
+
### Scope
|
|
57
|
+
The scope should be the name of the npm package affected (as perceived by the person reading the changelog generated from commit messages).
|
|
58
|
+
|
|
59
|
+
The following is the list of supported scopes:
|
|
60
|
+
|
|
61
|
+
* `scope-a`
|
|
62
|
+
* `scope-b`
|
|
63
|
+
* `scope-c`
|
|
64
|
+
|
|
65
|
+
### Summary
|
|
66
|
+
|
|
67
|
+
Use the summary field to provide a succinct description of the change:
|
|
68
|
+
|
|
69
|
+
* use the imperative, present tense: "change" not "changed" nor "changes"
|
|
70
|
+
* don't capitalize the first letter
|
|
71
|
+
* no dot (.) at the end
|
|
72
|
+
|
|
73
|
+
## Commit Message Body
|
|
74
|
+
|
|
75
|
+
Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor "fixes".
|
|
76
|
+
|
|
77
|
+
Explain the motivation for the change in the commit message body. This commit message should explain _why_ you are making the change.
|
|
78
|
+
You can include a comparison of the previous behavior with the new behavior in order to illustrate the impact of the change.
|
|
79
|
+
|
|
80
|
+
## Commit Message Footer
|
|
81
|
+
|
|
82
|
+
The footer can contain information about breaking changes and deprecations and is also the place to reference GitHub issues and other PRs that this commit closes or is related to.
|
|
83
|
+
For example:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
BREAKING CHANGE: <breaking change summary>
|
|
87
|
+
<BLANK LINE>
|
|
88
|
+
<breaking change description + migration instructions>
|
|
89
|
+
<BLANK LINE>
|
|
90
|
+
<BLANK LINE>
|
|
91
|
+
Fixes #<issue number>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
or
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
DEPRECATED: <what is deprecated>
|
|
98
|
+
<BLANK LINE>
|
|
99
|
+
<deprecation description + recommended update path>
|
|
100
|
+
<BLANK LINE>
|
|
101
|
+
<BLANK LINE>
|
|
102
|
+
Closes #<pr number>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Breaking Change section should start with the phrase `BREAKING CHANGE: ` followed by a *brief* summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
|
|
106
|
+
|
|
107
|
+
Similarly, a Deprecation section should start with `DEPRECATED: ` followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path.
|
|
108
|
+
|
|
109
|
+
## Revert commits
|
|
110
|
+
|
|
111
|
+
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
|
|
112
|
+
|
|
113
|
+
The content of the commit message body should contain:
|
|
114
|
+
|
|
115
|
+
- information about the SHA of the commit being reverted in the following format: `This reverts commit <SHA>`,
|
|
116
|
+
- a clear description of the reason for reverting the commit message.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Contribution guide
|
|
2
|
+
|
|
3
|
+
## Commits
|
|
4
|
+
|
|
5
|
+
Commit messages are linted with `commitlint` in the `commit-msg` git hook, following the **angular** convention. Please check the [commit convention](./COMMIT_CONVENTION.md).
|
|
6
|
+
|
|
7
|
+
## Releases
|
|
8
|
+
|
|
9
|
+
Run the following command to make a release:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm run release
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
Run the following command to generate project documentation:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm run docs
|
|
21
|
+
```
|
package/template/bin/cli/cli.js
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} = utils
|
|
7
|
-
// Get package.json content
|
|
8
|
-
const packageJson = require(path.resolve(rootDir, './package.json'))
|
|
1
|
+
import { CLIFactory } from 'juisy/cli'
|
|
2
|
+
|
|
3
|
+
import { commands } from './cmds/index.js'
|
|
4
|
+
|
|
5
|
+
const { $style } = CLI.OutputUtils
|
|
9
6
|
|
|
10
7
|
function getBanner () {
|
|
11
8
|
let str = ''
|
|
12
|
-
const title =
|
|
13
|
-
const length = title.length
|
|
9
|
+
const title = 'Built with Juisy'
|
|
10
|
+
const length = title.length
|
|
14
11
|
str += $style.cyan('-'.repeat(length) + '\n')
|
|
15
12
|
str += $style.cyan(title + '\n')
|
|
16
13
|
str += $style.cyan('-'.repeat(length) + '\n')
|
|
17
|
-
str += $style.italic('Made with') + ' ' + $style.red('❤') + ' ' + $style.italic('by ') + $style.bold('Hervé Perchec
|
|
14
|
+
str += $style.italic('Made with') + ' ' + $style.red('❤') + ' ' + $style.italic('by ') + $style.bold('Hervé Perchec') + '\n'
|
|
18
15
|
return str
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
module.exports = createCli(cli => cli
|
|
18
|
+
export default await CLIFactory(cli => cli
|
|
23
19
|
.scriptName('./bin/cli')
|
|
24
20
|
.usage(`${getBanner()}\nUsage: $0 <command> [<options>]`)
|
|
25
|
-
.
|
|
21
|
+
.disableDefaultCommand('docs generate:api')
|
|
22
|
+
.command(commands)
|
|
26
23
|
.demandCommand(1, ('Command is missing. See help to learn more.').red)
|
|
27
24
|
)
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
// Private commands
|
|
2
2
|
import docs from './private/docs/index.js'
|
|
3
|
-
import release from './private/release.js'
|
|
4
3
|
import test from './private/test.js'
|
|
5
4
|
|
|
6
5
|
export const commands = [
|
|
7
6
|
// Private commands
|
|
8
7
|
docs,
|
|
9
|
-
release,
|
|
10
8
|
test
|
|
11
9
|
// Public commands
|
|
12
10
|
// ...
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { InterfaceUtils, OutputUtils } from 'juisy/cli'
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
|
-
$style,
|
|
5
4
|
abort,
|
|
5
|
+
run
|
|
6
|
+
} = InterfaceUtils
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
$style,
|
|
6
10
|
log,
|
|
7
|
-
|
|
11
|
+
error,
|
|
8
12
|
step,
|
|
9
|
-
substep
|
|
10
|
-
|
|
11
|
-
} = juisy.utils
|
|
13
|
+
substep
|
|
14
|
+
} = OutputUtils
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* commit-msg git hook
|
|
@@ -17,26 +20,18 @@ const {
|
|
|
17
20
|
step('Git hook: commit-msg')
|
|
18
21
|
|
|
19
22
|
// Get git commit msg path from args
|
|
20
|
-
|
|
21
|
-
const gitMsgPath =
|
|
23
|
+
// We call this script as: node ./bin/scripts/commit-msg $1
|
|
24
|
+
const gitMsgPath = process.argv[2]
|
|
22
25
|
|
|
23
26
|
try {
|
|
24
|
-
|
|
25
|
-
// we replace "${1}" by gitMsgPath arg
|
|
26
|
-
await run('npx', [
|
|
27
|
-
'--no',
|
|
28
|
-
'--',
|
|
29
|
-
'commitlint',
|
|
30
|
-
'--edit',
|
|
31
|
-
gitMsgPath
|
|
32
|
-
], { cwd: rootDir })
|
|
27
|
+
await run('node', [ './bin/cli', 'lint:commit', '--edit', gitMsgPath ])
|
|
33
28
|
} catch (e) {
|
|
34
29
|
substep($style.red('❌ Git hook: "commit-msg" failed. Please check ./COMMIT_CONVENTION.md for more informations.'), { last: true })
|
|
30
|
+
error('Error:', e)
|
|
35
31
|
abort(1) // Abort with error
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
// Everything is okay
|
|
39
35
|
substep($style.green('✔ Git hook: "commit-msg" passed'), { last: true })
|
|
40
|
-
|
|
41
36
|
log() // blank line
|
|
42
37
|
})()
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { InterfaceUtils, OutputUtils } from 'juisy/cli'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
abort,
|
|
5
|
+
run
|
|
6
|
+
} = InterfaceUtils
|
|
2
7
|
|
|
3
8
|
const {
|
|
4
9
|
$style,
|
|
5
|
-
error,
|
|
6
10
|
log,
|
|
7
|
-
|
|
11
|
+
error,
|
|
8
12
|
step,
|
|
9
|
-
substep
|
|
10
|
-
|
|
11
|
-
} = juisy.utils
|
|
13
|
+
substep
|
|
14
|
+
} = OutputUtils
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Pre commit git hook
|
|
@@ -17,12 +20,11 @@ const {
|
|
|
17
20
|
step('Git hook: pre-commit')
|
|
18
21
|
|
|
19
22
|
try {
|
|
20
|
-
|
|
21
|
-
await run('npx', [
|
|
22
|
-
'lint-staged'
|
|
23
|
-
], { stdio: 'pipe', cwd: rootDir })
|
|
23
|
+
await run('node', [ './bin/cli', 'lint:staged' ])
|
|
24
24
|
} catch (e) {
|
|
25
|
-
|
|
25
|
+
substep($style.red('❌ Git hook: "pre-commit" failed.'), { last: true })
|
|
26
|
+
error('Error:', e)
|
|
27
|
+
abort(1) // Abort with error
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
// Everything is okay
|
package/template/dev.config.js
CHANGED
|
@@ -18,17 +18,29 @@ export default {
|
|
|
18
18
|
'commit-msg': 'node ./bin/scripts/commit-msg.js ${1}'
|
|
19
19
|
},
|
|
20
20
|
lint: {
|
|
21
|
+
default: {
|
|
22
|
+
config: 'eslint.config.js'
|
|
23
|
+
},
|
|
24
|
+
commit: {
|
|
25
|
+
// See also: https://github.com/conventional-changelog/commitlint
|
|
26
|
+
extends: [
|
|
27
|
+
'@commitlint/config-conventional'
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
markdown: [
|
|
31
|
+
{
|
|
32
|
+
globs: [ 'README.md' ],
|
|
33
|
+
config: './docs/.markdownlint-cli2.mjs'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
globs: [ 'cli.private.md', 'cli.public.md' ],
|
|
37
|
+
config: './docs/.markdownlint-cli2.mjs'
|
|
38
|
+
}
|
|
39
|
+
],
|
|
21
40
|
staged: {
|
|
22
41
|
'*.{js,cjs,ts}': [
|
|
23
|
-
'
|
|
42
|
+
'node ./bin/cli lint --fix'
|
|
24
43
|
]
|
|
25
44
|
}
|
|
26
|
-
},
|
|
27
|
-
release: {
|
|
28
|
-
git: {
|
|
29
|
-
commitMessage: 'chore(release): v${version}',
|
|
30
|
-
requireBranch: 'main',
|
|
31
|
-
tagAnnotation: 'v${version}'
|
|
32
|
-
}
|
|
33
45
|
}
|
|
34
46
|
}
|
package/template/dev.config.json
CHANGED
|
@@ -18,9 +18,27 @@
|
|
|
18
18
|
"commit-msg": "node ./bin/scripts/commit-msg.js ${1}"
|
|
19
19
|
},
|
|
20
20
|
"lint": {
|
|
21
|
+
"default": {
|
|
22
|
+
"config": "eslint.config.js"
|
|
23
|
+
},
|
|
24
|
+
"commit": {
|
|
25
|
+
"extends": [
|
|
26
|
+
"@commitlint/config-conventional"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"markdown": [
|
|
30
|
+
{
|
|
31
|
+
"globs": [ "README.md" ],
|
|
32
|
+
"config": "./docs/.markdownlint-cli2.mjs"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"globs": [ "cli.private.md", "cli.public.md" ],
|
|
36
|
+
"config": "./docs/.markdownlint-cli2.mjs"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
21
39
|
"staged": {
|
|
22
40
|
"*.{js,cjs,ts}": [
|
|
23
|
-
"
|
|
41
|
+
"node ./bin/cli lint --fix"
|
|
24
42
|
]
|
|
25
43
|
}
|
|
26
44
|
}
|
package/template/dev.config.ts
CHANGED
|
@@ -19,9 +19,28 @@ export default {
|
|
|
19
19
|
'commit-msg': 'node ./bin/scripts/commit-msg.js ${1}'
|
|
20
20
|
},
|
|
21
21
|
lint: {
|
|
22
|
+
default: {
|
|
23
|
+
config: 'eslint.config.js'
|
|
24
|
+
},
|
|
25
|
+
commit: {
|
|
26
|
+
// See also: https://github.com/conventional-changelog/commitlint
|
|
27
|
+
extends: [
|
|
28
|
+
'@commitlint/config-conventional'
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
markdown: [
|
|
32
|
+
{
|
|
33
|
+
globs: [ 'README.md' ],
|
|
34
|
+
config: './docs/.markdownlint-cli2.mjs'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
globs: [ 'cli.private.md', 'cli.public.md' ],
|
|
38
|
+
config: './docs/.markdownlint-cli2.mjs'
|
|
39
|
+
}
|
|
40
|
+
],
|
|
22
41
|
staged: {
|
|
23
42
|
'*.{js,cjs,ts}': [
|
|
24
|
-
'
|
|
43
|
+
'node ./bin/cli lint --fix'
|
|
25
44
|
]
|
|
26
45
|
}
|
|
27
46
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { init } from '@github/markdownlint-github'
|
|
2
|
+
|
|
3
|
+
const options = {
|
|
4
|
+
// See also https://www.npmjs.com/package/@github/markdownlint-github
|
|
5
|
+
config: init({
|
|
6
|
+
// ... Custom overrides
|
|
7
|
+
}),
|
|
8
|
+
customRules: [
|
|
9
|
+
'@github/markdownlint-github'
|
|
10
|
+
],
|
|
11
|
+
outputFormatters: [
|
|
12
|
+
[
|
|
13
|
+
'markdownlint-cli2-formatter-pretty',
|
|
14
|
+
{
|
|
15
|
+
appendLink: true // ensures the error message includes a link to the rule documentation
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default options
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReadmeTemplater configuration file
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import path, { dirname } from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
9
|
+
const __dirname = dirname(__filename)
|
|
10
|
+
|
|
11
|
+
/** @type {import('juisy/templater').ReadmeTemplaterUserConfig} */
|
|
12
|
+
export default {
|
|
13
|
+
/**
|
|
14
|
+
* Output file name: 'README.md' by default
|
|
15
|
+
*/
|
|
16
|
+
fileName: 'cli.private.md',
|
|
17
|
+
/**
|
|
18
|
+
* Change destination folder
|
|
19
|
+
*/
|
|
20
|
+
destFolder: path.resolve(__dirname, '../../..'),
|
|
21
|
+
/**
|
|
22
|
+
* Template entry file path
|
|
23
|
+
*/
|
|
24
|
+
templatePath: path.resolve(__dirname, './template.md'),
|
|
25
|
+
/**
|
|
26
|
+
* EJS data file
|
|
27
|
+
*/
|
|
28
|
+
ejsDataPath: path.resolve(__dirname, './data.js'),
|
|
29
|
+
/**
|
|
30
|
+
* EJS options
|
|
31
|
+
*/
|
|
32
|
+
ejsOptions: {
|
|
33
|
+
views: [
|
|
34
|
+
path.resolve(__dirname, './partials')
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReadmeTemplater EJS data file
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import stripAnsi from 'strip-ansi'
|
|
6
|
+
import cli from '../../../bin/cli/cli.js'
|
|
7
|
+
|
|
8
|
+
import { extractUsage } from 'juisy/cli'
|
|
9
|
+
|
|
10
|
+
export const rootDoclet = await extractUsage(cli, true) // recursively extract usage
|
|
11
|
+
// Add filters
|
|
12
|
+
export const $filters = {
|
|
13
|
+
stripAnsi
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<%%
|
|
2
|
+
// Optional props
|
|
3
|
+
if (hLevel === undefined) { hLevel = 3 }
|
|
4
|
+
if (recursive === undefined) { recursive = true }
|
|
5
|
+
-%>
|
|
6
|
+
<%%= $utils.h(hLevel, '`' + cmdDoclet.args.join(' ') + '`') %>
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
<%%- $filters.stripAnsi(cmdDoclet.rawUsage) %>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
<%%
|
|
13
|
+
if (recursive) {
|
|
14
|
+
for (const child in cmdDoclet.children) {
|
|
15
|
+
%>
|
|
16
|
+
<%%-
|
|
17
|
+
await include('child-command.md', {
|
|
18
|
+
cmdDoclet: cmdDoclet.children[child],
|
|
19
|
+
hLevel: hLevel + 1,
|
|
20
|
+
recursive: true
|
|
21
|
+
})
|
|
22
|
+
%>
|
|
23
|
+
<%%
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
%>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# CLI
|
|
2
|
+
|
|
3
|
+
## Table of contents
|
|
4
|
+
|
|
5
|
+
<%%#
|
|
6
|
+
// Table of contents is automatically injected here by
|
|
7
|
+
// [remark-toc](https://github.com/remarkjs/remark-toc)
|
|
8
|
+
-%>
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```console
|
|
13
|
+
<%%- $filters.stripAnsi(rootDoclet.rawUsage) %>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
<%% for (const child in rootDoclet.children) { %>
|
|
19
|
+
<%%-
|
|
20
|
+
await include('child-command.md', {
|
|
21
|
+
cmdDoclet: rootDoclet.children[child],
|
|
22
|
+
hLevel: 3,
|
|
23
|
+
recursive: true
|
|
24
|
+
})
|
|
25
|
+
%>
|
|
26
|
+
<%% } %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReadmeTemplater configuration file
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import path, { dirname } from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
|
+
import baseConfig from '../private/config.js'
|
|
9
|
+
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
11
|
+
const __dirname = dirname(__filename)
|
|
12
|
+
|
|
13
|
+
// Force process.env.CLI_ENV to "public"
|
|
14
|
+
process.env.CLI_ENV = 'public'
|
|
15
|
+
|
|
16
|
+
/** @type {import('juisy/templater').ReadmeTemplaterUserConfig} */
|
|
17
|
+
export default {
|
|
18
|
+
...baseConfig,
|
|
19
|
+
fileName: 'cli.public.md',
|
|
20
|
+
templatePath: path.resolve(__dirname, './template.md')
|
|
21
|
+
}
|