Remove automatic first run
This commit is contained in:
parent
c7096db568
commit
8816b0292b
@ -30,6 +30,9 @@
|
||||
},
|
||||
"redeploy_path": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_run": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": ["start", "preflight"]
|
||||
|
@ -31,12 +31,14 @@ let childProcess = null;
|
||||
* @param {string[] | string} param0.preflight
|
||||
* @param {string} param0.redeploy_file
|
||||
* @param {string | number} [param0.port]
|
||||
* @param {boolean} [param0.first_run] - Whether to run the preflight on first run. Default `false`
|
||||
*/
|
||||
function startProcess({ command, preflight, redeploy_file, port }) {
|
||||
function startProcess({ command, preflight, redeploy_file, port, first_run }) {
|
||||
try {
|
||||
console.log("First Run ...");
|
||||
|
||||
const runPreflight = preflightFn(preflight);
|
||||
if (first_run) {
|
||||
console.log("First Run ...");
|
||||
const runPreflight = preflightFn(preflight);
|
||||
}
|
||||
|
||||
if (!preflight) {
|
||||
console.log(
|
||||
@ -164,7 +166,7 @@ function preflightFn(preflight) {
|
||||
} else if (typeof preflight == "object" && preflight?.[0]) {
|
||||
preflight.forEach((cmd, index) => {
|
||||
try {
|
||||
execSync(cmd, options);
|
||||
const execCmd = execSync(cmd, options);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
`${colors.FgRed}Error:${colors.Reset} Preflight command ${cmd} Failed! => ${error.message}`
|
||||
|
3
index.js
3
index.js
@ -25,7 +25,7 @@ try {
|
||||
/** @type {NodeCIConfig} */
|
||||
const config = JSON.parse(configText);
|
||||
|
||||
const { start, preflight, redeploy_path } = config;
|
||||
const { start, preflight, redeploy_path, first_run } = config;
|
||||
|
||||
/** @type {string | undefined} */
|
||||
let redeployFile;
|
||||
@ -53,6 +53,7 @@ try {
|
||||
command: start,
|
||||
preflight,
|
||||
redeploy_file: redeployFile,
|
||||
first_run,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nodecid",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Simple CI/CD process",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
@ -5,4 +5,5 @@
|
||||
* the application starts, or a single `.sh` file path.
|
||||
* @property {string} [redeploy_path] - The path to the file that will trigger a
|
||||
* redeployment if content is changed. Default file path is `./REDEPLOY`
|
||||
* @property {boolean} [first_run] - Whether to run the preflight on first run. Default `false`
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user