Man hours uses subtotal
CI / build (push) Has been skipped
CI / deploy (push) Successful in 47s

This commit is contained in:
2026-03-18 10:44:13 -05:00
parent a9e0bafef0
commit 716a06ee28
2 changed files with 51 additions and 2 deletions
+43
View File
@@ -0,0 +1,43 @@
# New App Checklist (Vite + Bun + PM2)
## 1) Local Repo Changes
- Add `serve` script:
- `"serve": "serve -s dist -l tcp://0.0.0.0:$PORT"`
- Add dependency:
- `serve` (run `bun add serve`)
## 2) CI Workflow
- Use the template file in `ci-template.yaml`.
- Replace placeholders:
- `<APP_NAME>`
- `<APP_PORT>`
- `<DEPLOY_PATH>`
## 3) Server One-Time Setup
- Create deploy directory:
- `mkdir -p <DEPLOY_PATH>`
- First PM2 start:
- `cd <DEPLOY_PATH>`
- `PORT=<APP_PORT> pm2 start "bun run serve" --name <APP_NAME>`
- `pm2 save`
## 4) Deploy + Restart (CI will do this)
- Files copied to server:
- `dist/`, `package.json`, `bun.lock` (or `bun.lockb`)
- On server:
- `bun install --production`
- `PORT=<APP_PORT> pm2 restart <APP_NAME> --update-env`
## 5) Verification
- PM2 process:
- `pm2 show <APP_NAME>`
- Port:
- `pm2 env <ID> | grep PORT`
- Bind:
- `pm2 logs <APP_NAME> --lines 20`
- Expect: `Accepting connections at http://0.0.0.0:<APP_PORT>`
- Files:
- `ls -la <DEPLOY_PATH>`
- `ls -la <DEPLOY_PATH>/dist | head -20`
- HTTP:
- `curl -I http://<SERVER_IP>:<APP_PORT>`
+8 -2
View File
@@ -12,6 +12,10 @@ export interface ModifierModule {
calculateDisplay?: (modifier: Modifier, subScopeTotalWithMarkup: number, subScopeItems: EstimateItem[]) => number; calculateDisplay?: (modifier: Modifier, subScopeTotalWithMarkup: number, subScopeItems: EstimateItem[]) => number;
} }
const getPreMarkupSubtotal = (items: EstimateItem[]) => {
return items.reduce((sum, item) => sum + item.quantity * item.unitPrice, 0);
};
const TaxModule: ModifierModule = { const TaxModule: ModifierModule = {
id: 'tax', id: 'tax',
name: 'Tax', name: 'Tax',
@@ -34,9 +38,11 @@ const ManHoursModule: ModifierModule = {
defaultValueType: 'unit', defaultValueType: 'unit',
defaultUnitLabel: 'factor', defaultUnitLabel: 'factor',
calculate: () => 0, calculate: () => 0,
calculateDisplay: (m, base) => { calculateDisplay: (m, _, items) => {
const factor = m.value || 1; const factor = m.value || 1;
return base / factor; if (factor === 0) return 0;
const subtotal = getPreMarkupSubtotal(items);
return subtotal / factor;
} }
}; };