From ca03ff090060f223b762d77e47171247ec723535 Mon Sep 17 00:00:00 2001 From: Fabian Vilers Date: Sun, 2 Aug 2020 14:23:32 +0200 Subject: [PATCH 1/2] Set output directory to dist --- .gitignore | 7 +------ karma.conf.cjs | 2 +- package.json | 4 ++-- rollup.config.js | 6 +++--- tsconfig.json | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index c0b598a5..047a35e1 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/karma.conf.cjs b/karma.conf.cjs index adfc4bd6..1d9470f9 100644 --- a/karma.conf.cjs +++ b/karma.conf.cjs @@ -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', }, ], diff --git a/package.json b/package.json index 72a7225f..8cf78ba2 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,13 @@ "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", diff --git a/rollup.config.js b/rollup.config.js index ef00cc62..7238bcbf 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -12,13 +12,13 @@ * 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', format: 'esm', diff --git a/tsconfig.json b/tsconfig.json index 6c2d84ea..11ed9df2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "declaration": true, "declarationMap": true, "sourceMap": true, - "outDir": "./", + "outDir": "./dist", "rootDir": "./src", "strict": true, "noUnusedLocals": true, From 9aebabd4ef48587a870aef1189c8bc9d1d38be3f Mon Sep 17 00:00:00 2001 From: Fabian Vilers Date: Mon, 15 Mar 2021 08:13:44 +0100 Subject: [PATCH 2/2] Update paths to use ./dist --- dev/index.html | 35 +++++++++++++++++++---------------- package.json | 6 +++--- rollup.config.js | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/dev/index.html b/dev/index.html index 8e27df24..560f284a 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,20 +1,23 @@ - - - <my-element> Demo - - - - - -

This is child content

-
- + + + + <my-element> Demo + + + + + + +

This is child content

+
+ + diff --git a/package.json b/package.json index 8cf78ba2..8bca7a99 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "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", @@ -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", diff --git a/rollup.config.js b/rollup.config.js index 7238bcbf..68d93162 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -20,7 +20,7 @@ import {terser} from 'rollup-plugin-terser'; export default { input: 'dist/my-element.js', output: { - file: 'my-element.bundled.js', + file: 'dist/my-element.bundled.js', format: 'esm', }, onwarn(warning) {