@cocreate/cli 1.33.1 → 1.33.3
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/CoCreate.config.js +7 -6
- package/package.json +2 -1
- package/src/commands/other/certBotWildcard.js +56 -0
- package/src/commands/symlink.js +2 -0
- package/src/commands/fs/bump.js +0 -75
- package/src/commands/fs/icon-extract.js +0 -31
- package/src/commands/fs/package.js +0 -39
- package/src/commands/other/add.js +0 -62
- package/src/commands/other/config.sh +0 -4
- package/src/commands/other/test.js +0 -43
- package/src/commands/other/updateModules.js +0 -51
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.33.3](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.33.2...v1.33.3) (2023-06-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* postintall error ([b255b5c](https://github.com/CoCreate-app/CoCreate-cli/commit/b255b5cf83f9af59994c40b7da966e17f94a8cf5))
|
|
7
|
+
|
|
8
|
+
## [1.33.2](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.33.1...v1.33.2) (2023-06-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* @cocreate/cli moved to dependencies ([0a5ebdd](https://github.com/CoCreate-app/CoCreate-cli/commit/0a5ebdd1753a0a92532229c2c58dd36072e22a14))
|
|
14
|
+
|
|
1
15
|
## [1.33.1](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.33.0...v1.33.1) (2023-06-11)
|
|
2
16
|
|
|
3
17
|
|
package/CoCreate.config.js
CHANGED
|
@@ -416,11 +416,6 @@ module.exports = {
|
|
|
416
416
|
},
|
|
417
417
|
|
|
418
418
|
|
|
419
|
-
|
|
420
|
-
// {
|
|
421
|
-
// 'path': '../CoCreateWS',
|
|
422
|
-
// 'repo': 'github.com/CoCreate-app/CoCreateWS.git'
|
|
423
|
-
// },
|
|
424
419
|
// {
|
|
425
420
|
// 'path': '../CoCreateApi',
|
|
426
421
|
// 'repo': 'github.com/CoCreate-app/CoCreateApi.git'
|
|
@@ -432,7 +427,13 @@ module.exports = {
|
|
|
432
427
|
// },
|
|
433
428
|
|
|
434
429
|
|
|
435
|
-
//
|
|
430
|
+
// Server
|
|
431
|
+
{
|
|
432
|
+
'path': '../CoCreateWS',
|
|
433
|
+
'repo': 'github.com/CoCreate-app/CoCreateWS.git'
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
// Server Components
|
|
436
437
|
{
|
|
437
438
|
'path': '../CoCreate-authenticate',
|
|
438
439
|
'repo': 'github.com/CoCreate-app/CoCreate-authenticate.git'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/cli",
|
|
3
|
-
"version": "1.33.
|
|
3
|
+
"version": "1.33.3",
|
|
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,6 +60,7 @@
|
|
|
60
60
|
"@cocreate/cli": "^1.29.3"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
+
"@cocreate/cli": "^1.33.0",
|
|
63
64
|
"@cocreate/file": "^1.2.5",
|
|
64
65
|
"glob": "^7.1.7",
|
|
65
66
|
"prettier": "^2.3.2"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const { spawn } = require('child_process');
|
|
2
|
+
|
|
3
|
+
function runCertbot() {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
const certbotProcess = spawn('sudo', [
|
|
6
|
+
'certbot',
|
|
7
|
+
'certonly',
|
|
8
|
+
'--manual',
|
|
9
|
+
'-d', '*.cocreate.zone',
|
|
10
|
+
'-d', 'cocreate.zone',
|
|
11
|
+
'--agree-tos',
|
|
12
|
+
'-m', 'admin@cocreate.app',
|
|
13
|
+
'--preferred-challenges', 'dns-01',
|
|
14
|
+
'--server', 'https://acme-v02.api.letsencrypt.org/directory'
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
let promptsCount = 0;
|
|
18
|
+
|
|
19
|
+
certbotProcess.stdout.on('data', (data) => {
|
|
20
|
+
const output = data.toString();
|
|
21
|
+
if (output.includes('Enter your response here')) {
|
|
22
|
+
promptsCount++;
|
|
23
|
+
if (promptsCount === 1) {
|
|
24
|
+
certbotProcess.stdin.write('Your first response\n');
|
|
25
|
+
} else if (promptsCount === 2) {
|
|
26
|
+
certbotProcess.stdin.write('Your second response\n');
|
|
27
|
+
} else if (promptsCount === 3) {
|
|
28
|
+
certbotProcess.stdin.write('Your third response\n');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
certbotProcess.stderr.on('data', (data) => {
|
|
34
|
+
reject(data.toString());
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
certbotProcess.on('close', (code) => {
|
|
38
|
+
if (code === 0) {
|
|
39
|
+
resolve('Certbot process completed successfully.');
|
|
40
|
+
} else {
|
|
41
|
+
reject(`Certbot process exited with code ${code}`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function executeCertbot() {
|
|
48
|
+
try {
|
|
49
|
+
const result = await runCertbot();
|
|
50
|
+
console.log(result);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('An error occurred:', error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
executeCertbot();
|
package/src/commands/symlink.js
CHANGED
|
@@ -39,6 +39,8 @@ async function createSymlink(repo) {
|
|
|
39
39
|
try {
|
|
40
40
|
let dest = path.resolve(dpath, 'node_modules');
|
|
41
41
|
if (dest) {
|
|
42
|
+
// let exists = await fs.promises.access(filePath, fs.constants.F_OK);
|
|
43
|
+
|
|
42
44
|
if (fs.existsSync(dest)) {
|
|
43
45
|
|
|
44
46
|
if (!cwdNodeModulesPath.includes('/CoCreateJS')) {
|
package/src/commands/fs/bump.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
let fs = require('fs');
|
|
3
|
-
let list = require('../../../repositories.js');
|
|
4
|
-
const path = require("path")
|
|
5
|
-
|
|
6
|
-
let CoCreateJsPath = path.resolve('../CoCreateJS');
|
|
7
|
-
|
|
8
|
-
let pathList = list.map(o => o.path)
|
|
9
|
-
let nameList = pathList.map(fn => path.basename(fn).toLowerCase());
|
|
10
|
-
let item = {}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// (async() => {
|
|
14
|
-
|
|
15
|
-
// for (let [index, name] of nameList.entries()) {
|
|
16
|
-
// getVersions(pathList[index] + '/package.json', name).
|
|
17
|
-
// }
|
|
18
|
-
// // console.log('bump versions', item)
|
|
19
|
-
// // for (let [index, name] of nameList.entries()) {
|
|
20
|
-
// // await bumpVersion(pathList[index] + '/package.json', name)
|
|
21
|
-
// // }
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// })();
|
|
25
|
-
|
|
26
|
-
async function run() {
|
|
27
|
-
for (let [index, name] of nameList.entries()) {
|
|
28
|
-
getVersions(pathList[index] + '/package.json', `@${name}`)
|
|
29
|
-
}
|
|
30
|
-
console.log('bump versions', item)
|
|
31
|
-
|
|
32
|
-
for (let [index, name] of nameList.entries()) {
|
|
33
|
-
await bumpVersion(pathList[index] + '/package.json', name)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
console.log('completed')
|
|
37
|
-
// process.exit()
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function getVersions(path, name) {
|
|
41
|
-
if (!fs.existsSync(path))
|
|
42
|
-
return console.error('path doesn\'t exist:', path)
|
|
43
|
-
let object = require(path)
|
|
44
|
-
if (object.name && object.version) {
|
|
45
|
-
item[object.name] = `^${object.version}`
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function bumpVersion(filePath, name) {
|
|
50
|
-
if (!fs.existsSync(filePath))
|
|
51
|
-
return console.error('path doesn\'t exist:', path)
|
|
52
|
-
let object = require(filePath)
|
|
53
|
-
let newObject = {...object}
|
|
54
|
-
|
|
55
|
-
if (!object.dependencies)
|
|
56
|
-
return console.log(name, 'not updated')
|
|
57
|
-
else {
|
|
58
|
-
for (const name of Object.keys(object.dependencies)) {
|
|
59
|
-
if (item[name]) {
|
|
60
|
-
newObject.dependencies[name] = item[name]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
let fileContent = JSON.stringify(object, null, 4)
|
|
65
|
-
|
|
66
|
-
filePath = filePath.replace('/package.json', '')
|
|
67
|
-
let Path = path.resolve(filePath, 'package.json')
|
|
68
|
-
if (fs.existsSync(Path))
|
|
69
|
-
fs.unlinkSync(Path)
|
|
70
|
-
|
|
71
|
-
fs.writeFileSync(Path, fileContent)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
run()
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
let glob = require("glob");
|
|
2
|
-
let fs = require('fs');
|
|
3
|
-
const path = require("path")
|
|
4
|
-
|
|
5
|
-
function globUpdater(er, files) {
|
|
6
|
-
console.log('ggggggggggggggggggg', files, er)
|
|
7
|
-
if (er)
|
|
8
|
-
console.log(files, 'glob resolving issue')
|
|
9
|
-
else
|
|
10
|
-
files.forEach(filename => {
|
|
11
|
-
console.log(filename, 'glob resolving issue')
|
|
12
|
-
// update(filename + '/automated.yml')
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function update(YmlPath) {
|
|
18
|
-
let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
|
|
19
|
-
let fileContent = ``;
|
|
20
|
-
// process.exit()
|
|
21
|
-
if (fs.existsSync(YmlPath))
|
|
22
|
-
fs.unlinkSync(YmlPath)
|
|
23
|
-
fs.writeFileSync(YmlPath, fileContent)
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let pathSrc = "../../CoCreate-admin/src/**/*.html"
|
|
28
|
-
if (!fs.existsSync(pathSrc))
|
|
29
|
-
console.log('does not exist')
|
|
30
|
-
|
|
31
|
-
glob(pathSrc, globUpdater)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
let fs = require('fs');
|
|
3
|
-
let list = require('../repositories.js');
|
|
4
|
-
const path = require("path")
|
|
5
|
-
|
|
6
|
-
let CoCreateJsPath = path.resolve('../CoCreateJS');
|
|
7
|
-
|
|
8
|
-
let pathList = list.map(o => o.path)
|
|
9
|
-
let nameList = pathList.map(fn => path.basename(fn).toLowerCase());
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
(async() => {
|
|
14
|
-
|
|
15
|
-
for (let [index, name] of nameList.entries()) {
|
|
16
|
-
await addPackage(pathList[index] + '/package.json', name)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})()
|
|
21
|
-
function addPackage(path, name) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!fs.existsSync(path))
|
|
25
|
-
return console.error('path doesn\'t exist:', path)
|
|
26
|
-
let object = require(name)
|
|
27
|
-
|
|
28
|
-
// console.log(object)
|
|
29
|
-
if (!object.dependencies)
|
|
30
|
-
return console.log(name, 'not updated')
|
|
31
|
-
else
|
|
32
|
-
Object.assign(object.dependencies, {
|
|
33
|
-
"@cocreate/hosting": "^1.0.0",
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
// process.exit()
|
|
37
|
-
fs.writeFileSync(name, JSON.stringify(object, null, 4))
|
|
38
|
-
console.log(name)
|
|
39
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require("path")
|
|
3
|
-
const spawn = require('../../spawn');
|
|
4
|
-
const addMeta = require('../../addMeta');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
module.exports = async function updateYarnLink(repos, args) {
|
|
8
|
-
let failed = [];
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
repos = addMeta(repos, failed)
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
catch (err) {
|
|
15
|
-
failed.push({
|
|
16
|
-
name: 'GENERAL',
|
|
17
|
-
des: err.message
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// console.log(repos)
|
|
23
|
-
// return [];
|
|
24
|
-
for (let repo of repos) {
|
|
25
|
-
await reAdd(repo.deps, repo, failed, '')
|
|
26
|
-
await reAdd(repo.devDeps, repo, failed, '-D ')
|
|
27
|
-
}
|
|
28
|
-
return failed;
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
async function reAdd(deps, repo, failed, param = '') {
|
|
34
|
-
try {
|
|
35
|
-
if (!deps.length)
|
|
36
|
-
return;
|
|
37
|
-
deps.unshift("add")
|
|
38
|
-
let packageList = deps;
|
|
39
|
-
let packageListLog = deps.join(' ');
|
|
40
|
-
console.log(color.green + `${repo.name}: ` + color.reset, `yarn ${packageListLog}`);
|
|
41
|
-
// let exitCode = await spawn(`yarn`, ['add', ...param && [param], packageList], {
|
|
42
|
-
let exitCode = await spawn('yarn', packageList, {
|
|
43
|
-
cwd: repo.absolutePath, stdio: 'inherit',
|
|
44
|
-
});
|
|
45
|
-
if (exitCode !== 0) {
|
|
46
|
-
failed.push({
|
|
47
|
-
name: repo.name,
|
|
48
|
-
des: `yarn ${param} ${packageListLog}`
|
|
49
|
-
})
|
|
50
|
-
console.error(color.red + `${repo.name}: yarn ${param} ${packageListLog}` + color.reset)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch (err) {
|
|
54
|
-
failed.push({
|
|
55
|
-
name: repo.name,
|
|
56
|
-
des: err.message
|
|
57
|
-
})
|
|
58
|
-
console.error(color.red + `${repo.name}: ${err.message}` + color.reset)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const { spawn, exec } = require('child_process');
|
|
2
|
-
var child = spawn('npm', ['login'], {stdio: [ 'pipe', 'pipe', 'pipe' ], shell: true });
|
|
3
|
-
// var child = exec('npm login');
|
|
4
|
-
|
|
5
|
-
process.stdout.pipe(child.stdout);
|
|
6
|
-
process.stderr.pipe(child.stderr);
|
|
7
|
-
process.stdin.pipe(child.stdin);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
child.stdout.on('data', function (data) {
|
|
11
|
-
// exec('\n')
|
|
12
|
-
// console.log('stdout: ' + data, '\n\n\n\n\n\n\n');
|
|
13
|
-
child.stdin.write('newwrite\n'); //my command takes a markdown string...
|
|
14
|
-
child.stdin.end('newend\n');
|
|
15
|
-
// process.stdout.pipe(child.stdout);
|
|
16
|
-
// process.stderr.pipe(child.stderr);
|
|
17
|
-
// process.stdin.pipe(child.stdin);
|
|
18
|
-
process.stdin.write('test\n');
|
|
19
|
-
process.stdin.end('test\n');
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
// console.log(child)
|
|
23
|
-
// child.stdout.pipe(process.stdout);
|
|
24
|
-
// child.stderr.pipe(process.stderr);
|
|
25
|
-
// process.stdin.pipe(child.stdin);
|
|
26
|
-
|
|
27
|
-
child.on('exit', () => {
|
|
28
|
-
console.log('exiting')
|
|
29
|
-
process.exit()
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
child.on('close', (code) => {
|
|
33
|
-
console.log(`Child process exited with code ${code}.`);
|
|
34
|
-
});
|
|
35
|
-
child.on('spawn', (code) => {
|
|
36
|
-
console.log(`Child process spawn with code ${code}.`);
|
|
37
|
-
});
|
|
38
|
-
child.on('message', (code) => {
|
|
39
|
-
console.log(`Child process message with code ${code}.`);
|
|
40
|
-
});
|
|
41
|
-
child.on('disconnect', (code) => {
|
|
42
|
-
console.log(`Child process disconnect with code ${code}.`);
|
|
43
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
async function updateModules() {
|
|
2
|
-
|
|
3
|
-
let data = await CoCreate.crud.readDocument({
|
|
4
|
-
collection: ['modules'],
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
if (data && data.document && data.document.length) {
|
|
8
|
-
for (let document of data.document) {
|
|
9
|
-
let isUpdateable = false
|
|
10
|
-
if (document.icon) {
|
|
11
|
-
console.log(document.icon)
|
|
12
|
-
let name = document.icon
|
|
13
|
-
if (name.includes('fa fa-'))
|
|
14
|
-
name = name.substring(16).replace('"></i>', "")
|
|
15
|
-
else
|
|
16
|
-
name = name.substring(17).replace('"></i>', "")
|
|
17
|
-
console.log(name)
|
|
18
|
-
if (name) {
|
|
19
|
-
document.icon = name
|
|
20
|
-
let updateDocument = await CoCreate.crud.updateDocument({
|
|
21
|
-
collection: ['modules'],
|
|
22
|
-
document
|
|
23
|
-
})
|
|
24
|
-
console.log(updateDocument)
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// let keys = ['navbar-menu-primary', 'navbar-menu-secondary', 'main-menu-primary', 'main-menu-secondary', 'settings-menu-primary', 'settings-menu-secondary']
|
|
29
|
-
// for (let key of keys) {
|
|
30
|
-
// if (document[key] && document[key].path) {
|
|
31
|
-
// let parts = document[key].path.split('/')
|
|
32
|
-
// let name = parts.pop()
|
|
33
|
-
// let parentDirectory = parts.pop()
|
|
34
|
-
// if (!name)
|
|
35
|
-
// continue
|
|
36
|
-
// console.log(name, parentDirectory)
|
|
37
|
-
// document[key].name = name
|
|
38
|
-
// document[key].parentDirectory = parentDirectory || ''
|
|
39
|
-
// isUpdateable = true
|
|
40
|
-
// }
|
|
41
|
-
// }
|
|
42
|
-
// if (isUpdateable) {
|
|
43
|
-
// let updateDocument = await CoCreate.crud.updateDocument({
|
|
44
|
-
// collection: ['modules'],
|
|
45
|
-
// document
|
|
46
|
-
// })
|
|
47
|
-
// console.log(updateDocument)
|
|
48
|
-
// }
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|