|
1 | 1 | # @heymp/scratchpad
|
2 | 2 |
|
| 3 | +## 1.0.0-next.8 |
| 4 | + |
| 5 | +### Major Changes |
| 6 | + |
| 7 | +- 4aa2817: Add `generate config` command [#38](https://github.com/heyMP/scratchpad/issues/38) |
| 8 | + |
| 9 | + ```bash |
| 10 | + npx @heymp/scratchpad generate --help |
| 11 | + |
| 12 | + Usage: scratchpad generate [options] [command] |
| 13 | + |
| 14 | + Generate files from templates. |
| 15 | + |
| 16 | + Options: |
| 17 | + -h, --help display help for command |
| 18 | + |
| 19 | + Commands: |
| 20 | + config Generates an example config file. |
| 21 | + help [command] display help for command |
| 22 | + ``` |
| 23 | + |
| 24 | +- 4aa2817: Add `run` command |
| 25 | + |
| 26 | + ```bash |
| 27 | + npx @heymp/scratchpad run --help |
| 28 | + |
| 29 | + Usage: cli run [options] <file> |
| 30 | + |
| 31 | + Execute a file in a browser. |
| 32 | + |
| 33 | + Arguments: |
| 34 | + file file to execute in the browser. |
| 35 | + |
| 36 | + Options: |
| 37 | + --headless [boolean] specify running the browser in headless |
| 38 | + mode. |
| 39 | + --devtools [boolean] open browser devtools automatically. |
| 40 | + --ts-write [boolean] write the js output of the target ts file. |
| 41 | + --url [string] specify a specific url to execute the code |
| 42 | + in. |
| 43 | + -h, --help display help for command |
| 44 | + ``` |
| 45 | + |
| 46 | +### Minor Changes |
| 47 | + |
| 48 | +- ea5b50d: Add `writeFile`, `appendFile` exposed functions. (#44)[https://github.com/heyMP/scratchpad/issues/44] |
| 49 | + |
| 50 | + ```.js |
| 51 | + await writeFile('./log.txt', 'hello'); |
| 52 | + await appendFile('./log.txt', '\n'); |
| 53 | + await appendFile('./log.txt', 'world'); |
| 54 | + ``` |
| 55 | + |
| 56 | + Include custom exposed functions example. |
| 57 | + |
| 58 | + ```.js |
| 59 | + import { join } from 'node:path' |
| 60 | + import fs from 'node:fs/promises'; |
| 61 | + |
| 62 | + function loadFile(path) { |
| 63 | + return fs.readFile(join(process.cwd(), path), 'utf8'); |
| 64 | + } |
| 65 | + |
| 66 | + export default /** @type {import('@heymp/scratchpad/src/config').Config} */ ({ |
| 67 | + playwright: async (args) => { |
| 68 | + const { context, page } = args; |
| 69 | + await context.exposeFunction('loadFile', loadFile) |
| 70 | + } |
| 71 | + }); |
| 72 | + ``` |
| 73 | + |
| 74 | +- a242c0f: ⚠️ Change config types directory. |
| 75 | + |
| 76 | + ```js |
| 77 | + export default /** @type {import('@heymp/scratchpad/src/config').Config} */ ({}); |
| 78 | + ``` |
| 79 | + |
3 | 80 | ## 1.0.0-next.7
|
4 | 81 |
|
5 | 82 | ### Minor Changes
|
|
0 commit comments