juisy 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -0
- package/bin/cli/cli.js +23 -0
- package/bin/cli/cmds/changelog.js +41 -0
- package/bin/cli/cmds/docs/generate-api.js +22 -0
- package/bin/cli/cmds/docs/generate-cli.js +11 -0
- package/bin/cli/cmds/docs/generate-readme.js +11 -0
- package/bin/cli/cmds/docs/index.js +22 -0
- package/bin/cli/cmds/docs/lint.js +42 -0
- package/bin/cli/cmds/eject.js +28 -0
- package/bin/cli/cmds/git-hooks/index.js +20 -0
- package/bin/cli/cmds/git-hooks/reset.js +48 -0
- package/bin/cli/cmds/git-hooks/sync.js +19 -0
- package/bin/cli/cmds/index.js +15 -0
- package/bin/cli/cmds/print-globals.js +28 -0
- package/bin/cli/cmds/release.js +231 -0
- package/bin/cli/cmds/squeeze.js +269 -0
- package/bin/cli/cmds/test.js +33 -0
- package/bin/cli/index.js +9 -0
- package/bin/cli/lib/docs/generate-api-doc.js +78 -0
- package/bin/cli/lib/version/update-version.js +52 -0
- package/bin/scripts/commit-msg.js +32 -0
- package/bin/scripts/pre-commit.js +24 -0
- package/dist/DataExporter.d.ts +67 -0
- package/dist/cli/CLIFactory.d.ts +19 -0
- package/dist/cli/Command.d.ts +44 -0
- package/dist/cli/InterfaceUtils.d.ts +53 -0
- package/dist/cli/OutputUtils.d.ts +123 -0
- package/dist/cli/command-visitors/command-handler-injections.d.ts +10 -0
- package/dist/cli/command-visitors/get-command-meta.d.ts +10 -0
- package/dist/cli/command-visitors/index.d.ts +9 -0
- package/dist/cli/command-visitors/private-command.d.ts +16 -0
- package/dist/cli/create-engine.d.ts +7 -0
- package/dist/cli/extract-usage.d.ts +72 -0
- package/dist/cli/index.d.ts +20 -0
- package/dist/cli/index.js +559 -0
- package/dist/cli/types.d.ts +112 -0
- package/dist/cli/utils.d.ts +19 -0
- package/dist/eject.d.ts +22 -0
- package/dist/get-package-info.d.ts +6 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +244 -0
- package/dist/project-globals.d.ts +63 -0
- package/dist/templater/Templater.d.ts +23 -0
- package/dist/templater/index.d.ts +6 -0
- package/dist/templater/index.js +330 -0
- package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +154 -0
- package/dist/templater/markdown-templater/index.d.ts +25 -0
- package/dist/templater/types.d.ts +10 -0
- package/dist/utils/misc.d.ts +21 -0
- package/package.json +179 -0
- package/src/index.js +507 -0
- package/template/CHANGELOG.md +0 -0
- package/template/bin/cli/cli.js +27 -0
- package/template/bin/cli/cmds/changelog.js +71 -0
- package/template/bin/cli/cmds/docs.js +30 -0
- package/template/bin/cli/cmds/docs_cmds/generate-api.js +75 -0
- package/template/bin/cli/cmds/docs_cmds/generate-readme.js +51 -0
- package/template/bin/cli/cmds/git-hooks.js +30 -0
- package/template/bin/cli/cmds/git_hooks_cmds/reset.js +76 -0
- package/template/bin/cli/cmds/git_hooks_cmds/sync.js +44 -0
- package/template/bin/cli/cmds/release.js +219 -0
- package/template/bin/cli/index.js +7 -0
- package/template/bin/cli/lib/docs/generate-api-doc.js +33 -0
- package/template/bin/cli/lib/release/generate-release-note.js +3 -0
- package/template/bin/cli/lib/version/update-version.js +51 -0
- package/template/bin/scripts/commit-msg.js +42 -0
- package/template/bin/scripts/pre-commit.js +32 -0
- package/template/docs/api/docs.config.js +10 -0
- package/template/docs/readme/config.js +22 -0
- package/template/docs/readme/readme.js +70 -0
- package/template/docs/readme/template.md +53 -0
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const juisy = require('@hperchec/juisy')
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
$style,
|
|
5
|
+
abort,
|
|
6
|
+
log,
|
|
7
|
+
rootDir,
|
|
8
|
+
step,
|
|
9
|
+
substep,
|
|
10
|
+
run
|
|
11
|
+
} = juisy.utils
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* commit-msg git hook
|
|
15
|
+
*/
|
|
16
|
+
;(async function () {
|
|
17
|
+
step('Git hook: commit-msg')
|
|
18
|
+
|
|
19
|
+
// Get git commit msg path from args
|
|
20
|
+
const args = process.argv.slice(2)
|
|
21
|
+
const gitMsgPath = args[0]
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
// original is: npx --no -- commitlint --edit ${1}
|
|
25
|
+
// we replace "${1}" by gitMsgPath arg
|
|
26
|
+
await run('npx', [
|
|
27
|
+
'--no',
|
|
28
|
+
'--',
|
|
29
|
+
'commitlint',
|
|
30
|
+
'--edit',
|
|
31
|
+
gitMsgPath
|
|
32
|
+
], { cwd: rootDir })
|
|
33
|
+
} catch (e) {
|
|
34
|
+
substep($style.red('❌ Git hook: "commit-msg" failed. Please check ./COMMIT_CONVENTION.md for more informations.'), { last: true })
|
|
35
|
+
abort(1) // Abort with error
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Everything is okay
|
|
39
|
+
substep($style.green('✔ Git hook: "commit-msg" passed'), { last: true })
|
|
40
|
+
|
|
41
|
+
log() // blank line
|
|
42
|
+
})()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const juisy = require('@hperchec/juisy')
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
$style,
|
|
5
|
+
error,
|
|
6
|
+
log,
|
|
7
|
+
rootDir,
|
|
8
|
+
step,
|
|
9
|
+
substep,
|
|
10
|
+
run
|
|
11
|
+
} = juisy.utils
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Pre commit git hook
|
|
15
|
+
*/
|
|
16
|
+
;(async function () {
|
|
17
|
+
step('Git hook: pre-commit')
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
// npx lint-staged
|
|
21
|
+
await run('npx', [
|
|
22
|
+
'lint-staged'
|
|
23
|
+
], { stdio: 'pipe', cwd: rootDir })
|
|
24
|
+
} catch (e) {
|
|
25
|
+
error('Git hook: "commit-msg" error: ', e)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Everything is okay
|
|
29
|
+
substep($style.green('✔ Git hook: "pre-commit" passed'), { last: true })
|
|
30
|
+
|
|
31
|
+
log() // blank line
|
|
32
|
+
})()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hperchec/readme-generator Example configuration file
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const path = require('path')
|
|
6
|
+
|
|
7
|
+
// Export configuration
|
|
8
|
+
module.exports = {
|
|
9
|
+
// Template path
|
|
10
|
+
templatePath: path.resolve(__dirname, './template.md'), // Default template file
|
|
11
|
+
// Output path
|
|
12
|
+
outputPath: path.resolve(__dirname, '../../'), // Your project root directory by default
|
|
13
|
+
// Output file name
|
|
14
|
+
outputName: 'README.md', // 'README.md' by default
|
|
15
|
+
// Path to ejs data file
|
|
16
|
+
ejsDataPath: path.resolve(__dirname, './readme.js'), // Default template ejs data file
|
|
17
|
+
// EJS options (see https://www.npmjs.com/package/ejs#options)
|
|
18
|
+
ejsOptions: {
|
|
19
|
+
async: true
|
|
20
|
+
/* your ejs options... */
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Awesome project
|
|
2
|
+
|
|
3
|
+
[]()
|
|
4
|
+
[](http://herve-perchec.com/)
|
|
5
|
+
|
|
6
|
+
**Table of contents**:
|
|
7
|
+
|
|
8
|
+
[[*TOC*]]
|
|
9
|
+
|
|
10
|
+
## 🚀 Get started
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
# Let's go!
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 📙 Documentation
|
|
17
|
+
|
|
18
|
+
Please check the [documentation](https://www.npmjs.com/package/@hperchec/juisy)
|
|
19
|
+
|
|
20
|
+
## 🧱 Dependencies
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>Global</summary>
|
|
24
|
+
|
|
25
|
+
<%%= dependencies %>
|
|
26
|
+
|
|
27
|
+
</details>
|
|
28
|
+
|
|
29
|
+
<details>
|
|
30
|
+
<summary>Dev</summary>
|
|
31
|
+
|
|
32
|
+
<%%= devDependencies %>
|
|
33
|
+
|
|
34
|
+
</details>
|
|
35
|
+
|
|
36
|
+
<details>
|
|
37
|
+
<summary>Peer</summary>
|
|
38
|
+
|
|
39
|
+
<%%= peerDependencies %>
|
|
40
|
+
|
|
41
|
+
</details>
|
|
42
|
+
|
|
43
|
+
## ✍ Author
|
|
44
|
+
|
|
45
|
+
<%%= author %>
|
|
46
|
+
|
|
47
|
+
## 📄 License
|
|
48
|
+
|
|
49
|
+
<%%= license %>
|
|
50
|
+
|
|
51
|
+
----
|
|
52
|
+
|
|
53
|
+
Made with ❤ by <%%= author %>
|