Skip to content
Open
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
9 changes: 2 additions & 7 deletions .github/dependabot.yml
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"
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
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
10 changes: 10 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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
- run: bun run test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ vendor/
tests/_output
tests/_support/_generated
tests/_data/**/.puprc
tests/_data/fake-project-git-repo
tests/_data/fake-project-git-repo
node_modules
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
1,572 changes: 1,572 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions eslint.config.js
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',
},
},
];
25 changes: 25 additions & 0 deletions jest.config.ts
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"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more usual pattern is *.spec.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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;
58 changes: 58 additions & 0 deletions package.json
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": ">=20"
},
"files": [
"dist/",
"defaults/",
"docs/",
"action.yml"
],
"scripts": {
"build": "tsdown",
"dev": "tsdown --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",
"tsdown": "^0.20.3",
"typescript": "^5.4.0",
"typescript-eslint": "^8.0.0"
}
}
20 changes: 20 additions & 0 deletions tsconfig.json
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"]
}
16 changes: 16 additions & 0 deletions tsconfig.test.json
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"
}
}
}
14 changes: 14 additions & 0 deletions tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'tsdown';

export default defineConfig({
entry: ['src/cli.ts'],
format: ['esm'],
target: 'node20',
outDir: 'dist',
fixedExtension: false,
sourcemap: true,
dts: false,
outputOptions: {
banner: '#!/usr/bin/env node',
},
});