Skip to content

Commit

Permalink
add esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
binjamil committed May 18, 2024
0 parents commit 095f3d1
Show file tree
Hide file tree
Showing 7 changed files with 424 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules
dist
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false
}
22 changes: 22 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as esbuild from "esbuild";
import pkg from "./package.json" assert { type: "json" };

await Promise.all([
// bundle for esm
esbuild.build({
entryPoints: ["src/index.ts"],
bundle: true,
minify: true,
format: "esm",
outfile: pkg.module,
}),

// bundle for commonjs
esbuild.build({
entryPoints: ["src/index.ts"],
bundle: true,
minify: true,
format: "cjs",
outfile: pkg.main,
}),
]);
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "matomo-client",
"version": "1.0.0",
"description": "A thin wrapper around Matomo analytics",
"keywords": [
"analytics"
],
"license": "MIT",
"author": "Muhammad Bin Jamil",
"files": [
"dist/matomo-client.cjs.js",
"dist/matomo-client.esm.js",
"dist/index.d.ts"
],
"main": "dist/matomo-client.cjs.js",
"module": "dist/matomo-client.esm.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "npm run build:types && npm run build:js",
"build:js": "node build.mjs",
"build:types": "tsc --emitDeclarationOnly"
},
"devDependencies": {
"esbuild": "^0.21.3",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
}
}
Loading

0 comments on commit 095f3d1

Please sign in to comment.