@cocreate/cli 1.20.0 → 1.21.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.21.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.20.1...v1.21.0) (2023-04-23)
2
+
3
+
4
+ ### Features
5
+
6
+ * nginx create and delete commands ie. coc nginx create <domain> ([6dfe58c](https://github.com/CoCreate-app/CoCreate-cli/commit/6dfe58c66ffd20b1e0005809ad769bc57b2bbffe))
7
+
8
+ ## [1.20.1](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.20.0...v1.20.1) (2023-04-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * update demo domains clean code ([aafd70d](https://github.com/CoCreate-app/CoCreate-cli/commit/aafd70d2c29d7bb0837e8e90c0c12d8025899587))
14
+
1
15
  # [1.20.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.19.8...v1.20.0) (2023-04-23)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cli",
3
- "version": "1.20.0",
3
+ "version": "1.21.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/coc.js CHANGED
File without changes
@@ -7,7 +7,7 @@ const exec = util.promisify(require('node:child_process').exec);
7
7
 
8
8
  let pathList, nameList, item = {}, failed = [];
9
9
 
10
- module.exports = async function bump(repos) {
10
+ module.exports = async function bump(repos, args) {
11
11
  pathList = repos.map(o => o.absolutePath)
12
12
  if (repos.length === 1) {
13
13
  let packageJsonPath = path.resolve(process.cwd(), './package.json');
@@ -3,7 +3,7 @@ const spawn = require('../spawn');
3
3
  const colors = require('colors');
4
4
  const path = require('path');
5
5
 
6
- module.exports = async function gitClone(repos) {
6
+ module.exports = async function gitClone(repos, args) {
7
7
  const failed = [];
8
8
  const cwdPath = path.resolve(process.cwd());
9
9
 
@@ -1,6 +1,5 @@
1
1
  let glob = require("glob");
2
2
  let fs = require('fs');
3
- const prettier = require("prettier");
4
3
  const path = require("path")
5
4
 
6
5
  function globUpdater(er, files) {
@@ -20,7 +19,6 @@ function globUpdater(er, files) {
20
19
 
21
20
 
22
21
  function update(YmlPath) {
23
- // component name
24
22
  let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
25
23
  let fileContent = `name: Automated Workflow
26
24
  'on':
@@ -108,12 +106,10 @@ jobs:
108
106
  uses: CoCreate-app/CoCreate-docs@master
109
107
 
110
108
  `;
111
- let formated = prettier.format(fileContent, { semi: false, parser: "yaml" });
112
- // console.log(fileContent);
113
109
  // process.exit()
114
110
  if (fs.existsSync(YmlPath))
115
- fs.unlinkSync(YmlPath)
116
- fs.writeFileSync(YmlPath, formated)
111
+ fs.unlinkSync(YmlPath)
112
+ fs.writeFileSync(YmlPath, fileContent)
117
113
 
118
114
  }
119
115
 
@@ -1,6 +1,5 @@
1
1
 
2
2
  let fs = require('fs');
3
- const prettier = require("prettier");
4
3
  let list = require('../../../repositories.js');
5
4
  const path = require("path")
6
5
 
@@ -62,16 +61,14 @@ function bumpVersion(filePath, name) {
62
61
  }
63
62
  }
64
63
 
65
- let str = JSON.stringify(object)
66
- let formated = prettier.format(str, { semi: false, parser: "json" });
64
+ let fileContent = JSON.stringify(object, null, 4)
67
65
 
68
66
  filePath = filePath.replace('/package.json', '')
69
67
  let Path = path.resolve(filePath, 'package.json')
70
- if (fs.existsSync(Path)){
68
+ if (fs.existsSync(Path))
71
69
  fs.unlinkSync(Path)
72
- }
73
70
 
74
- fs.writeFileSync(Path, formated)
71
+ fs.writeFileSync(Path, fileContent)
75
72
  }
76
73
  }
77
74
 
@@ -1,6 +1,5 @@
1
1
  let glob = require("glob");
2
2
  let fs = require('fs');
3
- const prettier = require("prettier");
4
3
  const path = require("path");
5
4
 
6
5
  function globUpdater(er, files) {
@@ -1,8 +1,6 @@
1
1
  let fs = require('fs');
2
2
  const prettier = require("prettier");
3
3
  const path = require("path")
4
- const { promisify } = require('util');
5
- const exec = promisify(require('child_process').exec)
6
4
  let list = require('../repositories.js');
7
5
 
8
6
 
@@ -35,13 +33,11 @@ let metaYarnLink = list.map(meta => {
35
33
  (async() => {
36
34
  for (let meta of metaYarnLink) {
37
35
  await update(meta)
38
- // await updateYarnLink(metaYarnLink[0])
39
36
  }
40
37
  })();
41
38
 
42
39
 
43
40
  function update(param) {
44
- // component name
45
41
  if (!param) return;
46
42
  let { packageObj, absolutePath } = param;
47
43
  let { name, description } = packageObj;
@@ -1,6 +1,5 @@
1
1
  let glob = require("glob");
2
2
  let fs = require('fs');
3
- const prettier = require("prettier");
4
3
  const path = require("path")
5
4
 
6
5
  function globUpdater(er, files) {
@@ -13,22 +12,16 @@ function globUpdater(er, files) {
13
12
 
14
13
 
15
14
 
16
- function update(YmlPath) {
17
- // component name
18
- let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
15
+ function update(Path) {
19
16
  let fileContent = `# ignore
20
17
  node_modules
21
18
  dist
22
19
  .npmrc
23
20
 
24
21
  `;
25
- let formated = prettier.format(fileContent, { semi: false, parser: "yaml" });
26
- // console.log(fileContent);
27
- // process.exit()
28
- if (fs.existsSync(YmlPath))
29
- fs.unlinkSync(YmlPath)
30
- fs.writeFileSync(YmlPath, formated)
31
-
22
+ if (fs.existsSync(Path))
23
+ fs.unlinkSync(Path)
24
+ fs.writeFileSync(Path, fileContent)
32
25
 
33
26
  }
34
27
 
@@ -1,6 +1,5 @@
1
1
  let glob = require("glob");
2
2
  let fs = require('fs');
3
- const prettier = require("prettier");
4
3
  const path = require("path")
5
4
 
6
5
  function globUpdater(er, files) {
@@ -19,9 +18,9 @@ function globUpdater(er, files) {
19
18
 
20
19
 
21
20
 
22
- function update(YmlPath) {
21
+ function update(Path) {
23
22
  // component name
24
- let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
23
+ let name = path.basename(path.resolve(path.dirname(Path), '../..')).substring(9);
25
24
  let fileContent = `name: Manual Workflow
26
25
  on:
27
26
  workflow_dispatch:
@@ -68,12 +67,11 @@ jobs:
68
67
  invalidations: \${{ github.event.inputs.invalidations }}
69
68
 
70
69
  `;
71
- let formated = prettier.format(fileContent, { semi: false, parser: "yaml" });
72
- // console.log(fileContent);
73
- // process.exit()
74
- if (fs.existsSync(YmlPath))
75
- fs.unlinkSync(YmlPath)
76
- fs.writeFileSync(YmlPath, formated)
70
+
71
+
72
+ if (fs.existsSync(Path))
73
+ fs.unlinkSync(Path)
74
+ fs.writeFileSync(Path, fileContent)
77
75
 
78
76
  }
79
77
 
@@ -2,7 +2,6 @@ let fs = require('fs');
2
2
  const prettier = require("prettier");
3
3
  const path = require("path")
4
4
  const { promisify } = require('util');
5
- const exec = promisify(require('child_process').exec)
6
5
  let list = require('../repositories.js');
7
6
 
8
7
 
@@ -1,7 +1,5 @@
1
1
  let glob = require("glob");
2
2
  let fs = require('fs');
3
- const prettier = require("prettier");
4
- const path = require("path")
5
3
 
6
4
  function globUpdater(er, files) {
7
5
  if (er)
@@ -1,6 +1,5 @@
1
1
  let glob = require("glob");
2
2
  let fs = require('fs');
3
- const prettier = require("prettier");
4
3
  const path = require("path")
5
4
 
6
5
  function globUpdater(er, files) {
@@ -31,9 +31,9 @@ function update(webpackPath) {
31
31
  let entry;
32
32
 
33
33
  if (fs.existsSync( path.resolve(dir, './src/index.js') ))
34
- entry = "./src/index.js";
34
+ entry = "./src/index.js";
35
35
  else
36
- entry = './src/' + name + '.js';
36
+ entry = './src/' + name + '.js';
37
37
 
38
38
  // get component name in came case "cocreate" less
39
39
  let componentName = toCamelCase(name);
@@ -1,7 +1,7 @@
1
1
  let fs = require('fs');
2
2
  const path = require("path");
3
3
 
4
- module.exports = async function linkPackages(repos) {
4
+ module.exports = async function linkPackages(repos, args) {
5
5
  const failed = []
6
6
  const prompt = require('prompt');
7
7
 
@@ -2,7 +2,7 @@ let fs = require('fs');
2
2
  const path = require('path');
3
3
  const failed = [];
4
4
 
5
- module.exports = async function gitConfig(repos) {
5
+ module.exports = async function gitConfig(repos, args) {
6
6
  try {
7
7
  await getPrompts(repos);
8
8
  }
@@ -1,15 +1,15 @@
1
1
  const addMeta = require('../addMeta');
2
2
 
3
- module.exports = async function(repos) {
3
+ module.exports = async function(repos, args) {
4
4
  let failed = [];
5
5
  try {
6
- let cloneFailed = await require('./clone.js')(repos)
6
+ let cloneFailed = await require('./clone.js')(repos, args)
7
7
  if (cloneFailed)
8
8
  failed.push(cloneFailed)
9
9
 
10
10
  repos = await addMeta(repos, failed)
11
11
 
12
- let symlinkFailed = await require('./symlink.js')(repos)
12
+ let symlinkFailed = await require('./symlink.js')(repos, args)
13
13
  if (symlinkFailed)
14
14
  failed.push(symlinkFailed)
15
15
  } catch (err) {
@@ -0,0 +1,25 @@
1
+ const {createServer, deleteServer} = require('./other/nodeCertManager.js')
2
+
3
+ module.exports = async function nginx(repos, args) {
4
+ let failed = [];
5
+
6
+ try {
7
+ if (args.length) {
8
+ if (args[0] === 'create') {
9
+ args.shift()
10
+ await createServer(args);
11
+ } else if (args[0] === 'delete') {
12
+ args.shift()
13
+ await deleteServer(args);
14
+ } else
15
+ await createServer(args);
16
+ }
17
+ } catch (err) {
18
+ failed.push({ name: 'GENERAL', des: err.message });
19
+ console.error(err.red);
20
+ } finally {
21
+ return failed;
22
+ }
23
+
24
+ }
25
+
@@ -5,7 +5,7 @@ const colors = require('colors');
5
5
  const addMeta = require('../../addMeta');
6
6
 
7
7
 
8
- module.exports = async function updateYarnLink(repos) {
8
+ module.exports = async function updateYarnLink(repos, args) {
9
9
  let failed = [];
10
10
 
11
11
  try {
File without changes
@@ -101,7 +101,7 @@ async function deleteServer(hosts) {
101
101
  return response
102
102
  }
103
103
 
104
- // createServer(['cocreate.app', 'cocreate.ai'])
105
- // deleteServer(['cocreate.com'])
104
+ // createServer(['cocreate.app'])
105
+ // deleteServer(['cocreate.app'])
106
106
 
107
107
  module.exports = {createServer, deleteServer}
@@ -9,7 +9,7 @@ let cwdNodeModulesPath = path.resolve(cwdPath, 'node_modules')
9
9
 
10
10
  let reposLength, failed = [];
11
11
 
12
- module.exports = async function symlink(repos) {
12
+ module.exports = async function symlink(repos, args) {
13
13
  reposLength = repos.length
14
14
 
15
15
  for (let i = 0; i < repos.length; i++) {
package/src/execute.js CHANGED
@@ -8,7 +8,10 @@ const exec = util.promisify(require('node:child_process').exec);
8
8
 
9
9
  module.exports = async function execute(command, repos, config) {
10
10
  let failed = [];
11
- let predefined = path.resolve(__dirname, 'commands', command + '.js');
11
+ let type = command.split(' ')[0]
12
+ let args = command.replace(type, '').replaceAll("'", '"').trim()
13
+
14
+ let predefined = path.resolve(__dirname, 'commands', type + '.js');
12
15
 
13
16
  if (fs.existsSync(predefined)) {
14
17
  console.warn(`executing a predefined command in ${predefined}`.blue);
@@ -18,11 +21,11 @@ module.exports = async function execute(command, repos, config) {
18
21
  else
19
22
  console.log('running on all repos'.blue)
20
23
 
21
- failed = require(predefined)(repos)
24
+ failed = require(predefined)(args, repos)
22
25
 
23
26
  } else {
24
- let type = command.split(' ')[0]
25
- let args = command.replace(type, '').replaceAll("'", '"').trim()
27
+ // let type = command.split(' ')[0]
28
+ // let args = command.replace(type, '').replaceAll("'", '"').trim()
26
29
 
27
30
  for (let repo of repos) {
28
31
  try {