Skip to content

Commit

Permalink
Experimenting with WCs
Browse files Browse the repository at this point in the history
- Maybe ESBuild will be able to build webcomponents after all...?
- Removed Qodana btw
  • Loading branch information
Atulin committed Mar 10, 2024
1 parent 498eeb5 commit b17d97d
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 35 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ tab_width = 4
[*.{cs,cshtml}]
# Roslynator.Analyzers rules
dotnet_diagnostic.rcs1260.severity = warning
roslynator_trailing_comma_style = omit_when_single_line
roslynator_trailing_comma_style = omit_when_single_line


[*.cs]
csharp_style_namespace_declarations = file_scoped:warning
19 changes: 0 additions & 19 deletions .github/workflows/qodana_code_quality.yml

This file was deleted.

23 changes: 20 additions & 3 deletions Ogma3/esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
import * as esbuild from "esbuild";
import { minifyTemplates, writeFiles } from "esbuild-minify-templates";

const start = process.hrtime.bigint();

const ctx = await esbuild.context({
entryPoints: ["./wwwroot/js/src/**/*.ts", "./wwwroot/js/src/**/*.js"],
const baseSettings = {
minify: true,
bundle: true,
sourcemap: true,
outdir: "./wwwroot/js/dist",
color: true,
logLevel: "info"
};

const bundleContext = await esbuild.context({
...baseSettings,
entryPoints: ["./wwwroot/js/src/**/*.ts", "./wwwroot/js/src/**/*.js"],
outdir: "./wwwroot/js/dist"
});

const litContext = await esbuild.context({
...baseSettings,
entryPoints: ["./wwwroot/js/src-webcomponents/**/*.ts"],
plugins: [minifyTemplates(), writeFiles()],
outdir: "./wwwroot/js/bundle",
write: false
})

// perform build
const ctx = process.argv.includes('--wc') ? litContext : bundleContext;

if (process.argv.includes("--watch")) {
await ctx.watch();
console.log("Watching files...");
} else {
await ctx.rebuild();
await ctx.dispose();
console.log(`Build completed in ${(process.hrtime.bigint() - start) / BigInt(1_000_000)}ms`);
process.exit();
}
94 changes: 83 additions & 11 deletions Ogma3/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Ogma3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"autoprefixer": "10.4.16",
"concurrently": "^8.2.2",
"esbuild": "0.19.5",
"esbuild-minify-templates": "^0.11.0",
"eslint": "8.53.0",
"eslint-config-prettier": "9.0.0",
"gulp": "4.0.2",
Expand Down Expand Up @@ -53,7 +54,9 @@
"dayjs": "1.11.10",
"lit": "3.0.2"
},
"web-types": ["./web-types.json"],
"web-types": [
"./web-types.json"
],
"wca-config": {
"webtypesConfig": {
"name": "Ogma Components",
Expand Down

0 comments on commit b17d97d

Please sign in to comment.