@cocreate/cli 1.14.29 → 1.15.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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/repositories.js +10 -6
- package/src/coc.js +0 -0
- package/src/commands/install.js +17 -8
- package/src/commands/link.js +25 -31
- package/src/commands/{add.js → other/add.js} +2 -2
- package/src/commands/{symbolic.js → other/symbolic.js} +2 -2
- package/src/commands/{yarnInstall.js → other/yarnInstall.js} +2 -2
- package/src/execute.js +11 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.15.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.14.30...v1.15.0) (2023-02-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* auto detects your chosen package manager, Currently supports npm and yarn ([c3349b3](https://github.com/CoCreate-app/CoCreate-cli/commit/c3349b3f3448ff27a1efd98e3b6d3eb14b09aced))
|
|
7
|
+
|
|
8
|
+
## [1.14.30](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.14.29...v1.14.30) (2023-02-02)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add CoCreate-actions to repo list ([79e576e](https://github.com/CoCreate-app/CoCreate-cli/commit/79e576ebe9484d97dd9b1e62546da8d8f496d9f9))
|
|
14
|
+
|
|
1
15
|
## [1.14.29](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.14.28...v1.14.29) (2023-02-01)
|
|
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.15.0",
|
|
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",
|
package/repositories.js
CHANGED
|
@@ -78,13 +78,17 @@ module.exports = [
|
|
|
78
78
|
'path': '/home/ubuntu/CoCreateServer/CoCreate-components/CoCreate-element-config',
|
|
79
79
|
'repo': 'github.com/CoCreate-app/CoCreate-element-config.git'
|
|
80
80
|
},
|
|
81
|
+
{
|
|
82
|
+
'path': '/home/ubuntu/CoCreateServer/CoCreate-components/CoCreate-element-prototype',
|
|
83
|
+
'repo': 'github.com/CoCreate-app/CoCreate-element-prototype.git'
|
|
84
|
+
},
|
|
81
85
|
{
|
|
82
86
|
'path': '/home/ubuntu/CoCreateServer/CoCreate-components/CoCreate-elements',
|
|
83
87
|
'repo': 'github.com/CoCreate-app/CoCreate-elements.git'
|
|
84
88
|
},
|
|
85
89
|
{
|
|
86
|
-
'path': '
|
|
87
|
-
'repo': 'github.com/CoCreate-app/CoCreate-
|
|
90
|
+
'path': '../CoCreate-components/CoCreate-events',
|
|
91
|
+
'repo': 'github.com/CoCreate-app/CoCreate-events.git'
|
|
88
92
|
},
|
|
89
93
|
{
|
|
90
94
|
'path': '/home/ubuntu/CoCreateServer/CoCreate-components/CoCreate-fetch',
|
|
@@ -234,10 +238,10 @@ module.exports = [
|
|
|
234
238
|
'path': '/home/ubuntu/CoCreateServer/CoCreate-components/CoCreate-text',
|
|
235
239
|
'repo': 'github.com/CoCreate-app/CoCreate-text.git'
|
|
236
240
|
},
|
|
237
|
-
{
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
},
|
|
241
|
+
// {
|
|
242
|
+
// 'path': '/home/ubuntu/CoCreateServer/CoCreate-components/CoCreate-toggle',
|
|
243
|
+
// 'repo': 'github.com/CoCreate-app/CoCreate-toggle.git'
|
|
244
|
+
// },
|
|
241
245
|
{
|
|
242
246
|
'path': '/home/ubuntu/CoCreateServer/CoCreate-components/CoCreate-toolbar',
|
|
243
247
|
'repo': 'github.com/CoCreate-app/CoCreate-toolbar.git'
|
package/src/coc.js
CHANGED
|
File without changes
|
package/src/commands/install.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
|
+
const util = require('node:util');
|
|
2
|
+
const exec = util.promisify(require('node:child_process').exec);
|
|
1
3
|
const spawn = require('../spawn');
|
|
2
|
-
|
|
4
|
+
|
|
3
5
|
module.exports = async function( repos, allRepos,) {
|
|
4
6
|
let failed = [];
|
|
5
7
|
try {
|
|
6
8
|
|
|
7
9
|
let cloneFailed = await require('./clone.js')(repos)
|
|
8
10
|
|
|
9
|
-
let installFailed = await require('./yarnInstall.js')(repos)
|
|
10
|
-
|
|
11
11
|
let linkFailed = await require('./link.js')( repos, allRepos)
|
|
12
|
-
failed = [...cloneFailed, ...
|
|
13
|
-
|
|
14
|
-
let
|
|
12
|
+
failed = [...cloneFailed, ...linkFailed];
|
|
13
|
+
|
|
14
|
+
let packageManager = 'npm'
|
|
15
|
+
const { error } = await exec('yarn --version');
|
|
16
|
+
if (!error)
|
|
17
|
+
packageManager = 'yarn';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
let exitCode = spawn(packageManager, ['start'], {
|
|
21
|
+
cwd: '../CoCreateJS',
|
|
22
|
+
shell: true,
|
|
23
|
+
stdio: 'inherit'
|
|
24
|
+
})
|
|
15
25
|
if (exitCode !== 0) {
|
|
16
|
-
failed.push({ name: 'cocreatejs', des:
|
|
26
|
+
failed.push({ name: 'cocreatejs', des: `${packageManager} start failed` })
|
|
17
27
|
}
|
|
18
28
|
} catch (err) {
|
|
19
29
|
console.error(err);
|
|
20
30
|
failed.push({ name: 'general', des: err.message })
|
|
21
|
-
|
|
22
31
|
}
|
|
23
32
|
return failed;
|
|
24
33
|
}
|
package/src/commands/link.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require("path")
|
|
3
|
-
const {
|
|
4
|
-
promisify
|
|
5
|
-
} = require('util');
|
|
6
1
|
const spawn = require('../spawn');
|
|
7
2
|
const colors = require('colors');
|
|
8
3
|
const addMeta = require('../addMeta');
|
|
9
4
|
|
|
5
|
+
const util = require('node:util');
|
|
6
|
+
const exec = util.promisify(require('node:child_process').exec);
|
|
10
7
|
|
|
8
|
+
module.exports = async function linkPackages(repos, allrepo) {
|
|
9
|
+
let packageManager = 'npm'
|
|
10
|
+
const { error } = await exec('yarn --version');
|
|
11
|
+
if (!error)
|
|
12
|
+
packageManager = 'yarn';
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
module.exports = async function updateYarnInstall(repos, allrepo) {
|
|
15
|
-
|
|
16
|
-
const failed = [],
|
|
17
|
-
isLinked = {};
|
|
14
|
+
const failed = [], isLinked = {};
|
|
18
15
|
try {
|
|
19
16
|
repos = addMeta(repos, failed)
|
|
20
17
|
allrepo = addMeta(allrepo, failed)
|
|
@@ -29,41 +26,34 @@ module.exports = async function updateYarnInstall(repos, allrepo) {
|
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
try {
|
|
32
|
-
// console.log(repos)
|
|
33
|
-
|
|
34
29
|
for (let repo of repos) {
|
|
35
30
|
|
|
36
31
|
if (!repo)
|
|
37
32
|
continue;
|
|
38
33
|
|
|
39
|
-
|
|
40
34
|
let {
|
|
41
|
-
ppath,
|
|
42
35
|
packageName,
|
|
43
36
|
deps,
|
|
44
37
|
devDeps,
|
|
45
|
-
name
|
|
46
38
|
} = repo;
|
|
47
39
|
|
|
48
40
|
console.log(packageName, 'configuring ...')
|
|
49
|
-
await doLink(deps, repo, allrepo, failed, isLinked)
|
|
50
|
-
await doLink(devDeps, repo, allrepo, failed, isLinked)
|
|
41
|
+
await doLink(deps, repo, allrepo, failed, isLinked, packageManager)
|
|
42
|
+
await doLink(devDeps, repo, allrepo, failed, isLinked, packageManager)
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
45
|
catch (err) {
|
|
54
46
|
failed.push({ name: 'GENERAL', des: err.message })
|
|
55
|
-
console.error(err
|
|
47
|
+
console.error(`${err}`.red)
|
|
56
48
|
}
|
|
57
49
|
|
|
58
50
|
return failed;
|
|
59
51
|
}
|
|
60
52
|
|
|
61
53
|
|
|
62
|
-
async function doLink(deps, repo, allrepo, failed, isLinked) {
|
|
54
|
+
async function doLink(deps, repo, allrepo, failed, isLinked, packageManager) {
|
|
63
55
|
for (let dep of deps) {
|
|
64
56
|
let depMeta = allrepo.find(meta => meta.packageName === dep);
|
|
65
|
-
// console.log(depMeta)
|
|
66
|
-
// return failed;
|
|
67
57
|
try {
|
|
68
58
|
if (!depMeta) {
|
|
69
59
|
failed.push({
|
|
@@ -77,37 +67,41 @@ async function doLink(deps, repo, allrepo, failed, isLinked) {
|
|
|
77
67
|
|
|
78
68
|
|
|
79
69
|
if (!isLinked[depMeta.packageName]) {
|
|
70
|
+
|
|
80
71
|
isLinked[depMeta.packageName] = true;
|
|
81
|
-
let exitCode = await spawn(
|
|
72
|
+
let exitCode = await spawn(packageManager, ['link'], {
|
|
82
73
|
cwd: depMeta.ppath,
|
|
83
|
-
|
|
74
|
+
shell: true,
|
|
75
|
+
stdio: 'inherit'
|
|
84
76
|
});
|
|
77
|
+
|
|
85
78
|
if (exitCode !== 0) {
|
|
86
79
|
failed.push({
|
|
87
80
|
name: depMeta.name,
|
|
88
|
-
des:
|
|
81
|
+
des: `${packageManager} link failed`
|
|
89
82
|
})
|
|
90
|
-
console.error(`${depMeta.name}:
|
|
83
|
+
console.error(`${depMeta.name}: ${packageManager} link failed`.red)
|
|
91
84
|
}
|
|
92
85
|
}
|
|
93
86
|
console.log(repo.packageName, 'linking', depMeta.packageName, '...')
|
|
94
87
|
|
|
95
|
-
let exitCode = await spawn(
|
|
88
|
+
let exitCode = await spawn(packageManager, ['link', depMeta.packageName], {
|
|
96
89
|
cwd: repo.ppath,
|
|
97
|
-
|
|
90
|
+
shell: true,
|
|
91
|
+
stdio: 'inherit'
|
|
98
92
|
})
|
|
99
93
|
if (exitCode !== 0) {
|
|
100
94
|
failed.push({
|
|
101
95
|
name: repo.name,
|
|
102
|
-
des:
|
|
96
|
+
des: `${packageManager} link ${depMeta.packageName} failed`
|
|
103
97
|
});
|
|
104
|
-
console.error(`${repo.name}:
|
|
98
|
+
console.error(`${repo.name}: ${packageManager} link ${depMeta.packageName} failed`.red)
|
|
105
99
|
}
|
|
106
100
|
|
|
107
101
|
}
|
|
108
102
|
catch (err) {
|
|
109
103
|
failed.push({ name: repo.packageName, des: err.message })
|
|
110
|
-
console.error(err
|
|
104
|
+
console.error(`${err}`.red)
|
|
111
105
|
}
|
|
112
106
|
|
|
113
107
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
const path = require("path")
|
|
3
|
-
const spawn = require('
|
|
3
|
+
const spawn = require('../../spawn');
|
|
4
4
|
const colors = require('colors');
|
|
5
|
-
const addMeta = require('
|
|
5
|
+
const addMeta = require('../../addMeta');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
module.exports = async function updateYarnLink(repos) {
|
|
@@ -3,9 +3,9 @@ const path = require("path")
|
|
|
3
3
|
const {
|
|
4
4
|
promisify
|
|
5
5
|
} = require('util');
|
|
6
|
-
const spawn = require('
|
|
6
|
+
const spawn = require('../../spawn');
|
|
7
7
|
const colors = require('colors');
|
|
8
|
-
const addMeta = require('
|
|
8
|
+
const addMeta = require('../../addMeta');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const spawn = require('
|
|
3
|
+
const spawn = require('../../spawn');
|
|
4
4
|
const colors = require('colors');
|
|
5
|
-
const addMeta = require('
|
|
5
|
+
const addMeta = require('../../addMeta');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
module.exports = async function updateYarnLink(repos) {
|
package/src/execute.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
const colors = require('colors');
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const fs = require("fs");
|
|
4
|
-
const {
|
|
5
|
-
promisify
|
|
6
|
-
} = require('util');
|
|
7
4
|
const spawn = require('./spawn');
|
|
8
|
-
const
|
|
5
|
+
const util = require('node:util');
|
|
6
|
+
const exec = util.promisify(require('node:child_process').exec);
|
|
7
|
+
|
|
9
8
|
|
|
10
9
|
module.exports = async function execute(command, repos, config) {
|
|
11
10
|
|
|
@@ -44,11 +43,15 @@ module.exports = async function execute(command, repos, config) {
|
|
|
44
43
|
} = repo;
|
|
45
44
|
console.log(`${name}: `.green, command)
|
|
46
45
|
let exitCode;
|
|
47
|
-
if (config.hideMessage)
|
|
48
|
-
|
|
46
|
+
if (config.hideMessage) {
|
|
47
|
+
const strCommand = command.join(' ');
|
|
48
|
+
const { error } = await exec(strCommand, {
|
|
49
49
|
cwd: repo.ppath,
|
|
50
|
-
})
|
|
51
|
-
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (error)
|
|
53
|
+
exitCode = 1
|
|
54
|
+
} else
|
|
52
55
|
exitCode = await spawn(command, null, {
|
|
53
56
|
cwd: repo.ppath,
|
|
54
57
|
shell: true,
|