@cocreate/cli 1.17.2 → 1.18.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 +12 -0
- package/package.json +1 -1
- package/src/addMeta.js +31 -29
- package/src/coc.js +0 -0
- package/src/commands/clone.js +1 -0
- package/src/commands/install.js +5 -2
- package/src/commands/link.js +2 -0
- package/src/commands/symlink.js +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [1.18.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.17.2...v1.18.0) (2023-03-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* else condition if file exist ([df1eaa0](https://github.com/CoCreate-app/CoCreate-cli/commit/df1eaa0bd4de9f1d7858e0d97655df0ef9784e62))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* if install true symlink will install packages then will run link. fixed directory path ([97103bf](https://github.com/CoCreate-app/CoCreate-cli/commit/97103bfd1949a5db26ac836e0ba385c108f25f20))
|
|
12
|
+
|
|
1
13
|
## [1.17.2](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.17.1...v1.17.2) (2023-03-16)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.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/src/addMeta.js
CHANGED
|
@@ -11,7 +11,8 @@ module.exports = async function addMeta(repos, failed, directory) {
|
|
|
11
11
|
|
|
12
12
|
if (directory) {
|
|
13
13
|
repos[i].absolutePath = path.resolve(directory, repos[i].path);
|
|
14
|
-
repos[i].
|
|
14
|
+
const parsedPath = path.parse(repos[i].absolutePath);
|
|
15
|
+
repos[i].directory = parsedPath.dir
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
let packagejson = path.resolve(repos[i].absolutePath, 'package.json');
|
|
@@ -21,40 +22,41 @@ module.exports = async function addMeta(repos, failed, directory) {
|
|
|
21
22
|
name: repos[i].name,
|
|
22
23
|
des: 'package json not found'
|
|
23
24
|
})
|
|
24
|
-
}
|
|
25
|
+
} else {
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
let packageObj
|
|
28
|
+
try {
|
|
29
|
+
packageObj = require(packagejson);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
console.error('packageObj', err.message)
|
|
33
|
+
}
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
repos[i].packageName = packageObj.name;
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
repos[i].packageManager = 'yarn'
|
|
52
|
-
else {
|
|
53
|
-
const { error } = await exec('yarn --version');
|
|
54
|
-
if (!error)
|
|
38
|
+
repos[i].deps = Object.keys(packageObj['dependencies'] || {})
|
|
39
|
+
.filter(packageName => packageName.startsWith('@cocreate/'));
|
|
40
|
+
repos[i].devDeps = Object.keys(packageObj['devDependencies'] || {})
|
|
41
|
+
.filter(packageName => packageName.startsWith('@cocreate/'));
|
|
42
|
+
|
|
43
|
+
if (!repos[i].packageManager) {
|
|
44
|
+
if (packageManager)
|
|
45
|
+
repos[i].packageManager = packageManager
|
|
46
|
+
else {
|
|
47
|
+
repos[i].packageManager = 'npm'
|
|
48
|
+
let lockFile = path.resolve(repos[i].absolutePath, 'package-lock.json');
|
|
49
|
+
if (!fs.existsSync(lockFile)) {
|
|
50
|
+
lockFile = path.resolve(repos[i].absolutePath, 'yarn.lock');
|
|
51
|
+
if (fs.existsSync(lockFile))
|
|
55
52
|
repos[i].packageManager = 'yarn'
|
|
53
|
+
else {
|
|
54
|
+
const { error } = await exec('yarn --version');
|
|
55
|
+
if (!error)
|
|
56
|
+
repos[i].packageManager = 'yarn'
|
|
57
|
+
}
|
|
58
|
+
packageManager = repos[i].packageManager
|
|
56
59
|
}
|
|
57
|
-
packageManager = repos[i].packageManager
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
}
|
package/src/coc.js
CHANGED
|
File without changes
|
package/src/commands/clone.js
CHANGED
|
@@ -8,6 +8,7 @@ module.exports = async function gitClone(repos) {
|
|
|
8
8
|
const cwdPath = path.resolve(process.cwd());
|
|
9
9
|
|
|
10
10
|
for (let i = 0; i < repos.length; i++) {
|
|
11
|
+
// ToDo: Check if path exist and if git.config or package.json exist continue
|
|
11
12
|
if (cwdPath !== repos[i].absolutePath) {
|
|
12
13
|
let exitCode = await spawn('mkdir', ['-p', repos[i].directory], { stdio: 'inherit', cwd: process.cwd() })
|
|
13
14
|
if (exitCode !== 0) {
|
package/src/commands/install.js
CHANGED
|
@@ -4,11 +4,14 @@ module.exports = async function(repos) {
|
|
|
4
4
|
let failed = [];
|
|
5
5
|
try {
|
|
6
6
|
let cloneFailed = await require('./clone.js')(repos)
|
|
7
|
+
if (cloneFailed)
|
|
8
|
+
failed.push(cloneFailed)
|
|
9
|
+
|
|
7
10
|
repos = await addMeta(repos, failed)
|
|
8
11
|
|
|
9
12
|
let symlinkFailed = await require('./symlink.js')(repos)
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
if (symlinkFailed)
|
|
14
|
+
failed.push(symlinkFailed)
|
|
12
15
|
} catch (err) {
|
|
13
16
|
console.error(err);
|
|
14
17
|
failed.push({ name: 'general', des: err.message })
|
package/src/commands/link.js
CHANGED
|
@@ -7,6 +7,8 @@ module.exports = async function linkPackages(repos) {
|
|
|
7
7
|
try {
|
|
8
8
|
for (let repo of repos) {
|
|
9
9
|
if (!repo) continue;
|
|
10
|
+
if (repo.exclude && repo.exclude.includes('link'))
|
|
11
|
+
continue
|
|
10
12
|
|
|
11
13
|
console.log(repo.packageName, 'configuring ...')
|
|
12
14
|
await doLink(repo.deps, repo, repos, failed, isLinked)
|
package/src/commands/symlink.js
CHANGED
|
@@ -18,6 +18,7 @@ module.exports = async function symlink(repos) {
|
|
|
18
18
|
if (repos[i].install == true) {
|
|
19
19
|
reposLength -= 1
|
|
20
20
|
await install(repos[i])
|
|
21
|
+
|
|
21
22
|
} else if (cwdPath !== repos[i].absolutePath) {
|
|
22
23
|
await createSymlink(repos[i])
|
|
23
24
|
}
|
|
@@ -94,9 +95,13 @@ async function install(repo) {
|
|
|
94
95
|
// });
|
|
95
96
|
// }
|
|
96
97
|
let {error} = await exec(`${repo.packageManager} install `, { cwd: dpath })
|
|
97
|
-
if (!error)
|
|
98
|
+
if (!error) {
|
|
98
99
|
console.log(repo.name, 'installed')
|
|
99
|
-
|
|
100
|
+
let linkFailed = await require('./link.js')([repo])
|
|
101
|
+
if (linkFailed)
|
|
102
|
+
failed.push(linkFailed)
|
|
103
|
+
|
|
104
|
+
} else {
|
|
100
105
|
failed.push({name: 'install ', des: error})
|
|
101
106
|
console.error(repo.name, 'failed to install', error)
|
|
102
107
|
}
|