@cocreate/cli 1.20.1 → 1.22.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.22.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.21.0...v1.22.0) (2023-04-23)
2
+
3
+
4
+ ### Features
5
+
6
+ * args sent to command ([79eecb1](https://github.com/CoCreate-app/CoCreate-cli/commit/79eecb13bc0ea15e5593dc834f584824bf009eb9))
7
+
8
+ # [1.21.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.20.1...v1.21.0) (2023-04-23)
9
+
10
+
11
+ ### Features
12
+
13
+ * nginx create and delete commands ie. coc nginx create <domain> ([6dfe58c](https://github.com/CoCreate-app/CoCreate-cli/commit/6dfe58c66ffd20b1e0005809ad769bc57b2bbffe))
14
+
1
15
  ## [1.20.1](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.20.0...v1.20.1) (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.1",
3
+ "version": "1.22.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,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
@@ -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,12 @@ 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
+
28
+ // let type = command.split(' ')[0]
29
+ // let args = command.replace(type, '').replaceAll("'", '"').trim()
26
30
 
27
31
  for (let repo of repos) {
28
32
  try {