From a62768b55f92638088665bea4f3be89316c6abdf Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 30 Jun 2020 14:05:19 -0600 Subject: [PATCH] Update Build Workflow --- .config/main.config.js | 7 ------- .config/min.config.js | 10 ---------- .npmignore | 1 - index.js | 21 ++++++++++----------- index.min.js | 20 +++++++++++++++++++- package.json | 9 ++++----- 6 files changed, 33 insertions(+), 35 deletions(-) delete mode 100644 .config/main.config.js delete mode 100644 .config/min.config.js diff --git a/.config/main.config.js b/.config/main.config.js deleted file mode 100644 index 2fa0971..0000000 --- a/.config/main.config.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - input: 'src/wc-blink.js', - output: { - file: 'index.js', - format: 'esm' - } -}; diff --git a/.config/min.config.js b/.config/min.config.js deleted file mode 100644 index 8dbbc49..0000000 --- a/.config/min.config.js +++ /dev/null @@ -1,10 +0,0 @@ -import { terser } from "rollup-plugin-terser"; - -export default { - input: 'src/wc-blink.js', - output: { - file: 'index.min.js', - format: 'esm' - }, - plugins: [terser()] -}; diff --git a/.npmignore b/.npmignore index 681e8f7..d81a148 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,3 @@ -.config/ .github/ .vscode/ dev/ diff --git a/index.js b/index.js index 14690a0..75697c1 100644 --- a/index.js +++ b/index.js @@ -1,14 +1,13 @@ -/* eslint no-undef: 0 */ +// src/wc-blink.js class WCBlink extends HTMLElement { - constructor () { + constructor() { super(); - const template = document.createElement('template'); + const template = document.createElement("template"); template.innerHTML = WCBlink.template(); - this.attachShadow({ mode: 'open' }); + this.attachShadow({mode: "open"}); this.shadowRoot.appendChild(document.importNode(template.content, true)); } - - static template () { + static template() { return ` - ` + `; } } - -customElements.define('wc-blink', WCBlink); - -export { WCBlink }; +customElements.define("wc-blink", WCBlink); +export { + WCBlink +}; diff --git a/index.min.js b/index.min.js index 2b953f2..0b3a136 100644 --- a/index.min.js +++ b/index.min.js @@ -1 +1,19 @@ -class n extends HTMLElement{constructor(){super();const e=document.createElement("template");e.innerHTML=n.template(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(document.importNode(e.content,!0))}static template(){return'\n \n \n '}}customElements.define("wc-blink",n);export{n as WCBlink}; +class a extends HTMLElement{constructor(){super();const b=document.createElement("template");b.innerHTML=a.template(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(document.importNode(b.content,!0))}static template(){return` + + + `}}customElements.define("wc-blink",a);export{a as WCBlink}; diff --git a/package.json b/package.json index 70ea9fe..160fbf0 100644 --- a/package.json +++ b/package.json @@ -14,16 +14,15 @@ "scripts": { "start": "npx live-server --no-browser --port=5500 --open=dev", "lint": "esmtk lint", - "build": "npm run build:main && npm run build:min", - "build:main": "npx rollup --config .config/main.config.js", - "build:min": "npx rollup --config .config/min.config.js", + "build": "npm run bundle && npm run minify", + "bundle": "esmtk bundle src/wc-blink.js index.js", + "minify": "esmtk minify src/wc-blink.js index.min.js", "package": "npx rimraf package && npm pack | tail -n 1 | xargs tar -xf", "preversion": "npm run lint", "postversion": "git push --follow-tags" }, "devDependencies": { - "esmtk": "^0.1.1", - "rollup-plugin-terser": "^5.2.0" + "esmtk": "^0.4.0" }, "standard": { "ignore": [