Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ff051ce
ENG-219: Add app bootstrap, config, and shared utilities
d4mation Feb 11, 2026
e768bf1
Merge branch 'ENG-219/build-setup' into ENG-219/app-bootstrap
d4mation Feb 11, 2026
71b22cc
Merge branch 'ENG-219/build-setup' into ENG-219/app-bootstrap
d4mation Feb 11, 2026
d18da44
Merge branch 'ENG-219/build-setup' into ENG-219/app-bootstrap
d4mation Feb 11, 2026
d130c3e
ENG-219: Remove PHP test and static analysis workflows
d4mation Feb 11, 2026
b0a0516
ENG-219: Fix lint error in config.ts (let → const)
d4mation Feb 11, 2026
37f4c92
Merge branch 'ENG-219/build-setup' into ENG-219/app-bootstrap
d4mation Feb 11, 2026
56a1585
ENG-219: Add build step before running tests in CI
d4mation Feb 11, 2026
12df110
ENG-219: Add npm caching to CI workflows
d4mation Feb 11, 2026
3fb3385
ENG-219: Check for invalid .puprc during app initialization
d4mation Feb 11, 2026
741d07d
ENG-219: Add createTempProject helper for test isolation
d4mation Feb 11, 2026
cd4894d
ENG-219: Merge build-setup into app-bootstrap
d4mation Feb 11, 2026
ec2249e
ENG-219: Add node_modules caching to CI workflows
d4mation Feb 11, 2026
9f478e1
Merge branch 'ENG-219/build-setup' into ENG-219/app-bootstrap
d4mation Feb 12, 2026
3ccbe0a
Merge branch 'ENG-219/build-setup' into ENG-219/app-bootstrap
d4mation Feb 13, 2026
3135f4b
Merge branch 'ENG-219/build-setup' into ENG-219/app-bootstrap
d4mation Feb 13, 2026
75308bc
ENG-219: Address PR #30 review comments
d4mation Feb 13, 2026
fe88e3a
Merge branch 'ENG-219/build-setup' into ENG-219/app-bootstrap
d4mation Feb 13, 2026
8bc0588
ENG-219: Use bundler module resolution for .ts imports
d4mation Feb 13, 2026
35d61a5
ENG-219: Change .js to .ts import paths
d4mation Feb 13, 2026
f6c5a1d
ENG-219: Remove redundant env forwarding from process.ts
d4mation Feb 13, 2026
959c4a6
ENG-219: Rename .puprc-defaults to .puprc-defaults.json
d4mation Feb 13, 2026
8c31609
ENG-219: Add Zod schemas as single source of truth for types
d4mation Feb 13, 2026
bf9d965
ENG-219: Use JS # private fields and readonly in Config
d4mation Feb 13, 2026
658a8fa
ENG-219: Remove redundant null check in config merge
d4mation Feb 13, 2026
391ea51
ENG-219: Use path.join for version file paths
d4mation Feb 13, 2026
3c45c6f
ENG-219: Import .puprc-defaults as JSON module
d4mation Feb 13, 2026
f7e5f20
ENG-219: Validate .puprc input with Zod schema
d4mation Feb 13, 2026
4aeabfd
ENG-219: Throw on invalid .puprc instead of silent fallback
d4mation Feb 13, 2026
ea8ee0e
ENG-219: Consolidate check defaults with Zod schema
d4mation Feb 13, 2026
a497018
ENG-219: Import version directly from package.json
d4mation Feb 13, 2026
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
12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- name: Get bun cache directory
id: bun-cache
shell: bash
run: |
echo "dir=$(bun pm cache)" >> $GITHUB_OUTPUT
- name: Cache bun dependencies
uses: actions/cache@v5
with:
path: ${{ steps.bun-cache.outputs.dir }}
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- run: bun install --frozen-lockfile
- run: bun run lint
- name: Typecheck
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/static-analysis.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/tests-php.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,18 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- name: Get bun cache directory
id: bun-cache
shell: bash
run: |
echo "dir=$(bun pm cache)" >> $GITHUB_OUTPUT
- name: Cache bun dependencies
uses: actions/cache@v5
with:
path: ${{ steps.bun-cache.outputs.dir }}
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun run test
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"execa": "^8.0.1",
"fs-extra": "^11.2.0",
"picomatch": "^4.0.0",
"simple-git": "^3.22.0"
"simple-git": "^3.22.0",
"zod": "^4.3.6"
},
"devDependencies": {
"@jest/types": "^30.2.0",
Expand Down
28 changes: 28 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Command } from 'commander';
import { Config, getConfig, resetConfig } from './config.ts';
import { version } from '../package.json';

export const PUP_VERSION = version;

/**
* Creates and configures the Commander program instance.
*
* @since TBD
*
* @returns {Command} The configured Commander program.
*/
export function createApp(): Command {
resetConfig();

getConfig();
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that because of that getConfig invocation, the --root flag doesn't work in other commands. So the config will always be created for the current work directory. Can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be right, actually. --root is poorly described in the PHP version of the code (and I've been fixing it in the TS version as I've noticed it).

When you call something like pup i18n --root some-dir it changes the CWD for downloading the translation files. It doesn't change where the Config itself is loaded from.

So, we should load the config as early as possible like we are now. This ensures that the config is loaded at all times. --root doesn't impact the config itself, so we don't need to worry about it.

It looks like some commands are strangely passing --root to the config though which is causing this confusion. I'm fixing that now :)


const program = new Command();
program
.name('pup')
.version(PUP_VERSION)
.description("StellarWP's Project Utilities & Packager");

return program;
}

export { Config, getConfig, resetConfig };
8 changes: 8 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createApp } from './app.ts';

const program = createApp();

program.parseAsync(process.argv).catch((err) => {
console.error(err instanceof Error ? err.message : String(err));
process.exit(1);
});
Loading