@cocreate/cli 1.27.4 → 1.28.1

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.28.1](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.28.0...v1.28.1) (2023-05-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * JSON.stringify options ([32c2d03](https://github.com/CoCreate-app/CoCreate-cli/commit/32c2d037ae96749beb82666a2dd3f2003a401802))
7
+
8
+ # [1.28.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.27.4...v1.28.0) (2023-05-02)
9
+
10
+
11
+ ### Features
12
+
13
+ * symlinkPwa ([54d0136](https://github.com/CoCreate-app/CoCreate-cli/commit/54d01367e1a3f310a1711086f820e09b462bef4c))
14
+
1
15
  ## [1.27.4](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.27.3...v1.27.4) (2023-05-01)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cli",
3
- "version": "1.27.4",
3
+ "version": "1.28.1",
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",
@@ -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
 
@@ -34,10 +33,7 @@ function addPackage(path, name) {
34
33
  "@cocreate/hosting": "^1.0.0",
35
34
  })
36
35
 
37
- let str = JSON.stringify(object)
38
- // console.log(str)
39
- let formated = prettier.format(str, { semi: false, parser: "json" });
40
36
  // process.exit()
41
- fs.writeFileSync(name, formated)
37
+ fs.writeFileSync(name, JSON.stringify(object, null, 4))
42
38
  console.log(name)
43
39
  }
@@ -0,0 +1,39 @@
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+
4
+ function symlink(dir, dest, option) {
5
+ if (!fs.existsSync(dir)) {
6
+ return console.log(dir, 'does not exist')
7
+ } else
8
+ dir = path.resolve(dir)
9
+
10
+ if (fs.existsSync(dest))
11
+ fs.rm(dest, { recursive: true, force: true }, function (err) {
12
+ if (err) {
13
+ console.log('failed');
14
+ }
15
+ createSymlink(dir, dest, option)
16
+ });
17
+ else
18
+ createSymlink(dir, dest, option)
19
+ }
20
+
21
+ function createSymlink(dir, dest, option) {
22
+ dest = path.resolve(dest)
23
+
24
+ fs.symlink(dir, dest, option, (err) => {
25
+ console.log(dir, dest, option)
26
+ if (err)
27
+ console.log(err);
28
+ else {
29
+ console.log("symlink added");
30
+ }
31
+
32
+ })
33
+
34
+ }
35
+
36
+ symlink('./src/assets', '../assets', 'dir')
37
+ symlink('./src/manifest.webmanifest', '../manifest.webmanifest', 'file')
38
+ symlink('./src/sw.js', '../sw.js', 'file')
39
+ symlink('./src/offline.html', '../offline.html', 'file')
@@ -0,0 +1,51 @@
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
+ }
@@ -1,26 +0,0 @@
1
- const fs = require('fs')
2
-
3
- function createSymlink(dir, dest){
4
- if (!fs.existsSync(dir)) {
5
- console.log('does not exist')
6
- return
7
- }
8
-
9
- if (fs.existsSync(dest))
10
- fs.unlinkSync(dest)
11
-
12
- fs.symlink( dir, dest, 'dir', (err) => {
13
- if (err)
14
- console.log(err);
15
- else {
16
- console.log("symlink added");
17
- }
18
- })
19
-
20
- }
21
-
22
-
23
- // createSymlink('./assets', '../../assets')
24
- createSymlink('./manifest.webmanifest', '../../manifest.webmanifest')
25
- createSymlink('./sw.js', '../../sw.js')
26
- createSymlink('./offline.html', '../../offline.html')