Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds rollup #10

Merged
merged 6 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"scripts": {
"test": "node test/index.js",
"build:html": "npx @11ty/eleventy --config=_build/.eleventy.cjs",
"build": "npm run build:html",
"build": "npm run build:html && npm run build:js",
"watch:html": "npx @11ty/eleventy --config=_build/.eleventy.cjs --watch",
"watch": "npm run watch:html",
"build:docs": "npx typedoc --out docs src/"
"build:docs": "npx typedoc --out docs src/",
"build:js": "rollup -c"
adamjanicki2 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why delete npx? That was needed regardless! Please read up a bit on what it does and you'll see why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I got confused from the slack conversation

LeaVerou marked this conversation as resolved.
Show resolved Hide resolved
},
"repository": {
"type": "git",
Expand All @@ -34,6 +35,7 @@
"htest.dev": "^0.0.4",
"jsep": "^1.3.8",
"markdown-it-anchor": "^8.6.7",
"rollup": "^2.79.1",
"typedoc": "^0.25.3"
}
}
26 changes: 26 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const BASE_FILENAME = "vastly";
const IIFE_NAME = "Vastly";

function bundle(format, filenameAddition = "") {
let filename = BASE_FILENAME;

if (format !== "esm" && filenameAddition) {
filename += "." + filenameAddition;
}

return {
file: `dist/${filename}.js`,
name: IIFE_NAME,
format,
sourcemap: format !== "esm"
};
}

export default {
input: "src/index.js",
output: [
bundle("iife", "global"),
bundle("esm"),
bundle("cjs", "cjs"),
],
};