Move files outside the dist folder

pull/14/head
Nikita Karamov 2020-07-23 20:17:00 +02:00
parent f868a8fd3f
commit 88f92e7026
No known key found for this signature in database
GPG Key ID: E40DFE6E993540FF
4 changed files with 35 additions and 35 deletions

6
.gitignore vendored
View File

@ -1,7 +1,9 @@
dev dev
dist
!dist/noinit/package.json
.DS_Store .DS_Store
.idea .idea
node_modules node_modules
yarn-error.log yarn-error.log
index.js
index.mjs
noinit
shareon.min.css

View File

@ -1,7 +0,0 @@
{
"main": "index.cjs",
"module": "index.mjs",
"browser": {
"./index.js": "./index.min.js"
}
}

View File

@ -21,28 +21,27 @@
"email": "nick@karamoff.dev", "email": "nick@karamoff.dev",
"url": "https://karamoff.dev" "url": "https://karamoff.dev"
}, },
"main": "./dist/index.cjs", "main": "./index.js",
"module": "./dist/index.mjs", "module": "./index.mjs",
"unpkg": "./dist/index.min.js", "unpkg": "./index.js",
"exports": { "exports": {
"./package.json": "./package.json", "./package.json": "./package.json",
".": { ".": {
"browser": "./dist/index.min.js", "browser": "./index.js",
"require": "./dist/index.cjs", "require": "./index.js",
"import": "./dist/index.mjs" "import": "./index.mjs"
}, },
"./noinit/package.json": "./dist/noinit/package.json",
"./noinit": { "./noinit": {
"browser": "./dist/noinit/index.min.js", "browser": "./noinit/index.js",
"require": "./dist/noinit/index.cjs", "require": "./noinit/index.js",
"import": "./dist/noinit/index.mjs" "import": "./noinit/index.mjs"
} }
}, },
"browser": {
"./index.js": "./dist/index.min.js"
},
"files": [ "files": [
"dist" "index.js",
"index.mjs",
"noinit/index.js",
"noinit/index.mjs"
], ],
"scripts": { "scripts": {
"build": "rollup -c", "build": "rollup -c",
@ -79,16 +78,16 @@
"size-limit": [ "size-limit": [
{ {
"limit": "1 KB", "limit": "1 KB",
"path": "./dist/index.min.js", "path": "./index.js",
"webpack": false "webpack": false
}, },
{ {
"limit": "1 KB", "limit": "1 KB",
"path": "./dist/index.mjs" "path": "./index.mjs"
}, },
{ {
"limit": "7 KB", "limit": "7 KB",
"path": "./dist/index.min.css", "path": "./shareon.min.css",
"webpack": false "webpack": false
} }
] ]

View File

@ -10,7 +10,7 @@ const isDev = process.env.ROLLUP_WATCH || process.env.NODE_ENV === 'development'
const pkg = require('./package.json'); const pkg = require('./package.json');
const outputDir = isDev ? './dev/' : './dist/'; const outputDir = isDev ? './dev/' : './';
const bannerText = `${pkg.name} v${pkg.version} by Nikita Karamov\n${pkg.homepage}`; const bannerText = `${pkg.name} v${pkg.version} by Nikita Karamov\n${pkg.homepage}`;
@ -67,15 +67,15 @@ const getOutputs = (baseDir) => {
if (isDev) { if (isDev) {
result.push({ result.push({
name: pkg.name, name: pkg.name,
format: 'iife', format: 'umd',
file: `${baseDir}index.js`, file: `${baseDir}index.js`,
}); });
} else { } else {
result.push({ // result.push({
name: pkg.name, // name: pkg.name,
format: 'cjs', // format: 'cjs',
file: `${baseDir}index.cjs`, // file: `${baseDir}index.cjs`,
}); // });
result.push({ result.push({
name: pkg.name, name: pkg.name,
format: 'esm', format: 'esm',
@ -83,10 +83,16 @@ const getOutputs = (baseDir) => {
}); });
result.push({ result.push({
name: pkg.name, name: pkg.name,
format: 'iife', format: 'umd',
file: `${baseDir}index.min.js`, file: `${baseDir}index.js`,
plugins: [terser({ output: { comments: false } })], plugins: [terser({ output: { comments: false } })],
}); });
// result.push({
// name: pkg.name,
// format: 'iife',
// file: `${baseDir}index.min.js`,
// plugins: [terser({ output: { comments: false } })],
// });
} }
return result; return result;