@cocreate/cli 1.32.0 → 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 CHANGED
@@ -1,3 +1,18 @@
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
+
9
+ ## [1.32.1](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.32.0...v1.32.1) (2023-06-10)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([ae1b262](https://github.com/CoCreate-app/CoCreate-cli/commit/ae1b2624321a8f3be8f48a5f07ee9f98e4b8f466))
15
+
1
16
  # [1.32.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.31.2...v1.32.0) (2023-06-10)
2
17
 
3
18
 
@@ -10,7 +10,7 @@ module.exports = {
10
10
  "name": "index.html",
11
11
  "path": "/docs/cli/index.html",
12
12
  "src": "{{./docs/index.html}}",
13
- "hosts": [
13
+ "host": [
14
14
  "*",
15
15
  "general.cocreate.app"
16
16
  ],
@@ -22,7 +22,7 @@ module.exports = {
22
22
  }
23
23
  }
24
24
  ],
25
- "repositoreies": [
25
+ "repositories": [
26
26
 
27
27
  {
28
28
  'path': '../../CoCreateJS',
@@ -142,10 +142,6 @@ module.exports = {
142
142
  'path': '../CoCreate-fullscreen',
143
143
  'repo': 'github.com/CoCreate-app/CoCreate-fullscreen.git'
144
144
  },
145
- {
146
- 'path': '../CoCreate-hosting',
147
- 'repo': 'github.com/CoCreate-app/CoCreate-hosting.git'
148
- },
149
145
  {
150
146
  'path': '../CoCreate-indexeddb',
151
147
  'repo': 'github.com/CoCreate-app/CoCreate-indexeddb.git'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cli",
3
- "version": "1.32.0",
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",
@@ -56,8 +56,11 @@
56
56
  "bin": {
57
57
  "coc": "src/coc.js"
58
58
  },
59
+ "devdependencies": {
60
+ "@cocreate/cli": "^1.29.3"
61
+ },
59
62
  "dependencies": {
60
- "@cocreate/file": "^1.2.2",
63
+ "@cocreate/file": "^1.2.3",
61
64
  "glob": "^7.1.7",
62
65
  "prettier": "^2.3.2"
63
66
  }
@@ -2,7 +2,7 @@ let fs = require('fs');
2
2
  const path = require("path")
3
3
  const util = require('node:util');
4
4
  const exec = util.promisify(require('node:child_process').exec);
5
- const { color } = require('./fonts');
5
+ const { color } = require('../fonts');
6
6
 
7
7
  let pathList, nameList, item = {}, failed = [];
8
8
 
@@ -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 if (localConfig[key]) {
75
- config[key] = localConfig[key];
76
- } else if (globalConfig[key]) {
77
- config[key] = globalConfig[key];
78
- } else if (prompt || prompt === '') {
79
- config[key] = await promptForInput(prompt || `${key}: `);
80
- if (processEnv) process.env[key] = config[key];
81
- if (updateGlobal) update = true;
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
- "hosts": [
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);
@@ -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
+