blob: 2ccbf19c39a3d31238fa59365bc8c80419d1ad80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* Copyright (c) 2021 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
var PrebuildPlugin = require("prebuild-webpack-plugin");
const fs = require("fs");
const { compileFromFile } = require('json-schema-to-typescript');
async function generateHardwareMetadataTypescript() {
const ts = await compileFromFile("../schema/hardware-metadata.schema.json");
fs.writeFileSync("src/hardware-metadata.d.ts", ts);
}
module.exports = function () {
return {
name: "hardware-metadata-typescript-plugin",
configureWebpack() {
return {
plugins: [
new PrebuildPlugin({
build: generateHardwareMetadataTypescript,
}),
],
};
},
};
};
|