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
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
// const path = require('path')
|
|
2
|
-
// const {
|
|
3
|
-
// $style,
|
|
4
|
-
// log,
|
|
5
|
-
// step,
|
|
6
|
-
// substep,
|
|
7
|
-
// run,
|
|
8
|
-
// error,
|
|
9
|
-
// wait,
|
|
10
|
-
// confirm,
|
|
11
|
-
// prompts
|
|
12
|
-
// } = juisy.utils
|
|
13
|
-
|
|
14
|
-
// const rootDir = path.resolve(__dirname, '../../../')
|
|
15
|
-
|
|
16
|
-
// const updateVersion = require('../lib/version/update-version')
|
|
17
|
-
|
|
18
|
-
import semver from 'semver'
|
|
19
|
-
|
|
20
|
-
import { getPackageInfo } from 'juisy'
|
|
21
|
-
|
|
22
|
-
/** @type {import('juisy/cli').Command} */
|
|
23
|
-
export default new CLI.Command({
|
|
24
|
-
command: 'release',
|
|
25
|
-
describe: 'Make a release',
|
|
26
|
-
meta: {
|
|
27
|
-
private: true
|
|
28
|
-
},
|
|
29
|
-
builder: function (cli) {
|
|
30
|
-
cli.option('p', {
|
|
31
|
-
alias: 'preid',
|
|
32
|
-
type: 'string',
|
|
33
|
-
describe: 'Pre-release id',
|
|
34
|
-
requiresArg: true
|
|
35
|
-
})
|
|
36
|
-
return cli
|
|
37
|
-
},
|
|
38
|
-
async handler (argv) {
|
|
39
|
-
const { step } = CLI.OutputUtils
|
|
40
|
-
const { abort, run } = CLI.InterfaceUtils
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Generate docs
|
|
44
|
-
*/
|
|
45
|
-
step('Release-it')
|
|
46
|
-
await run('npx', [ 'release-it' ], { stdio: 'pipe' })
|
|
47
|
-
|
|
48
|
-
// const packageJson = getPackageInfo()
|
|
49
|
-
// let targetVersion
|
|
50
|
-
// const currentVersion = packageJson.version
|
|
51
|
-
// const packageName = packageJson.name
|
|
52
|
-
// const preId = argv.preid || (semver.prerelease(currentVersion) && semver.prerelease(currentVersion)[0])
|
|
53
|
-
// const inc = i => semver.inc(currentVersion, i, preId)
|
|
54
|
-
// const versionIncrements = [
|
|
55
|
-
// 'patch',
|
|
56
|
-
// 'minor',
|
|
57
|
-
// 'major',
|
|
58
|
-
// ...(preId ? [ 'prepatch', 'preminor', 'premajor', 'prerelease' ] : [])
|
|
59
|
-
// ]
|
|
60
|
-
|
|
61
|
-
// /**
|
|
62
|
-
// * First, check if local repository is clean
|
|
63
|
-
// */
|
|
64
|
-
// step('Checking changes to commit')
|
|
65
|
-
// const { stdout } = await run('git', [ 'diff' ], { stdio: 'pipe', cwd: rootDir })
|
|
66
|
-
// if (stdout) {
|
|
67
|
-
// error('Please commit your changes before creating a new release!', new Error('There are changes to commit'))
|
|
68
|
-
// }
|
|
69
|
-
// substep($style.green('✔ Local repository is clean'), { last: true })
|
|
70
|
-
// log() // Blank line
|
|
71
|
-
|
|
72
|
-
// /**
|
|
73
|
-
// * Release prompt
|
|
74
|
-
// */
|
|
75
|
-
// step('Setup')
|
|
76
|
-
// const { release } = await prompts([
|
|
77
|
-
// {
|
|
78
|
-
// type: 'select',
|
|
79
|
-
// name: 'release',
|
|
80
|
-
// message: 'Release type:',
|
|
81
|
-
// choices: versionIncrements.map(i => ({ title: `${i} (${inc(i)})`, value: inc(i) })).concat([ { title: 'custom', value: 'custom' } ])
|
|
82
|
-
// }
|
|
83
|
-
// ])
|
|
84
|
-
// // If custom release
|
|
85
|
-
// if (release === 'custom') {
|
|
86
|
-
// const { version: customVersion } = await prompts([
|
|
87
|
-
// {
|
|
88
|
-
// type: 'text',
|
|
89
|
-
// name: 'version',
|
|
90
|
-
// message: 'New custom version:',
|
|
91
|
-
// initial: currentVersion,
|
|
92
|
-
// validate: value => Boolean(semver.valid(value))
|
|
93
|
-
// }
|
|
94
|
-
// ])
|
|
95
|
-
// targetVersion = customVersion
|
|
96
|
-
// } else {
|
|
97
|
-
// targetVersion = release
|
|
98
|
-
// }
|
|
99
|
-
|
|
100
|
-
// /**
|
|
101
|
-
// * Demand confirmation
|
|
102
|
-
// */
|
|
103
|
-
// await confirm({ message: `Releasing v${targetVersion}. Confirm?` })
|
|
104
|
-
// log() // Blank line
|
|
105
|
-
|
|
106
|
-
// /**
|
|
107
|
-
// * Run tests
|
|
108
|
-
// */
|
|
109
|
-
// // step(`Running tests`)
|
|
110
|
-
// // ... here run tests
|
|
111
|
-
|
|
112
|
-
// /**
|
|
113
|
-
// * Update version in necessary files
|
|
114
|
-
// */
|
|
115
|
-
// await updateVersion(targetVersion)
|
|
116
|
-
// log() // Blank line
|
|
117
|
-
|
|
118
|
-
// /**
|
|
119
|
-
// * Generate docs
|
|
120
|
-
// */
|
|
121
|
-
// step('Generate docs')
|
|
122
|
-
// await wait('API docs', async () => {
|
|
123
|
-
// await run('node', [ './bin/cli', 'docs', 'generate:api' ], { stdio: 'pipe', cwd: rootDir })
|
|
124
|
-
// })
|
|
125
|
-
// substep($style.green('✔ API docs successfuly generated'))
|
|
126
|
-
// await wait('CLI docs', async () => {
|
|
127
|
-
// await run('node', [ './bin/cli', 'docs', 'generate:cli' ], { stdio: 'pipe', cwd: rootDir })
|
|
128
|
-
// })
|
|
129
|
-
// substep($style.green('✔ CLI docs successfuly generated'))
|
|
130
|
-
// await wait('README', async () => {
|
|
131
|
-
// await run('node', [ './bin/cli', 'docs', 'generate:readme' ], { stdio: 'pipe', cwd: rootDir })
|
|
132
|
-
// })
|
|
133
|
-
// substep($style.green('✔ README successfuly generated'), { last: true })
|
|
134
|
-
// // await wait('Linting', async () => {
|
|
135
|
-
// // await run('node', [ './bin/cli', 'docs', 'lint', '-c', './docs/.markdownlint-cli2.cjs' ], { stdio: 'pipe', cwd: rootDir })
|
|
136
|
-
// // })
|
|
137
|
-
// log() // Blank line
|
|
138
|
-
|
|
139
|
-
// /**
|
|
140
|
-
// * Generate changelog file
|
|
141
|
-
// */
|
|
142
|
-
// step('Generating changelog')
|
|
143
|
-
// await wait('Generating', async () => {
|
|
144
|
-
// await run('node', [ './bin/cli', 'changelog' ], { stdio: 'pipe', cwd: rootDir })
|
|
145
|
-
// })
|
|
146
|
-
// substep($style.green('✔ Success'), { last: true })
|
|
147
|
-
// log() // Blank line
|
|
148
|
-
|
|
149
|
-
// /**
|
|
150
|
-
// * Confirm changes to commit
|
|
151
|
-
// */
|
|
152
|
-
// step('Confirm changes to commit')
|
|
153
|
-
// substep($style.yellow('↓ The following changes will be committed:'))
|
|
154
|
-
// await run('git', [ 'status', '-s' ], { stdio: 'inherit', cwd: rootDir })
|
|
155
|
-
// substep($style.yellow('- The following tag will be created: ') + `v${targetVersion}`, { last: true })
|
|
156
|
-
|
|
157
|
-
// /**
|
|
158
|
-
// * Demand confirmation
|
|
159
|
-
// */
|
|
160
|
-
// await confirm()
|
|
161
|
-
// log() // Blank line
|
|
162
|
-
|
|
163
|
-
// /**
|
|
164
|
-
// * Publish package
|
|
165
|
-
// */
|
|
166
|
-
// step(`Publishing ${packageName}`)
|
|
167
|
-
// const releaseTag = targetVersion.includes('alpha')
|
|
168
|
-
// ? 'alpha'
|
|
169
|
-
// : targetVersion.includes('beta')
|
|
170
|
-
// ? 'beta'
|
|
171
|
-
// : targetVersion.includes('rc')
|
|
172
|
-
// ? 'rc'
|
|
173
|
-
// : null
|
|
174
|
-
// let alreadyPublished = false
|
|
175
|
-
// await wait('Publishing', async () => {
|
|
176
|
-
// try {
|
|
177
|
-
// await run('npm', [ 'publish', ...(releaseTag ? [ '--tag', releaseTag ] : []) ], { stdio: 'pipe', cwd: rootDir })
|
|
178
|
-
// } catch (e) {
|
|
179
|
-
// if (e.stderr.match(/previously published/)) {
|
|
180
|
-
// alreadyPublished = true
|
|
181
|
-
// } else {
|
|
182
|
-
// error('Unknown error during publishing', e)
|
|
183
|
-
// }
|
|
184
|
-
// }
|
|
185
|
-
// })
|
|
186
|
-
// substep(
|
|
187
|
-
// alreadyPublished
|
|
188
|
-
// ? $style.yellow(`Skipping already published: ${packageName}`)
|
|
189
|
-
// : $style.green('✔ Success'),
|
|
190
|
-
// { last: true }
|
|
191
|
-
// )
|
|
192
|
-
// log() // Blank line
|
|
193
|
-
|
|
194
|
-
// /**
|
|
195
|
-
// * Push to git
|
|
196
|
-
// */
|
|
197
|
-
// step('Pushing changes')
|
|
198
|
-
// await wait('Committing', async () => {
|
|
199
|
-
// try {
|
|
200
|
-
// await run('git', [ 'add', '.' ], { stdio: 'pipe', cwd: rootDir })
|
|
201
|
-
// await run('git', [ 'commit', '-m', `chore(release): v${targetVersion}` ], { stdio: 'pipe', cwd: rootDir })
|
|
202
|
-
// } catch (e) {
|
|
203
|
-
// error('Unable to commit', e)
|
|
204
|
-
// }
|
|
205
|
-
// })
|
|
206
|
-
// substep($style.green('✔ Committed'))
|
|
207
|
-
// await wait('Creating tag', async () => {
|
|
208
|
-
// try {
|
|
209
|
-
// await run('git', [ 'tag', '-a', `v${targetVersion}`, '-m', `v${targetVersion}` ], { stdio: 'pipe', cwd: rootDir })
|
|
210
|
-
// } catch (e) {
|
|
211
|
-
// error('Unable to create tag', e)
|
|
212
|
-
// }
|
|
213
|
-
// })
|
|
214
|
-
// substep($style.green('✔ Tagged'))
|
|
215
|
-
// log() // blank line
|
|
216
|
-
|
|
217
|
-
// log($style.green(`✔ Release v${targetVersion} successfuly created`))
|
|
218
|
-
// log()
|
|
219
|
-
|
|
220
|
-
// log($style.yellow('IMPORTANT: You should now run ') + 'git push origin --follow-tags')
|
|
221
|
-
// log()
|
|
222
|
-
}
|
|
223
|
-
})
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const fs = require('fs-extra')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const juisy = require('@hperchec/juisy')
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
rootDir,
|
|
7
|
-
$style,
|
|
8
|
-
step,
|
|
9
|
-
substep
|
|
10
|
-
} = juisy.utils
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Generate doc function
|
|
14
|
-
* @param {Object} [options = {}] - The options object
|
|
15
|
-
*/
|
|
16
|
-
module.exports = async function generateAPIDoc (options = {}) {
|
|
17
|
-
// Process options
|
|
18
|
-
const distDir = options.distDir
|
|
19
|
-
const outputDir = options.outputDir
|
|
20
|
-
|
|
21
|
-
const outputFullPath = path.resolve(rootDir, distDir, outputDir)
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Generate api documentation
|
|
25
|
-
*/
|
|
26
|
-
step('Generating API documentation')
|
|
27
|
-
|
|
28
|
-
// Here do logic to generate your documentation
|
|
29
|
-
// ex: jsdoc
|
|
30
|
-
fs.writeFileSync(path.resolve(outputFullPath, './api.md'), '# Awesome API !', { encoding: 'utf8' })
|
|
31
|
-
|
|
32
|
-
substep($style.yellow('This command just creates an example file. Let\'s write your logic!'), { last: true })
|
|
33
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const juisy = require('@hperchec/juisy')
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
rootDir,
|
|
7
|
-
$style,
|
|
8
|
-
error,
|
|
9
|
-
step,
|
|
10
|
-
substep,
|
|
11
|
-
run,
|
|
12
|
-
wait
|
|
13
|
-
} = juisy.utils
|
|
14
|
-
|
|
15
|
-
// File paths
|
|
16
|
-
const filePaths = {
|
|
17
|
-
packageJson: path.resolve(rootDir, './package.json')
|
|
18
|
-
}
|
|
19
|
-
// Get package.json content
|
|
20
|
-
const packageJson = require(filePaths.packageJson)
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Update version in necessary files
|
|
24
|
-
* @param {string} version - The version
|
|
25
|
-
* @return {void}
|
|
26
|
-
*/
|
|
27
|
-
module.exports = async function updateVersion (version) {
|
|
28
|
-
// Update version for each file
|
|
29
|
-
packageJson.version = version
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Update files
|
|
33
|
-
*/
|
|
34
|
-
step('Updating version in necessary files')
|
|
35
|
-
// Update package.json
|
|
36
|
-
try {
|
|
37
|
-
fs.writeFileSync(filePaths.packageJson, JSON.stringify(packageJson, null, 4), 'utf8')
|
|
38
|
-
} catch (e) {
|
|
39
|
-
error('Unable to update package.json file', e)
|
|
40
|
-
}
|
|
41
|
-
substep($style.green('✔ package.json successfuly updated'))
|
|
42
|
-
// Updating package-lock
|
|
43
|
-
await wait('Updating package-lock.json', async () => {
|
|
44
|
-
try {
|
|
45
|
-
await run('npm', [ 'install', '--prefer-offline' ], { stdio: 'pipe' })
|
|
46
|
-
} catch (e) {
|
|
47
|
-
error('Unable to update package-lock.json file', e)
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
substep($style.green('✔ package-lock.json successfuly updated'), { last: true })
|
|
51
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @hperchec/readme-generator Template EJS data example file
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const markdownTable = require('markdown-table') // ! v3 not compatible, use v2
|
|
6
|
-
|
|
7
|
-
// Based on the package.json file, get some data and informations
|
|
8
|
-
const pkg = require('../../package.json')
|
|
9
|
-
const packageName = pkg.name
|
|
10
|
-
const packageUrl = `https://www.npmjs.com/package/${packageName}`
|
|
11
|
-
const dependencies = pkg.dependencies || {}
|
|
12
|
-
const devDependencies = pkg.devDependencies || {}
|
|
13
|
-
const peerDependencies = pkg.peerDependencies || {}
|
|
14
|
-
const author = pkg.author
|
|
15
|
-
const contributors = pkg.contributors || []
|
|
16
|
-
const license = pkg.license || 'Unknown'
|
|
17
|
-
const homepage = pkg.homepage
|
|
18
|
-
const projectUrl = pkg.repository.url
|
|
19
|
-
const issuesUrl = pkg.bugs.url
|
|
20
|
-
|
|
21
|
-
// Output a markdown formatted table from a js object
|
|
22
|
-
// Like:
|
|
23
|
-
// |name|version|
|
|
24
|
-
// |----|-------|
|
|
25
|
-
// | | |
|
|
26
|
-
function getMdDependencies (deps) {
|
|
27
|
-
return markdownTable([
|
|
28
|
-
[ 'name', 'version' ],
|
|
29
|
-
...(Object.entries(deps))
|
|
30
|
-
])
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Return author link
|
|
35
|
-
* @param {Object} author
|
|
36
|
-
* @return {string}
|
|
37
|
-
*/
|
|
38
|
-
function getMdAuthor (author) {
|
|
39
|
-
return '[' + author.name + '](' + author.url + ')'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Return markdown list of persons
|
|
44
|
-
* @param {Array} contributors
|
|
45
|
-
* @return {String}
|
|
46
|
-
*/
|
|
47
|
-
function getMdContributors (contributors) {
|
|
48
|
-
let mdString = ''
|
|
49
|
-
contributors.forEach((person) => {
|
|
50
|
-
mdString += '- [' + person.name + '](' + person.url + ')\n'
|
|
51
|
-
})
|
|
52
|
-
return mdString
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Export data for readme file templating
|
|
57
|
-
*/
|
|
58
|
-
module.exports = {
|
|
59
|
-
packageName,
|
|
60
|
-
packageUrl,
|
|
61
|
-
projectUrl,
|
|
62
|
-
homepage,
|
|
63
|
-
issuesUrl,
|
|
64
|
-
dependencies: getMdDependencies(dependencies),
|
|
65
|
-
devDependencies: getMdDependencies(devDependencies),
|
|
66
|
-
peerDependencies: getMdDependencies(peerDependencies),
|
|
67
|
-
author: getMdAuthor(author),
|
|
68
|
-
contributors: getMdContributors(contributors),
|
|
69
|
-
license
|
|
70
|
-
}
|