Commit be4c715d authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Ajoute la conversion des schémas drawio.

parent 56d07e07
const { src, dest, parallel, watch } = require("gulp");
const server = require("gulp-server-livereload");
const pandoc = require("gulp-pandoc");
var exec = require("gulp-exec");
const SRC_DIR = process.env.SRC || "src";
const DEST_DIR = process.env.OUTPUT || "public/";
const ASSET_GLOB = `${SRC_DIR}/**/*.{png,gif,jpg,svg}`;
const PREZ_GLOB = `${SRC_DIR}/**/index.md`;
const DRAWIO_GLOB = `${SRC_DIR}/**/*.drawio`;
const assets = () => src(ASSET_GLOB).pipe(dest(DEST_DIR));
......@@ -40,7 +42,14 @@ const prez = () =>
)
.pipe(dest(DEST_DIR));
exports.default = exports.build = parallel(assets, prez);
const drawio = () =>
src(DRAWIO_GLOB).pipe(
exec(
`mkdir -p $(dirname '${DEST_DIR}<%= file.relative %>'); drawio --export --format svg --width 1024 --output '${DEST_DIR}<%= file.relative.replace('.drawio', '.svg') %>' '<%= file.path %>'`
)
);
exports.default = exports.build = parallel(assets, prez, drawio);
const serve = () => {
src(DEST_DIR).pipe(
......@@ -52,7 +61,11 @@ const serve = () => {
);
};
const watch_prez = () => watch(PREZ_GLOB, { ignoreInitial: false }, prez);
const watch_assets = () => watch(ASSET_GLOB, { ignoreInitial: false }, assets);
const do_watch = (glob, task) => () =>
watch(glob, { ignoreInitial: false }, task);
const watch_prez = do_watch(PREZ_GLOB, prez);
const watch_assets = do_watch(ASSET_GLOB, assets);
const watch_drawio = do_watch(DRAWIO_GLOB, drawio);
exports.dev = parallel(serve, watch_prez, watch_assets);
exports.dev = parallel(serve, watch_prez, watch_assets, watch_drawio);
......@@ -1922,6 +1922,48 @@
}
}
},
"gulp-exec": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/gulp-exec/-/gulp-exec-4.0.0.tgz",
"integrity": "sha512-A9JvTyB3P4huusd/43bTr6SDg3MqBxL9AQbLnsKSO6/91wVkHfxgeJZlgDMkqK8sMel4so8wcko4SZOeB1UCgA==",
"requires": {
"lodash.template": "^4.4.0",
"plugin-error": "^1.0.1",
"through2": "^3.0.1"
},
"dependencies": {
"lodash._reinterpolate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
"integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0="
},
"lodash.template": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz",
"integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==",
"requires": {
"lodash._reinterpolate": "^3.0.0",
"lodash.templatesettings": "^4.0.0"
}
},
"lodash.templatesettings": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz",
"integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==",
"requires": {
"lodash._reinterpolate": "^3.0.0"
}
},
"through2": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz",
"integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==",
"requires": {
"readable-stream": "2 || 3"
}
}
}
},
"gulp-pandoc": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/gulp-pandoc/-/gulp-pandoc-0.2.2.tgz",
......@@ -3670,6 +3712,17 @@
"pinkie": "^2.0.0"
}
},
"plugin-error": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz",
"integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==",
"requires": {
"ansi-colors": "^1.0.1",
"arr-diff": "^4.0.0",
"arr-union": "^3.1.0",
"extend-shallow": "^3.0.2"
}
},
"posix-character-classes": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
......
......@@ -14,6 +14,7 @@
"license": "MIT",
"dependencies": {
"gulp": "^4.0.2",
"gulp-exec": "^4.0.0",
"gulp-pandoc": "^0.2.2",
"gulp-server-livereload": "^1.9.2"
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment