cob-cli 2.29.0 → 2.31.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/bin/cob-cli.js +1 -0
- package/lib/commands/customize.js +129 -79
- package/lib/commands/init.js +1 -1
- package/lib/commands/test.js +1 -2
- package/lib/task_lists/common_enviromentHandler.js +1 -1
- package/lib/task_lists/common_helpers.js +1 -1
- package/lib/task_lists/common_releaseManager.js +2 -2
- package/lib/task_lists/deploy_execute.js +1 -1
- package/lib/task_lists/deploy_validate.js +1 -1
- package/lib/task_lists/init_existingProject.js +1 -1
- package/lib/task_lists/init_newProject.js +1 -1
- package/lib/task_lists/test_customUIsContinuosReload.js +4 -3
- package/lib/task_lists/test_otherFilesContiousReload.js +2 -2
- package/lib/task_lists/test_validate.js +1 -1
- package/lib/webpack/webpack.config.js +33 -26
- package/package.json +7 -6
package/bin/cob-cli.js
CHANGED
|
@@ -36,6 +36,7 @@ program
|
|
|
36
36
|
.option('-f --force', 'skips comparisons')
|
|
37
37
|
.option('-c --cache', 'cache all customizations')
|
|
38
38
|
.option('-l --local', 'use local files')
|
|
39
|
+
.option('-u --update', 'update all previsously added customizations')
|
|
39
40
|
.description('Interactive prompt to customize an aspect of the server')
|
|
40
41
|
.action( customize );
|
|
41
42
|
|
|
@@ -4,72 +4,112 @@ const path = require("path");
|
|
|
4
4
|
const { checkVersion } = require("./upgradeRepo");
|
|
5
5
|
const { checkWorkingCopyCleanliness } = require("../task_lists/common_helpers");
|
|
6
6
|
const axios = require("axios");
|
|
7
|
-
const git = require("simple-git
|
|
7
|
+
const git = require("simple-git");
|
|
8
8
|
const ncp = require("ncp");
|
|
9
9
|
const { Transform } = require("stream");
|
|
10
10
|
const fg = require("fast-glob");
|
|
11
11
|
const fs = require("fs-extra");
|
|
12
12
|
|
|
13
|
+
const customizationsVersionsFile = "customizations.json";
|
|
14
|
+
|
|
13
15
|
/* ************************************************************************ */
|
|
14
16
|
async function customize(filter, args) {
|
|
15
17
|
try {
|
|
16
18
|
console.log("Customize...");
|
|
17
|
-
checkVersion();
|
|
18
|
-
if (!args.force) await checkWorkingCopyCleanliness();
|
|
19
|
+
if (!args.cache) checkVersion();
|
|
20
|
+
if (!args.force && !args.cache) await checkWorkingCopyCleanliness();
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
if (args.cache) {
|
|
23
|
+
await cacheAllCustomizations(filter, args);
|
|
24
|
+
|
|
25
|
+
} else if (args.update) {
|
|
26
|
+
await updatePreviouslyAppliedCostumizations(filter, args);
|
|
27
|
+
|
|
28
|
+
} else {
|
|
29
|
+
const customizationRepo = await getCustomizationRepo(filter, args);
|
|
30
|
+
await applyCustomization(customizationRepo, args);
|
|
31
|
+
|
|
32
|
+
console.log( colors.green("\nDone"), "\nCheck changes to your git working tree and try:" );
|
|
33
|
+
console.log( "\tcob-cli test\n" );
|
|
34
|
+
}
|
|
23
35
|
|
|
24
|
-
console.log( colors.green("\nDone"), "\nCheck changes to your git working tree and try:" );
|
|
25
|
-
console.log( "\tcob-cli test\n" );
|
|
26
36
|
} catch (err) {
|
|
27
37
|
console.error("\n", err.message);
|
|
28
38
|
}
|
|
29
39
|
}
|
|
30
40
|
module.exports = customize;
|
|
31
41
|
|
|
42
|
+
/* ************************************************************************ */
|
|
43
|
+
async function updatePreviouslyAppliedCostumizations(filter, args) {
|
|
44
|
+
if (filter || args.cache) {
|
|
45
|
+
throw new Error("\nError: ".red + " incompatible options. Use of --update with filter or --cache.\n");
|
|
46
|
+
}
|
|
47
|
+
console.log("Updating all installed customizations...");
|
|
48
|
+
|
|
49
|
+
let customizationsVersions = {};
|
|
50
|
+
if(fs.existsSync(customizationsVersionsFile)) {
|
|
51
|
+
const customizationsVersionsRawData = fs.readFileSync(customizationsVersionsFile);
|
|
52
|
+
customizationsVersions = JSON.parse(customizationsVersionsRawData);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const customizationRepos = await getCustomizationRepo(null, args);
|
|
56
|
+
for (let customizationRepo of customizationRepos) {
|
|
57
|
+
if(customizationsVersions[customizationRepo.name]) {
|
|
58
|
+
await applyCustomization(customizationRepo, args);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* ************************************************************************ */
|
|
64
|
+
async function cacheAllCustomizations(filter, args) {
|
|
65
|
+
if (filter || args.local || args.update) {
|
|
66
|
+
throw new Error("\nError: ".red + " incompatible options. Use --cache as single argument\n");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
console.log("Caching all customizations...");
|
|
70
|
+
const customizationRepos = await getCustomizationRepo(null, args);
|
|
71
|
+
for (let customizationRepo of customizationRepos) {
|
|
72
|
+
await downloadCustomizationFiles(customizationRepo);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const { xdgData } = await import("xdg-basedir");
|
|
76
|
+
const cacheCustomizationsFile = path.resolve(xdgData, "cob-cli", "customizations.json")
|
|
77
|
+
fs.writeFileSync(cacheCustomizationsFile,
|
|
78
|
+
JSON.stringify(customizationRepos, null, 2),
|
|
79
|
+
(err) => {
|
|
80
|
+
if(err) throw new Error("\nError: ".red + " problem writing " + cacheCustomizationsFile + ":", err.message);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
32
85
|
/* ************************************************************************ */
|
|
33
86
|
async function getCustomizationRepo(filter, args) {
|
|
34
87
|
const { xdgData } = await import("xdg-basedir");
|
|
35
|
-
const
|
|
88
|
+
const cacheCustomizationsFile = path.resolve(xdgData,"cob-cli","customizations.json")
|
|
36
89
|
|
|
37
90
|
let customizationRepos;
|
|
38
91
|
let customizationNameQuery = "customize. " + (filter ? filter : "");
|
|
39
92
|
if (args.local) {
|
|
40
|
-
customizationRepos = JSON.parse(fs.readFileSync(
|
|
93
|
+
customizationRepos = JSON.parse(fs.readFileSync(cacheCustomizationsFile))
|
|
41
94
|
if (filter) {
|
|
42
95
|
customizationRepos = customizationRepos.filter(customizationRepo => customizationRepo.name.indexOf(filter) != -1)
|
|
43
96
|
}
|
|
44
97
|
} else {
|
|
45
98
|
// Get list of relevant customizations from github
|
|
46
|
-
|
|
47
|
-
"https://api.github.com/search/repositories?q=" +
|
|
48
|
-
customizationNameQuery + "+in:name+org:cob",
|
|
49
|
-
{ headers: { Accept: "application/json", "Accept-Encoding": "identity" } }
|
|
50
|
-
)
|
|
99
|
+
const response = await axios.get( "https://api.github.com/search/repositories?q=" + customizationNameQuery + "+in:name+org:cob", { headers: { Accept: "application/json", "Accept-Encoding": "identity" } } )
|
|
51
100
|
customizationRepos = response.data.items
|
|
52
101
|
}
|
|
53
102
|
|
|
54
|
-
//
|
|
55
|
-
if (
|
|
103
|
+
//If the goal is to cache or update customizations just return all customizations
|
|
104
|
+
if (args.cache || args.update) {
|
|
105
|
+
return customizationRepos;
|
|
106
|
+
}
|
|
56
107
|
|
|
57
|
-
// Asks for customization to apply
|
|
58
|
-
if (args.cache && args.local) {
|
|
59
|
-
throw new Error("\nError: ".red + " incompatible options, --local AND --cache\n");
|
|
60
|
-
} else if(args.cache) {
|
|
61
|
-
console.log("Caching all customizations...");
|
|
62
|
-
for( let customizationRepo of customizationRepos) {
|
|
63
|
-
await getCustomizationFiles(customizationRepo);
|
|
64
|
-
}
|
|
65
|
-
fs.writeFileSync( cacheCustomizations,
|
|
66
|
-
JSON.stringify(customizationRepos, null, 2),
|
|
67
|
-
(err) => {
|
|
68
|
-
if (err) console.log( "Error writing " + cacheCustomizations + ":", err.message);
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
108
|
|
|
109
|
+
// Throw error if there's no customization
|
|
110
|
+
if (customizationRepos.length == 0) throw new Error("\nError: ".red + " no customization found\n");
|
|
111
|
+
|
|
112
|
+
// Otherwise asks for customization to apply
|
|
73
113
|
let answer = await inquirer.prompt([
|
|
74
114
|
{
|
|
75
115
|
type: "list",
|
|
@@ -84,7 +124,7 @@ async function getCustomizationRepo(filter, args) {
|
|
|
84
124
|
}
|
|
85
125
|
|
|
86
126
|
/* ************************************************************************ */
|
|
87
|
-
async function
|
|
127
|
+
async function downloadCustomizationFiles(customizationRepo) {
|
|
88
128
|
const { xdgData } = await import("xdg-basedir");
|
|
89
129
|
const baseDir = process.cwd();
|
|
90
130
|
const cacheDir = path.resolve(xdgData,"cob-cli")
|
|
@@ -97,16 +137,20 @@ async function getCustomizationFiles(customizationRepo) {
|
|
|
97
137
|
} else {
|
|
98
138
|
console.log(" git pull " + customizationRepo.ssh_url);
|
|
99
139
|
process.chdir(customizationRepo.name);
|
|
100
|
-
|
|
140
|
+
try {
|
|
141
|
+
await git().pull();
|
|
142
|
+
} catch (error) { }
|
|
101
143
|
}
|
|
102
144
|
process.chdir(baseDir);
|
|
103
145
|
}
|
|
104
146
|
|
|
105
147
|
/* ************************************************************************ */
|
|
106
|
-
async function applyCustomization(customizationRepo) {
|
|
148
|
+
async function applyCustomization(customizationRepo, args) {
|
|
107
149
|
console.log("\nApplying " + customizationRepo.name + " customization ...");
|
|
108
150
|
|
|
109
151
|
// Get customization info from convention defined file (customize.js)
|
|
152
|
+
if (!args.local) await downloadCustomizationFiles(customizationRepo);
|
|
153
|
+
|
|
110
154
|
const { xdgData } = await import("xdg-basedir");
|
|
111
155
|
const customizationPath = path.resolve( xdgData, "cob-cli", customizationRepo.name);
|
|
112
156
|
const customizationFile = path.resolve( customizationPath, "customize.js");
|
|
@@ -126,7 +170,7 @@ async function applyCustomization(customizationRepo) {
|
|
|
126
170
|
customization.actions(customizationRepo.name, answers, copyAndMerge);
|
|
127
171
|
} else {
|
|
128
172
|
// Default actions
|
|
129
|
-
copyAndMerge(customizationRepo.name, answers);
|
|
173
|
+
await copyAndMerge(customizationRepo.name, answers);
|
|
130
174
|
}
|
|
131
175
|
|
|
132
176
|
// Update customizations.json file
|
|
@@ -166,50 +210,53 @@ async function copyAndMerge(customizationRepoName, substitutions = {}) {
|
|
|
166
210
|
// Source is on cob-cli customizationRepo and Destination on the server repo
|
|
167
211
|
const target = process.cwd() // Always copy to directory where command is being executed, ie, the root directory of the server repo
|
|
168
212
|
const substitutionRegex = /__(((?!word).)*)__/g;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
fs.
|
|
185
|
-
|
|
213
|
+
return new Promise((resolve, reject) => {
|
|
214
|
+
ncp(
|
|
215
|
+
source,
|
|
216
|
+
target,
|
|
217
|
+
{
|
|
218
|
+
clobber: true,
|
|
219
|
+
filter: (src) => src.match(excludedFiles) == null,
|
|
220
|
+
rename: function(target) {
|
|
221
|
+
// Don't rename __MERGE__ templates, they will be handled by the merge method
|
|
222
|
+
if (target.match(/__MERGE__/)) return target;
|
|
223
|
+
|
|
224
|
+
//get finalTarget from target with any existing substitution
|
|
225
|
+
const finalTarget = target.replace(substitutionRegex, (match,g1) => substitutions[g1] ? substitutions[g1] : match);
|
|
226
|
+
|
|
227
|
+
//if the directory of finalTarget doesn't exists it means that a replacement ocurred on the dirpath (ie, there was a /__.+__/ was on the dirpath), in which case we need to create the desired directory and remove the one just created by ncp
|
|
228
|
+
if (!fs.existsSync(path.dirname(finalTarget))) {
|
|
229
|
+
fs.mkdirSync(path.dirname(finalTarget), { recursive: true })
|
|
230
|
+
fs.rmdirSync(target.substring(0,target.lastIndexOf("__")+2), { recursive: true,force: false }) //NOTE: won't handle more than 1 substitution on the same dirpath
|
|
231
|
+
}
|
|
232
|
+
return finalTarget;
|
|
233
|
+
},
|
|
234
|
+
transform(read, write) {
|
|
235
|
+
const replaceVarsTransformFunction = new Transform({
|
|
236
|
+
transform: (chunk, encoding, done) => {
|
|
237
|
+
if(/\ufffd/.test(chunk) === true) {
|
|
238
|
+
// If chunk is binary don't change anything
|
|
239
|
+
done(null, chunk)
|
|
240
|
+
} else {
|
|
241
|
+
// Otherwise change any existing substitution
|
|
242
|
+
done(null,chunk.toString().replace(substitutionRegex, (match,g1) => substitutions[g1] ? substitutions[g1] : match))
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
read.pipe(replaceVarsTransformFunction).pipe(write)
|
|
186
247
|
}
|
|
187
|
-
return finalTarget;
|
|
188
248
|
},
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
done(null,chunk.toString().replace(substitutionRegex, (match,g1) => substitutions[g1] ? substitutions[g1] : match))
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
})
|
|
201
|
-
read.pipe(replaceVarsTransformFunction).pipe(write)
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
(error) => {
|
|
205
|
-
// If no error occurred then proced with merging files
|
|
206
|
-
if(!error) {
|
|
207
|
-
mergeFiles(customizationRepoName);
|
|
208
|
-
} else {
|
|
209
|
-
throw new Error(error.map((e) => e.message).join("\n"))
|
|
249
|
+
async (error) => {
|
|
250
|
+
// If no error occurred then proced with merging files
|
|
251
|
+
if(!error) {
|
|
252
|
+
await mergeFiles(customizationRepoName);
|
|
253
|
+
resolve();
|
|
254
|
+
} else {
|
|
255
|
+
reject(error.map((e) => e.message).join("\n"))
|
|
256
|
+
}
|
|
210
257
|
}
|
|
211
|
-
|
|
212
|
-
)
|
|
258
|
+
)
|
|
259
|
+
});
|
|
213
260
|
}
|
|
214
261
|
|
|
215
262
|
/* ************************************************************************ */
|
|
@@ -256,13 +303,16 @@ async function mergeFiles(block) {
|
|
|
256
303
|
|
|
257
304
|
/* ************************************************************************ */
|
|
258
305
|
function updateCustomizationsVersions(customizationKey, version) {
|
|
259
|
-
const customizationsVersionsFile = "customizations.json";
|
|
260
306
|
let customizationsVersions = {};
|
|
261
307
|
if(fs.existsSync(customizationsVersionsFile)) {
|
|
262
308
|
const customizationsVersionsRawData = fs.readFileSync(customizationsVersionsFile);
|
|
263
309
|
customizationsVersions = JSON.parse(customizationsVersionsRawData);
|
|
264
310
|
}
|
|
265
|
-
customizationsVersions
|
|
311
|
+
if(customizationsVersions[customizationKey]) {
|
|
312
|
+
customizationsVersions[customizationKey] = version
|
|
313
|
+
} else {
|
|
314
|
+
customizationsVersions = {[customizationKey]: version, ...customizationsVersions}
|
|
315
|
+
}
|
|
266
316
|
|
|
267
317
|
fs.writeFileSync(
|
|
268
318
|
customizationsVersionsFile,
|
package/lib/commands/init.js
CHANGED
|
@@ -4,7 +4,7 @@ const { newProjectTasks } = require("../task_lists/init_newProject");
|
|
|
4
4
|
const { existingProjectTasks } = require("../task_lists/init_existingProject");
|
|
5
5
|
const fs = require('fs-extra');
|
|
6
6
|
const axios = require('axios');
|
|
7
|
-
const git = require('simple-git
|
|
7
|
+
const git = require('simple-git');
|
|
8
8
|
|
|
9
9
|
/* ******************************** MAIN LOGIC **************************************** */
|
|
10
10
|
async function init(servername,args) {
|
package/lib/commands/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require('colors');
|
|
2
|
-
const opn = require('
|
|
2
|
+
const opn = require('open');
|
|
3
3
|
const { validateTestingConditions } = require("../task_lists/test_validate");
|
|
4
4
|
const { customUIsContinuosReload } = require("../task_lists/test_customUIsContinuosReload");
|
|
5
5
|
const { otherFilesContiousReload } = require("../task_lists/test_otherFilesContiousReload");
|
|
@@ -24,7 +24,6 @@ async function test (args) {
|
|
|
24
24
|
}
|
|
25
25
|
customUIsContinuosReload(cmdEnv, args.dashboard)
|
|
26
26
|
|
|
27
|
-
console.log( "\n" + (" NOTE: Press " + "O".bold.red + " to open default browser, " + "CTRL+C".bold.red + " or " + "Q".bold.red + " to stop the tests... ").yellow.bold + "\n\n" )
|
|
28
27
|
let key;
|
|
29
28
|
do {
|
|
30
29
|
key = await getKeypress()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('colors');
|
|
2
2
|
const execa = require('execa');
|
|
3
3
|
const fg = require('fast-glob');
|
|
4
|
-
const git = require('simple-git
|
|
4
|
+
const git = require('simple-git');
|
|
5
5
|
const fs = require('fs-extra');
|
|
6
6
|
const { getCurrentBranch } = require("./common_releaseManager");
|
|
7
7
|
const { SERVER_COB_CLI_DIRECTORY } = require("./common_helpers")
|
|
@@ -2,7 +2,7 @@ const SERVER_COB_CLI_DIRECTORY = "/opt/cob-cli/";
|
|
|
2
2
|
|
|
3
3
|
/* **************************************************************************************** */
|
|
4
4
|
async function checkWorkingCopyCleanliness(testNotDetached=true) {
|
|
5
|
-
const git = require('simple-git
|
|
5
|
+
const git = require('simple-git');
|
|
6
6
|
//Check we're not detached
|
|
7
7
|
if(testNotDetached) await git().revparse(["--abbrev-ref", "HEAD"]).then( currentBranch => { if(!currentBranch) throw new Error("Aborded:".red + " git head is dettached")} )
|
|
8
8
|
await git().fetch()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const execa = require('execa');
|
|
2
2
|
const fs = require('fs-extra');
|
|
3
|
-
const git = require('simple-git
|
|
3
|
+
const git = require('simple-git');
|
|
4
4
|
|
|
5
5
|
const SERVER_CHANGELOG = "/opt/cob-cli/DEPLOYLOG.md";
|
|
6
6
|
const LAST_SHA_FILE = "lastDeploySha"
|
|
@@ -33,7 +33,7 @@ async function registerRelease(cmdEnv) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// Maintain server deploy file log
|
|
36
|
-
const user = require(
|
|
36
|
+
const user = require("os").userInfo().username;
|
|
37
37
|
const date = new Date();
|
|
38
38
|
const dateStr = date.toISOString().slice(0,10).replace(/-/g,".")
|
|
39
39
|
const dateTimeStr = date.toISOString().slice(0,16).replace(/T/," ")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const Listr = require('listr');
|
|
2
2
|
const UpdaterRenderer = require('listr-update-renderer');
|
|
3
3
|
const verboseRenderer = require('listr-verbose-renderer');
|
|
4
|
-
const git = require('simple-git
|
|
4
|
+
const git = require('simple-git');
|
|
5
5
|
const { registerRelease } = require("./common_releaseManager");
|
|
6
6
|
const { copyFiles } = require("./common_syncFiles");
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@ require('colors');
|
|
|
2
2
|
const Listr = require('listr');
|
|
3
3
|
const UpdaterRenderer = require('listr-update-renderer');
|
|
4
4
|
const verboseRenderer = require('listr-verbose-renderer');
|
|
5
|
-
const git = require('simple-git
|
|
5
|
+
const git = require('simple-git');
|
|
6
6
|
const { checkWorkingCopyCleanliness, checkConnectivity } = require("./common_helpers");
|
|
7
7
|
const { getCurrentBranch, getLastDeployedSha } = require("./common_releaseManager");
|
|
8
8
|
const { testEquality } = require("./common_syncFiles");
|
|
@@ -3,7 +3,7 @@ const Listr = require('listr');
|
|
|
3
3
|
const fs = require('fs-extra');
|
|
4
4
|
const path = require('path')
|
|
5
5
|
const execa = require('execa');
|
|
6
|
-
const git = require('simple-git
|
|
6
|
+
const git = require('simple-git');
|
|
7
7
|
const UpdaterRenderer = require('listr-update-renderer');
|
|
8
8
|
const verboseRenderer = require('listr-verbose-renderer');
|
|
9
9
|
const { checkConnectivity } = require("./common_helpers");
|
|
@@ -20,7 +20,7 @@ async function customUIsContinuosReload(cmdEnv, dashboard) {
|
|
|
20
20
|
if(dashboardPathIsDirectory) {
|
|
21
21
|
// If we have a dashboard to serve run it from local dashboard directory on 8081 with vue-cli-service
|
|
22
22
|
// it will use its vue.config.js
|
|
23
|
-
console.log("\n
|
|
23
|
+
console.log("\n PLEASE WAIT".red + ": checking dependencies...")
|
|
24
24
|
await execa("npm",["install"],{cwd: dashboardPath} )
|
|
25
25
|
|
|
26
26
|
commands.push( {
|
|
@@ -33,14 +33,15 @@ async function customUIsContinuosReload(cmdEnv, dashboard) {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
console.log( "\n" + (" NOTE: Press " + "O".bold.red + " to open default browser, " + "CTRL+C".bold.red + " or " + "Q".bold.red + " to stop the tests... ").yellow.bold + "\n\n" )
|
|
37
|
+
|
|
36
38
|
commands.push({
|
|
37
39
|
// run wepback from cob-cli directory with webpack.config.js also from cob-cli directory
|
|
38
40
|
command: [
|
|
39
41
|
path.resolve(__dirname, '../../node_modules/.bin/webpack-dev-server'),
|
|
40
42
|
"--config",
|
|
41
43
|
path.resolve(__dirname, "../webpack/webpack.config.js"),
|
|
42
|
-
"--
|
|
43
|
-
"--env.DASHBOARD=" + dashboard
|
|
44
|
+
"--mode=development"
|
|
44
45
|
].join(" "),
|
|
45
46
|
name: 'customUIs server',
|
|
46
47
|
prefixColor: "blue"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const fs = require('fs-extra');
|
|
2
2
|
const execa = require('execa');
|
|
3
|
-
const git = require('simple-git
|
|
4
|
-
const user = require('whoami');
|
|
3
|
+
const git = require('simple-git');
|
|
5
4
|
const { SERVER_COB_CLI_DIRECTORY } = require("./common_helpers");
|
|
6
5
|
const { confirmExecutionOfChanges, resolveCobPath } = require("./common_syncFiles");
|
|
7
6
|
const { syncFile } = require("./test_syncFile");
|
|
@@ -124,6 +123,7 @@ async function addFileToCurrentTest(server, changedFile, changedFiles, changeTyp
|
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
if(!changedFiles.has(changedFile)) {
|
|
126
|
+
const user = require("os").userInfo().username;
|
|
127
127
|
execa('ssh', [server, "echo '" + changedFile + " by " + user + "' >> " + SERVER_IN_PROGRESS_TEST_FILE]);
|
|
128
128
|
changedFiles.add(changedFile);
|
|
129
129
|
}
|
|
@@ -4,7 +4,7 @@ const execa = require('execa');
|
|
|
4
4
|
const fs = require('fs-extra');
|
|
5
5
|
const UpdaterRenderer = require('listr-update-renderer');
|
|
6
6
|
const verboseRenderer = require('listr-verbose-renderer');
|
|
7
|
-
const git = require('simple-git
|
|
7
|
+
const git = require('simple-git');
|
|
8
8
|
const { checkConnectivity } = require("./common_helpers");
|
|
9
9
|
const { getCurrentBranch, getLastDeployedSha } = require("./common_releaseManager");
|
|
10
10
|
const { testEquality } = require("./common_syncFiles");
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const { env } = require('process');
|
|
3
2
|
|
|
4
3
|
module.exports = env => {
|
|
5
4
|
return {
|
|
@@ -7,37 +6,45 @@ module.exports = env => {
|
|
|
7
6
|
fake_customizations2: path.resolve(__dirname,'./fake_customizations2.js')
|
|
8
7
|
},
|
|
9
8
|
devServer: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
static : {
|
|
10
|
+
directory: '.',
|
|
11
|
+
watch: {
|
|
12
|
+
ignored: [
|
|
13
|
+
"**/.git/**",
|
|
14
|
+
"**/integrationm/**",
|
|
15
|
+
"**/recordm-importer/**",
|
|
16
|
+
"**/node_modules/**",
|
|
17
|
+
"**/node_modules/.cache/**",
|
|
18
|
+
"**/services/**",
|
|
19
|
+
"**/" + process.env.dash_dir + "/**"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
hot:false,
|
|
24
24
|
port: 8040,
|
|
25
25
|
host: "0.0.0.0",
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
devMiddleware: {
|
|
27
|
+
stats: {
|
|
28
|
+
maxModules: 0 // Set the maximum number of modules to be shown
|
|
29
|
+
}
|
|
28
30
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
setupMiddlewares: (middlewares, devServer) => {
|
|
32
|
+
middlewares.push({
|
|
33
|
+
name: 'hello-world-test-one',
|
|
34
|
+
// `path` is optional
|
|
35
|
+
path: '*',
|
|
36
|
+
middleware: (req, res, next) => {
|
|
37
|
+
// Permite usar / ou /DASH_BOARD/ quando acedido directamente
|
|
38
|
+
if(req.url != "/") {
|
|
39
|
+
return next();
|
|
40
|
+
}
|
|
41
|
+
res.redirect(`/recordm/`);
|
|
42
|
+
},
|
|
37
43
|
});
|
|
44
|
+
return middlewares;
|
|
38
45
|
},
|
|
39
46
|
proxy: {
|
|
40
|
-
[ "**/" + env.
|
|
47
|
+
[ "**/" + process.env.dash_dir + "/**"]: {
|
|
41
48
|
target: "http://localhost:8041",
|
|
42
49
|
secure: false
|
|
43
50
|
},
|
|
@@ -47,7 +54,7 @@ module.exports = env => {
|
|
|
47
54
|
},
|
|
48
55
|
"/": {
|
|
49
56
|
logLevel: "warn",
|
|
50
|
-
target: env.
|
|
57
|
+
target: process.env.server,
|
|
51
58
|
secure: false,
|
|
52
59
|
ws: false,
|
|
53
60
|
changeOrigin: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cob-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.0",
|
|
4
4
|
"description": "A command line utility to help Cult of Bits partners develop with higher speed and reusing common code and best practices.",
|
|
5
5
|
"preferGlobal": true,
|
|
6
6
|
"repository": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"cob-cli": "bin/cob-cli.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@webpack-cli/serve": "^2.0.1",
|
|
19
20
|
"axios": "^0.21.1",
|
|
20
21
|
"colors": "^1.4.0",
|
|
21
22
|
"commander": "^5.1.0",
|
|
@@ -27,11 +28,11 @@
|
|
|
27
28
|
"listr": "^0.14.3",
|
|
28
29
|
"ncp": "^2.0.0",
|
|
29
30
|
"omelette": "^0.4.15-1",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"webpack
|
|
33
|
-
"webpack-
|
|
34
|
-
"
|
|
31
|
+
"open": "^8.4.0",
|
|
32
|
+
"simple-git": "^3.15.1",
|
|
33
|
+
"webpack": "^5.75.0",
|
|
34
|
+
"webpack-cli": "^5.0.1",
|
|
35
|
+
"webpack-dev-server": "^4.11.1",
|
|
35
36
|
"xdg-basedir": "^5.1.0"
|
|
36
37
|
},
|
|
37
38
|
"keywords": [],
|