diff --git a/packages/fiori/package-scripts.cjs b/packages/fiori/package-scripts.cjs index 9dfa1e2eb405..d0d3ced336d7 100644 --- a/packages/fiori/package-scripts.cjs +++ b/packages/fiori/package-scripts.cjs @@ -15,7 +15,7 @@ const filterOut = [ const options = { port: 8081, portStep: 2, - ui5package: true, + dev: true, fioriPackage: true, typescript: true, noWatchTS: true, diff --git a/packages/main/package-scripts.cjs b/packages/main/package-scripts.cjs index d51a76d97b47..b0b5017282fc 100644 --- a/packages/main/package-scripts.cjs +++ b/packages/main/package-scripts.cjs @@ -5,7 +5,7 @@ const options = { portStep: 2, typescript: true, noWatchTS: true, - ui5package: true, + dev: true, }; const scripts = getScripts(options); diff --git a/packages/tools/components-package/nps.js b/packages/tools/components-package/nps.js index c1f25be3a790..f3de58642b10 100644 --- a/packages/tools/components-package/nps.js +++ b/packages/tools/components-package/nps.js @@ -136,8 +136,8 @@ const getScripts = (options) => { }, generateAPI: { default: `nps ${ tsOption ? "generateAPI.generateCEM generateAPI.validateCEM" : "generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest"}`, - generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.ui5package ? "--ui5package" : "" }`, - validateCEM: `node "${LIB}/cem/validate.js" ${ options.ui5package ? "--ui5package" : "" }`, + generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.dev ? "--ui5package" : "" }`, + validateCEM: `node "${LIB}/cem/validate.js" ${ options.dev ? "--ui5package" : "" }`, prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`, prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`, preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`, diff --git a/packages/tools/lib/cem/validate.js b/packages/tools/lib/cem/validate.js index b8aca0dbb9cf..d041f460f7de 100644 --- a/packages/tools/lib/cem/validate.js +++ b/packages/tools/lib/cem/validate.js @@ -40,34 +40,28 @@ const clearProps = (data) => { return data; } -const inputDataExternal = clearProps(JSON.parse(JSON.stringify(inputDataInternal))); - const ajv = new Ajv({ allowUnionTypes: true, allError: true }) - let validate = ajv.compile(internalSchema) // Validate the JSON data against the schema -if (validate(inputDataInternal)) { - console.log('Validation internal custom-elements successful'); -} else { - if (argv.ui5package) { - throw new Error(`Validation of internal custom-elements failed: ${validate.errors}`); +if (argv.ui5package) { + if (validate(inputDataInternal)) { + console.log('Internal custom element manifest is validated successfully'); } else { - console.error('Validation of internal custom-elements failed') + throw new Error(`Validation of internal custom elements manifest failed: ${validate.errors}`); } } +const inputDataExternal = clearProps(JSON.parse(JSON.stringify(inputDataInternal))); validate = ajv.compile(extenalSchema) // Validate the JSON data against the schema if (validate(inputDataExternal)) { - console.log('Validation external custom-elements successful'); + console.log('Custom element manifest is validated successfully'); fs.writeFileSync(inputFilePath, JSON.stringify(inputDataExternal, null, 2), 'utf8'); fs.writeFileSync(inputFilePath.replace("custom-elements", "custom-elements-internal"), JSON.stringify(inputDataInternal, null, 2), 'utf8'); } else { if (argv.ui5package) { - throw new Error(`Validation of external custom-elements failed: ${validate.errors}`); - } else { - console.error('Validation of external custom-elements failed') + throw new Error(`Validation of public custom elements manifest failed: ${validate.errors}`); } } \ No newline at end of file