@ckeditor/ckeditor5-dev-changelog 50.2.0 → 50.3.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/dist/index.js +4 -4
- package/dist/template.d.ts +0 -5
- package/dist/template.js +24 -11
- package/package.json +2 -2
- package/template/template.md +2 -0
package/dist/index.js
CHANGED
|
@@ -644,12 +644,12 @@ async function determineNextVersion(options) {
|
|
|
644
644
|
}
|
|
645
645
|
logInfo(`○ ${chalk.cyan('Determining the new version...')}`);
|
|
646
646
|
let bumpType = 'patch';
|
|
647
|
-
if (sections.
|
|
648
|
-
bumpType = 'minor';
|
|
649
|
-
}
|
|
650
|
-
if (sections.major.entries.length) {
|
|
647
|
+
if (sections.major.entries.length || sections.breaking.entries.length) {
|
|
651
648
|
bumpType = 'major';
|
|
652
649
|
}
|
|
650
|
+
else if (sections.minor.entries.length || sections.feature.entries.length) {
|
|
651
|
+
bumpType = 'minor';
|
|
652
|
+
}
|
|
653
653
|
const areErrorsPresent = !!sections.invalid.entries.length;
|
|
654
654
|
const areWarningsPresent = Object.values(sections).some(section => section.entries.some(entry => entry.data.validations && entry.data.validations.length > 0));
|
|
655
655
|
const userProvidedVersion = await provideNewVersion({
|
package/dist/template.d.ts
CHANGED
|
@@ -8,11 +8,6 @@
|
|
|
8
8
|
interface GenerateTemplateOptions {
|
|
9
9
|
directory: string;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Returns a filename for the template file based on the current date and git branch name.
|
|
13
|
-
* The filename is formatted as `YYYYMMDDHHMMSS_{GIT_BRANCH_NAME}.md`.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getFileName(): Promise<string>;
|
|
16
11
|
/**
|
|
17
12
|
* Generates a template file for the changelog in the specified directory.
|
|
18
13
|
*/
|
package/dist/template.js
CHANGED
|
@@ -21,6 +21,15 @@ const TEMPLATE_FILE = path.join(import.meta.dirname, '../template/template.md');
|
|
|
21
21
|
const DEFAULT_OPTIONS = {
|
|
22
22
|
directory: CHANGESET_DIRECTORY
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* List of branch names that are usually protected.
|
|
26
|
+
*/
|
|
27
|
+
const PROTECTED_BRANCHES = [
|
|
28
|
+
'master',
|
|
29
|
+
'main',
|
|
30
|
+
'release',
|
|
31
|
+
'stable'
|
|
32
|
+
];
|
|
24
33
|
/**
|
|
25
34
|
* Reads CLI arguments and turn the keys into camelcase.
|
|
26
35
|
*/
|
|
@@ -65,9 +74,8 @@ async function getFormattedGitBranchName() {
|
|
|
65
74
|
* Returns a filename for the template file based on the current date and git branch name.
|
|
66
75
|
* The filename is formatted as `YYYYMMDDHHMMSS_{GIT_BRANCH_NAME}.md`.
|
|
67
76
|
*/
|
|
68
|
-
|
|
77
|
+
function getFileName(gitBranchName) {
|
|
69
78
|
const date = format(new Date(), 'yyyyMMddHHmmss');
|
|
70
|
-
const gitBranchName = await getFormattedGitBranchName();
|
|
71
79
|
return `${date}_${gitBranchName}.md`;
|
|
72
80
|
}
|
|
73
81
|
/**
|
|
@@ -75,21 +83,26 @@ async function getFileName() {
|
|
|
75
83
|
*/
|
|
76
84
|
async function generateTemplate(args = getCliArguments(), retries = 5) {
|
|
77
85
|
const options = normalizeOptions(args);
|
|
78
|
-
const
|
|
86
|
+
const gitBranchName = await getFormattedGitBranchName();
|
|
87
|
+
const filename = getFileName(gitBranchName);
|
|
79
88
|
const outputPath = path.resolve(options.directory, filename);
|
|
80
89
|
await mkdir(options.directory, { recursive: true });
|
|
81
90
|
try {
|
|
82
91
|
await copyFile(TEMPLATE_FILE, outputPath, constants.COPYFILE_EXCL);
|
|
83
|
-
const indent = ' '.repeat(
|
|
92
|
+
const indent = ' '.repeat(2);
|
|
84
93
|
const relativePath = path.relative(process.cwd(), outputPath);
|
|
85
|
-
console.log(styleText('green', '
|
|
94
|
+
console.log(styleText('green', '◌ The changelog file has been successfully created.'));
|
|
86
95
|
console.log('');
|
|
87
|
-
console.log('
|
|
88
|
-
console.log(indent + styleText('cyan', `file://${outputPath}`));
|
|
96
|
+
console.log('◌ Please fill it with relevant information about your changes.');
|
|
97
|
+
console.log(indent + styleText(['cyan', 'bold'], `file://${outputPath}`));
|
|
89
98
|
console.log('');
|
|
90
|
-
console.log('
|
|
91
|
-
console.log(indent + styleText('gray', `$ git add ${relativePath}`));
|
|
92
|
-
console.log(indent + styleText('gray', '$ git commit -m "..."'));
|
|
99
|
+
console.log('◌ Once done, commit the changelog file:');
|
|
100
|
+
console.log(styleText('gray', indent + styleText('gray', `$ git add ${relativePath}`)));
|
|
101
|
+
console.log(styleText('gray', indent + styleText('gray', '$ git commit -m "..."')));
|
|
102
|
+
if (PROTECTED_BRANCHES.includes(gitBranchName)) {
|
|
103
|
+
console.log('');
|
|
104
|
+
console.warn(styleText(['red', 'bold'], 'You are on a protected branch!'), styleText('red', 'Consider creating a new branch for your changes.'));
|
|
105
|
+
}
|
|
93
106
|
}
|
|
94
107
|
catch (error) {
|
|
95
108
|
if (retries <= 0) {
|
|
@@ -105,4 +118,4 @@ async function generateTemplate(args = getCliArguments(), retries = 5) {
|
|
|
105
118
|
}
|
|
106
119
|
}
|
|
107
120
|
|
|
108
|
-
export { generateTemplate
|
|
121
|
+
export { generateTemplate };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-changelog",
|
|
3
|
-
"version": "50.
|
|
3
|
+
"version": "50.3.0",
|
|
4
4
|
"description": "A CKEditor 5 development tool for handling changelogs.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"ckeditor5-dev-changelog-create-entry": "bin/generate-template.js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ckeditor/ckeditor5-dev-utils": "^50.
|
|
31
|
+
"@ckeditor/ckeditor5-dev-utils": "^50.3.0",
|
|
32
32
|
"chalk": "^5.0.0",
|
|
33
33
|
"date-fns": "^4.0.0",
|
|
34
34
|
"fs-extra": "^11.0.0",
|
package/template/template.md
CHANGED