Skip to content
Open
Show file tree
Hide file tree
Changes from 14 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
6 changes: 6 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- run: bun install --frozen-lockfile
- run: bun run lint
- name: Typecheck
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/static-analysis.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These workflows were originally removed only in #41, but these workflows fail once .distignore-defaults and .puprc-defaults are moved, so we will delete them in this branch to avoid confusion with CI during reviews.

This file was deleted.

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

This file was deleted.

7 changes: 7 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun run test
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Command } from 'commander';
import { Config, getConfig, resetConfig } from './config.js';
import * as output from './utils/output.js';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import fs from 'fs-extra';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

/**
* Reads the pup version from the nearest package.json.
*
* @since TBD
*
* @returns {string} The version string from package.json, or '2.0.0' as a fallback.
*/
function getVersion(): string {
// Try to read from package.json
const candidates = [
path.resolve(__dirname, '..', 'package.json'),
path.resolve(__dirname, '..', '..', 'package.json'),
];

for (const candidate of candidates) {
if (fs.existsSync(candidate)) {
const pkg = JSON.parse(fs.readFileSync(candidate, 'utf-8')) as { version: string };
return pkg.version;
}
}

return '2.0.0';
}

export const PUP_VERSION = getVersion();

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

const config = getConfig();
if (config.hasInvalidPuprc()) {
output.error('There is a .puprc file in this directory, but it could not be parsed.');
output.error(`JSON Error: ${config.getPuprcParseError()}`);
}

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.js';

const program = createApp();

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