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.
- package/bin/cli/cli.js +6 -4
- package/bin/cli/cmds/index.js +10 -10
- package/bin/cli/cmds/private/docs/generate-api.js +31 -0
- package/bin/cli/cmds/{docs → private/docs}/index.js +4 -6
- package/bin/cli/cmds/{print-globals.js → public/print-globals.js} +0 -1
- package/bin/scripts/prepare.js +22 -0
- package/dist/DataExporter.d.ts +6 -0
- package/dist/cli/CLIFactory.d.ts +48 -11
- package/dist/cli/Command.d.ts +23 -13
- package/dist/cli/GlobalSettings.schema.json +1 -0
- package/dist/cli/InterfaceUtils.d.ts +8 -2
- package/dist/cli/OutputUtils.d.ts +3 -3
- package/dist/cli/Plugin.d.ts +21 -0
- package/dist/cli/extract-usage.d.ts +7 -1
- package/dist/cli/index.d.ts +19 -6
- package/dist/cli/index.js +1160 -138
- package/dist/cli/plugins/command-handler-injections/augment.d.ts +29 -0
- package/dist/cli/{command-visitors → plugins/command-handler-injections/command-visitors}/command-handler-injections.d.ts +1 -1
- package/dist/cli/plugins/command-handler-injections/index.d.ts +3 -0
- package/dist/cli/plugins/command-meta/augment.d.ts +23 -0
- package/dist/cli/{command-visitors/get-command-meta.d.ts → plugins/command-meta/command-visitors/command-meta.d.ts} +1 -1
- package/dist/cli/plugins/command-meta/index.d.ts +3 -0
- package/dist/cli/plugins/default-command-fallbacks/augment.d.ts +3 -0
- package/dist/cli/plugins/default-command-fallbacks/command-visitors/default-command-fallbacks.d.ts +10 -0
- package/dist/cli/plugins/default-command-fallbacks/index.d.ts +3 -0
- package/dist/cli/plugins/load-env-file/augment.d.ts +9 -0
- package/dist/cli/plugins/load-env-file/index.d.ts +3 -0
- package/dist/cli/plugins/private-commands/augment.d.ts +6 -0
- package/dist/cli/{command-visitors → plugins/private-commands/command-visitors}/private-command.d.ts +1 -1
- package/dist/cli/plugins/private-commands/index.d.ts +3 -0
- package/dist/cli/plugins/register-changelog-command/augment.d.ts +110 -0
- package/dist/cli/plugins/register-changelog-command/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-changelog-command/index.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/augment.d.ts +18 -0
- package/dist/cli/plugins/register-docs-commands/cmds/generate-api.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/cmds/generate-cli.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/cmds/generate-readme.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/index.d.ts +3 -0
- package/dist/cli/plugins/register-git-hooks-commands/augment.d.ts +40 -0
- package/dist/cli/plugins/register-git-hooks-commands/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-git-hooks-commands/cmds/reset.d.ts +3 -0
- package/dist/cli/plugins/register-git-hooks-commands/cmds/sync.d.ts +3 -0
- package/dist/cli/plugins/register-git-hooks-commands/index.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/augment.d.ts +39 -0
- package/dist/cli/plugins/register-lint-commands/cmds/commit.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/cmds/default.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/cmds/markdown.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/cmds/staged.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/index.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/settings.d.ts +11 -0
- package/dist/cli/plugins/register-lint-commands/types.d.ts +26 -0
- package/dist/cli/plugins/register-release-command/augment.d.ts +9 -0
- package/dist/cli/plugins/register-release-command/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-release-command/index.d.ts +3 -0
- package/dist/cli/plugins/register-test-command/augment.d.ts +3 -0
- package/dist/cli/plugins/register-test-command/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-test-command/index.d.ts +3 -0
- package/dist/cli/types.d.ts +73 -44
- package/dist/cli/utils.d.ts +3 -3
- package/dist/eject.d.ts +11 -4
- package/dist/index.d.ts +8 -2
- package/dist/index.js +80 -76
- package/dist/project-globals.d.ts +9 -0
- package/dist/templater/index.d.ts +6 -1
- package/dist/templater/index.js +27 -40
- package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +28 -28
- package/dist/templater/markdown-templater/index.d.ts +3 -0
- package/dist/templater/types.d.ts +6 -0
- package/dist/utils/misc.d.ts +1 -1
- package/package.json +69 -55
- package/README.md +0 -211
- package/bin/cli/cmds/changelog.js +0 -41
- package/bin/cli/cmds/docs/generate-api.js +0 -22
- package/bin/cli/cmds/docs/generate-cli.js +0 -11
- package/bin/cli/cmds/docs/generate-readme.js +0 -11
- package/bin/cli/cmds/eject.js +0 -28
- package/bin/cli/cmds/git-hooks/index.js +0 -20
- package/bin/cli/cmds/git-hooks/reset.js +0 -48
- package/bin/cli/cmds/git-hooks/sync.js +0 -19
- package/bin/cli/cmds/release.js +0 -231
- package/bin/cli/lib/docs/generate-api-doc.js +0 -78
- package/bin/cli/lib/version/update-version.js +0 -52
- package/bin/scripts/commit-msg.js +0 -32
- package/bin/scripts/pre-commit.js +0 -24
- package/dist/cli/command-visitors/index.d.ts +0 -9
- package/src/index.js +0 -507
- package/template/CHANGELOG.md +0 -0
- package/template/bin/cli/cli.js +0 -27
- package/template/bin/cli/cmds/changelog.js +0 -71
- package/template/bin/cli/cmds/docs.js +0 -30
- package/template/bin/cli/cmds/docs_cmds/generate-api.js +0 -75
- package/template/bin/cli/cmds/docs_cmds/generate-readme.js +0 -51
- package/template/bin/cli/cmds/git-hooks.js +0 -30
- package/template/bin/cli/cmds/git_hooks_cmds/reset.js +0 -76
- package/template/bin/cli/cmds/git_hooks_cmds/sync.js +0 -44
- package/template/bin/cli/cmds/release.js +0 -219
- package/template/bin/cli/index.js +0 -7
- 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/bin/scripts/commit-msg.js +0 -42
- package/template/bin/scripts/pre-commit.js +0 -32
- package/template/docs/api/docs.config.js +0 -10
- package/template/docs/readme/config.js +0 -22
- package/template/docs/readme/readme.js +0 -70
- package/template/docs/readme/template.md +0 -53
- /package/bin/cli/cmds/{docs → private/docs}/lint.js +0 -0
- /package/bin/cli/cmds/{test.js → private/test.js} +0 -0
- /package/bin/cli/cmds/{squeeze.js → public/squeeze.js} +0 -0
package/bin/cli/cmds/eject.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { eject } from '#juisy'
|
|
2
|
-
|
|
3
|
-
/** @type {import('#juisy/cli').Command} */
|
|
4
|
-
export default new CLI.Command({
|
|
5
|
-
command: 'eject <identifier>',
|
|
6
|
-
describe: 'Eject file from juisy template to project directory',
|
|
7
|
-
builder (cli) {
|
|
8
|
-
cli.option('f', {
|
|
9
|
-
alias: 'force',
|
|
10
|
-
type: 'boolean',
|
|
11
|
-
default: false,
|
|
12
|
-
describe: 'Overwrites existing files'
|
|
13
|
-
})
|
|
14
|
-
cli.option('l', {
|
|
15
|
-
alias: 'log-level',
|
|
16
|
-
type: 'string',
|
|
17
|
-
default: 'trace',
|
|
18
|
-
describe: 'Can be one of: trace, debug, info, warn, error, silent'
|
|
19
|
-
})
|
|
20
|
-
return cli
|
|
21
|
-
},
|
|
22
|
-
async handler (argv) {
|
|
23
|
-
await eject(argv.identifier, {
|
|
24
|
-
force: argv.force,
|
|
25
|
-
logLevel: argv['log-level']
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import reset from './reset.js'
|
|
2
|
-
import sync from './sync.js'
|
|
3
|
-
|
|
4
|
-
/** @type {import('#juisy/cli').Command} */
|
|
5
|
-
export default new CLI.Command({
|
|
6
|
-
command: 'git-hooks <command>',
|
|
7
|
-
describe: 'Git relative commands',
|
|
8
|
-
meta: {
|
|
9
|
-
private: true
|
|
10
|
-
},
|
|
11
|
-
builder: function (cli) {
|
|
12
|
-
return cli
|
|
13
|
-
.command([
|
|
14
|
-
reset,
|
|
15
|
-
sync
|
|
16
|
-
])
|
|
17
|
-
.demandCommand(1, 'Command is missing. See help to learn more.')
|
|
18
|
-
},
|
|
19
|
-
handler: async function (argv) {}
|
|
20
|
-
})
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import fs from 'fs-extra'
|
|
3
|
-
|
|
4
|
-
/** @type {import('#juisy/cli').Command} */
|
|
5
|
-
export default new CLI.Command({
|
|
6
|
-
command: 'reset',
|
|
7
|
-
describe: 'Reset git hooks',
|
|
8
|
-
builder (cli) {
|
|
9
|
-
return cli
|
|
10
|
-
},
|
|
11
|
-
async handler (argv) {
|
|
12
|
-
// Utils
|
|
13
|
-
const { $style, step, substep } = CLI.OutputUtils
|
|
14
|
-
const { rootDir, run, abort } = CLI.InterfaceUtils
|
|
15
|
-
/**
|
|
16
|
-
* Reset git hooks
|
|
17
|
-
*/
|
|
18
|
-
step('Reset git hooks')
|
|
19
|
-
|
|
20
|
-
// Create temporary empty configuration file
|
|
21
|
-
const tempConfigFilePath = './__TEMP_SIMPLE_GIT_HOOKS_CONFIG__.json' // relative to project root folder
|
|
22
|
-
fs.writeFileSync(path.resolve(rootDir, tempConfigFilePath), '{}')
|
|
23
|
-
|
|
24
|
-
// Run command with empty configuration
|
|
25
|
-
let commandError = false
|
|
26
|
-
try {
|
|
27
|
-
await run('npx', [
|
|
28
|
-
'simple-git-hooks',
|
|
29
|
-
tempConfigFilePath
|
|
30
|
-
], { stdio: 'pipe', cwd: rootDir })
|
|
31
|
-
} catch (e) {
|
|
32
|
-
commandError = e
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Don't forget to always remove temporary file
|
|
36
|
-
fs.unlinkSync(path.resolve(rootDir, tempConfigFilePath))
|
|
37
|
-
|
|
38
|
-
// If error
|
|
39
|
-
if (commandError) {
|
|
40
|
-
substep($style.red('❌ Unable to reset git hooks.'), { last: true })
|
|
41
|
-
abort(1) // Abort with error
|
|
42
|
-
} else {
|
|
43
|
-
// Everything is okay
|
|
44
|
-
substep($style.green('✔ Git hooks successfuly reset'), { last: true })
|
|
45
|
-
this.log() // blank line
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** @type {import('#juisy/cli').Command} */
|
|
2
|
-
export default new CLI.Command({
|
|
3
|
-
command: 'sync',
|
|
4
|
-
describe: 'Sync git hooks',
|
|
5
|
-
builder (cli) {
|
|
6
|
-
return cli
|
|
7
|
-
},
|
|
8
|
-
async handler (argv) {
|
|
9
|
-
// Utils
|
|
10
|
-
const { step} = CLI.OutputUtils
|
|
11
|
-
const { run } = CLI.InterfaceUtils
|
|
12
|
-
/**
|
|
13
|
-
* Sync git hooks
|
|
14
|
-
*/
|
|
15
|
-
step('Sync git hooks')
|
|
16
|
-
|
|
17
|
-
await run('npx', [ 'simple-git-hooks' ])
|
|
18
|
-
}
|
|
19
|
-
})
|
package/bin/cli/cmds/release.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const semver = require('semver')
|
|
3
|
-
const juisy = require('../../../src')
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
$style,
|
|
7
|
-
log,
|
|
8
|
-
step,
|
|
9
|
-
substep,
|
|
10
|
-
run,
|
|
11
|
-
error,
|
|
12
|
-
wait,
|
|
13
|
-
confirm,
|
|
14
|
-
prompts
|
|
15
|
-
} = juisy.utils
|
|
16
|
-
|
|
17
|
-
const rootDir = path.resolve(__dirname, '../../../')
|
|
18
|
-
|
|
19
|
-
// Get package.json content
|
|
20
|
-
const packageJson = require(path.resolve(rootDir, './package.json'))
|
|
21
|
-
const updateVersion = require('../lib/version/update-version')
|
|
22
|
-
|
|
23
|
-
// Exports command object
|
|
24
|
-
module.exports = {
|
|
25
|
-
private: true,
|
|
26
|
-
/**
|
|
27
|
-
* Command syntax
|
|
28
|
-
*/
|
|
29
|
-
command: 'release',
|
|
30
|
-
/**
|
|
31
|
-
* Aliases
|
|
32
|
-
*/
|
|
33
|
-
aliases: [],
|
|
34
|
-
/**
|
|
35
|
-
* Command description
|
|
36
|
-
*/
|
|
37
|
-
describe: 'Make a release',
|
|
38
|
-
/**
|
|
39
|
-
* Builder
|
|
40
|
-
* @param {Object} yargs
|
|
41
|
-
* @return {Object}
|
|
42
|
-
*/
|
|
43
|
-
builder: function (yargs) {
|
|
44
|
-
return yargs.option('p', {
|
|
45
|
-
alias: 'preid',
|
|
46
|
-
type: 'string',
|
|
47
|
-
describe: 'Pre-release id',
|
|
48
|
-
requiresArg: true
|
|
49
|
-
})
|
|
50
|
-
},
|
|
51
|
-
/**
|
|
52
|
-
* Handler
|
|
53
|
-
* @param {Object} argv - The argv
|
|
54
|
-
* @return {void}
|
|
55
|
-
*/
|
|
56
|
-
handler: async function (argv) {
|
|
57
|
-
let targetVersion
|
|
58
|
-
const currentVersion = packageJson.version
|
|
59
|
-
const packageName = packageJson.name
|
|
60
|
-
const preId = argv.preid || (semver.prerelease(currentVersion) && semver.prerelease(currentVersion)[0])
|
|
61
|
-
const inc = i => semver.inc(currentVersion, i, preId)
|
|
62
|
-
const versionIncrements = [
|
|
63
|
-
'patch',
|
|
64
|
-
'minor',
|
|
65
|
-
'major',
|
|
66
|
-
...(preId ? [ 'prepatch', 'preminor', 'premajor', 'prerelease' ] : [])
|
|
67
|
-
]
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* First, check if local repository is clean
|
|
71
|
-
*/
|
|
72
|
-
step('Checking changes to commit')
|
|
73
|
-
const { stdout } = await run('git', [ 'diff' ], { stdio: 'pipe', cwd: rootDir })
|
|
74
|
-
if (stdout) {
|
|
75
|
-
error('Please commit your changes before creating a new release!', new Error('There are changes to commit'))
|
|
76
|
-
}
|
|
77
|
-
substep($style.green('✔ Local repository is clean'), { last: true })
|
|
78
|
-
log() // Blank line
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Release prompt
|
|
82
|
-
*/
|
|
83
|
-
step('Setup')
|
|
84
|
-
const { release } = await prompts([
|
|
85
|
-
{
|
|
86
|
-
type: 'select',
|
|
87
|
-
name: 'release',
|
|
88
|
-
message: 'Release type:',
|
|
89
|
-
choices: versionIncrements.map(i => ({ title: `${i} (${inc(i)})`, value: inc(i) })).concat([ { title: 'custom', value: 'custom' } ])
|
|
90
|
-
}
|
|
91
|
-
])
|
|
92
|
-
// If custom release
|
|
93
|
-
if (release === 'custom') {
|
|
94
|
-
const { version: customVersion } = await prompts([
|
|
95
|
-
{
|
|
96
|
-
type: 'text',
|
|
97
|
-
name: 'version',
|
|
98
|
-
message: 'New custom version:',
|
|
99
|
-
initial: currentVersion,
|
|
100
|
-
validate: value => Boolean(semver.valid(value))
|
|
101
|
-
}
|
|
102
|
-
])
|
|
103
|
-
targetVersion = customVersion
|
|
104
|
-
} else {
|
|
105
|
-
targetVersion = release
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Demand confirmation
|
|
110
|
-
*/
|
|
111
|
-
await confirm({ message: `Releasing v${targetVersion}. Confirm?` })
|
|
112
|
-
log() // Blank line
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Run tests
|
|
116
|
-
*/
|
|
117
|
-
// step(`Running tests`)
|
|
118
|
-
// ... here run tests
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Update version in necessary files
|
|
122
|
-
*/
|
|
123
|
-
await updateVersion(targetVersion)
|
|
124
|
-
log() // Blank line
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Generate docs
|
|
128
|
-
*/
|
|
129
|
-
step('Generate docs')
|
|
130
|
-
await wait('API docs', async () => {
|
|
131
|
-
await run('node', [ './bin/cli', 'docs', 'generate:api' ], { stdio: 'pipe', cwd: rootDir })
|
|
132
|
-
})
|
|
133
|
-
substep($style.green('✔ API docs successfuly generated'))
|
|
134
|
-
await wait('CLI docs', async () => {
|
|
135
|
-
await run('node', [ './bin/cli', 'docs', 'generate:cli' ], { stdio: 'pipe', cwd: rootDir })
|
|
136
|
-
})
|
|
137
|
-
substep($style.green('✔ CLI docs successfuly generated'))
|
|
138
|
-
await wait('README', async () => {
|
|
139
|
-
await run('node', [ './bin/cli', 'docs', 'generate:readme' ], { stdio: 'pipe', cwd: rootDir })
|
|
140
|
-
})
|
|
141
|
-
substep($style.green('✔ README successfuly generated'), { last: true })
|
|
142
|
-
// await wait('Linting', async () => {
|
|
143
|
-
// await run('node', [ './bin/cli', 'docs', 'lint', '-c', './docs/.markdownlint-cli2.cjs' ], { stdio: 'pipe', cwd: rootDir })
|
|
144
|
-
// })
|
|
145
|
-
log() // Blank line
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Generate changelog file
|
|
149
|
-
*/
|
|
150
|
-
step('Generating changelog')
|
|
151
|
-
await wait('Generating', async () => {
|
|
152
|
-
await run('node', [ './bin/cli', 'changelog' ], { stdio: 'pipe', cwd: rootDir })
|
|
153
|
-
})
|
|
154
|
-
substep($style.green('✔ Success'), { last: true })
|
|
155
|
-
log() // Blank line
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Confirm changes to commit
|
|
159
|
-
*/
|
|
160
|
-
step('Confirm changes to commit')
|
|
161
|
-
substep($style.yellow('↓ The following changes will be committed:'))
|
|
162
|
-
await run('git', [ 'status', '-s' ], { stdio: 'inherit', cwd: rootDir })
|
|
163
|
-
substep($style.yellow('- The following tag will be created: ') + `v${targetVersion}`, { last: true })
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Demand confirmation
|
|
167
|
-
*/
|
|
168
|
-
await confirm()
|
|
169
|
-
log() // Blank line
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Publish package
|
|
173
|
-
*/
|
|
174
|
-
step(`Publishing ${packageName}`)
|
|
175
|
-
const releaseTag = targetVersion.includes('alpha')
|
|
176
|
-
? 'alpha'
|
|
177
|
-
: targetVersion.includes('beta')
|
|
178
|
-
? 'beta'
|
|
179
|
-
: targetVersion.includes('rc')
|
|
180
|
-
? 'rc'
|
|
181
|
-
: null
|
|
182
|
-
let alreadyPublished = false
|
|
183
|
-
await wait('Publishing', async () => {
|
|
184
|
-
try {
|
|
185
|
-
await run('npm', [ 'publish', ...(releaseTag ? [ '--tag', releaseTag ] : []) ], { stdio: 'pipe', cwd: rootDir })
|
|
186
|
-
} catch (e) {
|
|
187
|
-
if (e.stderr.match(/previously published/)) {
|
|
188
|
-
alreadyPublished = true
|
|
189
|
-
} else {
|
|
190
|
-
error('Unknown error during publishing', e)
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
substep(
|
|
195
|
-
alreadyPublished
|
|
196
|
-
? $style.yellow(`Skipping already published: ${packageName}`)
|
|
197
|
-
: $style.green('✔ Success'),
|
|
198
|
-
{ last: true }
|
|
199
|
-
)
|
|
200
|
-
log() // Blank line
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Push to git
|
|
204
|
-
*/
|
|
205
|
-
step('Pushing changes')
|
|
206
|
-
await wait('Committing', async () => {
|
|
207
|
-
try {
|
|
208
|
-
await run('git', [ 'add', '.' ], { stdio: 'pipe', cwd: rootDir })
|
|
209
|
-
await run('git', [ 'commit', '-m', `chore(release): v${targetVersion}` ], { stdio: 'pipe', cwd: rootDir })
|
|
210
|
-
} catch (e) {
|
|
211
|
-
error('Unable to commit', e)
|
|
212
|
-
}
|
|
213
|
-
})
|
|
214
|
-
substep($style.green('✔ Committed'))
|
|
215
|
-
await wait('Creating tag', async () => {
|
|
216
|
-
try {
|
|
217
|
-
await run('git', [ 'tag', '-a', `v${targetVersion}`, '-m', `v${targetVersion}` ], { stdio: 'pipe', cwd: rootDir })
|
|
218
|
-
} catch (e) {
|
|
219
|
-
error('Unable to create tag', e)
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
substep($style.green('✔ Tagged'))
|
|
223
|
-
log() // blank line
|
|
224
|
-
|
|
225
|
-
log($style.green(`✔ Release v${targetVersion} successfuly created`))
|
|
226
|
-
log()
|
|
227
|
-
|
|
228
|
-
log($style.yellow('IMPORTANT: You should now run ') + 'git push origin --follow-tags')
|
|
229
|
-
log()
|
|
230
|
-
}
|
|
231
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// import fs from 'fs-extra'
|
|
2
|
-
// import jsdoc2md from 'jsdoc-to-markdown'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import { InterfaceUtils, OutputUtils } from '#juisy/cli'
|
|
5
|
-
|
|
6
|
-
// utils
|
|
7
|
-
const { rootDir } = InterfaceUtils
|
|
8
|
-
const {
|
|
9
|
-
$style,
|
|
10
|
-
log,
|
|
11
|
-
step,
|
|
12
|
-
substep
|
|
13
|
-
} = OutputUtils
|
|
14
|
-
|
|
15
|
-
// Default config
|
|
16
|
-
const defaultConfig = {
|
|
17
|
-
outputDir: 'documentation',
|
|
18
|
-
jsdoc: {
|
|
19
|
-
configPath: undefined
|
|
20
|
-
},
|
|
21
|
-
jsdoc2md: {
|
|
22
|
-
partial: []
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Generate API doc function
|
|
28
|
-
* @param {object} [options = {}] - The options object
|
|
29
|
-
* @returns {void}
|
|
30
|
-
*/
|
|
31
|
-
export default async function generateApiDoc (options = {}) {
|
|
32
|
-
// Process options
|
|
33
|
-
options = merge(defaultConfig, options)
|
|
34
|
-
|
|
35
|
-
const docs = {
|
|
36
|
-
API: {
|
|
37
|
-
sourcePath: path.resolve(rootDir, './src/index.js'),
|
|
38
|
-
destPath: path.resolve(rootDir, './documentation/api.md')
|
|
39
|
-
},
|
|
40
|
-
Utils: {
|
|
41
|
-
sourcePath: path.resolve(rootDir, './src/utils/index.js'),
|
|
42
|
-
destPath: path.resolve(rootDir, './documentation/utils.md')
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Generate doc
|
|
48
|
-
*/
|
|
49
|
-
step('Generate doc')
|
|
50
|
-
|
|
51
|
-
// // Loop on docs
|
|
52
|
-
// for (const name in docs) {
|
|
53
|
-
// const sourcePath = docs[name].sourcePath
|
|
54
|
-
// const destPath = docs[name].destPath
|
|
55
|
-
|
|
56
|
-
// let genResult
|
|
57
|
-
// await wait(`Generating "${name}"`, async () => {
|
|
58
|
-
// genResult = await jsdoc2md.render({
|
|
59
|
-
// 'no-cache': Boolean(options.jsdoc.configPath),
|
|
60
|
-
// files: sourcePath,
|
|
61
|
-
// template: `# ${name} documentation\n\n{{>main}}`,
|
|
62
|
-
// partial: options.jsdoc2md.partial,
|
|
63
|
-
// configure: options.jsdoc.configPath
|
|
64
|
-
// })
|
|
65
|
-
// })
|
|
66
|
-
// // f*cking windows compat:
|
|
67
|
-
// // jsdoc2md will generate CR (\r) character for @example blocks content line endings
|
|
68
|
-
// genResult = genResult.replace(/\r(\n)?/g, '\n')
|
|
69
|
-
// // Write output
|
|
70
|
-
// await wait(`Writing file "${path.basename(destPath)}"`, async () => {
|
|
71
|
-
// await fs.writeFile(destPath, genResult, { encoding: 'utf8' })
|
|
72
|
-
// })
|
|
73
|
-
// substep(`File "${path.basename(destPath)}" successfuly generated`)
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
substep($style.green('✔ Success'), { last: true })
|
|
77
|
-
log() // Blank line
|
|
78
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const juisy = require('../../../../src')
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
$style,
|
|
7
|
-
error,
|
|
8
|
-
step,
|
|
9
|
-
substep,
|
|
10
|
-
run,
|
|
11
|
-
wait
|
|
12
|
-
} = juisy.utils
|
|
13
|
-
|
|
14
|
-
const rootDir = path.resolve(__dirname, '../../../../')
|
|
15
|
-
|
|
16
|
-
// File paths
|
|
17
|
-
const filePaths = {
|
|
18
|
-
packageJson: path.resolve(rootDir, './package.json')
|
|
19
|
-
}
|
|
20
|
-
// Get package.json content
|
|
21
|
-
const packageJson = require(filePaths.packageJson)
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Update version in necessary files
|
|
25
|
-
* @param {string} version - The version
|
|
26
|
-
* @return {void}
|
|
27
|
-
*/
|
|
28
|
-
module.exports = async function updateVersion (version) {
|
|
29
|
-
// Update version for each file
|
|
30
|
-
packageJson.version = version
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Update files
|
|
34
|
-
*/
|
|
35
|
-
step('Updating version in necessary files')
|
|
36
|
-
// Update package.json
|
|
37
|
-
try {
|
|
38
|
-
fs.writeFileSync(filePaths.packageJson, JSON.stringify(packageJson, null, 4), 'utf8')
|
|
39
|
-
} catch (e) {
|
|
40
|
-
error('Unable to update package.json file', e)
|
|
41
|
-
}
|
|
42
|
-
substep($style.green('✔ package.json successfuly updated'))
|
|
43
|
-
// Updating package-lock
|
|
44
|
-
await wait('Updating package-lock.json', async () => {
|
|
45
|
-
try {
|
|
46
|
-
await run('npm', [ 'install', '--prefer-offline' ], { stdio: 'pipe', cwd: rootDir })
|
|
47
|
-
} catch (e) {
|
|
48
|
-
error('Unable to update package-lock.json file', e)
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
substep($style.green('✔ package-lock.json successfuly updated'), { last: true })
|
|
52
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import run from 'execa'
|
|
2
|
-
/**
|
|
3
|
-
* commit-msg git hook
|
|
4
|
-
*/
|
|
5
|
-
;(async function () {
|
|
6
|
-
console.log('Git hook: commit-msg')
|
|
7
|
-
|
|
8
|
-
// Get git commit msg path from args
|
|
9
|
-
const args = process.argv.slice(2)
|
|
10
|
-
const gitMsgPath = args[0]
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
// original is: npx --no -- commitlint --edit ${1}
|
|
14
|
-
// we replace "${1}" by gitMsgPath arg
|
|
15
|
-
await run('npx', [
|
|
16
|
-
'--no',
|
|
17
|
-
'--',
|
|
18
|
-
'commitlint',
|
|
19
|
-
'--edit',
|
|
20
|
-
gitMsgPath
|
|
21
|
-
])
|
|
22
|
-
} catch (e) {
|
|
23
|
-
console.error('❌ Git hook: "commit-msg" failed. Please check ./COMMIT_CONVENTION.md for more informations.', e)
|
|
24
|
-
console.log() // blank line
|
|
25
|
-
process.exit(1) // Abort with error
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Everything is okay
|
|
29
|
-
console.log('✔ Git hook: "commit-msg" passed')
|
|
30
|
-
|
|
31
|
-
console.log() // blank line
|
|
32
|
-
})()
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import run from 'execa'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pre commit git hook
|
|
5
|
-
*/
|
|
6
|
-
;(async function () {
|
|
7
|
-
console.log('Git hook: pre-commit')
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
// npx lint-staged
|
|
11
|
-
await run('npx', [
|
|
12
|
-
'lint-staged'
|
|
13
|
-
], { stdio: 'pipe' })
|
|
14
|
-
} catch (e) {
|
|
15
|
-
console.error('Git hook: "commit-msg" error: ', e)
|
|
16
|
-
console.log() // blank line
|
|
17
|
-
process.exit(1)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Everything is okay
|
|
21
|
-
console.log('✔ Git hook: "pre-commit" passed')
|
|
22
|
-
|
|
23
|
-
console.log() // blank line
|
|
24
|
-
})()
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as commandHandlerInjections from './command-handler-injections';
|
|
2
|
-
import * as getCommandMeta from './get-command-meta';
|
|
3
|
-
import * as privateCommand from './private-command';
|
|
4
|
-
declare const _default: {
|
|
5
|
-
commandHandlerInjections: typeof commandHandlerInjections;
|
|
6
|
-
getCommandMeta: typeof getCommandMeta;
|
|
7
|
-
privateCommand: typeof privateCommand;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|