From 73b54c385a70fa9d5068405cb3ceae5baeef7176 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 10 Feb 2022 20:32:40 +0100 Subject: [PATCH 1/3] Write new index.js for the package --- src/{autoinit.js => index.js} | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename src/{autoinit.js => index.js} (56%) diff --git a/src/autoinit.js b/src/index.js similarity index 56% rename from src/autoinit.js rename to src/index.js index b8ac85a..43fcaef 100644 --- a/src/autoinit.js +++ b/src/index.js @@ -1,8 +1,10 @@ import initializeShareon from "./shareon"; import "./style.css"; -window.onload = () => { +// TODO: update README +const s = document.currentScript; +if (s && s.hasAttribute("init")) { initializeShareon(); -}; +} export default initializeShareon; From 305751a36162f47c36d3180e799b53cd41361ec8 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 10 Feb 2022 20:32:52 +0100 Subject: [PATCH 2/3] Build the new version --- rollup.config.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 604b43a..50be708 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -99,15 +99,8 @@ const getOutput = (baseDir) => { ]; }; -export default [ - { - input: join(__dirname, "src", "autoinit.js"), - output: getOutput(outputDir), - plugins: getPlugins(true), - }, - { - input: join(__dirname, "src", "shareon.js"), - output: getOutput(join(outputDir, "noinit")), - plugins: getPlugins(false), - }, -]; +export default { + input: join(__dirname, "src", "index.js"), + output: getOutput(outputDir), + plugins: getPlugins(true), +}; From af7060fb9893088e318c47d5ec290968536d93ce Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 10 Feb 2022 20:32:58 +0100 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea5ed1c..3229505 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Added + +- **BREAKING:** new (auto-)init behaviour, inspired by [petite-vue](https://github.com/vuejs/petite-vue) + - `require`, `import`, or use `