None of the content push was working.
here is the patch file to make this work. It would be nice if some could use the path
and make this cross-platform.
Attach is the changes where this can be applied to make it work in Mac.
diff --git a/lib/setupscripts/cmd.js b/lib/setupscripts/cmd.js
index a9c3e6d..76e435f 100644
--- a/lib/setupscripts/cmd.js
+++ b/lib/setupscripts/cmd.js
@@ -1,36 +1,34 @@
-const color = require('./colorConstants');
+const color = require("./colorConstants");
+async function runCommand(command) {
+ const { exec } = require("child_process");
+ try {
+ await exec(command, (error, stdout, stderr) => {
+ if (error) {
+ console.log(color.ERROR, `error: ${error.message}`);
+ return "ERROR";
+ }
+ if (stderr) {
+ console.log(color.ERROR, `stderr: ${stderr}`);
+ return "STDERROR";
+ }
+ console.log(color.INFO, `${stdout}`);
+ });
+ } catch (error) {
+ console.log(color.ERROR, "Error (runCommand): " + error);
+ }
-async function runCommand (command) {
- const { exec } = require("child_process");
- try {
- await exec(command, (error, stdout, stderr) => {
- if (error) {
- console.log(color.ERROR,`error: ${error.message}`);
- return 'ERROR';
- }
- if (stderr) {
- console.log(color.ERROR,`stderr: ${stderr}`);
- return 'STDERROR';
- }
- console.log(color.INFO,`${stdout}`);
- });
- } catch(error) {
- console.log(color.ERROR,'Error (runCommand): ' + error)
- }
-
- return 'OK';
+ return "OK";
}
function getRootDirectory() {
-
- var root = __dirname.replace("\\lib\\setupscripts","");;
- return root;
+ var root = __dirname.replace("/lib/setupscripts", "");
+ return root;
}
function sleep(ms) {
- return new Promise((resolve) => {
- setTimeout(resolve, ms);
- });
- }
-module.exports = {runCommand,getRootDirectory,sleep}
\ No newline at end of file
+ return new Promise((resolve) => {
+ setTimeout(resolve, ms);
+ });
+}
+module.exports = { runCommand, getRootDirectory, sleep };
diff --git a/lib/setupscripts/serialize.js b/lib/setupscripts/serialize.js
index 52adaba..735513a 100644
--- a/lib/setupscripts/serialize.js
+++ b/lib/setupscripts/serialize.js
@@ -1,25 +1,36 @@
-const cmd = require('./cmd');
-const color = require('./colorConstants');
+const cmd = require("./cmd");
+const color = require("./colorConstants");
//Push Content Types
async function pushContentTypes() {
- console.log(color.INFO,'Push Content Types...');
- var status = await cmd.runCommand("ch-one-cli ser push content-type -f \"" + cmd.getRootDirectory() + "\\serialization\"");
- return status;
+ console.log(color.INFO, "Push Content Types...");
+ var status = await cmd.runCommand(
+ 'ch-one-cli ser push content-type -f "' +
+ cmd.getRootDirectory() +
+ '/serialization"'
+ );
+ return status;
}
-
-
//Push Content Items
async function pushContentItems(contentType) {
- console.log(color.INFO,'Push Content Items for ContentType: ' + contentType + '...');
- try {
- var status = await cmd.runCommand("ch-one-cli serialization push content-item -c " + contentType + " -f \"" + cmd.getRootDirectory() + "\\serialization\"");
- } catch (error) {
- console.log(color.ERROR,'Error (pushContentItems): ' + error)
- return status;
- }
- return status;
+ console.log(
+ color.INFO,
+ "Push Content Items for ContentType: " + contentType + "..."
+ );
+ try {
+ var status = await cmd.runCommand(
+ "ch-one-cli serialization push content-item -c " +
+ contentType +
+ " -f " +
+ cmd.getRootDirectory() +
+ "/serialization/"
+ );
+ } catch (error) {
+ console.log(color.ERROR, "Error (pushContentItems): " + error);
+ return status;
+ }
+ return status;
}
-module.exports = {pushContentTypes,pushContentItems}
\ No newline at end of file
+module.exports = { pushContentTypes, pushContentItems };