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
8 changes: 1 addition & 7 deletions scripts/generate-manifest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const { listModelFiles } = require('./utils');

const SEARCH_ROOTS = ['Published', 'Examples', 'Tutorials'];

Expand Down Expand Up @@ -120,13 +121,6 @@ function listMetadataFiles(dir, results = []) {
return results;
}

function listModelFiles(dir) {
return fs.readdirSync(dir, { withFileTypes: true })
.filter(entry => entry.isFile() && entry.name.endsWith('.bngl'))
.map(entry => entry.name)
.sort();
}

function buildEntry(root, metadata, metadataFile, modelFile, isCollection) {
const modelDir = path.dirname(metadataFile);
const relativeModelPath = path.relative(root, path.join(modelDir, modelFile)).replace(/\\/g, '/');
Expand Down
12 changes: 12 additions & 0 deletions scripts/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const fs = require('fs');

function listModelFiles(dir) {
return fs.readdirSync(dir, { withFileTypes: true })
.filter((entry) => entry.isFile() && entry.name.endsWith('.bngl'))
.map((entry) => entry.name)
.sort();
}

module.exports = {
listModelFiles
};
8 changes: 1 addition & 7 deletions scripts/validate-metadata.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const { listModelFiles } = require('./utils');

const SEARCH_ROOTS = ['Published', 'Examples', 'Tutorials'];
const CATEGORY_VALUES = new Set([
Expand Down Expand Up @@ -136,13 +137,6 @@ function listMetadataFiles(dir, results = []) {
return results;
}

function listModelFiles(dir) {
return fs.readdirSync(dir, { withFileTypes: true })
.filter((entry) => entry.isFile() && entry.name.endsWith('.bngl'))
.map((entry) => entry.name)
.sort();
}

function normalizeModelKey(value) {
return String(value || '')
.replace(/\.bngl$/i, '')
Expand Down
Loading