From e61bbe82c5e747f7136b49f87220b20e128552ab Mon Sep 17 00:00:00 2001 From: Paulo Pinto Date: Fri, 20 Dec 2024 15:09:54 +0000 Subject: [PATCH] Guarantee that src/plugin/schema.json is up-to-date --- schema/build.mjs | 7 ++++++- webpack.config.cjs | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/schema/build.mjs b/schema/build.mjs index 300b45da..cce3f17f 100755 --- a/schema/build.mjs +++ b/schema/build.mjs @@ -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 ) ); @@ -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 ); diff --git a/webpack.config.cjs b/webpack.config.cjs index 2bff9c26..35e7d66f 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -215,7 +215,6 @@ class EmitSubjectsSchemaPlugin { }, async ( assets, callback ) => { execSync( './schema/build.mjs', { stdio: 'inherit' } ); - copyFileSync( SCHEMA_SRC, SCHEMA_PLUGIN_PATH ); callback(); } );