spectrum-cli 1.0.4 → 1.0.6

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/index.js CHANGED
@@ -9,7 +9,7 @@ const release = require('./src/release');
9
9
  program
10
10
  .name('spectrum')
11
11
  .description('🚀 Spectrum CLI for development workflow')
12
- .version('1.0.4');
12
+ .version('1.0.6');
13
13
 
14
14
  // Release commands
15
15
  const releaseCmd = program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spectrum-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "🚀 Modern CLI for development workflow automation - release management, versioning, and changelog generation",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,30 @@
1
+ ## [Unreleased]
2
+
3
+ ### 🆕 Added
4
+
5
+ _Список новой функциональности._
6
+
7
+ ### 🛠 Changed
8
+
9
+ _Список изменившейся функциональности._
10
+
11
+ ### 📜 Deprecated
12
+
13
+ _Список устаревшей функциональности._
14
+
15
+ ### 🗑 Removed
16
+
17
+ _Список удаленной функциональности._
18
+
19
+ ### 🪲 Fixed
20
+
21
+ _Список исправлений багов._
22
+
23
+ ### 🔐 Security
24
+
25
+ _Список правок для обеспечения безопасности._
26
+
27
+ ### 📦 Support
28
+
29
+ _Список правок для обеспечения технической поддержки._
30
+
package/src/changelog.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  const fs = require('fs');
3
+ const path = require('path');
3
4
  const { logSuccess, execCommand, getVersion, colors } = require('./utils');
4
5
 
5
6
  function changelogChangeHeader() {
@@ -8,15 +9,15 @@ function changelogChangeHeader() {
8
9
  if (!currentVersion) {
9
10
  return false;
10
11
  }
11
-
12
+
12
13
  const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
13
14
  const updatedChangelog = changelog.replace(
14
15
  /## \[Unreleased\]/g,
15
16
  `## 🚀 [${currentVersion}]`
16
17
  );
17
-
18
+
18
19
  fs.writeFileSync('CHANGELOG.md', updatedChangelog);
19
- console.log(` ${colors.yellow} ${colors.reset} Update header ${colors.green}🚀 [${currentVersion}]${colors.reset}.`);
20
+ logSuccess('🔄', `Update header ${colors.green}🚀 [${currentVersion}]${colors.reset}.`);
20
21
  return true;
21
22
  } catch (error) {
22
23
  return false;
@@ -28,8 +29,8 @@ function changelogRemoveEmptyChapters() {
28
29
  const data = fs.readFileSync('CHANGELOG.md', 'utf8');
29
30
  const updatedData = data.replaceAll(/###.*\n\n_.*_\n\n/gm, '');
30
31
  fs.writeFileSync('CHANGELOG.md', updatedData);
31
-
32
- console.log(` ${colors.yellow} ${colors.reset} Remove empty chapters.`);
32
+
33
+ logSuccess('🧹', 'Remove empty chapters.');
33
34
  return true;
34
35
  } catch (error) {
35
36
  return false;
@@ -42,47 +43,17 @@ function changelogAddUnreleasedBlock() {
42
43
  if (!currentVersion) {
43
44
  return false;
44
45
  }
45
-
46
- const unreleased = `## [Unreleased]
47
-
48
- ### 🆕 Added
49
-
50
- _Список новой функциональности._
51
-
52
- ### 🛠 Changed
53
-
54
- _Список изменившейся функциональности._
55
-
56
- ### 📜 Deprecated
57
-
58
- _Список устаревшей функциональности._
59
46
 
60
- ### 🗑 Removed
47
+ const unreleased = fs.readFileSync(path.join(__dirname, 'UNRELEASED.md'), 'utf8') + '\n';
61
48
 
62
- _Список удаленной функциональности._
63
-
64
- ### 🪲 Fixed
65
-
66
- _Список исправлений багов._
67
-
68
- ### 🔐 Security
69
-
70
- _Список правок для обеспечения безопасности._
71
-
72
- ### 📦 Support
73
-
74
- _Список правок для обеспечения технической поддержки._
75
-
76
- `;
77
-
78
49
  const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
79
50
  const updatedChangelog = changelog.replace(
80
51
  new RegExp(`## 🚀 \\[${currentVersion}\\]`),
81
52
  `${unreleased}## 🚀 [${currentVersion}]`
82
53
  );
83
-
54
+
84
55
  fs.writeFileSync('CHANGELOG.md', updatedChangelog);
85
- console.log(` ${colors.yellow} ${colors.reset} Add unreleased block.`);
56
+ logSuccess('📋', 'Add unreleased block.');
86
57
  return true;
87
58
  } catch (error) {
88
59
  return false;
@@ -92,9 +63,9 @@ _Список правок для обеспечения технической
92
63
  function changelogCommit() {
93
64
  const addSuccess = execCommand('git add CHANGELOG.md', null, null);
94
65
  const commitSuccess = execCommand('git commit --message "📝 Update changelog." --no-verify', null, null);
95
-
66
+
96
67
  if (addSuccess && commitSuccess) {
97
- logSuccess('󰜘', 'Commit updated changelog.');
68
+ logSuccess('📝', 'Commit updated changelog.');
98
69
  return true;
99
70
  }
100
71
  return false;
package/src/git.js CHANGED
@@ -4,7 +4,7 @@ const { logSuccess, logError, execSilent, execCommand, getCurrentBranch, getMain
4
4
  function goToMainBranch() {
5
5
  const mainBranch = getMainBranch();
6
6
  if (execCommand(`git switch ${mainBranch}`, null, null)) {
7
- logSuccess('󱓏', `Swap to branch ${mainBranch}.`);
7
+ logSuccess('🌿', `Swap to branch ${mainBranch}.`);
8
8
  return true;
9
9
  }
10
10
  return false;
@@ -13,7 +13,7 @@ function goToMainBranch() {
13
13
  function goToDevBranch() {
14
14
  const devBranch = getDevelopBranch();
15
15
  if (execCommand(`git switch ${devBranch}`, null, null)) {
16
- logSuccess('󱓏', `Swap to branch ${getCurrentBranch()}.`);
16
+ logSuccess('🌿', `Swap to branch ${getCurrentBranch()}.`);
17
17
  return true;
18
18
  }
19
19
  return false;
@@ -25,7 +25,7 @@ function updateCurrentBranch() {
25
25
  const fetchSuccess = execCommand(`git fetch --all --prune --jobs=10`, null, null);
26
26
 
27
27
  if (pullSuccess && fetchSuccess) {
28
- logSuccess('󱓍', `Pull and fetch from branch ${currentBranch}.`);
28
+ logSuccess('🔄', `Pull and fetch from branch ${currentBranch}.`);
29
29
  return true;
30
30
  }
31
31
  return false;
@@ -63,7 +63,7 @@ function gitLfsReset() {
63
63
  if (success) {
64
64
  execCommand('rm .gitattributes', null, null);
65
65
  execCommand('git restore .gitattributes', null, null);
66
- logSuccess('󰴋', 'Reinstall git-lfs and clear files.');
66
+ logSuccess('📦', 'Reinstall git-lfs and clear files.');
67
67
  }
68
68
 
69
69
  return success;
@@ -75,22 +75,22 @@ function gitCreateTagAndPush() {
75
75
 
76
76
  const currentVersion = getVersion();
77
77
  if (!currentVersion) {
78
- logError('󰜣', 'Cannot get version from package.json');
78
+ logError('❌', 'Cannot get version from package.json');
79
79
  return false;
80
80
  }
81
81
 
82
82
  const existingTag = execSilent(`git tag -l "v${currentVersion}"`);
83
83
 
84
84
  if (existingTag) {
85
- logError('󰜣', `Tag v${currentVersion} already created.`);
85
+ logError('❌', `Tag v${currentVersion} already created.`);
86
86
  return false;
87
87
  }
88
88
 
89
89
  if (execCommand(`git tag v${currentVersion}`, null, null)) {
90
- logSuccess('󰜢', `Create tag v${currentVersion}.`);
90
+ logSuccess('🏷️', `Create tag v${currentVersion}.`);
91
91
 
92
92
  if (execCommand(`git push origin v${currentVersion}`, null, null)) {
93
- logSuccess('󱩺', `Push tag v${currentVersion}.`);
93
+ logSuccess('🚀', `Push tag v${currentVersion}.`);
94
94
  return true;
95
95
  }
96
96
  }
package/src/release.js CHANGED
@@ -9,12 +9,12 @@ function releaseCreate() {
9
9
 
10
10
  const currentVersion = getVersion();
11
11
  if (!currentVersion) {
12
- logError('󰜣', 'Cannot get version from package.json');
12
+ logError('❌', 'Cannot get version from package.json');
13
13
  return false;
14
14
  }
15
15
 
16
16
  if (execCommand(`git switch -c release/${currentVersion}`, null, null)) {
17
- logSuccess('󱓊', `Create new release branch ${getCurrentBranch()}.`);
17
+ logSuccess('🌱', `Create new release branch ${getCurrentBranch()}.`);
18
18
  return true;
19
19
  }
20
20
 
@@ -25,8 +25,8 @@ function releasePush() {
25
25
  const currentBranch = getCurrentBranch();
26
26
 
27
27
  if (execCommand(`git push origin ${currentBranch}`, null, null)) {
28
- logSuccess('󱓎', `Push release branch ${currentBranch}.`);
29
- console.log(` ${colors.yellow} ${colors.reset}Go to https://gitlab.spectrumdata.tech/ and merge branch manually.`);
28
+ logSuccess('📤', `Push release branch ${currentBranch}.`);
29
+ logSuccess('🌐', 'Go to https://gitlab.spectrumdata.tech/ and merge branch manually.');
30
30
  goToMainBranch();
31
31
  return true;
32
32
  }
@@ -44,10 +44,10 @@ function releaseClose() {
44
44
  updateCurrentBranch();
45
45
 
46
46
  if (execCommand(`git merge ${mainBranch}`, null, null)) {
47
- logSuccess('󰘬', `Merge branch ${getCurrentBranch()} with ${mainBranch}.`);
47
+ logSuccess('🔀', `Merge branch ${getCurrentBranch()} with ${mainBranch}.`);
48
48
 
49
49
  if (execCommand(`git push origin ${getCurrentBranch()} -o ci.skip`, null, null)) {
50
- logSuccess('󱓎', `Push branch ${getCurrentBranch()}.`);
50
+ logSuccess('📤', `Push branch ${getCurrentBranch()}.`);
51
51
  return true;
52
52
  }
53
53
  }
package/src/utils.js CHANGED
@@ -11,7 +11,7 @@ const colors = {
11
11
  };
12
12
 
13
13
  function log(emoji, message, color = colors.green) {
14
- console.log(` ${colors.yellow} ${emoji}${colors.reset} ${message}`);
14
+ console.log(` ${emoji} ${message}`);
15
15
  }
16
16
 
17
17
  function logSuccess(emoji, message) {
package/src/version.js CHANGED
@@ -34,10 +34,10 @@ function setVersionTypescript(versionType) {
34
34
  packageJson.version = newVersion;
35
35
  fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2) + '\n');
36
36
 
37
- console.log(` ${colors.yellow}󱜱${colors.reset} Current version ${oldVersion} up to ${colors.green}${newVersion}${colors.reset}.`);
37
+ logSuccess('🏷️', `Current version ${oldVersion} up to ${colors.green}${newVersion}${colors.reset}.`);
38
38
  return true;
39
39
  } catch (error) {
40
- logError('󰜣', 'Error updating version in package.json');
40
+ logError('❌', 'Error updating version in package.json');
41
41
  return false;
42
42
  }
43
43
  }