Skip to content

Switched to web components workflow #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# js-framework

To install packages,

```bash
npm install
```

Development mode,

```bash
npm run dev
1 change: 0 additions & 1 deletion chat/.npmrc

This file was deleted.

11 changes: 0 additions & 11 deletions chat/package.json

This file was deleted.

46 changes: 46 additions & 0 deletions config/esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import esbuild from 'esbuild';

const commonOptions = {
entryPoints: ['example/index.js'],
outdir: 'dist',
format: 'esm',
bundle: true,
loader: {
'.svg': 'file',
'.woff': 'file',
'.woff2': 'file',
'.ttf': 'file',
'.otf': 'file',
'.html': 'copy',
'.json': 'copy',
}
};

if (process.env.NODE_ENV === 'production') {
await esbuild.build({
...commonOptions,
minify: true,
sourcemap: false,
define: {
'process.env.NODE_ENV': '"production"',
},
}).catch(() => process.exit(1));
} else {
commonOptions.entryPoints.push('example/index.html', 'example/data.json');
let ctx = await esbuild.context({
...commonOptions,
minify: false,
sourcemap: true,
define: {
'process.env.NODE_ENV': '"development"',
},
})

let { host, port } = await ctx.serve({
servedir: commonOptions.outdir,
});
console.log(`Serving on http://${host}:${port}`);

await ctx.watch();
console.log('watching');
}
3 changes: 2 additions & 1 deletion config/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ export default [
{
languageOptions: {
globals: globals.browser,
ecmaVersion: 'latest',
ecmaVersion: 13,
sourceType: 'module',
},
},
...compat.extends('airbnb-base'),
{
rules: {
'import/prefer-default-export': 'off',
'import/no-default-export': 'error'
},
}
];
Loading