Skip to content

Releases: heyMP/scratchpad

v1.0.0-next.11

08 Aug 14:48
5aca333
Compare
Choose a tag to compare
v1.0.0-next.11 Pre-release
Pre-release

Minor Changes

  • 708f25e: Support ts config files

    scratchpad.config.ts

    import { 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');

v1.0.0-next.10

06 Aug 12:59
8cf0415
Compare
Choose a tag to compare
v1.0.0-next.10 Pre-release
Pre-release

Patch Changes

  • e628851: Fix cannot find package '@commander-js/extra-typings error.

v1.0.0-next.9

05 Aug 19:59
0a9006e
Compare
Choose a tag to compare
v1.0.0-next.9 Pre-release
Pre-release

Patch Changes

v1.0.0-next.8

05 Aug 14:15
8bcfaf4
Compare
Choose a tag to compare
v1.0.0-next.8 Pre-release
Pre-release

Major Changes

  • 4aa2817: Add generate config command #38

    npx @heymp/scratchpad generate --help
    
    Usage: scratchpad generate [options] [command]
    
    Generate files from templates.
    
    Options:
      -h, --help      display help for command
    
    Commands:
      config          Generates an example config file.
      help [command]  display help for command
  • 4aa2817: Add run command

    npx @heymp/scratchpad run --help
    
    Usage: cli run [options] <file>
    
    Execute a file in a browser.
    
    Arguments:
      file                  file to execute in the browser.
    
    Options:
      --headless [boolean]  specify running the browser in headless
                            mode.
      --devtools [boolean]  open browser devtools automatically.
      --ts-write [boolean]  write the js output of the target ts file.
      --url [string]        specify a specific url to execute the code
                            in.
      -h, --help            display help for command

Minor Changes

  • ea5b50d: Add writeFile, appendFile exposed functions. (#44)[https://github.com//issues/44]

    await writeFile('./log.txt', 'hello');
    await appendFile('./log.txt', '\n');
    await appendFile('./log.txt', 'world');

    Include custom exposed functions example.

    import { join } from 'node:path'
    import fs from 'node:fs/promises';
    
    function loadFile(path) {
      return fs.readFile(join(process.cwd(), path), 'utf8');
    }
    
    export default /** @type {import('@heymp/scratchpad/src/config').Config} */ ({
      playwright: async (args) => {
        const { context, page } = args;
        await context.exposeFunction('loadFile', loadFile)
      }
    });
  • a242c0f: ⚠️ Change config types directory.

    export default /** @type {import('@heymp/scratchpad/src/config').Config} */ ({});

v1.0.0-next.7

02 Aug 16:58
41365b8
Compare
Choose a tag to compare
v1.0.0-next.7 Pre-release
Pre-release

Minor Changes

  • c31a8f9: Expose Playwright runtime context to scratchpad.config.js #40

    scratchpad.config.js

    export default /** @type {import('@heymp/scratchpad/config').Config} */ ({
      devtools: true,
      playwright: async (args) => {
        const { context, page } = args;
        // block esmodule shims
        await context.route(/es-module-shims\.js/, async (route) => {
          await route.abort();
        });
        await page.goto("https://ux.redhat.com");
      },
    });
  • f6fb1f2: Add option for writing the js output to a file based on the compiled
    ts target. Use --ts-write as a boolean flag in the cli.

Patch Changes

  • c31a8f9: Add typings for scratchpad.config.js #37

    export default /** @type {import('@heymp/scratchpad/config').Config} */ ({
      devtools: true,
      headless: true,
      url: "https://google.com",
    });

v1.0.0-next.6

01 Aug 03:29
c0d3ec3
Compare
Choose a tag to compare
v1.0.0-next.6 Pre-release
Pre-release

Minor Changes

  • 2bcb56e: Add scratchpad.config.js file as an alternative to specifying scratchpad options
    using the CLI flags.

    export default {
      devtools: true,
      headless: false,
      url: "https://www.google.com",
    };

    NOTE: CLI flags will take precidence over config file options.

v1.0.0-next.5

01 Aug 02:54
0e6cb47
Compare
Choose a tag to compare
v1.0.0-next.5 Pre-release
Pre-release

Minor Changes

  • db0f2af: Open devtools automatically with cli flag. Use the --devtools flag
    to enable the devtools in the browser.

v1.0.0-next.4

04 Jul 16:59
3174092
Compare
Choose a tag to compare
v1.0.0-next.4 Pre-release
Pre-release

Minor Changes

  • 7b6410e: Migrate from tsc to esbuild for TS compilation

v1.0.0-next.3

19 Jun 14:10
3a5c1d4
Compare
Choose a tag to compare
v1.0.0-next.3 Pre-release
Pre-release

Major Changes

v1.0.0-next.2

02 Mar 19:50
0f83901
Compare
Choose a tag to compare
v1.0.0-next.2 Pre-release
Pre-release

Patch Changes