Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 39 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"@blockly/block-test": "^6.0.4",
"@blockly/dev-tools": "^8.0.4",
"@blockly/theme-modern": "^6.0.3",
"@hyperjump/browser": "^1.1.4",
"@hyperjump/json-schema": "^1.5.0",
"@microsoft/api-documenter": "^7.22.4",
"@microsoft/api-extractor": "^7.29.5",
Expand Down
17 changes: 10 additions & 7 deletions tests/migration/validate-renamings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import JSON5 from 'json5';
import {readFile} from 'fs/promises';
import {posixPath} from '../../scripts/helpers.js';
import {validate} from '@hyperjump/json-schema/draft-2020-12';
import {DETAILED} from '@hyperjump/json-schema/experimental';
import {BASIC} from '@hyperjump/json-schema/experimental';

/** @type {URL} Renaming schema filename. */
const SCHEMA_URL = new URL('renamings.schema.json', import.meta.url);
Expand All @@ -29,12 +29,15 @@ const RENAMINGS_URL = new URL(
const renamingsJson5 = await readFile(RENAMINGS_URL);
const renamings = JSON5.parse(renamingsJson5);

const output = await validate(SCHEMA_URL, renamings, DETAILED);
const output = await validate(SCHEMA_URL, renamings, BASIC);

if (!output.valid) {
console.log('Renamings file is invalid.');
console.log('Maybe this validator output will help you find the problem:');
console.log(JSON5.stringify(output, undefined, ' '));
console.error(`Renamings file is invalid. First error occurs at:
${output.errors[0].instanceLocation}`);
console.info(
`Here is the full validator output, in case that helps:\n`,
output,
);
process.exit(1);
}

Expand All @@ -45,7 +48,7 @@ Object.entries(renamings).forEach(([version, modules]) => {
const seen = new Set();
for (const {oldName} of modules) {
if (seen.has(oldName)) {
console.log(
console.error(
`Duplicate entry for module ${oldName} ` + `in version ${version}.`,
);
ok = false;
Expand All @@ -54,7 +57,7 @@ Object.entries(renamings).forEach(([version, modules]) => {
}
});
if (!ok) {
console.log('Renamings file is invalid.');
console.error('Renamings file is invalid.');
process.exit(1);
}
// Default is a successful exit 0.