scripts-orchestrator 2.9.0 → 2.10.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/README.md +18 -0
- package/index.js +6 -1
- package/lib/orchestrator.js +12 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -263,6 +263,9 @@ The orchestrator doesn't care what the commands do - it just ensures they run (i
|
|
|
263
263
|
|
|
264
264
|
# Specify a custom log folder
|
|
265
265
|
npm run scripts-orchestrator -- --logFolder ./custom-logs
|
|
266
|
+
|
|
267
|
+
# Force execution even if git state is unchanged
|
|
268
|
+
npm run scripts-orchestrator -- --force
|
|
266
269
|
```
|
|
267
270
|
|
|
268
271
|
### Starting from a Specific Phase
|
|
@@ -422,6 +425,21 @@ This feature is particularly useful in CI/CD pipelines where the same commit mig
|
|
|
422
425
|
|
|
423
426
|
**Note**: The cache is only updated on successful execution. Failed runs will not update the cache, ensuring subsequent runs will retry.
|
|
424
427
|
|
|
428
|
+
### Force Execution
|
|
429
|
+
|
|
430
|
+
You can bypass the git cache check and force execution even when the git state is unchanged by using the `--force` flag:
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Force execution regardless of git state
|
|
434
|
+
npm run scripts-orchestrator -- --force
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
This is useful when you want to:
|
|
438
|
+
- Re-run commands without making code changes
|
|
439
|
+
- Test configuration changes
|
|
440
|
+
- Debug issues without modifying the codebase
|
|
441
|
+
- Override the cache in CI/CD pipelines
|
|
442
|
+
|
|
425
443
|
## Exit Codes
|
|
426
444
|
|
|
427
445
|
- `0`: All commands executed successfully
|
package/index.js
CHANGED
|
@@ -35,6 +35,10 @@ const argv = yargs(hideBin(process.argv))
|
|
|
35
35
|
type: 'boolean',
|
|
36
36
|
description: 'Run all commands sequentially instead of in parallel (for low CPU machines)',
|
|
37
37
|
})
|
|
38
|
+
.option('force', {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
description: 'Force execution even if git state is unchanged',
|
|
41
|
+
})
|
|
38
42
|
.help()
|
|
39
43
|
.alias('h', 'help')
|
|
40
44
|
.parse();
|
|
@@ -46,6 +50,7 @@ let startPhase = argv.phase;
|
|
|
46
50
|
let logFolder = argv.logFolder;
|
|
47
51
|
const phases = argv.phases ? argv.phases.split(',').map(p => p.trim()) : null;
|
|
48
52
|
const sequential = argv.sequential || false;
|
|
53
|
+
const force = argv.force || false;
|
|
49
54
|
|
|
50
55
|
// Validate config file exists
|
|
51
56
|
if (!fs.existsSync(configPath)) {
|
|
@@ -75,7 +80,7 @@ if (logFolder) {
|
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
// Create and run the orchestrator
|
|
78
|
-
const orchestrator = new Orchestrator(commandsConfig, startPhase, logFolder, phases, sequential);
|
|
83
|
+
const orchestrator = new Orchestrator(commandsConfig, startPhase, logFolder, phases, sequential, force);
|
|
79
84
|
|
|
80
85
|
// Enhanced signal handlers
|
|
81
86
|
const handleSignal = async (signal) => {
|
package/lib/orchestrator.js
CHANGED
|
@@ -4,12 +4,13 @@ import { log } from './logger.js';
|
|
|
4
4
|
import { GitCache } from './git-cache.js';
|
|
5
5
|
|
|
6
6
|
export class Orchestrator {
|
|
7
|
-
constructor(config, startPhase = null, logFolder = null, phases = null, sequential = false) {
|
|
7
|
+
constructor(config, startPhase = null, logFolder = null, phases = null, sequential = false, force = false) {
|
|
8
8
|
this.config = config;
|
|
9
9
|
this.startPhase = startPhase;
|
|
10
10
|
this.logFolder = logFolder;
|
|
11
11
|
this.phases = phases;
|
|
12
12
|
this.sequential = sequential;
|
|
13
|
+
this.force = force;
|
|
13
14
|
this.processManager = processManager;
|
|
14
15
|
this.healthCheck = healthCheck;
|
|
15
16
|
this.logger = log;
|
|
@@ -240,11 +241,16 @@ export class Orchestrator {
|
|
|
240
241
|
|
|
241
242
|
async run() {
|
|
242
243
|
try {
|
|
243
|
-
// Check if we should skip execution based on git state
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
244
|
+
// Check if we should skip execution based on git state (unless forced)
|
|
245
|
+
if (!this.force) {
|
|
246
|
+
const shouldSkip = await this.gitCache.shouldSkipExecution();
|
|
247
|
+
if (shouldSkip) {
|
|
248
|
+
this.logger.success('🎉 No changes detected, skipping execution!');
|
|
249
|
+
this.logger.info('💡 To force execution, use: --force');
|
|
250
|
+
process.exit(0);
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
this.logger.info('⚡ Force execution enabled, skipping git cache check');
|
|
248
254
|
}
|
|
249
255
|
|
|
250
256
|
let hasFailures = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scripts-orchestrator",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "A powerful script orchestrator for running parallel commands with dependency management, background processes, and health checks",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|