juisy 2.0.0-beta.1 → 2.0.0-beta.10
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/bin/cli/index.js +1 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +128 -27
- package/dist/cli/plugins/register-bump-version-command/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-bump-version-command/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/templater/index.js +10 -10
- package/package.json +201 -193
- package/bin/cli/cmds/private/docs/lint.js +0 -42
- package/dist/cli/plugins/register-test-command/augment.d.ts +0 -3
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* juisy v2.0.0-beta.
|
|
2
|
+
* juisy v2.0.0-beta.10
|
|
3
3
|
* Copyright © 2022-Present Hervé Perchec
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -17,10 +17,11 @@ import chalk from 'chalk';
|
|
|
17
17
|
import indent from 'indent-string';
|
|
18
18
|
import _stripAnsi from 'strip-ansi';
|
|
19
19
|
import dotenv from '@dotenvx/dotenvx';
|
|
20
|
+
import semver from 'semver';
|
|
21
|
+
import { getPackageInfo } from 'juisy';
|
|
20
22
|
import kebabcase from 'lodash.kebabcase';
|
|
21
23
|
import { ReadmeTemplater } from 'juisy/templater';
|
|
22
24
|
import path from 'node:path';
|
|
23
|
-
import { getPackageInfo } from 'juisy';
|
|
24
25
|
import { ESLint } from 'eslint';
|
|
25
26
|
import fs$1 from 'node:fs';
|
|
26
27
|
import yargsParser from 'yargs-parser';
|
|
@@ -173,7 +174,7 @@ const proxify = (target) => {
|
|
|
173
174
|
}
|
|
174
175
|
return obj[prop];
|
|
175
176
|
}
|
|
176
|
-
return
|
|
177
|
+
return void 0;
|
|
177
178
|
}
|
|
178
179
|
});
|
|
179
180
|
for (const property in target) {
|
|
@@ -182,13 +183,7 @@ const proxify = (target) => {
|
|
|
182
183
|
return tmp;
|
|
183
184
|
};
|
|
184
185
|
const defaultGlobalSettings = {
|
|
185
|
-
|
|
186
|
-
git: {
|
|
187
|
-
commitMessage: "chore(release): v${version}",
|
|
188
|
-
requireBranch: "main",
|
|
189
|
-
tagAnnotation: "v${version}"
|
|
190
|
-
}
|
|
191
|
-
}
|
|
186
|
+
// ...
|
|
192
187
|
};
|
|
193
188
|
const defaultCommands = [];
|
|
194
189
|
const registeredPlugins = [];
|
|
@@ -417,7 +412,7 @@ class OutputUtils {
|
|
|
417
412
|
static formatOutputMessage(msg, options = {}) {
|
|
418
413
|
let formatted = `${msg}`;
|
|
419
414
|
if (options.indentChar) {
|
|
420
|
-
if (options.indent ===
|
|
415
|
+
if (options.indent === void 0) {
|
|
421
416
|
options.indent = 1;
|
|
422
417
|
}
|
|
423
418
|
} else {
|
|
@@ -472,7 +467,7 @@ class OutputUtils {
|
|
|
472
467
|
*/
|
|
473
468
|
static error(msg, err) {
|
|
474
469
|
OutputUtils.log(OutputUtils.$style.red(`⨉ ERROR: ${msg}`));
|
|
475
|
-
if (err !==
|
|
470
|
+
if (err !== void 0) {
|
|
476
471
|
OutputUtils.log();
|
|
477
472
|
throw err;
|
|
478
473
|
}
|
|
@@ -488,7 +483,7 @@ class OutputUtils {
|
|
|
488
483
|
*/
|
|
489
484
|
static step(msg, options = {}) {
|
|
490
485
|
OutputUtils.stepsCache.index++;
|
|
491
|
-
if (options.index ===
|
|
486
|
+
if (options.index === void 0) {
|
|
492
487
|
options.index = OutputUtils.stepsCache.index;
|
|
493
488
|
}
|
|
494
489
|
OutputUtils.log(`${options.index !== null ? options.index + " - " : ""}${msg}`, { indentChar: "● " });
|
|
@@ -623,6 +618,103 @@ const LoadEnvFile = new Plugin("built-in:load-env-file", {
|
|
|
623
618
|
}
|
|
624
619
|
});
|
|
625
620
|
|
|
621
|
+
const bumpVersion = new Command({
|
|
622
|
+
command: "bump-version",
|
|
623
|
+
describe: "Bump version in package.json file",
|
|
624
|
+
meta: {
|
|
625
|
+
private: true
|
|
626
|
+
},
|
|
627
|
+
builder: function(cli) {
|
|
628
|
+
cli.option("p", {
|
|
629
|
+
alias: "preid",
|
|
630
|
+
type: "string",
|
|
631
|
+
describe: "Pre-release id",
|
|
632
|
+
requiresArg: true
|
|
633
|
+
});
|
|
634
|
+
return cli;
|
|
635
|
+
},
|
|
636
|
+
async handler(argv) {
|
|
637
|
+
const { $style, step, substep, error } = OutputUtils;
|
|
638
|
+
const { run, prompts, abort } = InterfaceUtils;
|
|
639
|
+
const packageJson = getPackageInfo();
|
|
640
|
+
let targetVersion;
|
|
641
|
+
const currentVersion = packageJson.version;
|
|
642
|
+
packageJson.name;
|
|
643
|
+
const preId = argv.preid || semver.prerelease(currentVersion) && semver.prerelease(currentVersion)[0];
|
|
644
|
+
const inc = (i) => semver.inc(currentVersion, i, preId);
|
|
645
|
+
const versionIncrements = [
|
|
646
|
+
"patch",
|
|
647
|
+
"minor",
|
|
648
|
+
"major",
|
|
649
|
+
...preId ? ["prepatch", "preminor", "premajor", "prerelease"] : []
|
|
650
|
+
];
|
|
651
|
+
step("Bump version");
|
|
652
|
+
const { release } = await prompts([
|
|
653
|
+
{
|
|
654
|
+
type: "select",
|
|
655
|
+
name: "release",
|
|
656
|
+
message: "Release type:",
|
|
657
|
+
choices: versionIncrements.map((i) => ({ title: `${i} (${inc(i)})`, value: inc(i) })).concat([{ title: "custom", value: "custom" }])
|
|
658
|
+
}
|
|
659
|
+
]);
|
|
660
|
+
if (release === "custom") {
|
|
661
|
+
const { version: customVersion } = await prompts([
|
|
662
|
+
{
|
|
663
|
+
type: "text",
|
|
664
|
+
name: "version",
|
|
665
|
+
message: "New custom version:",
|
|
666
|
+
initial: currentVersion,
|
|
667
|
+
validate: (value) => Boolean(semver.valid(value))
|
|
668
|
+
}
|
|
669
|
+
]);
|
|
670
|
+
targetVersion = customVersion;
|
|
671
|
+
} else {
|
|
672
|
+
targetVersion = release;
|
|
673
|
+
}
|
|
674
|
+
const { yes } = await prompts([
|
|
675
|
+
{
|
|
676
|
+
type: "confirm",
|
|
677
|
+
name: "yes",
|
|
678
|
+
message: `Releasing v${targetVersion}. Confirm?`,
|
|
679
|
+
initial: true
|
|
680
|
+
}
|
|
681
|
+
]);
|
|
682
|
+
if (!yes) {
|
|
683
|
+
abort();
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
this.log();
|
|
687
|
+
let commandError = false;
|
|
688
|
+
try {
|
|
689
|
+
await run("npm", [
|
|
690
|
+
"--no-git-tag-version",
|
|
691
|
+
"version",
|
|
692
|
+
targetVersion
|
|
693
|
+
], { stdio: "inherit" });
|
|
694
|
+
} catch (e) {
|
|
695
|
+
commandError = e;
|
|
696
|
+
}
|
|
697
|
+
if (commandError) {
|
|
698
|
+
substep($style.red("❌ An error has occured."), { last: true });
|
|
699
|
+
error("An error has occured.", commandError);
|
|
700
|
+
abort(1);
|
|
701
|
+
} else {
|
|
702
|
+
substep($style.green("✔ Version successfuly bumped"), { last: true });
|
|
703
|
+
this.log();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
const RegisterBumpVersionCommand = new Plugin("built-in:register-bump-version-command", {
|
|
709
|
+
beforeCreate({ defineDefaultCommand, defineSettings, builder, factoryOptions }) {
|
|
710
|
+
defineDefaultCommand({
|
|
711
|
+
fullSignature: "bump-version",
|
|
712
|
+
commandObject: bumpVersion,
|
|
713
|
+
children: []
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
|
|
626
718
|
const changelog = new Command({
|
|
627
719
|
command: "changelog",
|
|
628
720
|
describe: "Generate CHANGELOG file",
|
|
@@ -669,7 +761,8 @@ const RegisterChangelogCommand = new Plugin("built-in:register-changelog-command
|
|
|
669
761
|
defineSettings("changelog", {
|
|
670
762
|
infile: "CHANGELOG.md",
|
|
671
763
|
preset: "angular",
|
|
672
|
-
sameFile: true
|
|
764
|
+
sameFile: true,
|
|
765
|
+
onReleaseConfig: {}
|
|
673
766
|
});
|
|
674
767
|
defineDefaultCommand({
|
|
675
768
|
fullSignature: "changelog",
|
|
@@ -931,7 +1024,7 @@ const lint = new Command({
|
|
|
931
1024
|
private: true
|
|
932
1025
|
},
|
|
933
1026
|
builder(cli) {
|
|
934
|
-
cli.option("fix", {
|
|
1027
|
+
cli.strict(false).option("fix", {
|
|
935
1028
|
alias: "f",
|
|
936
1029
|
describe: "Automatically fix problems",
|
|
937
1030
|
type: "boolean",
|
|
@@ -1244,8 +1337,6 @@ const release = new Command({
|
|
|
1244
1337
|
async handler(argv) {
|
|
1245
1338
|
const { $style, step, substep, error, wait } = OutputUtils;
|
|
1246
1339
|
const { abort, run } = InterfaceUtils;
|
|
1247
|
-
console.log("argv ? ", argv);
|
|
1248
|
-
abort(1);
|
|
1249
1340
|
step("Prepare for release");
|
|
1250
1341
|
const tempConfigFilePath = "./__TEMP_RELEASE_IT_CONFIG__.json";
|
|
1251
1342
|
const releaseItCmdArgs = [];
|
|
@@ -1296,6 +1387,7 @@ const release = new Command({
|
|
|
1296
1387
|
strictSemVer: onReleaseConfig.strictSemVer
|
|
1297
1388
|
};
|
|
1298
1389
|
tempConfig = {
|
|
1390
|
+
...releaseSettings,
|
|
1299
1391
|
plugins: {
|
|
1300
1392
|
"@release-it/conventional-changelog": releaseItChangelogConfig
|
|
1301
1393
|
}
|
|
@@ -1307,9 +1399,13 @@ const release = new Command({
|
|
|
1307
1399
|
if (argv["dry-run"]) {
|
|
1308
1400
|
releaseItCmdArgs.push("--dry-run");
|
|
1309
1401
|
}
|
|
1310
|
-
if (argv.increment) {
|
|
1311
|
-
|
|
1312
|
-
|
|
1402
|
+
if (argv.increment !== void 0) {
|
|
1403
|
+
if (argv.increment === false) {
|
|
1404
|
+
releaseItCmdArgs.push("--no-increment");
|
|
1405
|
+
} else {
|
|
1406
|
+
releaseItCmdArgs.push("--increment");
|
|
1407
|
+
releaseItCmdArgs.push(argv.increment);
|
|
1408
|
+
}
|
|
1313
1409
|
}
|
|
1314
1410
|
if (argv.ci) {
|
|
1315
1411
|
releaseItCmdArgs.push("--ci");
|
|
@@ -1357,7 +1453,11 @@ const release = new Command({
|
|
|
1357
1453
|
const RegisterReleaseCommand = new Plugin("built-in:register-release-command", {
|
|
1358
1454
|
beforeCreate({ defineDefaultCommand, defineSettings, builder, factoryOptions }) {
|
|
1359
1455
|
defineSettings("release", {
|
|
1360
|
-
|
|
1456
|
+
git: {
|
|
1457
|
+
commitMessage: "chore(release): v${version}",
|
|
1458
|
+
requireBranch: "main",
|
|
1459
|
+
tagAnnotation: "v${version}"
|
|
1460
|
+
}
|
|
1361
1461
|
});
|
|
1362
1462
|
defineDefaultCommand({
|
|
1363
1463
|
fullSignature: "release",
|
|
@@ -1513,13 +1613,13 @@ async function extractUsage(factory, recursive = false, args = [""], locale = "e
|
|
|
1513
1613
|
const innerYargs = factory([""]);
|
|
1514
1614
|
innerYargs.locale(locale);
|
|
1515
1615
|
const doclet = {
|
|
1516
|
-
command:
|
|
1517
|
-
args:
|
|
1518
|
-
aliases:
|
|
1616
|
+
command: void 0,
|
|
1617
|
+
args: void 0,
|
|
1618
|
+
aliases: void 0,
|
|
1519
1619
|
deprecated: false,
|
|
1520
|
-
extractedUsage:
|
|
1521
|
-
rawUsage:
|
|
1522
|
-
children: recursive ? {} :
|
|
1620
|
+
extractedUsage: void 0,
|
|
1621
|
+
rawUsage: void 0,
|
|
1622
|
+
children: recursive ? {} : void 0
|
|
1523
1623
|
};
|
|
1524
1624
|
const parseCallback = function(err, argv, output) {
|
|
1525
1625
|
if (err)
|
|
@@ -1567,6 +1667,7 @@ globalThis.CLI = {
|
|
|
1567
1667
|
OutputUtils
|
|
1568
1668
|
};
|
|
1569
1669
|
CLIFactory.use(LoadEnvFile);
|
|
1670
|
+
CLIFactory.use(RegisterBumpVersionCommand);
|
|
1570
1671
|
CLIFactory.use(RegisterChangelogCommand);
|
|
1571
1672
|
CLIFactory.use(RegisterDocsCommands);
|
|
1572
1673
|
CLIFactory.use(RegisterGitHooksCommands);
|
package/dist/index.js
CHANGED
package/dist/templater/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* juisy v2.0.0-beta.
|
|
2
|
+
* juisy v2.0.0-beta.10
|
|
3
3
|
* Copyright © 2022-Present Hervé Perchec
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -28,7 +28,7 @@ class Templater {
|
|
|
28
28
|
this.methodsMap.compile = async (template) => {
|
|
29
29
|
return handlebars.compile(template, options.engineOptions);
|
|
30
30
|
};
|
|
31
|
-
this.methodsMap.render = async (template, data =
|
|
31
|
+
this.methodsMap.render = async (template, data = void 0, opts = void 0) => {
|
|
32
32
|
return this.methodsMap.compile(template).template(data);
|
|
33
33
|
};
|
|
34
34
|
break;
|
|
@@ -37,7 +37,7 @@ class Templater {
|
|
|
37
37
|
this.methodsMap.compile = async (template) => {
|
|
38
38
|
return ejs.compile(template, options.engineOptions);
|
|
39
39
|
};
|
|
40
|
-
this.methodsMap.render = async (template, data =
|
|
40
|
+
this.methodsMap.render = async (template, data = void 0, opts) => {
|
|
41
41
|
return ejs.render(template, data, {
|
|
42
42
|
...options.engineOptions,
|
|
43
43
|
...opts || {}
|
|
@@ -66,7 +66,7 @@ class Templater {
|
|
|
66
66
|
/**
|
|
67
67
|
* Renders a template with the given context.
|
|
68
68
|
*/
|
|
69
|
-
async render(template, data =
|
|
69
|
+
async render(template, data = void 0, options = void 0) {
|
|
70
70
|
const mergedData = { ...this.defaultData, ...data || {} };
|
|
71
71
|
return await this.methodsMap.render(template, mergedData, options);
|
|
72
72
|
}
|
|
@@ -99,8 +99,8 @@ class MarkdownTemplater extends Templater {
|
|
|
99
99
|
use: [
|
|
100
100
|
...options.use || []
|
|
101
101
|
],
|
|
102
|
-
toc: options.toc === true ? defaultRemarkTocOptions : options.toc !==
|
|
103
|
-
frontmatter: options.frontmatter === true ? defaultRemarkFrontmatterOptions : options.frontmatter !==
|
|
102
|
+
toc: options.toc === true ? defaultRemarkTocOptions : options.toc !== void 0 ? options.toc : defaultRemarkTocOptions,
|
|
103
|
+
frontmatter: options.frontmatter === true ? defaultRemarkFrontmatterOptions : options.frontmatter !== void 0 ? options.frontmatter : defaultRemarkFrontmatterOptions
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
initProcessor() {
|
|
@@ -116,7 +116,7 @@ class MarkdownTemplater extends Templater {
|
|
|
116
116
|
/**
|
|
117
117
|
* Renders a template with the given context.
|
|
118
118
|
*/
|
|
119
|
-
async render(template, data =
|
|
119
|
+
async render(template, data = void 0, options = void 0) {
|
|
120
120
|
const content = await super.render(template, data, options);
|
|
121
121
|
return (await this.processor.process(content)).toString();
|
|
122
122
|
}
|
|
@@ -229,9 +229,9 @@ class ReadmeTemplater {
|
|
|
229
229
|
} else {
|
|
230
230
|
result.ejsOptions = ReadmeTemplater.defaultConfig.ejsOptions;
|
|
231
231
|
}
|
|
232
|
-
result.appendAutoGenMessage = customConfig.appendAutoGenMessage !==
|
|
233
|
-
result.autoToc = customConfig.autoToc !==
|
|
234
|
-
result.slugify = customConfig.slugify !==
|
|
232
|
+
result.appendAutoGenMessage = customConfig.appendAutoGenMessage !== void 0 ? customConfig.appendAutoGenMessage : ReadmeTemplater.defaultConfig.appendAutoGenMessage;
|
|
233
|
+
result.autoToc = customConfig.autoToc !== void 0 ? customConfig.autoToc : ReadmeTemplater.defaultConfig.autoToc;
|
|
234
|
+
result.slugify = customConfig.slugify !== void 0 ? customConfig.slugify : ReadmeTemplater.defaultConfig.slugify;
|
|
235
235
|
return result;
|
|
236
236
|
}
|
|
237
237
|
/**
|