feat(build): add automatic npm dependency management
All checks were successful
ci / build (push) Successful in 52s
All checks were successful
ci / build (push) Successful in 52s
- Add deps:ensure-npm task to automatically install npm packages when needed - Configure build, serve, and test tasks to depend on npm dependencies - Use Task's sources/generates/status for intelligent dependency detection - Prevents build failures due to missing PostCSS and other npm packages - Improves developer experience by eliminating manual npm install steps
This commit is contained in:
parent
eec679657b
commit
69457ec964
1 changed files with 24 additions and 0 deletions
24
Taskfile.yml
24
Taskfile.yml
|
|
@ -13,16 +13,22 @@ tasks:
|
|||
# Build tasks
|
||||
build:
|
||||
desc: Build Hugo site
|
||||
deps:
|
||||
- deps:ensure-npm
|
||||
cmds:
|
||||
- "{{.HUGO_CMD}} --gc --minify"
|
||||
|
||||
build:dev:
|
||||
desc: Build Hugo site for development
|
||||
deps:
|
||||
- deps:ensure-npm
|
||||
cmds:
|
||||
- "{{.HUGO_CMD}}"
|
||||
|
||||
serve:
|
||||
desc: Start Hugo dev server
|
||||
deps:
|
||||
- deps:ensure-npm
|
||||
cmds:
|
||||
- "{{.HUGO_CMD}} server"
|
||||
|
||||
|
|
@ -48,16 +54,22 @@ tasks:
|
|||
|
||||
test:build:
|
||||
desc: Test Hugo build
|
||||
deps:
|
||||
- deps:ensure-npm
|
||||
cmds:
|
||||
- "{{.HUGO_CMD}} --gc --minify --logLevel info"
|
||||
|
||||
test:markdown:
|
||||
desc: Lint markdown files
|
||||
deps:
|
||||
- deps:ensure-npm
|
||||
cmds:
|
||||
- "{{.NPM_CMD}} run test:markdown"
|
||||
|
||||
test:html:
|
||||
desc: Validate HTML
|
||||
deps:
|
||||
- deps:ensure-npm
|
||||
cmds:
|
||||
- "{{.NPM_CMD}} run test:html"
|
||||
|
||||
|
|
@ -67,6 +79,18 @@ tasks:
|
|||
- htmltest
|
||||
|
||||
# Development tasks
|
||||
deps:ensure-npm:
|
||||
desc: Ensure npm dependencies are installed
|
||||
sources:
|
||||
- package.json
|
||||
- package-lock.json
|
||||
generates:
|
||||
- node_modules/.package-lock.json
|
||||
cmds:
|
||||
- "{{.NPM_CMD}} install"
|
||||
status:
|
||||
- test -d node_modules
|
||||
|
||||
deps:install:
|
||||
desc: Install all dependencies
|
||||
cmds:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue