Skip to content
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

Set output directory to dist #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/node_modules/
/lib/
/test/

# top level source
my-element.js
my-element.js.map
my-element.d.ts
my-element.d.ts.map
/dist/
35 changes: 19 additions & 16 deletions dev/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<!doctype html>

<html>
<head>
<meta charset="utf-8">
<title>&lt;my-element> Demo</title>
<script type="module" src="../my-element.js"></script>
<style>
p {
border: solid 1px blue;
padding: 8px;
}
</style>
</head>
<body>
<my-element>
<p>This is child content</p>
</my-element>
</body>

<head>
<meta charset="utf-8">
<title>&lt;my-element> Demo</title>
<script type="module" src="../dist/my-element.js"></script>
<style>
p {
border: solid 1px blue;
padding: 8px;
}
</style>
</head>

<body>
<my-element>
<p>This is child content</p>
</my-element>
</body>

</html>
2 changes: 1 addition & 1 deletion karma.conf.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = (config) => {
},
files: [
{
pattern: config.grep ? config.grep : 'test/**/*_test.js',
pattern: config.grep ? config.grep : 'dist/test/**/*_test.js',
type: 'module',
},
],
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"name": "lit-element-starter-ts",
"version": "0.0.0",
"description": "A simple web component",
"main": "my-element.js",
"module": "my-element.js",
"main": "./dist/my-element.js",
"module": "./dist/my-element.js",
"type": "module",
"scripts": {
"build": "tsc",
"build:watch": "tsc --watch",
"clean": "rimraf my-element.{d.ts,d.ts.map,js,js.map} test/my-element.{d.ts,d.ts.map,js,js.map} test/my-element_test.{d.ts,d.ts.map,js,js.map}",
"clean": "rimraf dist/",
"lint": "npm run lint:lit-analyzer && npm run lint:eslint",
"lint:eslint": "eslint 'src/**/*.ts'",
"lint:lit-analyzer": "lit-analyzer",
"format": "prettier src/* --write",
"docs": "npm run docs:clean && npm run build && npm run analyze && npm run docs:build && npm run docs:assets && npm run docs:gen",
"docs:clean": "rimraf docs",
"docs:clean": "rimraf docs/",
"docs:gen": "eleventy --config=.eleventy.cjs",
"docs:gen:watch": "eleventy --config=.eleventy.cjs --watch",
"docs:build": "rollup -c --file docs/my-element.bundled.js",
Expand All @@ -26,7 +26,7 @@
"test:watch": "karma start karma.conf.cjs --auto-watch=true --single-run=false",
"test:update-snapshots": "karma start karma.conf.cjs --update-snapshots",
"test:prune-snapshots": "karma start karma.conf.cjs --prune-snapshots",
"checksize": "rollup -c ; cat my-element.bundled.js | gzip -9 | wc -c ; rm my-element.bundled.js"
"checksize": "rollup -c ; cat ./dist/my-element.bundled.js | gzip -9 | wc -c ; rm ./dist/my-element.bundled.js"
},
"keywords": [
"web-components",
Expand Down
8 changes: 4 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
* http://polymer.github.io/PATENTS.txt
*/

import replace from '@rollup/plugin-replace';
import filesize from 'rollup-plugin-filesize';
import {terser} from 'rollup-plugin-terser';
import resolve from 'rollup-plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import {terser} from 'rollup-plugin-terser';

export default {
input: 'my-element.js',
input: 'dist/my-element.js',
output: {
file: 'my-element.bundled.js',
file: 'dist/my-element.bundled.js',
format: 'esm',
},
onwarn(warning) {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"noUnusedLocals": true,
Expand Down