Skip to content

Commit

Permalink
Add vscode custom data to package
Browse files Browse the repository at this point in the history
  • Loading branch information
bendera committed Jan 2, 2024
1 parent cb4bc79 commit cf9ca79
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
20 changes: 18 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
"files": [
"dist",
"custom-elements.json",
"vscode.*-custom-data.json",
"!dist/**/*.test.*"
],
"customElements": "custom-elements.json",
"scripts": {
"build": "wireit",
"build:ts": "wireit",
"build:watch": "wireit",
"clean": "rimraf .wireit && rimraf coverage && rimraf dist && rimraf custom-elements.json && rimraf stats.html",
"clean": "rimraf -g .wireit coverage dist custom-elements.json stats.html vscode.*-custom-data.json",
"lint": "npm run lint:lit-analyzer && npm run lint:eslint",
"lint:eslint": "eslint src/**/*.ts",
"lint:lit-analyzer": "lit-analyzer",
Expand All @@ -29,7 +30,8 @@
"test:watch": "wtr --watch",
"checksize": "npm run build && cat dist/bundled.js | gzip -9 | wc -c",
"generate": "node scripts/generateComponent.js",
"icons": "node scripts/generateIconList.js"
"icons": "node scripts/generateIconList.js",
"vscode-data": "wireit"
},
"wireit": {
"analyze": {
Expand All @@ -46,6 +48,7 @@
"command": "rollup -c --file dist/bundled.js",
"dependencies": [
"analyze",
"vscode-data",
"build:ts"
],
"files": [
Expand Down Expand Up @@ -100,6 +103,19 @@
"src/**/*.ts"
],
"output": []
},
"vscode-data": {
"command": "node scripts/generate-custom-data.mjs",
"dependencies": [
"analyze"
],
"files": [
"custom-elements.json"
],
"output": [
"vscode.html-custom-data.json",
"vscode.css-custom-data.json"
]
}
},
"keywords": [
Expand Down
22 changes: 18 additions & 4 deletions scripts/generate-custom-data.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import { generateVsCodeCustomElementData } from "custom-element-vs-code-integration";
import manifest from "../custom-elements.json" assert { type: "json" };
import fs from 'node:fs';
import util from 'node:util';
import path, {dirname} from 'node:path';
import {fileURLToPath} from 'node:url';
import {generateVsCodeCustomElementData} from 'custom-element-vs-code-integration';

const options = {};
const readFile = util.promisify(fs.readFile);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

generateVsCodeCustomElementData(manifest, options);
async function main() {
const fc = await readFile(path.join(__dirname, '..', 'custom-elements.json'), 'utf-8');
const manifest = JSON.parse(fc);

const options = {};

generateVsCodeCustomElementData(manifest, options);
}

main();

0 comments on commit cf9ca79

Please sign in to comment.