Skip to content

Commit

Permalink
Merge pull request #8 from maxholman/qol20241013
Browse files Browse the repository at this point in the history
QOL updates 2024-10
  • Loading branch information
maxholman authored Oct 13, 2024
2 parents f800e88 + e3eaa5d commit 0cddbd1
Show file tree
Hide file tree
Showing 29 changed files with 47,380 additions and 13,661 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ dist
node_modules
build
tmp
jest.config.js
babel.config.js
4 changes: 4 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

Expand Down
36 changes: 21 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,58 @@ deps: node_modules

.PHONY: clean
clean:
pnpm tsc -b --clean
pnpm exec tsc -b --clean
rm -rf dist
rm -rf __tests__/dist
rm __tests__/fixtures/*/*.ts

.PHONY: test
test: node_modules
pnpm tsc -b
NODE_OPTIONS=--experimental-vm-modules pnpm jest
pnpm exec tsc -b
pnpm exec vitest

node_modules: package.json
pnpm install

dist: node_modules tsconfig.json $(SRCS)
pnpm tsc
pnpm exec tsc

.PHONY: dev
dev:
pnpm tsc -b -w

.PHONY: fixtures
fixtures: dist petstore test1 openai
fixtures: dist
$(MAKE) petstore test1 openai

.PHONY: petstore
petstore: __tests__/fixtures/petstore.json dist
node --enable-source-maps dist/bin/index.js \
-i $< \
-o __tests__/fixtures/petstore
pnpm prettier --write __tests__/fixtures/petstore
pnpm exec prettier --write __tests__/fixtures/petstore

.PHONY: test1
test1: __tests__/fixtures/test1.json dist
node --enable-source-maps dist/bin/index.js \
-i $< \
-o __tests__/fixtures/test1
pnpm prettier --write __tests__/fixtures/test1
pnpm exec prettier --write __tests__/fixtures/test1

.PHONY: openai
openai: __tests__/fixtures/openai.yaml dist

__tests__/fixtures/openai.json: __tests__/fixtures/openai.yaml
mkdir -p $(@D)
pnpm js-yaml $< > $(@D)/openai.json
pnpm exec js-yaml $< > $@

__tests__/fixtures/openai.yaml: __tests__/fixtures/openai.yaml
curl https://raw.githubusercontent.com/openai/openai-openapi/refs/heads/master/openapi.yaml --output $@

.PHONY: openai
openai: __tests__/fixtures/openai.json dist
node --enable-source-maps dist/bin/index.js \
-i $(@D)/openai.json \
-i $< \
-o __tests__/fixtures/openai
pnpm prettier --write __tests__/fixtures/openai

pnpm exec prettier --write __tests__/fixtures/openai

# .PHONY: cloudflare
# cloudflare: __tests__/fixtures/cloudflare/openapi.json dist
Expand All @@ -64,5 +70,5 @@ openai: __tests__/fixtures/openai.yaml dist

.PHONY: pretty
pretty: node_modules
pnpm eslint --fix . || true
pnpm prettier --write .
pnpm exec eslint --fix . || true
pnpm exec prettier --write .
7 changes: 2 additions & 5 deletions __tests__/__snapshots__/nullables.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`nullables 1`] = `
"import type { Jsonifiable, Jsonify } from "type-fest";
import type { JsonifiableObject } from "type-fest/source/jsonifiable.js";
export type MySchemaLolOrNullable = "lol" | "kek" | null;
"export type MySchemaLolOrNullable = "lol" | "kek" | null;
"
`;
16,914 changes: 16,914 additions & 0 deletions __tests__/fixtures/openai.json

Large diffs are not rendered by default.

Loading

0 comments on commit 0cddbd1

Please sign in to comment.