Skip to content

Commit

Permalink
Enforce uniqueness of vendor and product id pair
Browse files Browse the repository at this point in the history
  • Loading branch information
olivia committed Aug 30, 2022
1 parent e094740 commit 3c998a5
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 1,914 deletions.
10 changes: 9 additions & 1 deletion scripts/build-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {getDefinitionsPath, getOutputPath} from './get-path';
export async function buildNames() {
try {
const paths = glob.sync(getDefinitionsPath(), {absolute: true});
let foundDuplicateId = false;
console.log(path.resolve('./'));

const [v2Definitions] = [paths].map((paths) =>
Expand All @@ -20,18 +21,25 @@ export async function buildNames() {
.map(keyboardDefinitionV2ToVIADefinitionV2)
.reduce((p, n) => {
if (n.vendorProductId in p) {
const isIdentical =
JSON.stringify(p[n.vendorProductId]) === JSON.stringify(n);
console.log(
`Duplicate id found: ${n.name} collides with ${
p[n.vendorProductId].name
}`
} and is${!isIdentical ? ' not' : ''} identical`
);
foundDuplicateId = true;
}
return {...p, [n.vendorProductId]: n};
}, {} as any)
)
.map((d: any) => d.name)
.sort();

if (foundDuplicateId) {
throw new Error('Found duplicate vendor & product id pair');
}

const outputPath = getOutputPath();
if (!fs.existsSync(outputPath)) {
fs.mkdirSync(outputPath);
Expand Down
55 changes: 0 additions & 55 deletions src/handwired/dactyl_manuform/3x5_3/3x5_3.json

This file was deleted.

171 changes: 0 additions & 171 deletions src/ibm_wheelwriter/ibm_wheelwriter.json

This file was deleted.

Loading

0 comments on commit 3c998a5

Please sign in to comment.