create-juisy 2.0.0-beta.9 → 2.1.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/LICENSE +661 -0
- package/index.js +45 -17
- package/package.json +57 -59
- package/template/.env.example +1 -1
- package/template/COMMIT_CONVENTION.md +116 -0
- package/template/CONTRIBUTING.md +61 -0
- package/template/bin/cli/cli.js +11 -14
- package/template/bin/cli/cmds/index.js +4 -6
- package/template/bin/cli/cmds/private/docs/{generate-api.js → GenerateAPI.js} +28 -7
- package/template/bin/cli/cmds/private/docs/index.js +30 -11
- package/template/bin/cli/cmds/private/test.js +40 -25
- 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 +37 -5
- package/template/dev.config.json +19 -1
- package/template/dev.config.ts +40 -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 +37 -9
- package/template/eslint.config.js +47 -0
- package/template/package.json +9 -6
- package/template/project.globals.js +20 -29
- package/template/tests/unit/example.spec.ts +13 -0
- package/template/tests/unit/setup.unit.ts +14 -0
- package/template/tests/vitest.d.ts +16 -0
- package/template/tsconfig.json +18 -0
- package/template/vite.config.ts +22 -0
- 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,33 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineGlobals } from 'juisy'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export default defineGlobals(
|
|
4
|
+
{
|
|
5
|
+
// The environment variables to auto includes in "ENV" property
|
|
6
|
+
env: { map: [ 'NODE_ENV' ] }
|
|
7
7
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
ISSUES_URL: pkg.bugs.url,
|
|
23
|
-
HOMEPAGE: pkg.homepage,
|
|
24
|
-
BRAND: {
|
|
25
|
-
COLORS: {
|
|
26
|
-
GERALDINE: '#FF8E92',
|
|
27
|
-
SAND: '#FFC17A',
|
|
28
|
-
COGNAC: '#A04113',
|
|
29
|
-
DARK_PINK: '#E95185',
|
|
30
|
-
PINK_SHERBET: '#F583A3'
|
|
8
|
+
// Access to all environment variables and package.json info
|
|
9
|
+
({ env, pkg }) => {
|
|
10
|
+
return {
|
|
11
|
+
// Define your brand specific constants
|
|
12
|
+
BRAND: {
|
|
13
|
+
NAME: 'My brand',
|
|
14
|
+
COLORS: {
|
|
15
|
+
GERALDINE: '#FF8E92',
|
|
16
|
+
SAND: '#FFC17A',
|
|
17
|
+
COGNAC: '#A04113',
|
|
18
|
+
DARK_PINK: '#E95185',
|
|
19
|
+
PINK_SHERBET: '#F583A3'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
31
22
|
}
|
|
32
23
|
}
|
|
33
|
-
|
|
24
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* See also Vitest documentation: https://vitest.dev/guide/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------
|
|
8
|
+
|
|
9
|
+
describe('Example test set', () => {
|
|
10
|
+
it('should return "foo"', () => {
|
|
11
|
+
expect('foo').toBe('foo')
|
|
12
|
+
})
|
|
13
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import 'vitest'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Here, you can augment types from vitest.
|
|
5
|
+
* For example to add custom matchers
|
|
6
|
+
* See also: https://vitest.dev/guide/extending-matchers.html#extending-matchers
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
interface CustomMatchers<R = unknown> {
|
|
10
|
+
toBeFoo: () => R
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module 'vitest' {
|
|
14
|
+
interface Assertion<T = any> extends CustomMatchers<T> {}
|
|
15
|
+
interface AsymmetricMatchersContaining extends CustomMatchers {}
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"types": [
|
|
7
|
+
"vitest/globals",
|
|
8
|
+
"./tests/**/*.d.ts"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"tests/**/*.ts"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"bin",
|
|
16
|
+
"node_modules"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
2
|
+
import { defineConfig } from 'vite'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
test: {
|
|
6
|
+
setupFiles: [
|
|
7
|
+
'./tests/unit/setup.unit.ts'
|
|
8
|
+
],
|
|
9
|
+
include: [
|
|
10
|
+
'./tests/**/*.spec.ts'
|
|
11
|
+
],
|
|
12
|
+
coverage: {
|
|
13
|
+
enabled: true,
|
|
14
|
+
provider: 'v8',
|
|
15
|
+
reporter: [ 'text', 'json', 'html' ],
|
|
16
|
+
reportsDirectory: './tests/unit/.coverage',
|
|
17
|
+
include: [
|
|
18
|
+
// 'src/**'
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
})
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** @type {import('juisy/cli').Command} */
|
|
2
|
-
export default new CLI.Command({
|
|
3
|
-
command: 'changelog',
|
|
4
|
-
describe: 'Generate CHANGELOG file',
|
|
5
|
-
meta: {
|
|
6
|
-
private: true
|
|
7
|
-
},
|
|
8
|
-
builder: function (cli) {
|
|
9
|
-
return cli.option('i', {
|
|
10
|
-
alias: 'infile',
|
|
11
|
-
type: 'string',
|
|
12
|
-
describe: 'Same as conventional-changelog option',
|
|
13
|
-
default: 'CHANGELOG.md',
|
|
14
|
-
requiresArg: true
|
|
15
|
-
})
|
|
16
|
-
},
|
|
17
|
-
async handler (argv) {
|
|
18
|
-
// Utils
|
|
19
|
-
const { $style, step, substep, error } = CLI.OutputUtils
|
|
20
|
-
const { run, wait } = CLI.InterfaceUtils
|
|
21
|
-
/**
|
|
22
|
-
* Generate changelog file
|
|
23
|
-
*/
|
|
24
|
-
step('Generating changelog')
|
|
25
|
-
await wait('Generating', async () => {
|
|
26
|
-
try {
|
|
27
|
-
await run(
|
|
28
|
-
'npx',
|
|
29
|
-
[
|
|
30
|
-
'conventional-changelog',
|
|
31
|
-
'-p', 'angular',
|
|
32
|
-
'-i', argv.infile,
|
|
33
|
-
'-s' // same file to output
|
|
34
|
-
],
|
|
35
|
-
{ stdio: 'pipe' }
|
|
36
|
-
)
|
|
37
|
-
} catch (e) {
|
|
38
|
-
error('Unable to generate changelog', e)
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
substep($style.green('✔ Success'), { last: true })
|
|
42
|
-
this.log() // Blank line
|
|
43
|
-
}
|
|
44
|
-
})
|
|
@@ -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
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/** @type {import('juisy/cli').Command} */
|
|
2
|
-
export default new CLI.Command({
|
|
3
|
-
command: 'lint',
|
|
4
|
-
describe: 'Lint markdown with markdownlint',
|
|
5
|
-
builder: function (cli) {
|
|
6
|
-
cli.option('c', {
|
|
7
|
-
alias: 'config',
|
|
8
|
-
type: 'string',
|
|
9
|
-
describe: 'Path to custom markdownlint config file (relative to root folder)',
|
|
10
|
-
requiresArg: true
|
|
11
|
-
})
|
|
12
|
-
cli.option('f', {
|
|
13
|
-
alias: 'fix',
|
|
14
|
-
type: 'boolean',
|
|
15
|
-
describe: 'Auto fix by passing --fix option to markdownlint-cli2',
|
|
16
|
-
default: false
|
|
17
|
-
})
|
|
18
|
-
return cli
|
|
19
|
-
},
|
|
20
|
-
async handler (argv) {
|
|
21
|
-
const { abort, run } = CLI.InterfaceUtils
|
|
22
|
-
const configPath = argv.config || './docs/.markdownlint-cli2.cjs' // default relative to root folder
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Call markdownlint command
|
|
26
|
-
*/
|
|
27
|
-
try {
|
|
28
|
-
await run(
|
|
29
|
-
'npx',
|
|
30
|
-
[
|
|
31
|
-
'markdownlint-cli2',
|
|
32
|
-
'--config',
|
|
33
|
-
configPath,
|
|
34
|
-
...(argv.fix ? [ '--fix' ] : [])
|
|
35
|
-
],
|
|
36
|
-
{ stdio: 'inherit' }
|
|
37
|
-
)
|
|
38
|
-
} catch (error) {
|
|
39
|
-
abort(error.exitCode)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
})
|
|
@@ -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 'node: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
|
-
})
|
|
@@ -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
|
-
}
|