Skip to content

Commit

Permalink
add turndown to vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
tztsai committed Nov 8, 2024
1 parent 1d6b88c commit dde7284
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sh panzoom/build.sh
sh prism/build.sh
sh remark/build.sh
sh themes/build.sh $browser
sh turndown/build.sh

# copy files
mkdir -p tmp
Expand Down
18 changes: 18 additions & 0 deletions build/turndown/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# set current working directory to directory of the shell script
cd "$(dirname "$0")"

# before
npm ci 2> /dev/null || npm i
mkdir -p tmp

# turndown.min.js
npx rollup --config rollup.mjs --input turndown.mjs --file tmp/turndown.js
npx terser --compress --mangle -- tmp/turndown.js > tmp/turndown.min.js

# copy
cp tmp/turndown.min.js ../../vendor/

# after
rm -rf node_modules/ tmp/
7 changes: 7 additions & 0 deletions build/turndown/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"dependencies": {
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"turndown": "^7.2.0"
}
}
15 changes: 15 additions & 0 deletions build/turndown/rollup.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import common from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';

export default {
input: 'node_modules/turndown/lib/turndown.browser.umd.js',
output: {
file: 'tmp/turndown.js',
format: 'umd',
name: 'TurndownService'
},
plugins: [
common(),
resolve()
]
};
3 changes: 3 additions & 0 deletions build/turndown/turndown.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TurndownService from "turndown";

export default TurndownService;

0 comments on commit dde7284

Please sign in to comment.