Releases: heyMP/scratchpad
v1.0.0-next.20
Patch Changes
- 9a81107: Update esbuild depencency
v1.0.0-next.19
Patch Changes
-
02e9e73: Add bypassCSP flag to run command.
Example:
scratchpad run test.ts --bypassCSP
v1.0.0-next.18
Patch Changes
-
2b88c36: File argument for run command optional
npx @heymp/scratchpad@next run
v1.0.0-next.17
Minor Changes
-
96cefea: Add clone command to copy remote files locally
npx @heymp/scratchpad@next clone https://www.example.com/scripts.js
Added new generic helper to reroute both document and asset file types.
scratchpad.config.ts
export default Scratchpad.defineConfig({ playwright: async (args) => { const { page } = args; Scratchpad.rerouteLocal(page, "pages"); }, });
v1.0.0-next.16
Patch Changes
- 7522bd7: Fix: generate config failing
v1.0.0-next.15
Minor Changes
-
2f0fffb: Add new generate commands
Generate document
Fetch HTML source of url and save it to a local file. This is helpful when using the
rerouteDocumentcommand.npx @heymp/scratchpad@next generate document https://www.example.com pages
Generate login
Launch a new browser that saves your session so it can be reused.
npx @heymp/scratchpad@next generate login
You can then reuse the session by using the
loginoption when using theruncommand.npx @heymp/scratchpad@next run --login
v1.0.0-next.14
Minor Changes
-
71270e1: Add config and playwright rerouting helpers
Export
defineConfig,rerouteUrl,rerouteDocument.Example:
import * as Scratchpad from "@heymp/scratchpad"; export default Scratchpad.defineConfig({ devtools: true, url: "https://www.redhat.com/en", playwright: async (args) => { const { page } = args; await Scratchpad.rerouteDocument(page, "./pages"); await Scratchpad.rerouteUrl(page, { type: "path", target: "**/rh-cta/rh-cta.js", source: "./rh-cta.js", }); }, });
v1.0.0-next.13
Minor Changes
-
21f3bed: Add global readFile method
Example
await readFile("./log.txt", "utf8");
v1.0.0-next.12
v1.0.0-next.11
Minor Changes
-
708f25e: Support ts config files
scratchpad.config.tsimport { Config } from "@heymp/scratchpad/src/config.js"; export function hi(name: string) { console.log(`Hi there ${name}`); } declare global { interface Window { hi: typeof hi; } } export default { playwright: async (args) => { const { context } = args; await context.exposeFunction("hi", hi); }, } satisfies Config;
test.ts/// <reference path="./scratchpad.config.ts" /> window.hi('Bob');