@cocreate/cli 1.32.2 → 1.33.1
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/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/commands/bump.js +22 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.33.1](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.33.0...v1.33.1) (2023-06-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([6ac634d](https://github.com/CoCreate-app/CoCreate-cli/commit/6ac634d0cba9a38904d38e01e7ee9bbc7733cb96))
|
|
7
|
+
|
|
8
|
+
# [1.33.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.32.2...v1.33.0) (2023-06-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* bump.js will iterate through both dependencies and devDependencies ([b537963](https://github.com/CoCreate-app/CoCreate-cli/commit/b537963fb11b6e5f8c505b02f609d6879f87ecb7))
|
|
14
|
+
|
|
1
15
|
## [1.32.2](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.32.1...v1.32.2) (2023-06-11)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.1",
|
|
4
4
|
"description": "Polyrepo management bash CLI tool. Run all git commands and yarn commands on multiple repositories. Also includes a few custom macros for cloning, installing, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@cocreate/cli": "^1.29.3"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@cocreate/file": "^1.2.
|
|
63
|
+
"@cocreate/file": "^1.2.5",
|
|
64
64
|
"glob": "^7.1.7",
|
|
65
65
|
"prettier": "^2.3.2"
|
|
66
66
|
}
|
package/src/commands/bump.js
CHANGED
|
@@ -8,13 +8,16 @@ let pathList, nameList, item = {}, failed = [];
|
|
|
8
8
|
|
|
9
9
|
module.exports = async function bump(repos, args) {
|
|
10
10
|
pathList = repos.map(o => o.absolutePath)
|
|
11
|
-
if (repos.length
|
|
11
|
+
if (repos.length <= 1) {
|
|
12
12
|
let packageJsonPath = path.resolve(process.cwd(), './package.json');
|
|
13
13
|
|
|
14
14
|
if (fs.existsSync(packageJsonPath)) {
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
|
|
15
|
+
let json = require(packageJsonPath)
|
|
16
|
+
if (json) {
|
|
17
|
+
let dependencies = json.dependencies || {}
|
|
18
|
+
let devDependencies = json.devDependencies || {}
|
|
19
|
+
let object = { ...dependencies, ...devDependencies }
|
|
20
|
+
for (let key of Object.keys(object)) {
|
|
18
21
|
if (key.startsWith("@cocreate/")) {
|
|
19
22
|
const version = await exec(`npm view ${key} version`);
|
|
20
23
|
item[key] = `^${version.stdout}`.trim()
|
|
@@ -30,7 +33,7 @@ module.exports = async function bump(repos, args) {
|
|
|
30
33
|
|
|
31
34
|
} else {
|
|
32
35
|
nameList = pathList.map(fn => path.basename(fn).toLowerCase());
|
|
33
|
-
|
|
36
|
+
console.log('namelist', nameList)
|
|
34
37
|
for (let [index, name] of nameList.entries()) {
|
|
35
38
|
getVersions(pathList[index] + '/package.json', `@${name}`)
|
|
36
39
|
}
|
|
@@ -62,22 +65,25 @@ function bumpVersion(filePath, name) {
|
|
|
62
65
|
let object = require(filePath)
|
|
63
66
|
if (object) {
|
|
64
67
|
let newObject = { ...object }
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (item[name]) {
|
|
71
|
-
newObject.dependencies[name] = item[name]
|
|
72
|
-
}
|
|
68
|
+
let dependencies = object.dependencies || {}
|
|
69
|
+
let devDependencies = object.devDependencies || {}
|
|
70
|
+
for (const name of Object.keys(dependencies)) {
|
|
71
|
+
if (item[name]) {
|
|
72
|
+
newObject.dependencies[name] = item[name]
|
|
73
73
|
}
|
|
74
|
+
}
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
for (const name of Object.keys(devDependencies)) {
|
|
77
|
+
if (item[name]) {
|
|
78
|
+
newObject.devDependencies[name] = item[name]
|
|
77
79
|
}
|
|
80
|
+
}
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
if (fs.existsSync(filePath)) {
|
|
83
|
+
fs.unlinkSync(filePath)
|
|
80
84
|
}
|
|
85
|
+
|
|
86
|
+
fs.writeFileSync(filePath, JSON.stringify(object, null, 2))
|
|
81
87
|
} else {
|
|
82
88
|
failed.push({ name: 'bump version', des: 'path doesn\'t exist:' + filePath })
|
|
83
89
|
}
|