-
Notifications
You must be signed in to change notification settings - Fork 0
TypeScript Rewrite: Build setup #29
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
base: base/ENG-219/typescript-rewrite
Are you sure you want to change the base?
Changes from 13 commits
293de18
686de67
69dcc4d
829a32e
48a5e67
98fc424
6f8e6c4
986ff48
df95ee5
cf9fde7
67488c8
6b2cb5b
8188393
dc06445
03b4edc
1c9f3aa
b873683
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,6 @@ | ||
| # To get started with Dependabot version updates, you'll need to specify which | ||
| # package ecosystems to update and where the package manifests are located. | ||
| # Please see the documentation for all configuration options: | ||
| # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
|
||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "composer" # See documentation for possible values | ||
| directory: "/" # Location of package manifests | ||
| - package-ecosystem: "npm" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: Lint & Typecheck | ||
| on: [push, pull_request] | ||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - run: bun install --frozen-lockfile | ||
| - run: bun run lint | ||
| - name: Typecheck | ||
| run: | | ||
| if ls src/**/*.ts >/dev/null 2>&1; then | ||
| bun run typecheck | ||
| else | ||
| echo "No TypeScript source files found, skipping typecheck" | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name: Tests | ||
| on: [push, pull_request] | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - run: bun install --frozen-lockfile | ||
| - name: Setup git | ||
| run: | | ||
| git config --global user.name "StellarWP GitHub Action" | ||
| git config --global user.email "action@github.com" | ||
| - run: bun run test | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 18 | ||
d4mation marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import tseslint from 'typescript-eslint'; | ||
|
|
||
| export default [ | ||
| ...tseslint.configs.recommended, | ||
| { | ||
| ignores: ['dist/', 'node_modules/', '*.js', '*.mjs'], | ||
| }, | ||
| { | ||
| rules: { | ||
| '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], | ||
| '@typescript-eslint/no-explicit-any': 'warn', | ||
| }, | ||
| }, | ||
| ]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import type { Config } from "@jest/types"; | ||
|
|
||
| const config: Config.InitialOptions = { | ||
| preset: "ts-jest", | ||
| testEnvironment: "node", | ||
| testMatch: ["**/tests/**/*.test.ts"], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A more usual pattern is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can change this after we get most/all of the Rewrite PRs through. They all have their own tests and we'd have to update every single branch with this change 😅 |
||
| transform: { | ||
| "^.+\\.tsx?$": [ | ||
| "ts-jest", | ||
| { | ||
| tsconfig: "tsconfig.test.json", | ||
| }, | ||
| ], | ||
| }, | ||
| moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], | ||
| moduleNameMapper: { | ||
| "^(\\.{1,2}/.*)\\.js$": "$1", | ||
| }, | ||
| transformIgnorePatterns: [ | ||
| "node_modules/(?!(execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-stream|signal-exit|picomatch|chalk|ansi-styles|supports-color|simple-git|fs-extra)/)", | ||
| ], | ||
| clearMocks: true, | ||
| }; | ||
|
|
||
| export default config; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| { | ||
| "name": "@stellarwp/pup", | ||
| "version": "2.0.0", | ||
| "description": "StellarWP's Project Utilities & Packager", | ||
| "bin": { | ||
| "pup": "./dist/cli.js" | ||
| }, | ||
| "type": "module", | ||
| "engines": { | ||
| "node": ">=18" | ||
d4mation marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "files": [ | ||
| "dist/", | ||
| "defaults/", | ||
| "docs/", | ||
| "action.yml" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsup", | ||
| "dev": "tsup --watch", | ||
| "test": "TS_NODE_PROJECT=tsconfig.test.json jest --passWithNoTests", | ||
| "lint": "eslint --no-error-on-unmatched-pattern src/ tests/", | ||
| "typecheck": "tsc --noEmit" | ||
| }, | ||
| "keywords": [ | ||
| "stellarwp", | ||
| "wordpress", | ||
| "build", | ||
| "packager", | ||
| "cli" | ||
| ], | ||
| "author": "StellarWP <dev@stellarwp.com>", | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "archiver": "^7.0.0", | ||
| "chalk": "^5.3.0", | ||
| "commander": "^12.0.0", | ||
| "execa": "^8.0.1", | ||
| "fs-extra": "^11.2.0", | ||
| "picomatch": "^4.0.0", | ||
| "simple-git": "^3.22.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@jest/types": "^30.2.0", | ||
| "@types/archiver": "^6.0.0", | ||
| "@types/fs-extra": "^11.0.0", | ||
| "@types/jest": "^30.0.0", | ||
| "@types/node": "^20.0.0", | ||
| "@types/picomatch": "^3.0.0", | ||
| "eslint": "^9.0.0", | ||
| "jest": "^29.7.0", | ||
| "ts-jest": "^29.1.0", | ||
| "ts-node": "^10.9.2", | ||
| "tsup": "^8.0.0", | ||
| "typescript": "^5.4.0", | ||
| "typescript-eslint": "^8.0.0" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "target": "ES2022", | ||
| "module": "NodeNext", | ||
| "moduleResolution": "NodeNext", | ||
| "lib": ["ES2022"], | ||
| "outDir": "dist", | ||
| "rootDir": "src", | ||
| "strict": true, | ||
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "resolveJsonModule": true, | ||
| "declaration": true, | ||
| "declarationMap": true, | ||
| "sourceMap": true | ||
| }, | ||
| "include": ["src/**/*"], | ||
| "exclude": ["node_modules", "dist", "tests"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "rootDir": ".", | ||
| "module": "commonjs", | ||
| "moduleResolution": "node", | ||
| "noEmit": true | ||
| }, | ||
| "include": ["src/**/*", "tests/**/*", "jest.config.ts"], | ||
| "ts-node": { | ||
| "compilerOptions": { | ||
| "module": "commonjs", | ||
| "moduleResolution": "node" | ||
| } | ||
| } | ||
| } |
d4mation marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { defineConfig } from 'tsup'; | ||
|
|
||
| export default defineConfig({ | ||
| entry: ['src/cli.ts'], | ||
| format: ['esm'], | ||
| target: 'node18', | ||
| outDir: 'dist', | ||
| clean: true, | ||
| sourcemap: true, | ||
| dts: false, | ||
| banner: { | ||
| js: '#!/usr/bin/env node', | ||
| }, | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.