diff --git a/.circleci/config.yml b/.circleci/config.yml index 150dd5293..d59b8373c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,6 +4,23 @@ # version: 2.1 +commands: + install-deps-for-screenshot-taking: + description: Install headless Chromium dependencies + steps: + - run: + name: Install Headless Chromium dependencies + command: | + sudo apt-get install -yq \ + ca-certificates fonts-liberation gconf-service libappindicator1 \ + libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 \ + libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 \ + libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 \ + libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 \ + libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 \ + libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget \ + xdg-utils + executors: node: docker: @@ -39,7 +56,7 @@ jobs: - persist_to_workspace: root: . paths: - - '*' + - "*" build: executor: node @@ -53,7 +70,7 @@ jobs: - persist_to_workspace: root: . paths: - - 'bin' + - "bin" lint: executor: node @@ -71,6 +88,8 @@ jobs: - attach_workspace: at: . + - install-deps-for-screenshot-taking + - run: npm run test release: diff --git a/@types/index.d.ts b/@types/index.d.ts index 4112c4167..b3ebf6fc7 100644 --- a/@types/index.d.ts +++ b/@types/index.d.ts @@ -7,3 +7,8 @@ declare module "*.html" { const value: string; export default value; } + +declare module "*.txt" { + const value: string; + export default value; +} diff --git a/rollup.config.js b/rollup.config.js index 89217fdef..cefee1803 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -26,11 +26,11 @@ export default ["generate-examples-index"].map(name => { external, plugins: [ nodeResolve({ - extensions: [".ts", ".js", ".json", ".css", ".html"], + extensions: [".css", ".html", ".js", ".json", ".ts", ".txt"], preferBuiltins: true }), string({ - include: ["**/*.{css,html}"] + include: ["**/*.{css,html,txt}"] }), typescript({ objectHashIgnoreUnknownHack: true, diff --git a/src/generate-examples-index/index.ts b/src/generate-examples-index/index.ts index 9963379cd..1fddedb9b 100644 --- a/src/generate-examples-index/index.ts +++ b/src/generate-examples-index/index.ts @@ -1,6 +1,7 @@ -import Pageres from "pageres"; import $ from "cheerio"; +import Pageres from "pageres"; import childProcess from "child_process"; +import commonScreenshotScript from "./screenshot-script.js.txt"; import crypto from "crypto"; import fs from "fs"; import globby from "globby"; @@ -530,6 +531,9 @@ class ContentBuilder { ); const screenshotPage = $.load(example.html); screenshotPage("head").prepend( + $(" + + + + + +
+ + diff --git a/test/generate-examples-index/examples/example-confirm.html b/test/generate-examples-index/examples/example-confirm.html new file mode 100644 index 000000000..e4639974b --- /dev/null +++ b/test/generate-examples-index/examples/example-confirm.html @@ -0,0 +1,16 @@ + + + + Test | Confirm + + + + + + + +
+ +