mirror of
https://github.com/shoelace-style/shoelace.git
synced 2026-01-12 02:59:13 +00:00
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:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
@@ -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');
|
||||
Reference in New Issue
Block a user