@outputai/core 0.7.1-next.306c136.0 → 0.7.1-next.ad03627.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/package.json
CHANGED
|
@@ -314,7 +314,7 @@ export const hashSourceCode = async rootDir => {
|
|
|
314
314
|
try {
|
|
315
315
|
const { hash } = await hashElement( rootDir, {
|
|
316
316
|
folders: {
|
|
317
|
-
exclude: [ '.*', 'node_modules', 'test_coverage', 'vendor', 'test' ],
|
|
317
|
+
exclude: [ '.*', 'node_modules', 'test_coverage', 'vendor', 'test', 'logs', 'dist' ],
|
|
318
318
|
ignoreRootName: true
|
|
319
319
|
},
|
|
320
320
|
files: {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
findSharedActivitiesFromWorkflows,
|
|
12
12
|
importComponents,
|
|
13
13
|
findPackageRoot,
|
|
14
|
+
hashSourceCode,
|
|
14
15
|
isPackageRoot,
|
|
15
16
|
isPathDescendentFromNodeModules,
|
|
16
17
|
resolveNodeModulesPath,
|
|
@@ -568,6 +569,41 @@ describe( 'findSharedActivitiesFromWorkflows', () => {
|
|
|
568
569
|
} );
|
|
569
570
|
} );
|
|
570
571
|
|
|
572
|
+
describe( 'hashSourceCode', () => {
|
|
573
|
+
const writeSource = root => {
|
|
574
|
+
mkdirSync( join( root, 'src' ), { recursive: true } );
|
|
575
|
+
writeFileSync( join( root, 'package.json' ), JSON.stringify( { name: 'proj' } ) );
|
|
576
|
+
writeFileSync( join( root, 'src', 'workflow.js' ), 'export default {};\n' );
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
it( 'ignores excluded folders so accumulated run logs do not change the hash', async () => {
|
|
580
|
+
const baseline = join( TEMP_BASE, `hash-baseline-${Date.now()}` );
|
|
581
|
+
const withCruft = join( TEMP_BASE, `hash-cruft-${Date.now()}` );
|
|
582
|
+
writeSource( baseline );
|
|
583
|
+
writeSource( withCruft );
|
|
584
|
+
|
|
585
|
+
// The cruft tree is identical source plus large excluded artifacts that
|
|
586
|
+
// boot must not walk: local trace dumps under logs/ and build output under dist/.
|
|
587
|
+
for ( const excluded of [ 'logs', 'logs/runs', 'dist', 'node_modules' ] ) {
|
|
588
|
+
const dir = join( withCruft, excluded );
|
|
589
|
+
mkdirSync( dir, { recursive: true } );
|
|
590
|
+
writeFileSync( join( dir, 'dump.json' ), JSON.stringify( { blob: 'x'.repeat( 50_000 ) } ) );
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
expect( await hashSourceCode( withCruft ) ).toBe( await hashSourceCode( baseline ) );
|
|
594
|
+
} );
|
|
595
|
+
|
|
596
|
+
it( 'changes the hash when actual source changes', async () => {
|
|
597
|
+
const before = join( TEMP_BASE, `hash-src-before-${Date.now()}` );
|
|
598
|
+
const after = join( TEMP_BASE, `hash-src-after-${Date.now()}` );
|
|
599
|
+
writeSource( before );
|
|
600
|
+
writeSource( after );
|
|
601
|
+
writeFileSync( join( after, 'src', 'workflow.js' ), 'export default { changed: true };\n' );
|
|
602
|
+
|
|
603
|
+
expect( await hashSourceCode( after ) ).not.toBe( await hashSourceCode( before ) );
|
|
604
|
+
} );
|
|
605
|
+
} );
|
|
606
|
+
|
|
571
607
|
describe( 'staticMatchers', () => {
|
|
572
608
|
describe( 'workflowFile', () => {
|
|
573
609
|
it( 'matches paths ending with path separator and workflow.js', () => {
|