@cocreate/cli 1.32.1 → 1.32.2
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 +8 -0
- package/CoCreate.config.js +1 -1
- package/package.json +1 -1
- package/src/commands/config.js +15 -8
- package/src/commands/fs/config.js +2 -2
- package/src/commands/symlink.js +32 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.32.2](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.32.1...v1.32.2) (2023-06-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* renamed db to storage ([fa41daf](https://github.com/CoCreate-app/CoCreate-cli/commit/fa41daf2344f2c8768bfd2db10c58ce4bad403be))
|
|
7
|
+
* renamed hosts to host. the value can be a string or an array of strings ([932f60b](https://github.com/CoCreate-app/CoCreate-cli/commit/932f60bdd7890da296b9d4d5ea92c9c7aeb9398c))
|
|
8
|
+
|
|
1
9
|
## [1.32.1](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.32.0...v1.32.1) (2023-06-10)
|
|
2
10
|
|
|
3
11
|
|
package/CoCreate.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/cli",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.2",
|
|
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/commands/config.js
CHANGED
|
@@ -71,14 +71,21 @@ module.exports = async function CoCreateConfig(items, processEnv = true, updateG
|
|
|
71
71
|
|
|
72
72
|
if (process.env[key]) {
|
|
73
73
|
config[key] = process.env[key];
|
|
74
|
-
} else
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
} else {
|
|
75
|
+
if (localConfig[key]) {
|
|
76
|
+
config[key] = localConfig[key];
|
|
77
|
+
} else if (globalConfig[key]) {
|
|
78
|
+
config[key] = globalConfig[key];
|
|
79
|
+
} else if (prompt || prompt === '') {
|
|
80
|
+
config[key] = await promptForInput(prompt || `${key}: `);
|
|
81
|
+
if (updateGlobal) update = true;
|
|
82
|
+
}
|
|
83
|
+
if (processEnv) {
|
|
84
|
+
if (typeof config[key] === 'object')
|
|
85
|
+
process.env[key] = JSON.stringify(config[key]);
|
|
86
|
+
else
|
|
87
|
+
process.env[key] = config[key];
|
|
88
|
+
}
|
|
82
89
|
}
|
|
83
90
|
}
|
|
84
91
|
}
|
|
@@ -39,7 +39,7 @@ function update(MdPath) {
|
|
|
39
39
|
"name": "index.html",
|
|
40
40
|
"path": "/docs/${name}/index.html",
|
|
41
41
|
"src": "{{./docs/index.html}}",
|
|
42
|
-
"
|
|
42
|
+
"host": [
|
|
43
43
|
"general.cocreate.app"
|
|
44
44
|
],
|
|
45
45
|
"directory": "/docs/${name}",
|
|
@@ -56,7 +56,7 @@ function update(MdPath) {
|
|
|
56
56
|
|
|
57
57
|
if (!document_id.length)
|
|
58
58
|
console.log("Document_id Undefined: ", MdPath);
|
|
59
|
-
if (document_id.length != 24 && document_id.length != 0
|
|
59
|
+
if (document_id.length != 24 && document_id.length != 0)
|
|
60
60
|
console.log("Document_id not valid! please check your config: ", MdPath);
|
|
61
61
|
else {
|
|
62
62
|
console.log(MdPath, " -> document_id : ", document_id);
|
package/src/commands/symlink.js
CHANGED
|
@@ -40,6 +40,18 @@ async function createSymlink(repo) {
|
|
|
40
40
|
let dest = path.resolve(dpath, 'node_modules');
|
|
41
41
|
if (dest) {
|
|
42
42
|
if (fs.existsSync(dest)) {
|
|
43
|
+
|
|
44
|
+
if (!cwdNodeModulesPath.includes('/CoCreateJS')) {
|
|
45
|
+
let isSymlink = await isSymlinkDirectory(dest)
|
|
46
|
+
if (isSymlink) {
|
|
47
|
+
const targetPath = await getSymlinkTargetPath(dest);
|
|
48
|
+
if (targetPath.includes('/CoCreateJS')) {
|
|
49
|
+
console.warn('symlink already exists with CoCreateJS')
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
43
55
|
fs.rm(dest, { recursive: true, force: true }, function (err) {
|
|
44
56
|
if (err) {
|
|
45
57
|
failed.push({ name: 'symlink', des: 'with response:' + response, err })
|
|
@@ -111,3 +123,23 @@ async function install(repo, repos) {
|
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
}
|
|
126
|
+
|
|
127
|
+
async function isSymlinkDirectory(path) {
|
|
128
|
+
try {
|
|
129
|
+
const stats = await fs.promises.lstat(path);
|
|
130
|
+
return stats.isSymbolicLink();
|
|
131
|
+
} catch (err) {
|
|
132
|
+
throw err;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async function getSymlinkTargetPath(symlinkPath) {
|
|
137
|
+
try {
|
|
138
|
+
const target = await fs.promises.readlink(symlinkPath);
|
|
139
|
+
const targetPath = fs.realpathSync(target);
|
|
140
|
+
return targetPath;
|
|
141
|
+
} catch (err) {
|
|
142
|
+
throw err;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|