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