JetBrains IDE Integration (#1512)

* upgrade vs code integration package

* add references

* add web-types plugin

* update reference

* run prettier

* update documentation

* run prettier

* remove test script
This commit is contained in:
Burton Smith
2023-08-14 09:34:34 -04:00
committed by GitHub
parent 6f08f50639
commit aeef986cf5
7 changed files with 39 additions and 73 deletions

View File

@@ -188,10 +188,6 @@ await nextTask('Wrapping components for React', () => {
return execPromise(`node scripts/make-react.js --outdir "${outdir}"`, { stdio: 'inherit' });
});
await nextTask('Generating Web Types', () => {
return execPromise(`node scripts/make-web-types.js --outdir "${outdir}"`, { stdio: 'inherit' });
});
await nextTask('Generating themes', () => {
return execPromise(`node scripts/make-themes.js --outdir "${outdir}"`, { stdio: 'inherit' });
});
@@ -207,6 +203,7 @@ await nextTask('Running the TypeScript compiler', () => {
// Copy the above steps to the CDN directory directly so we don't need to twice the work for nothing.
await nextTask(`Copying Web Types, Themes, Icons, and TS Types to "${cdndir}"`, async () => {
await deleteAsync(cdndir);
await copy('./web-types.json', `${outdir}/web-types.json`);
await copy(outdir, cdndir);
});

View File

@@ -1,68 +0,0 @@
//
// This script generates a web-types.json file from custom-elements.json for use with WebStorm/PHPStorm
//
// Docs: https://github.com/JetBrains/web-types
//
import commandLineArgs from 'command-line-args';
import jsonata from 'jsonata';
import fs from 'fs';
import path from 'path';
const { outdir } = commandLineArgs({ name: 'outdir', type: String });
const metadata = JSON.parse(fs.readFileSync(path.join(outdir, 'custom-elements.json'), 'utf8'));
const jsonataExprString = `{
"$schema": "http://json.schemastore.org/web-types",
"name": package.name,
"version": package.version,
"description-markup": "markdown",
"framework-config": {
"enable-when": {
"node-packages": [
package.name
]
}
},
"contributions": {
"html": {
"elements": [
modules.declarations.{
"name": tagName,
"description": description,
"doc-url": $join(["https://shoelace.style/components/", $substringAfter(tagName, 'sl-')]),
"js": {
"properties": [
members.{
"name": name,
"description": description,
"value": {
"type": type.text
}
}
],
"events": [
events.{
"name": name,
"description": description
}
]
},
"attributes": [
attributes.{
"name": name,
"description": description,
"value": {
"type": type.text
}
}
]
}
]
}
}
}`;
const expression = jsonata(jsonataExprString);
const result = await expression.evaluate(metadata);
fs.writeFileSync(path.join(outdir, 'web-types.json'), JSON.stringify(result, null, 2), 'utf8');