From 59399f5a1c769696d1911caf0aad5dc8b67cbd55 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 23 Jul 2020 20:00:31 +0200 Subject: [PATCH] Rename shareon to index --- .gitignore | 1 + dist/noinit/package.json | 7 +++++++ package.json | 30 ++++++++++++++++-------------- rollup.config.js | 8 ++++---- 4 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 dist/noinit/package.json diff --git a/.gitignore b/.gitignore index 5a3d2ce..36d4137 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ dev dist +!dist/noinit/package.json .DS_Store .idea node_modules diff --git a/dist/noinit/package.json b/dist/noinit/package.json new file mode 100644 index 0000000..5a52e7a --- /dev/null +++ b/dist/noinit/package.json @@ -0,0 +1,7 @@ +{ + "main": "index.cjs", + "module": "index.mjs", + "browser": { + "./index.js": "./index.min.js" + } +} diff --git a/package.json b/package.json index a36359d..b8dc8fc 100644 --- a/package.json +++ b/package.json @@ -21,22 +21,26 @@ "email": "nick@karamoff.dev", "url": "https://karamoff.dev" }, - "main": "./dist/shareon.cjs", - "module": "./dist/shareon.mjs", - "unpkg": "./dist/shareon.min.js", + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "unpkg": "./dist/index.min.js", "exports": { "./package.json": "./package.json", ".": { - "browser": "./dist/shareon.min.js", - "require": "./dist/shareon.cjs", - "import": "./dist/shareon.mjs" + "browser": "./dist/index.min.js", + "require": "./dist/index.cjs", + "import": "./dist/index.mjs" }, + "./noinit/package.json": "./dist/noinit/package.json", "./noinit": { - "browser": "./dist/noinit/shareon.min.js", - "require": "./dist/noinit/shareon.cjs", - "import": "./dist/noinit/shareon.mjs" + "browser": "./dist/noinit/index.min.js", + "require": "./dist/noinit/index.cjs", + "import": "./dist/noinit/index.mjs" } }, + "browser": { + "./index.js": "./dist/index.min.js" + }, "files": [ "dist" ], @@ -75,18 +79,16 @@ "size-limit": [ { "limit": "1 KB", - "path": "./dist/shareon.min.js", + "path": "./dist/index.min.js", "webpack": false }, { "limit": "1 KB", - "path": [ - "./dist/shareon.cjs" - ] + "path": "./dist/index.mjs" }, { "limit": "7 KB", - "path": "./dist/shareon.min.css", + "path": "./dist/index.min.css", "webpack": false } ] diff --git a/rollup.config.js b/rollup.config.js index 253060e..86df14d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -68,23 +68,23 @@ const getOutputs = (baseDir) => { result.push({ name: pkg.name, format: 'iife', - file: `${baseDir}${pkg.name}.js`, + file: `${baseDir}index.js`, }); } else { result.push({ name: pkg.name, format: 'cjs', - file: `${baseDir}${pkg.name}.cjs`, + file: `${baseDir}index.cjs`, }); result.push({ name: pkg.name, format: 'esm', - file: `${baseDir}${pkg.name}.mjs`, + file: `${baseDir}index.mjs`, }); result.push({ name: pkg.name, format: 'iife', - file: `${baseDir}${pkg.name}.min.js`, + file: `${baseDir}index.min.js`, plugins: [terser({ output: { comments: false } })], }); }