@cocreate/cli 1.28.3 → 1.29.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/.github/FUNDING.yml +3 -3
- package/.github/workflows/automated.yml +55 -55
- package/CHANGELOG.md +20 -0
- package/CONTRIBUTING.md +96 -96
- package/CoCreate.config.js +26 -26
- package/LICENSE +21 -21
- package/README.md +76 -76
- package/docs/index.html +242 -67
- package/package.json +3 -3
- package/release.config.js +21 -21
- package/repositories.js +475 -475
- package/src/addMeta.js +74 -74
- package/src/coc.js +80 -80
- package/src/commands/bump.js +85 -85
- package/src/commands/clone.js +2 -2
- package/src/commands/fs/automated.js +141 -141
- package/src/commands/fs/bump.js +74 -74
- package/src/commands/fs/config.js +78 -78
- package/src/commands/fs/contribution.js +136 -136
- package/src/commands/fs/gitignore.js +40 -40
- package/src/commands/fs/icon-extract.js +31 -31
- package/src/commands/fs/manual.js +91 -91
- package/src/commands/fs/package.js +39 -39
- package/src/commands/fs/readme.js +138 -138
- package/src/commands/fs/remove.js +28 -28
- package/src/commands/fs/replace.js +42 -42
- package/src/commands/fs/webpack.js +191 -191
- package/src/commands/git/gitConfig.js +70 -70
- package/src/commands/gitConfig.js +72 -72
- package/src/commands/install.js +24 -24
- package/src/commands/link.js +107 -107
- package/src/commands/nginx.js +25 -25
- package/src/commands/other/add.js +63 -63
- package/src/commands/other/config.sh +4 -4
- package/src/commands/other/nginxConfigManager.js +137 -137
- package/src/commands/other/nodeCertManager.js +147 -147
- package/src/commands/other/symlinkPwa.js +38 -38
- package/src/commands/other/test.js +43 -43
- package/src/commands/other/updateModules.js +50 -50
- package/src/commands/symlink.js +113 -111
- package/src/execute.js +66 -66
- package/src/spawn.js +9 -9
- package/webpack.config.js +84 -84
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
let glob = require("glob");
|
|
2
|
-
let fs = require('fs');
|
|
3
|
-
const path = require("path")
|
|
4
|
-
|
|
5
|
-
function globUpdater(er, files) {
|
|
6
|
-
|
|
7
|
-
if (er)
|
|
8
|
-
console.log(files, 'glob resolving issue')
|
|
9
|
-
else
|
|
10
|
-
files.forEach(filename => {
|
|
11
|
-
|
|
12
|
-
console.log(filename + '/automated.yml', 'glob resolving issue')
|
|
13
|
-
update(filename + '/automated.yml')
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function update(YmlPath) {
|
|
22
|
-
let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
|
|
23
|
-
let fileContent = `name: Automated Workflow
|
|
24
|
-
'on':
|
|
25
|
-
push:
|
|
26
|
-
branches:
|
|
27
|
-
- master
|
|
28
|
-
jobs:
|
|
29
|
-
about:
|
|
30
|
-
runs-on: ubuntu-latest
|
|
31
|
-
steps:
|
|
32
|
-
- name: Checkout
|
|
33
|
-
uses: actions/checkout@v3
|
|
34
|
-
- name: setup nodejs
|
|
35
|
-
uses: actions/setup-node@v3
|
|
36
|
-
with:
|
|
37
|
-
node-version: 16
|
|
38
|
-
- name: Jaid/action-sync-node-meta
|
|
39
|
-
uses: jaid/action-sync-node-meta@v1.4.0
|
|
40
|
-
with:
|
|
41
|
-
direction: overwrite-github
|
|
42
|
-
githubToken: '\${{ secrets.GITHUB }}'
|
|
43
|
-
release:
|
|
44
|
-
runs-on: ubuntu-latest
|
|
45
|
-
steps:
|
|
46
|
-
- name: Checkout
|
|
47
|
-
uses: actions/checkout@v3
|
|
48
|
-
- name: setup nodejs
|
|
49
|
-
uses: actions/setup-node@v3
|
|
50
|
-
with:
|
|
51
|
-
node-version: 16
|
|
52
|
-
- name: Semantic Release
|
|
53
|
-
uses: cycjimmy/semantic-release-action@v3
|
|
54
|
-
id: semantic
|
|
55
|
-
with:
|
|
56
|
-
extra_plugins: |
|
|
57
|
-
@semantic-release/changelog
|
|
58
|
-
@semantic-release/npm
|
|
59
|
-
@semantic-release/git
|
|
60
|
-
@semantic-release/github
|
|
61
|
-
env:
|
|
62
|
-
GITHUB_TOKEN: '\${{ secrets.GITHUB_TOKEN }}'
|
|
63
|
-
NPM_TOKEN: '\${{ secrets.NPM_TOKEN }}'
|
|
64
|
-
outputs:
|
|
65
|
-
new_release_published: '\${{ steps.semantic.outputs.new_release_published }}'
|
|
66
|
-
new_release_version: '\${{ steps.semantic.outputs.new_release_version }}'
|
|
67
|
-
cdn:
|
|
68
|
-
runs-on: ubuntu-latest
|
|
69
|
-
needs: release
|
|
70
|
-
if: needs.release.outputs.new_release_published == 'true'
|
|
71
|
-
env:
|
|
72
|
-
VERSION: '\${{ needs.release.outputs.new_release_version }}'
|
|
73
|
-
steps:
|
|
74
|
-
- name: Checkout
|
|
75
|
-
uses: actions/checkout@v3
|
|
76
|
-
- name: setup nodejs
|
|
77
|
-
uses: actions/setup-node@v3
|
|
78
|
-
with:
|
|
79
|
-
node-version: 16
|
|
80
|
-
- name: yarn install
|
|
81
|
-
run: >
|
|
82
|
-
echo "//registry.npmjs.org/:_authToken=\${{ secrets.NPM_TOKEN }}" >
|
|
83
|
-
.npmrc
|
|
84
|
-
|
|
85
|
-
yarn install
|
|
86
|
-
- name: yarn build
|
|
87
|
-
run: yarn build
|
|
88
|
-
- name: upload bundle as version
|
|
89
|
-
uses: CoCreate-app/CoCreate-s3@master
|
|
90
|
-
with:
|
|
91
|
-
aws-key-id: '\${{ secrets.AWSACCESSKEYID }}'
|
|
92
|
-
aws-access-key: '\${{ secrets.AWSSECERTACCESSKEY }}'
|
|
93
|
-
bucket: testcrudbucket
|
|
94
|
-
source: ./dist
|
|
95
|
-
destination: '/${name}/\${{env.VERSION}}'
|
|
96
|
-
acl: public-read
|
|
97
|
-
- name: upload bundle as latest
|
|
98
|
-
uses: CoCreate-app/CoCreate-s3@master
|
|
99
|
-
with:
|
|
100
|
-
aws-key-id: '\${{ secrets.AWSACCESSKEYID }}'
|
|
101
|
-
aws-access-key: '\${{ secrets.AWSSECERTACCESSKEY }}'
|
|
102
|
-
bucket: testcrudbucket
|
|
103
|
-
source: ./dist
|
|
104
|
-
destination: /${name}/latest
|
|
105
|
-
acl: public-read
|
|
106
|
-
invalidations: true
|
|
107
|
-
docs:
|
|
108
|
-
runs-on: ubuntu-latest
|
|
109
|
-
steps:
|
|
110
|
-
- name: Checkout
|
|
111
|
-
uses: actions/checkout@v3
|
|
112
|
-
- name: setup nodejs
|
|
113
|
-
uses: actions/setup-node@v3
|
|
114
|
-
with:
|
|
115
|
-
node-version: 16
|
|
116
|
-
|
|
117
|
-
- name: update documentation
|
|
118
|
-
uses: CoCreate-app/CoCreate-docs@master
|
|
119
|
-
|
|
120
|
-
`;
|
|
121
|
-
// process.exit()
|
|
122
|
-
if (fs.existsSync(YmlPath))
|
|
123
|
-
fs.unlinkSync(YmlPath)
|
|
124
|
-
fs.writeFileSync(YmlPath, fileContent)
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
// glob("../CoCreate-components/CoCreate-action/.github/workflows", globUpdater)
|
|
131
|
-
glob("../CoCreate-components/*/.github/workflows/", globUpdater)
|
|
132
|
-
glob("../CoCreate-apps/*/.github/workflows/", globUpdater)
|
|
133
|
-
glob("../CoCreate-plugins/*/.github/workflows/", globUpdater)
|
|
134
|
-
|
|
135
|
-
// substrin (9) removes CoCreateC leving namme as SS
|
|
136
|
-
// glob("../CoCreateCSS/.github/workflows/", globUpdater)
|
|
137
|
-
|
|
138
|
-
// does not need to add name... will require for name to be removed from destination
|
|
139
|
-
// glob("../CoCreateJS/.github/workflows/", globUpdater)
|
|
140
|
-
|
|
141
|
-
console.log('finished')
|
|
1
|
+
let glob = require("glob");
|
|
2
|
+
let fs = require('fs');
|
|
3
|
+
const path = require("path")
|
|
4
|
+
|
|
5
|
+
function globUpdater(er, files) {
|
|
6
|
+
|
|
7
|
+
if (er)
|
|
8
|
+
console.log(files, 'glob resolving issue')
|
|
9
|
+
else
|
|
10
|
+
files.forEach(filename => {
|
|
11
|
+
|
|
12
|
+
console.log(filename + '/automated.yml', 'glob resolving issue')
|
|
13
|
+
update(filename + '/automated.yml')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
function update(YmlPath) {
|
|
22
|
+
let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
|
|
23
|
+
let fileContent = `name: Automated Workflow
|
|
24
|
+
'on':
|
|
25
|
+
push:
|
|
26
|
+
branches:
|
|
27
|
+
- master
|
|
28
|
+
jobs:
|
|
29
|
+
about:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- name: Checkout
|
|
33
|
+
uses: actions/checkout@v3
|
|
34
|
+
- name: setup nodejs
|
|
35
|
+
uses: actions/setup-node@v3
|
|
36
|
+
with:
|
|
37
|
+
node-version: 16
|
|
38
|
+
- name: Jaid/action-sync-node-meta
|
|
39
|
+
uses: jaid/action-sync-node-meta@v1.4.0
|
|
40
|
+
with:
|
|
41
|
+
direction: overwrite-github
|
|
42
|
+
githubToken: '\${{ secrets.GITHUB }}'
|
|
43
|
+
release:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- name: Checkout
|
|
47
|
+
uses: actions/checkout@v3
|
|
48
|
+
- name: setup nodejs
|
|
49
|
+
uses: actions/setup-node@v3
|
|
50
|
+
with:
|
|
51
|
+
node-version: 16
|
|
52
|
+
- name: Semantic Release
|
|
53
|
+
uses: cycjimmy/semantic-release-action@v3
|
|
54
|
+
id: semantic
|
|
55
|
+
with:
|
|
56
|
+
extra_plugins: |
|
|
57
|
+
@semantic-release/changelog
|
|
58
|
+
@semantic-release/npm
|
|
59
|
+
@semantic-release/git
|
|
60
|
+
@semantic-release/github
|
|
61
|
+
env:
|
|
62
|
+
GITHUB_TOKEN: '\${{ secrets.GITHUB_TOKEN }}'
|
|
63
|
+
NPM_TOKEN: '\${{ secrets.NPM_TOKEN }}'
|
|
64
|
+
outputs:
|
|
65
|
+
new_release_published: '\${{ steps.semantic.outputs.new_release_published }}'
|
|
66
|
+
new_release_version: '\${{ steps.semantic.outputs.new_release_version }}'
|
|
67
|
+
cdn:
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
needs: release
|
|
70
|
+
if: needs.release.outputs.new_release_published == 'true'
|
|
71
|
+
env:
|
|
72
|
+
VERSION: '\${{ needs.release.outputs.new_release_version }}'
|
|
73
|
+
steps:
|
|
74
|
+
- name: Checkout
|
|
75
|
+
uses: actions/checkout@v3
|
|
76
|
+
- name: setup nodejs
|
|
77
|
+
uses: actions/setup-node@v3
|
|
78
|
+
with:
|
|
79
|
+
node-version: 16
|
|
80
|
+
- name: yarn install
|
|
81
|
+
run: >
|
|
82
|
+
echo "//registry.npmjs.org/:_authToken=\${{ secrets.NPM_TOKEN }}" >
|
|
83
|
+
.npmrc
|
|
84
|
+
|
|
85
|
+
yarn install
|
|
86
|
+
- name: yarn build
|
|
87
|
+
run: yarn build
|
|
88
|
+
- name: upload bundle as version
|
|
89
|
+
uses: CoCreate-app/CoCreate-s3@master
|
|
90
|
+
with:
|
|
91
|
+
aws-key-id: '\${{ secrets.AWSACCESSKEYID }}'
|
|
92
|
+
aws-access-key: '\${{ secrets.AWSSECERTACCESSKEY }}'
|
|
93
|
+
bucket: testcrudbucket
|
|
94
|
+
source: ./dist
|
|
95
|
+
destination: '/${name}/\${{env.VERSION}}'
|
|
96
|
+
acl: public-read
|
|
97
|
+
- name: upload bundle as latest
|
|
98
|
+
uses: CoCreate-app/CoCreate-s3@master
|
|
99
|
+
with:
|
|
100
|
+
aws-key-id: '\${{ secrets.AWSACCESSKEYID }}'
|
|
101
|
+
aws-access-key: '\${{ secrets.AWSSECERTACCESSKEY }}'
|
|
102
|
+
bucket: testcrudbucket
|
|
103
|
+
source: ./dist
|
|
104
|
+
destination: /${name}/latest
|
|
105
|
+
acl: public-read
|
|
106
|
+
invalidations: true
|
|
107
|
+
docs:
|
|
108
|
+
runs-on: ubuntu-latest
|
|
109
|
+
steps:
|
|
110
|
+
- name: Checkout
|
|
111
|
+
uses: actions/checkout@v3
|
|
112
|
+
- name: setup nodejs
|
|
113
|
+
uses: actions/setup-node@v3
|
|
114
|
+
with:
|
|
115
|
+
node-version: 16
|
|
116
|
+
|
|
117
|
+
- name: update documentation
|
|
118
|
+
uses: CoCreate-app/CoCreate-docs@master
|
|
119
|
+
|
|
120
|
+
`;
|
|
121
|
+
// process.exit()
|
|
122
|
+
if (fs.existsSync(YmlPath))
|
|
123
|
+
fs.unlinkSync(YmlPath)
|
|
124
|
+
fs.writeFileSync(YmlPath, fileContent)
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
// glob("../CoCreate-components/CoCreate-action/.github/workflows", globUpdater)
|
|
131
|
+
glob("../CoCreate-components/*/.github/workflows/", globUpdater)
|
|
132
|
+
glob("../CoCreate-apps/*/.github/workflows/", globUpdater)
|
|
133
|
+
glob("../CoCreate-plugins/*/.github/workflows/", globUpdater)
|
|
134
|
+
|
|
135
|
+
// substrin (9) removes CoCreateC leving namme as SS
|
|
136
|
+
// glob("../CoCreateCSS/.github/workflows/", globUpdater)
|
|
137
|
+
|
|
138
|
+
// does not need to add name... will require for name to be removed from destination
|
|
139
|
+
// glob("../CoCreateJS/.github/workflows/", globUpdater)
|
|
140
|
+
|
|
141
|
+
console.log('finished')
|
package/src/commands/fs/bump.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
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
|
-
|
|
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
75
|
run()
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
let glob = require("glob");
|
|
2
|
-
let fs = require('fs');
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
function globUpdater(er, files) {
|
|
6
|
-
if (er)
|
|
7
|
-
console.log(files, 'glob resolving issue');
|
|
8
|
-
else
|
|
9
|
-
files.forEach(filename => update(filename));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function update(MdPath) {
|
|
16
|
-
let name = path.basename(path.resolve(path.dirname(MdPath), './')).substring(9);
|
|
17
|
-
let document_id = '';
|
|
18
|
-
let replaceContent = fs.readFileSync(MdPath).toString();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let content_source = replaceContent.substring(replaceContent.indexOf("sources"));
|
|
22
|
-
let content1 = content_source.substring(content_source.indexOf("document_id"));
|
|
23
|
-
let content2 = content1.substring(content1.indexOf(':'));
|
|
24
|
-
document_id = content2.substring(3, content2.indexOf(',') - 4);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
let fileContent = `module.exports = {
|
|
28
|
-
"config": {
|
|
29
|
-
"organization_id": "5ff747727005da1c272740ab",
|
|
30
|
-
"key": "2061acef-0451-4545-f754-60cf8160",
|
|
31
|
-
"host": "general.cocreate.app"
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
"sources": [
|
|
35
|
-
{
|
|
36
|
-
"collection": "files",
|
|
37
|
-
"document": {
|
|
38
|
-
"_id": "${document_id}",
|
|
39
|
-
"name": "index.html",
|
|
40
|
-
"path": "/docs/${name}/index.html",
|
|
41
|
-
"src": "{{./docs/index.html}}",
|
|
42
|
-
"hosts": [
|
|
43
|
-
"general.cocreate.app"
|
|
44
|
-
],
|
|
45
|
-
"directory": "/docs/${name}",
|
|
46
|
-
"parentDirectory": "{{parentDirectory}}",
|
|
47
|
-
"content-type": "{{content-type}}",
|
|
48
|
-
"public": "true",
|
|
49
|
-
"website_id": "644d4bff8036fb9d1d1fd69c"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
if (!document_id.length)
|
|
58
|
-
console.log("Document_id Undefined: ", MdPath);
|
|
59
|
-
if (document_id.length != 24 && document_id.length != 0 )
|
|
60
|
-
console.log("Document_id not valid! please check your config: ", MdPath);
|
|
61
|
-
else {
|
|
62
|
-
console.log(MdPath, " -> document_id : ", document_id);
|
|
63
|
-
if (fs.existsSync(MdPath))
|
|
64
|
-
fs.unlinkSync(MdPath);
|
|
65
|
-
fs.writeFileSync(MdPath, fileContent);
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// glob("../../CoCreate-components/CoCreate-filter/CoCreate.config.js", globUpdater);
|
|
72
|
-
glob("../../CoCreate-components/*/CoCreate.config.js", globUpdater);
|
|
73
|
-
glob("../../CoCreate-apps/*/CoCreate.config.js", globUpdater);
|
|
74
|
-
glob("../../CoCreate-plugins/*/CoCreate.config.js", globUpdater);
|
|
75
|
-
// glob("../CoCreateCSS/CoCreate.config.js", globUpdater);
|
|
76
|
-
// glob("../CoCreateJS/CoCreate.config.js", globUpdater);
|
|
77
|
-
|
|
78
|
-
console.log('finished');
|
|
1
|
+
let glob = require("glob");
|
|
2
|
+
let fs = require('fs');
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
function globUpdater(er, files) {
|
|
6
|
+
if (er)
|
|
7
|
+
console.log(files, 'glob resolving issue');
|
|
8
|
+
else
|
|
9
|
+
files.forEach(filename => update(filename));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
function update(MdPath) {
|
|
16
|
+
let name = path.basename(path.resolve(path.dirname(MdPath), './')).substring(9);
|
|
17
|
+
let document_id = '';
|
|
18
|
+
let replaceContent = fs.readFileSync(MdPath).toString();
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
let content_source = replaceContent.substring(replaceContent.indexOf("sources"));
|
|
22
|
+
let content1 = content_source.substring(content_source.indexOf("document_id"));
|
|
23
|
+
let content2 = content1.substring(content1.indexOf(':'));
|
|
24
|
+
document_id = content2.substring(3, content2.indexOf(',') - 4);
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
let fileContent = `module.exports = {
|
|
28
|
+
"config": {
|
|
29
|
+
"organization_id": "5ff747727005da1c272740ab",
|
|
30
|
+
"key": "2061acef-0451-4545-f754-60cf8160",
|
|
31
|
+
"host": "general.cocreate.app"
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"sources": [
|
|
35
|
+
{
|
|
36
|
+
"collection": "files",
|
|
37
|
+
"document": {
|
|
38
|
+
"_id": "${document_id}",
|
|
39
|
+
"name": "index.html",
|
|
40
|
+
"path": "/docs/${name}/index.html",
|
|
41
|
+
"src": "{{./docs/index.html}}",
|
|
42
|
+
"hosts": [
|
|
43
|
+
"general.cocreate.app"
|
|
44
|
+
],
|
|
45
|
+
"directory": "/docs/${name}",
|
|
46
|
+
"parentDirectory": "{{parentDirectory}}",
|
|
47
|
+
"content-type": "{{content-type}}",
|
|
48
|
+
"public": "true",
|
|
49
|
+
"website_id": "644d4bff8036fb9d1d1fd69c"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
if (!document_id.length)
|
|
58
|
+
console.log("Document_id Undefined: ", MdPath);
|
|
59
|
+
if (document_id.length != 24 && document_id.length != 0 )
|
|
60
|
+
console.log("Document_id not valid! please check your config: ", MdPath);
|
|
61
|
+
else {
|
|
62
|
+
console.log(MdPath, " -> document_id : ", document_id);
|
|
63
|
+
if (fs.existsSync(MdPath))
|
|
64
|
+
fs.unlinkSync(MdPath);
|
|
65
|
+
fs.writeFileSync(MdPath, fileContent);
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// glob("../../CoCreate-components/CoCreate-filter/CoCreate.config.js", globUpdater);
|
|
72
|
+
glob("../../CoCreate-components/*/CoCreate.config.js", globUpdater);
|
|
73
|
+
glob("../../CoCreate-apps/*/CoCreate.config.js", globUpdater);
|
|
74
|
+
glob("../../CoCreate-plugins/*/CoCreate.config.js", globUpdater);
|
|
75
|
+
// glob("../CoCreateCSS/CoCreate.config.js", globUpdater);
|
|
76
|
+
// glob("../CoCreateJS/CoCreate.config.js", globUpdater);
|
|
77
|
+
|
|
78
|
+
console.log('finished');
|