feat: npm package: hybrid cjs+esm support (#14)
* feat(npm): add build script for hybrid cjs+esm support * style: fix mixed indents * allow import from CSS * doc: instructions on how to import css file * refactor(npm): use esbuild.js for a single build command * chore: fix mixed indents * fix(npm): rename file extension in npm include list Co-authored-by: sakkke <w32w64@gmail.com> Co-authored-by: Pocco81 <58336662+Pocco81@users.noreply.github.com> Co-authored-by: Pocco81 <pocco451@gmail.com>
This commit is contained in:
parent
7df14a72dd
commit
e92b4a9312
|
@ -1 +1,2 @@
|
|||
dist/
|
||||
node_modules/
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
const esbuild = require('esbuild');
|
||||
|
||||
const buildCJS = esbuild.build({
|
||||
entryPoints: ['./index.js'],
|
||||
outfile: './dist/index.cjs',
|
||||
format: 'cjs'
|
||||
})
|
||||
|
||||
const buildESM = esbuild.build({
|
||||
entryPoints: ['./index.js'],
|
||||
outfile: './dist/index.mjs',
|
||||
format: 'esm'
|
||||
})
|
||||
|
||||
Promise.all([buildCJS, buildESM]).catch(() => process.exit(1))
|
21
package.json
21
package.json
|
@ -1,19 +1,25 @@
|
|||
{
|
||||
"name": "@catppuccin/palette",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"description": "Soothing pastel themes for the high-spirited!",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
".": {
|
||||
"require": "./dist/index.cjs",
|
||||
"import": "./dist/index.mjs"
|
||||
},
|
||||
"./style": "./css/catppuccin.css"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "ava"
|
||||
"test": "ava",
|
||||
"build": "node esbuild.js",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"files": [
|
||||
"css/",
|
||||
"index.js",
|
||||
"dist/index.cjs",
|
||||
"dist/index.mjs",
|
||||
"index.d.ts"
|
||||
],
|
||||
"types": "index.d.ts",
|
||||
|
@ -39,6 +45,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/catppuccin/palette#readme",
|
||||
"devDependencies": {
|
||||
"ava": "^4.2.0"
|
||||
"ava": "^4.2.0",
|
||||
"esbuild": "^0.14.42"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue