@bentley/app-schema-validator 1.0.4 → 1.0.8

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/README.md CHANGED
@@ -8,7 +8,7 @@ The purpose of this NPM CLI tool is to validate the schemas present within an ap
8
8
 
9
9
  ### Prerequisites
10
10
 
11
- - [Node](https://nodejs.org/en/): an installation of the latest security patch of Node 20. The Node installation also includes the **npm** package manager.
11
+ - [Node](https://nodejs.org/en/): an installation of Node 24.15. The Node installation also includes the **npm** package manager.
12
12
 
13
13
  ### Installation
14
14
 
@@ -8,8 +8,8 @@ exports.verifyAppSchemas = verifyAppSchemas;
8
8
  exports.generateAppSchemaDirectoryList = generateAppSchemaDirectoryList;
9
9
  const fs = require("fs");
10
10
  const path = require("path");
11
- const chalk = require("chalk");
12
- const readdirp = require("readdirp");
11
+ const chalk_1 = require("chalk");
12
+ const readdirp_1 = require("readdirp");
13
13
  const Reporter_1 = require("@bentley/imodel-schema-validator/lib/Reporter");
14
14
  const ecschema_locaters_1 = require("@itwin/ecschema-locaters");
15
15
  const utils_1 = require("./utils");
@@ -58,7 +58,7 @@ async function applyValidations(schemaDir, schemaFile, appSchemaDirs, releasedSc
58
58
  await (0, imodel_schema_validator_1.validateSchema)(name, version, appSchemaPath, releasedSchemaDirectories, validationResult, output);
59
59
  releasedSchemaDirectories = fixReleasedSchemaDirectories(schemaDir, releasedSchemaDirectories);
60
60
  if ((0, imodel_schema_validator_1.isDynamicSchema)(appSchemaPath)) {
61
- console.log(chalk.grey(`Skipping difference audit for ${name} ${version}.
61
+ console.log(chalk_1.default.grey(`Skipping difference audit for ${name} ${version}.
62
62
  The schema is a dynamic schema and released versions of dynamic schemas are not saved.`));
63
63
  Reporter_1.Reporter.writeToLogFile(name, version, `Skipping difference audit for ${name}.${version}.
64
64
  The schema is a dynamic schema and released versions of dynamic schemas are not saved.\n`, output);
@@ -77,12 +77,12 @@ async function applyValidations(schemaDir, schemaFile, appSchemaDirs, releasedSc
77
77
  }
78
78
  if (!releasedSchemaPath) {
79
79
  if ((0, imodel_schema_validator_1.isDynamicSchema)(appSchemaPath)) {
80
- console.log(chalk.grey("Skipping difference audit for ", name, version, ". No released schema found."));
80
+ console.log(chalk_1.default.grey("Skipping difference audit for ", name, version, ". No released schema found."));
81
81
  Reporter_1.Reporter.writeToLogFile(name, version, `Skipping difference audit for ${name}.${version}. No released schema found.\n`, output);
82
82
  validationResult.comparer = imodel_schema_validator_1.iModelValidationResultTypes.Skipped;
83
83
  }
84
84
  else {
85
- console.log(chalk.grey("Skipping difference audit for ", name, version, ". No released schema found."));
85
+ console.log(chalk_1.default.grey("Skipping difference audit for ", name, version, ". No released schema found."));
86
86
  Reporter_1.Reporter.writeToLogFile(name, version, `Skipping difference audit for ${name}.${version}. No released schema found.\n`, output);
87
87
  validationResult.comparer = imodel_schema_validator_1.iModelValidationResultTypes.NotFound;
88
88
  }
@@ -123,8 +123,12 @@ function fixReleasedSchemaDirectories(appSchemaDir, releasedSchemaDirectories) {
123
123
  */
124
124
  async function generateAppSchemaDirectoryList(appDirectory) {
125
125
  // Skip schemas from platform based licensing-addon e.g licensing-win32-x64
126
- const filter = { fileFilter: "*.ecschema.xml", directoryFilter: ["!.vscode", "!licensing-*"] };
127
- const schemaPaths = (await readdirp.promise(appDirectory, filter)).map((entry) => path.dirname(entry.fullPath));
126
+ const filter = {
127
+ fileFilter: (entry) => entry.basename.endsWith(".ecschema.xml"),
128
+ directoryFilter: (entry) => entry.basename !== ".vscode" && !entry.basename.startsWith("licensing-"),
129
+ };
130
+ const entries = await (0, readdirp_1.readdirpPromise)(appDirectory, filter);
131
+ const schemaPaths = entries.map((entry) => path.dirname(entry.fullPath));
128
132
  return Array.from(new Set(schemaPaths).keys());
129
133
  }
130
134
  //# sourceMappingURL=AppSchemaValidator.js.map
package/lib/utils.js CHANGED
@@ -9,15 +9,20 @@ exports.getExcludeSchemaList = getExcludeSchemaList;
9
9
  exports.shouldExcludeSchema = shouldExcludeSchema;
10
10
  const fs = require("fs");
11
11
  const path = require("path");
12
- const readdirp = require("readdirp");
12
+ const readdirp_1 = require("readdirp");
13
13
  /**
14
14
  * Find released schemas directories
15
15
  * @schemaDirectory Directory to search for schema files
16
16
  * @returns Array containing released schemas directories
17
17
  */
18
18
  async function generateSchemaDirectoryLists(schemaDirectory) {
19
- const filter = { fileFilter: "*.ecschema.xml", directoryFilter: ["!node_modules", "!.vscode", "!tools"] };
20
- const allSchemaDirs = (await readdirp.promise(schemaDirectory, filter)).map((schemaPath) => path.dirname(schemaPath.fullPath));
19
+ const excludeDirs = new Set(["node_modules", ".vscode", "tools"]);
20
+ const filter = {
21
+ fileFilter: (entry) => entry.basename.endsWith(".ecschema.xml"),
22
+ directoryFilter: (entry) => !excludeDirs.has(entry.basename),
23
+ };
24
+ const entries = await (0, readdirp_1.readdirpPromise)(schemaDirectory, filter);
25
+ const allSchemaDirs = entries.map((schemaPath) => path.dirname(schemaPath.fullPath));
21
26
  return Array.from(new Set(allSchemaDirs.filter((schemaDir) => /released/i.test(schemaDir))).keys());
22
27
  }
23
28
  /**
package/package.json CHANGED
@@ -11,31 +11,31 @@
11
11
  "name": "Bentley Systems, Inc.",
12
12
  "url": "http://www.bentley.com"
13
13
  },
14
- "version": "1.0.4",
14
+ "version": "1.0.8",
15
15
  "bin": {
16
16
  "app-schema-validator": "./bin/index.js"
17
17
  },
18
18
  "dependencies": {
19
- "@itwin/ecschema-locaters": "5.5.2",
20
- "@itwin/ecschema-metadata": "5.5.2",
21
- "@bentley/imodel-schema-validator": "1.0.4",
22
- "chalk": "^3.0.0",
23
- "commander": "^2.19.0",
24
- "readdirp": "^3.0.0",
25
- "rimraf": "^6.0.1"
19
+ "@itwin/ecschema-locaters": "5.9.3",
20
+ "@itwin/ecschema-metadata": "5.9.3",
21
+ "@bentley/imodel-schema-validator": "1.0.8",
22
+ "chalk": "^5.6.2",
23
+ "commander": "^14.0.3",
24
+ "readdirp": "^5.0.0",
25
+ "rimraf": "^6.1.3"
26
26
  },
27
27
  "devDependencies": {
28
- "@itwin/eslint-plugin": "^4.0.2",
29
- "@itwin/build-tools": "5.5.2",
28
+ "@itwin/eslint-plugin": "^6.1.0",
29
+ "@itwin/build-tools": "5.9.3",
30
30
  "@types/node": "~20.17.0",
31
31
  "@types/chai": "4.3.1",
32
32
  "@types/mocha": "^10.0.6",
33
- "cpx2": "^8.0.0",
33
+ "cpx2": "^8.0.2",
34
34
  "typescript": "~5.6.2",
35
35
  "chai": "^4.3.10",
36
- "mocha": "^11.1.0",
36
+ "mocha": "^11.7.5",
37
37
  "nyc": "^17.1.0",
38
- "eslint": "^8.56.0"
38
+ "eslint": "^9.39.4"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsc 1>&2 && npm run copy:assets && npm run copy:test-assets",