mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-28 11:15:32 -06:00
91d98c7205
This commit adds a postprocessor to the docs build that enables examples to be edited and have the results show up live. See the additions to `docs/README.md` for more about what writing these blocks looks like or the netlify PR preview (e.g. at `docs/edge/how-do-i-write-policies/`) to see them in action (you'll need to disable CORS for live output). Signed-off-by: David Boles <me@davidbol.es>
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import babel from 'rollup-plugin-babel'
|
|
import commonjs from 'rollup-plugin-commonjs'
|
|
import json from 'rollup-plugin-json'
|
|
import postcss from 'rollup-plugin-postcss'
|
|
import resolve from 'rollup-plugin-node-resolve'
|
|
import {terser} from 'rollup-plugin-terser'
|
|
|
|
import pkg from './package.json'
|
|
|
|
export default [
|
|
// browser-friendly UMD build
|
|
{
|
|
input: 'src/web/index.js',
|
|
output: {
|
|
file: pkg.browser,
|
|
format: 'umd',
|
|
},
|
|
plugins: [
|
|
json(),
|
|
resolve(),
|
|
commonjs({
|
|
include: ['node_modules/**'],
|
|
sourceMap: false
|
|
}),
|
|
babel({// Taken from package.js, wasn't using plugins correctly otherwise
|
|
'plugins': [
|
|
[
|
|
'@babel/plugin-proposal-decorators',
|
|
{
|
|
'legacy': true
|
|
}
|
|
],
|
|
'@babel/plugin-transform-react-jsx',
|
|
'@babel/plugin-transform-regenerator'
|
|
],
|
|
'presets': [
|
|
'@babel/preset-env'
|
|
],
|
|
exclude: ['node_modules/**'],
|
|
}),
|
|
postcss({
|
|
extract: true
|
|
}),
|
|
terser(),
|
|
]
|
|
}
|
|
] |