Skip to content

Commit

Permalink
Guarantee that src/plugin/schema.json is up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
psrpinto committed Dec 20, 2024
1 parent 2dc556a commit e61bbe8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion schema/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { Ajv } from 'ajv';
import { fileURLToPath } from 'url';
import * as path from 'node:path';
import { readFileSync } from 'node:fs';
import { copyFileSync, readFileSync } from 'node:fs';
import * as fs from 'node:fs';

const cwd = path.dirname( fileURLToPath( import.meta.url ) );
Expand Down Expand Up @@ -64,4 +64,9 @@ fs.writeFileSync(
JSON.stringify( outputSchema, null, '\t' )
);

copyFileSync(
outputSchemaPath,
path.join( cwd, '..', 'src', 'plugin', 'schema.json' )
);

console.log( 'Schema file generated successfully:', outputSchemaPath );
1 change: 0 additions & 1 deletion webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ class EmitSubjectsSchemaPlugin {
},
async ( assets, callback ) => {
execSync( './schema/build.mjs', { stdio: 'inherit' } );
copyFileSync( SCHEMA_SRC, SCHEMA_PLUGIN_PATH );
callback();
}
);
Expand Down

0 comments on commit e61bbe8

Please sign in to comment.