diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e40617f310..6663a4988e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,10 +34,8 @@ jobs: run: yarn install env: CI: true - - name: Build icons - run: ./node_modules/.bin/gulp gen-icons-json - - name: Build translations - run: ./node_modules/.bin/gulp build-translations + - name: Build resources + run: ./node_modules/.bin/gulp gen-icons-json build-translations gather-gallery-demos - name: Run eslint run: ./node_modules/.bin/eslint '{**/src,src}/**/*.{js,ts,html}' --ignore-path .gitignore - name: Run tsc diff --git a/.gitignore b/.gitignore index c3c6849cdb..0fcd9b68bf 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ dist .vscode/* !.vscode/extensions.json -# Cast dev settings +# Cast dev settings src/cast/dev_const.ts # Secrets diff --git a/build-scripts/bundle.js b/build-scripts/bundle.js index 5433c4e59d..2c93bd7835 100644 --- a/build-scripts/bundle.js +++ b/build-scripts/bundle.js @@ -57,7 +57,7 @@ module.exports.babelOptions = ({ latestBuild }) => ({ ].filter(Boolean), plugins: [ // Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2}) - [ + !latestBuild && [ "@babel/plugin-proposal-object-rest-spread", { loose: true, useBuiltIns: true }, ], @@ -73,7 +73,7 @@ module.exports.babelOptions = ({ latestBuild }) => ({ require("@babel/plugin-proposal-class-properties").default, { loose: true }, ], - ], + ].filter(Boolean), }); // Are already ES5, cause warnings when babelified. diff --git a/build-scripts/gulp/gallery.js b/build-scripts/gulp/gallery.js index ec430118e5..194a6e532d 100644 --- a/build-scripts/gulp/gallery.js +++ b/build-scripts/gulp/gallery.js @@ -1,7 +1,10 @@ // Run demo develop mode const gulp = require("gulp"); +const fs = require("fs"); +const path = require("path"); const env = require("../env"); +const paths = require("../paths"); require("./clean.js"); require("./translations.js"); @@ -12,6 +15,31 @@ require("./service-worker.js"); require("./entry-html.js"); require("./rollup.js"); +gulp.task("gather-gallery-demos", async function gatherDemos() { + const files = await fs.promises.readdir( + path.resolve(paths.gallery_dir, "src/demos") + ); + + let content = "export const DEMOS = {\n"; + + for (const file of files) { + const demoId = path.basename(file, ".ts"); + const demoPath = "../src/demos/" + demoId; + content += ` "${demoId}": () => import("${demoPath}"),\n`; + } + + content += "};"; + + const galleryBuild = path.resolve(paths.gallery_dir, "build"); + + fs.mkdirSync(galleryBuild, { recursive: true }); + fs.writeFileSync( + path.resolve(galleryBuild, "import-demos.ts"), + content, + "utf-8" + ); +}); + gulp.task( "develop-gallery", gulp.series( @@ -20,7 +48,11 @@ gulp.task( }, "clean-gallery", "translations-enable-merge-backend", - gulp.parallel("gen-icons-json", "build-translations"), + gulp.parallel( + "gen-icons-json", + "build-translations", + "gather-gallery-demos" + ), "copy-static-gallery", "gen-index-gallery-dev", env.useRollup() ? "rollup-dev-server-gallery" : "webpack-dev-server-gallery" @@ -35,7 +67,11 @@ gulp.task( }, "clean-gallery", "translations-enable-merge-backend", - gulp.parallel("gen-icons-json", "build-translations"), + gulp.parallel( + "gen-icons-json", + "build-translations", + "gather-gallery-demos" + ), "copy-static-gallery", env.useRollup() ? "rollup-prod-gallery" : "webpack-prod-gallery", "gen-index-gallery-prod" diff --git a/cast/src/html/launcher-faq.html.template b/cast/src/html/launcher-faq.html.template index 59eea6a3a0..e220a1e1ce 100644 --- a/cast/src/html/launcher-faq.html.template +++ b/cast/src/html/launcher-faq.html.template @@ -37,23 +37,21 @@
<%= renderTemplate('_js_base') %> - -