2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-31 13:54: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 node-version: current
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: npm ci - run: npm ci
- run: npm run build
- name: Update @v3-alpha version - name: Update @v3-alpha version
run: npm version premajor --no-git-tag-version --preid "alpha.$GITHUB_RUN_NUMBER" run: npm version premajor --no-git-tag-version --preid "alpha.$GITHUB_RUN_NUMBER"
- name: Deploy @v3-alpha version to npm - name: Deploy @v3-alpha version to npm
@ -63,4 +64,3 @@ jobs:
with: with:
tag: v3-alpha tag: v3-alpha
token: ${{ secrets.NPM_TOKEN }} token: ${{ secrets.NPM_TOKEN }}
check-version: false

View File

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

View File

@ -4,6 +4,7 @@ import typescript from "@rollup/plugin-typescript";
import cleaner from "rollup-plugin-cleaner"; import cleaner from "rollup-plugin-cleaner";
import scss from "rollup-plugin-scss"; import scss from "rollup-plugin-scss";
/** @type {import('rollup').RollupOptions[]} */
export default [ export default [
// Browser configuration // Browser configuration
{ {
@ -15,7 +16,7 @@ export default [
}, },
plugins: [ plugins: [
cleaner({ cleaner({
targets: ["./dist/"], targets: ["./dist/browser"],
}), }),
nodeResolve(), nodeResolve(),
scss({ scss({
@ -25,4 +26,31 @@ export default [
terser(), 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, "allowJs": true,
"strict": true, "strict": true,
"target": "es2021", "target": "es2021",
"skipLibCheck": false, "skipLibCheck": false
"outDir": "dist/browser"
}, },
"files": ["src/index.ts"] "files": ["src/index.ts"]
} }