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": {
|
"scripts": {
|
||||||
"dev": "tsx --env-file=.env src/index.ts",
|
"dev": "tsx --env-file=.env src/index.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
"typecheck": "tsc --noEmit",
|
||||||
|
"clean": "rm -rf dist .turbo node_modules",
|
||||||
"scrape": "tsx --env-file=.env src/index.ts",
|
"scrape": "tsx --env-file=.env src/index.ts",
|
||||||
"scrape:raw": "tsx --env-file=.env src/index.ts raw",
|
"scrape:raw": "tsx --env-file=.env src/index.ts raw",
|
||||||
"llm:process": "tsx --env-file=.env src/process.ts",
|
"llm:process": "tsx --env-file=.env src/process.ts",
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
|
"clean": "rm -rf .next .turbo node_modules",
|
||||||
"generate:types": "payload generate:types"
|
"generate:types": "payload generate:types"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -15,7 +15,6 @@ export const Orders: CollectionConfig = {
|
|||||||
{
|
{
|
||||||
name: "orderNumber",
|
name: "orderNumber",
|
||||||
type: "number",
|
type: "number",
|
||||||
required: true,
|
|
||||||
unique: true,
|
unique: true,
|
||||||
admin: {
|
admin: {
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
@ -92,13 +91,13 @@ export const Orders: CollectionConfig = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
hooks: {
|
hooks: {
|
||||||
beforeChange: [
|
beforeValidate: [
|
||||||
async ({ data, operation, req }) => {
|
async ({ data, operation, req }) => {
|
||||||
if (operation === "create") {
|
if (operation === "create") {
|
||||||
const { totalDocs } = await req.payload.count({
|
const { totalDocs } = await req.payload.count({
|
||||||
collection: "orders",
|
collection: "orders",
|
||||||
});
|
});
|
||||||
data.orderNumber = totalDocs + 1;
|
data!.orderNumber = totalDocs + 1;
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -311,7 +311,7 @@ export interface Media {
|
|||||||
*/
|
*/
|
||||||
export interface Order {
|
export interface Order {
|
||||||
id: number;
|
id: number;
|
||||||
orderNumber: number;
|
orderNumber?: number | null;
|
||||||
items: {
|
items: {
|
||||||
product: number | Product;
|
product: number | Product;
|
||||||
quantity: number;
|
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 ] || (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"
|
@[ -f apps/web/.env ] && echo "apps/web/.env exists"
|
||||||
|
|
||||||
# Start Next.js dev server
|
# Start dev server(s) via Turbo
|
||||||
dev:
|
dev:
|
||||||
pnpm --filter @advdoors/web dev
|
pnpm dev
|
||||||
|
|
||||||
# Start everything: services + dev server
|
# Start everything: services + dev server
|
||||||
up: services
|
up: services
|
||||||
pnpm --filter @advdoors/web dev
|
pnpm dev
|
||||||
|
|
||||||
# Run scraper (import directly to Payload)
|
# Run scraper (import directly to Payload)
|
||||||
scrape:
|
scrape:
|
||||||
@ -72,7 +72,7 @@ lint:
|
|||||||
# Clean build artifacts
|
# Clean build artifacts
|
||||||
clean:
|
clean:
|
||||||
pnpm turbo clean
|
pnpm turbo clean
|
||||||
rm -rf node_modules apps/*/node_modules packages/*/node_modules
|
rm -rf node_modules
|
||||||
|
|
||||||
# Reset dev database (destructive)
|
# Reset dev database (destructive)
|
||||||
db-reset:
|
db-reset:
|
||||||
|
|||||||
@ -8,6 +8,9 @@
|
|||||||
"typecheck": "turbo typecheck",
|
"typecheck": "turbo typecheck",
|
||||||
"clean": "turbo clean"
|
"clean": "turbo clean"
|
||||||
},
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"turbo": "^2"
|
||||||
|
},
|
||||||
"packageManager": "pnpm@10.20.0",
|
"packageManager": "pnpm@10.20.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=22"
|
"node": ">=22"
|
||||||
|
|||||||
@ -4,6 +4,10 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"typecheck": "tsc --noEmit",
|
||||||
|
"clean": "rm -rf dist .turbo node_modules"
|
||||||
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
|
|||||||
67
pnpm-lock.yaml
generated
67
pnpm-lock.yaml
generated
@ -6,7 +6,11 @@ settings:
|
|||||||
|
|
||||||
importers:
|
importers:
|
||||||
|
|
||||||
.: {}
|
.:
|
||||||
|
devDependencies:
|
||||||
|
turbo:
|
||||||
|
specifier: ^2
|
||||||
|
version: 2.9.3
|
||||||
|
|
||||||
apps/scraper:
|
apps/scraper:
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -1756,6 +1760,36 @@ packages:
|
|||||||
'@tokenizer/token@0.3.0':
|
'@tokenizer/token@0.3.0':
|
||||||
resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==}
|
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':
|
'@types/acorn@4.0.6':
|
||||||
resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==}
|
resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==}
|
||||||
|
|
||||||
@ -3555,6 +3589,10 @@ packages:
|
|||||||
engines: {node: '>=18.0.0'}
|
engines: {node: '>=18.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
turbo@2.9.3:
|
||||||
|
resolution: {integrity: sha512-J/VUvsGRykPb9R8Kh8dHVBOqioDexLk9BhLCU/ZybRR+HN9UR3cURdazFvNgMDt9zPP8TF6K73Z+tplfmi0PqQ==}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
type-check@0.4.0:
|
type-check@0.4.0:
|
||||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
@ -5750,6 +5788,24 @@ snapshots:
|
|||||||
|
|
||||||
'@tokenizer/token@0.3.0': {}
|
'@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':
|
'@types/acorn@4.0.6':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/estree': 1.0.8
|
'@types/estree': 1.0.8
|
||||||
@ -7735,6 +7791,15 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents: 2.3.3
|
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:
|
type-check@0.4.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
prelude-ls: 1.2.1
|
prelude-ls: 1.2.1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user