Refactor justfile and package configurations for improved development workflow
- Updated `justfile` to simplify dev server commands and clean up node_modules. - Added Turbo as a dev dependency in `package.json` for enhanced build performance. - Modified `apps/scraper/package.json` and `apps/web/package.json` to include clean scripts. - Adjusted `apps/web/src/payload-types.ts` to make `orderNumber` optional. - Refactored `apps/web/src/collections/Orders.ts` to change hook from `beforeChange` to `beforeValidate` for better data handling during order creation. - Added type checking and cleaning scripts to `packages/shared/package.json` for consistency across packages.
This commit is contained in:
parent
45588fd30d
commit
f9cbc8b9a6
@ -6,6 +6,8 @@
|
||||
"scripts": {
|
||||
"dev": "tsx --env-file=.env src/index.ts",
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"clean": "rm -rf dist .turbo node_modules",
|
||||
"scrape": "tsx --env-file=.env src/index.ts",
|
||||
"scrape:raw": "tsx --env-file=.env src/index.ts raw",
|
||||
"llm:process": "tsx --env-file=.env src/process.ts",
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
"start": "next start",
|
||||
"lint": "eslint .",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"clean": "rm -rf .next .turbo node_modules",
|
||||
"generate:types": "payload generate:types"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@ -15,7 +15,6 @@ export const Orders: CollectionConfig = {
|
||||
{
|
||||
name: "orderNumber",
|
||||
type: "number",
|
||||
required: true,
|
||||
unique: true,
|
||||
admin: {
|
||||
readOnly: true,
|
||||
@ -92,13 +91,13 @@ export const Orders: CollectionConfig = {
|
||||
},
|
||||
],
|
||||
hooks: {
|
||||
beforeChange: [
|
||||
beforeValidate: [
|
||||
async ({ data, operation, req }) => {
|
||||
if (operation === "create") {
|
||||
const { totalDocs } = await req.payload.count({
|
||||
collection: "orders",
|
||||
});
|
||||
data.orderNumber = totalDocs + 1;
|
||||
data!.orderNumber = totalDocs + 1;
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
@ -311,7 +311,7 @@ export interface Media {
|
||||
*/
|
||||
export interface Order {
|
||||
id: number;
|
||||
orderNumber: number;
|
||||
orderNumber?: number | null;
|
||||
items: {
|
||||
product: number | Product;
|
||||
quantity: number;
|
||||
|
||||
8
justfile
8
justfile
@ -33,13 +33,13 @@ env:
|
||||
@[ -f apps/web/.env ] || (cp apps/web/.env.example apps/web/.env && sed -i 's/:5432/:5435/' apps/web/.env && echo "Created apps/web/.env (port adjusted to 5435)")
|
||||
@[ -f apps/web/.env ] && echo "apps/web/.env exists"
|
||||
|
||||
# Start Next.js dev server
|
||||
# Start dev server(s) via Turbo
|
||||
dev:
|
||||
pnpm --filter @advdoors/web dev
|
||||
pnpm dev
|
||||
|
||||
# Start everything: services + dev server
|
||||
up: services
|
||||
pnpm --filter @advdoors/web dev
|
||||
pnpm dev
|
||||
|
||||
# Run scraper (import directly to Payload)
|
||||
scrape:
|
||||
@ -72,7 +72,7 @@ lint:
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
pnpm turbo clean
|
||||
rm -rf node_modules apps/*/node_modules packages/*/node_modules
|
||||
rm -rf node_modules
|
||||
|
||||
# Reset dev database (destructive)
|
||||
db-reset:
|
||||
|
||||
@ -8,6 +8,9 @@
|
||||
"typecheck": "turbo typecheck",
|
||||
"clean": "turbo clean"
|
||||
},
|
||||
"devDependencies": {
|
||||
"turbo": "^2"
|
||||
},
|
||||
"packageManager": "pnpm@10.20.0",
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
|
||||
@ -4,6 +4,10 @@
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"clean": "rm -rf dist .turbo node_modules"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
|
||||
67
pnpm-lock.yaml
generated
67
pnpm-lock.yaml
generated
@ -6,7 +6,11 @@ settings:
|
||||
|
||||
importers:
|
||||
|
||||
.: {}
|
||||
.:
|
||||
devDependencies:
|
||||
turbo:
|
||||
specifier: ^2
|
||||
version: 2.9.3
|
||||
|
||||
apps/scraper:
|
||||
dependencies:
|
||||
@ -1756,6 +1760,36 @@ packages:
|
||||
'@tokenizer/token@0.3.0':
|
||||
resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==}
|
||||
|
||||
'@turbo/darwin-64@2.9.3':
|
||||
resolution: {integrity: sha512-P8foouaP+y/p+hhEGBoZpzMbpVvUMwPjDpcy6wN7EYfvvyISD1USuV27qWkczecihwuPJzQ1lDBuL8ERcavTyg==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@turbo/darwin-arm64@2.9.3':
|
||||
resolution: {integrity: sha512-SIzEkvtNdzdI50FJDaIQ6kQGqgSSdFPcdn0wqmmONN6iGKjy6hsT+EH99GP65FsfV7DLZTh2NmtTIRl2kdoz5Q==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@turbo/linux-64@2.9.3':
|
||||
resolution: {integrity: sha512-pLRwFmcHHNBvsCySLS6OFabr/07kDT2pxEt/k6eBf/3asiVQZKJ7Rk88AafQx2aYA641qek4RsXvYO3JYpiBug==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@turbo/linux-arm64@2.9.3':
|
||||
resolution: {integrity: sha512-gy6ApUroC2Nzv+qjGtE/uPNkhHAFU4c8God+zd5Aiv9L9uBgHlxVJpHT3XWl5xwlJZ2KWuMrlHTaS5kmNB+q1Q==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@turbo/windows-64@2.9.3':
|
||||
resolution: {integrity: sha512-d0YelTX6hAsB7kIEtGB3PzIzSfAg3yDoUlHwuwJc3adBXUsyUIs0YLG+1NNtuhcDOUGnWQeKUoJ2pGWvbpRj7w==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@turbo/windows-arm64@2.9.3':
|
||||
resolution: {integrity: sha512-/08CwpKJl3oRY8nOlh2YgilZVJDHsr60XTNxRhuDeuFXONpUZ5X+Nv65izbG/xBew9qxcJFbDX9/sAmAX+ITcQ==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@types/acorn@4.0.6':
|
||||
resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==}
|
||||
|
||||
@ -3555,6 +3589,10 @@ packages:
|
||||
engines: {node: '>=18.0.0'}
|
||||
hasBin: true
|
||||
|
||||
turbo@2.9.3:
|
||||
resolution: {integrity: sha512-J/VUvsGRykPb9R8Kh8dHVBOqioDexLk9BhLCU/ZybRR+HN9UR3cURdazFvNgMDt9zPP8TF6K73Z+tplfmi0PqQ==}
|
||||
hasBin: true
|
||||
|
||||
type-check@0.4.0:
|
||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
@ -5750,6 +5788,24 @@ snapshots:
|
||||
|
||||
'@tokenizer/token@0.3.0': {}
|
||||
|
||||
'@turbo/darwin-64@2.9.3':
|
||||
optional: true
|
||||
|
||||
'@turbo/darwin-arm64@2.9.3':
|
||||
optional: true
|
||||
|
||||
'@turbo/linux-64@2.9.3':
|
||||
optional: true
|
||||
|
||||
'@turbo/linux-arm64@2.9.3':
|
||||
optional: true
|
||||
|
||||
'@turbo/windows-64@2.9.3':
|
||||
optional: true
|
||||
|
||||
'@turbo/windows-arm64@2.9.3':
|
||||
optional: true
|
||||
|
||||
'@types/acorn@4.0.6':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.8
|
||||
@ -7735,6 +7791,15 @@ snapshots:
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
|
||||
turbo@2.9.3:
|
||||
optionalDependencies:
|
||||
'@turbo/darwin-64': 2.9.3
|
||||
'@turbo/darwin-arm64': 2.9.3
|
||||
'@turbo/linux-64': 2.9.3
|
||||
'@turbo/linux-arm64': 2.9.3
|
||||
'@turbo/windows-64': 2.9.3
|
||||
'@turbo/windows-arm64': 2.9.3
|
||||
|
||||
type-check@0.4.0:
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user