2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-30 13:24:28 -06:00

Add Node build

This commit is contained in:
Jeroen akkerman 2025-05-01 18:28:20 +02:00
parent bc16a40ea0
commit ee0aa6f0d1
4 changed files with 39 additions and 6 deletions

View File

@ -56,6 +56,7 @@ jobs:
node-version: current
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
- name: Update @v3-alpha version
run: npm version premajor --no-git-tag-version --preid "alpha.$GITHUB_RUN_NUMBER"
- name: Deploy @v3-alpha version to npm
@ -63,4 +64,3 @@ jobs:
with:
tag: v3-alpha
token: ${{ secrets.NPM_TOKEN }}
check-version: false

View File

@ -9,12 +9,18 @@
"editor",
"javascript"
],
"main": "dist/node/easymde.js",
"files": [
"dist",
"CHANGELOG.md"
],
"main": "dist/node/index.js",
"browser": "dist/browser/easymde.min.js",
"types": "dist/types/index.d.ts",
"license": "MIT",
"author": "Jeroen Akkerman",
"repository": "github:Ionaru/easy-markdown-editor",
"repository": {
"url": "git+https://github.com/Ionaru/easy-markdown-editor.git"
},
"scripts": {
"build": "rollup -c",
"build:watch": "rollup -c -w",

View File

@ -4,6 +4,7 @@ import typescript from "@rollup/plugin-typescript";
import cleaner from "rollup-plugin-cleaner";
import scss from "rollup-plugin-scss";
/** @type {import('rollup').RollupOptions[]} */
export default [
// Browser configuration
{
@ -15,7 +16,7 @@ export default [
},
plugins: [
cleaner({
targets: ["./dist/"],
targets: ["./dist/browser"],
}),
nodeResolve(),
scss({
@ -25,4 +26,31 @@ export default [
terser(),
],
},
// Node configuration
{
input: "src/index.ts",
output: {
dir: "dist/node",
sourcemap: true,
},
external: [
"marked",
"escape-string-regexp",
"@lezer/highlight",
"@lezer/markdown",
"@codemirror/lang-markdown",
"@codemirror/language",
"@codemirror/state",
"@codemirror/view",
],
plugins: [
cleaner({
targets: ["./dist/node"],
}),
scss({
fileName: "easymde.css",
}),
typescript(),
],
},
];

View File

@ -14,8 +14,7 @@
"allowJs": true,
"strict": true,
"target": "es2021",
"skipLibCheck": false,
"outDir": "dist/browser"
"skipLibCheck": false
},
"files": ["src/index.ts"]
}