Skip to content

Commit 281e3bb

Browse files
authored
Babel simplify (#35)
1 parent 52f4b40 commit 281e3bb

File tree

14 files changed

+369
-327
lines changed

14 files changed

+369
-327
lines changed

.github/workflows/autofix.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: autofix.ci
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
autofix:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- run: corepack enable
16+
- run: pnpm install --no-frozen-lockfile
17+
- run: pnpm run lint --fix
18+
- run: git diff
19+
- uses: autofix-ci/action@551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef

README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ module.exports = {
145145
<!-- codegen:start {preset: markdownFromJsdoc, source: src/presets/custom.ts, export: custom} -->
146146
#### [custom](./src/presets/custom.ts#L62)
147147

148-
Define your own codegen function, which will receive all options specified. Import the `Preset` type from this library to define a strongly-typed preset function:
148+
Define your own codegen function, which will receive all options specified.
149+
150+
Import the `Preset` type from this library to define a strongly-typed preset function:
149151

150152
##### Example
151153

@@ -164,7 +166,12 @@ This can be used in other files by specifying the `source` option like:
164166

165167
`<!-- codegen:start {source: ./lib/my-custom-preset.js, export: jsonPrinter, myCustomProp: hello}`
166168

167-
<br /> Note that some helpers passed via `dependencies`, such as `glob`, `fs`, `path`, `child_process`, `lodash`, `jsYaml`, `dedent`, and `readPkgUp`, corresponding to those node modules respectively. These can be useful to allow access to those libraries without them being production dependencies. This also allows your lint process to use these node-only dependencies, even in a file that is not run in node - only the calls would be included in any bundled output, not the dependencies themselves.
169+
<br />
170+
171+
Note that some helpers passed via `dependencies`, such as `glob`, `fs`, `path`, `child_process`, `lodash`, `jsYaml`, `dedent`, and `readPkgUp`, corresponding to those
172+
node modules respectively. These can be useful to allow access to those libraries without them being production dependencies.
173+
This also allows your lint process to use these node-only dependencies, even in a file that is not run in node - only the calls would be included in any
174+
bundled output, not the dependencies themselves.
168175

169176
##### Params
170177

@@ -268,13 +275,17 @@ module.exports.myGenerator = ({dependencies}) => {
268275
![](./gifs/custom.gif)
269276

270277
<!-- codegen:start {preset: markdownFromJsdoc, source: src/presets/copy.ts, export: copy} -->
271-
#### [copy](./src/presets/copy.ts#L53)
278+
#### [copy](./src/presets/copy.ts#L49)
272279

273-
Copies a whole other file. Useful for "borrowing" an implementation of a simple utility from another project, without needing to publish it. Obviously this creates duplicated code, so use judiciously!
280+
Copies a whole other file. Useful for "borrowing" an implementation of a simple utility from another project, without needing to publish it.
281+
Obviously this creates duplicated code, so use judiciously!
274282

275283
##### basic usage
276284
```js
277-
// codegen:start {preset: copy, source: ../../another-project/src/some-file.ts} import {z} from 'zod' export const MyObject = z.object({ foo: z.string() })
285+
// codegen:start {preset: copy, source: ../../another-project/src/some-file.ts}
286+
import {z} from 'zod'
287+
288+
export const MyObject = z.object({foo: z.string()})
278289
// codegen:end
279290
```
280291

@@ -283,6 +294,7 @@ Copies a whole other file. Useful for "borrowing" an implementation of a simple
283294
```ts
284295
import {z} from 'zod/v4' // in this project we use zod v4, but we're copying from a project that uses zod v3
285296
// codegen:start {preset: copy, source: ../../another-project/src/some-file.ts, excludeLines: ['^import']}
297+
286298
export const MyObject = z.object({foo: z.string()})
287299
// codegen:end
288300
```
@@ -430,7 +442,12 @@ Generate a table of contents from the current markdown file, based on markdown h
430442
<!-- codegen:start {preset: markdownFromJsdoc, source: src/presets/markdown-from-tests.ts, export: markdownFromTests} -->
431443
#### [markdownFromTests](./src/presets/markdown-from-tests.ts#L25)
432444

433-
Use a test file to generate library usage documentation. Note: this has been tested with vitest and jest. It _might_ also work fine with mocha, and maybe ava, but those haven't been tested. JSDoc/inline comments above tests will be added as a "preamble", making this a decent way to quickly document API usage of a library, and to be sure that the usage is real and accurate.
445+
Use a test file to generate library usage documentation.
446+
447+
Note: this has been tested with vitest and jest. It _might_ also work fine with mocha, and maybe ava, but those haven't been tested.
448+
449+
JSDoc/inline comments above tests will be added as a "preamble", making this a decent way to quickly document API usage of a library,
450+
and to be sure that the usage is real and accurate.
434451

435452
##### Example
436453

@@ -454,7 +471,11 @@ Use a test file to generate library usage documentation. Note: this has been tes
454471
<!-- codegen:start {preset: markdownFromJsdoc, source: src/presets/labeler.ts, export: labeler} -->
455472
#### [labeler](./src/presets/labeler.ts#L26)
456473

457-
Generates a yaml config for the [GitHub Pull Request Labeler Action](https://github.com/actions/labeler). Creates a label per package name, which will be applied to any file modified under the leaf package path. When packages are added or removed from the repo, or renamed, the yaml config will stay in sync with them. Additional labels can be added outside of the generated code block. See https://github.com/mmkal/ts/tree/main/.github/labeler.yml for an example.
474+
Generates a yaml config for the [GitHub Pull Request Labeler Action](https://github.com/actions/labeler).
475+
Creates a label per package name, which will be applied to any file modified under the leaf package path.
476+
When packages are added or removed from the repo, or renamed, the yaml config will stay in sync with them.
477+
Additional labels can be added outside of the generated code block.
478+
See https://github.com/mmkal/ts/tree/main/.github/labeler.yml for an example.
458479

459480
##### Example
460481
```yaml

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"lodash": "^4.17.15",
6262
"ms": "^2.1.3",
6363
"read-pkg-up": "^7.0.1",
64+
"recast": "^0.23.11",
6465
"safe-stringify": "^1.1.0",
6566
"strip-ansi": "6.0.1",
6667
"zod": "^3.25.48",
@@ -79,15 +80,14 @@
7980
"arktype": "^2.1.20",
8081
"eslint": "^8.57.0",
8182
"eslint-plugin-mmkal": "^0.10.1",
82-
"execa": "9.6.0",
8383
"minimatch": "3.0.4",
8484
"np": "^10.0.7",
8585
"pkg-pr-new": "^0.0.17",
8686
"strip-ansi": "6.0.1",
8787
"ts-morph": "16.0.0",
8888
"ts-node": "9.1.1",
8989
"tsup": "8.5.0",
90-
"tsx": "^4.7.1",
90+
"tsx": "4.20.3",
9191
"type-fest": "^3.4.0",
9292
"typescript": "^5.2.2",
9393
"vitest": "^1.4.0"

0 commit comments

Comments
 (0)