Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from TSDX to publishing untranspiled .ts source files #587

Merged
merged 18 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"buildCommand": false
}
3 changes: 0 additions & 3 deletions .github/workflows/build-and-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ jobs:

- run: pnpm install

- name: Compile TypeScript
run: pnpm docker-build-ts

# Publish to container registry
- name: Log in to the Container registry
uses: docker/login-action@v3
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,5 @@ jobs:
- run: pnpm tsc --build
if: runner.os != 'Windows'

- name: Build
run: pnpm build

- name: Test
run: pnpm test
18 changes: 0 additions & 18 deletions .github/workflows/package-size.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ node_modules
dist

__tests__/fixtures/__temp
docker/clone-and-preflight.js

*.tsbuildinfo

Expand Down
6 changes: 0 additions & 6 deletions .size-limit.json

This file was deleted.

10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM node:lts-alpine
# TODO: Switch back to lts-alpine once v22 becomes LTS
# FROM node:lts-alpine
FROM node:22-alpine

WORKDIR /preflight

Expand All @@ -21,6 +23,6 @@ ENV PNPM_HOME=/usr/local/bin

RUN pnpm add --global @upleveled/preflight@latest

COPY ./docker/clone-and-preflight.js ./
RUN chmod +x ./clone-and-preflight.js
ENTRYPOINT ["./clone-and-preflight.js"]
COPY ./docker/clone-and-preflight.ts ./
RUN chmod +x ./clone-and-preflight.ts
ENTRYPOINT ["./clone-and-preflight.ts"]
8 changes: 6 additions & 2 deletions __tests__/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const fixturesTempDir = '__tests__/fixtures/__temp';

beforeAll(
async () => {
// Pack and install Preflight globally
const { stdout: pnpmPackTarballPath } = await execa`pnpm pack`;
await execa`pnpm add --global ${process.cwd()}/${pnpmPackTarballPath}`;

await pMap(
[
{
Expand Down Expand Up @@ -60,7 +64,7 @@ function sortStdoutAndStripVersionNumber(stdout: string) {
test('Passes in the react-passing test project', async () => {
const { stdout, stderr } = await execa({
cwd: `${fixturesTempDir}/react-passing`,
})`${process.cwd()}/bin/preflight.js`;
})`preflight`;

expect(sortStdoutAndStripVersionNumber(stdout)).toMatchSnapshot();
expect(stderr.replace(/^\(node:\d+\) /, '')).toMatchSnapshot();
Expand All @@ -69,7 +73,7 @@ test('Passes in the react-passing test project', async () => {
test('Passes in the next-js-passing test project', async () => {
const { stdout, stderr } = await execa({
cwd: `${fixturesTempDir}/next-js-passing`,
})`${process.cwd()}/bin/preflight.js`;
})`preflight`;

expect(sortStdoutAndStripVersionNumber(stdout)).toMatchSnapshot();
expect(stderr.replace(/^\(node:\d+\) /, '')).toMatchSnapshot();
Expand Down
3 changes: 0 additions & 3 deletions bin/preflight.js

This file was deleted.

3 changes: 3 additions & 0 deletions bin/preflight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env -S pnpm exec tsx

import '../src/index.ts';
5 changes: 0 additions & 5 deletions bin/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion docker/clone-and-preflight.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
#!/usr/bin/env -S node --experimental-strip-types

import { argv, cwd, exit } from 'node:process';
import { execa as bindExeca } from 'execa';
Expand Down
13 changes: 0 additions & 13 deletions docker/tsconfig.build.json

This file was deleted.

10 changes: 0 additions & 10 deletions docker/tsconfig.json

This file was deleted.

48 changes: 10 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@upleveled/preflight",
"version": "7.0.9",
"version": "8.0.0-0",
"repository": "upleveled/preflight",
"license": "MIT",
"author": "UpLeveled (https://github.com/upleveled)",
Expand All @@ -9,28 +9,21 @@
"Karl Horky <[email protected]>"
],
"type": "module",
"main": "dist/preflight.esm.js",
"module": "dist/preflight.esm.js",
"typings": "dist/index.d.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"bin": {
"preflight": "bin/preflight.js"
"preflight": "./bin/preflight.ts"
},
"files": [
"bin/preflight.js",
"dist",
"./bin/preflight.js",
"src"
],
"scripts": {
"analyze": "size-limit --why",
"build": "tsdx build --format esm --target node --tsconfig tsconfig.src.json",
"docker-build": "docker build --tag preflight .",
"docker-build-run": "pnpm docker-build-ts && pnpm docker-build && pnpm docker-run",
"docker-build-ts": "tsc --project docker/tsconfig.build.json",
"docker-build-run": "pnpm docker-build && pnpm docker-run",
"docker-run": "docker run preflight",
"lint": "eslint . --max-warnings 0",
"prepare": "pnpm build",
"size": "size-limit",
"start": "tsdx watch --format esm --target node",
"start": "tsx watch ./src/index.ts",
"test": "vitest run",
"test-local": "rm -rf ./__tests__/fixtures/__temp && pnpm test"
},
Expand All @@ -47,44 +40,23 @@
"p-reduce": "3.0.0",
"readdirp": "4.0.2",
"semver": "7.6.3",
"top-user-agents": "2.1.24"
"top-user-agents": "2.1.24",
"tsx": "4.19.1"
},
"devDependencies": {
"@size-limit/file": "11.1.6",
"@types/node": "22.7.5",
"@types/p-map": "2.0.0",
"@types/semver": "7.5.8",
"eslint": "9.12.0",
"eslint-config-upleveled": "8.7.3",
"eslint-config-upleveled": "8.8.0",
"p-map": "7.0.2",
"postinstall-postinstall": "2.1.0",
"prettier": "3.3.3",
"size-limit": "11.1.6",
"stylelint": "16.9.0",
"tsdx": "0.14.1",
"tslib": "2.7.0",
"typescript": "5.6.3",
"vitest": "2.1.2"
},
"packageManager": "[email protected]+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4",
"engines": {
"node": ">=18"
},
"pnpm": {
"overrides": {
"@typescript-eslint/eslint-plugin": "8.8.1",
"@typescript-eslint/parser": "8.8.1",
"@typescript-eslint/scope-manager": "8.8.1",
"@typescript-eslint/utils": "8.8.1",
"eslint": "9.12.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-react-hooks": "4.6.2",
"node-notifier": "10.0.1",
"[email protected]>semver": "5.7.2",
"jest": "30.0.0-alpha.6",
"rollup-plugin-typescript2": "^0.36.0",
"ts-jest": "29.2.5",
"typescript": "5.6.3"
}
}
}
Loading