Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ccb22a

Browse files
committed
use a timestamp to determine whether pnpm i needs to run
1 parent 962608c commit 0ccb22a

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

Makefile

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,24 @@ $(foreach chart,$(charts),build/$(chart)_helm_$(VERSION).tgz): build/%_helm_$(VE
387387
--chart $* \
388388
--output "$@"
389389

390-
site/out/index.html: site/package.json $(shell find ./site $(FIND_EXCLUSIONS) -type f \( -name '*.ts' -o -name '*.tsx' \))
390+
node_modules/.installed: package.json
391+
./scripts/pnpm_install.sh
392+
393+
offlinedocs/node_modules/.installed: offlinedocs/package.json
394+
cd offlinedocs
395+
../scripts/pnpm_install.sh
396+
397+
site/node_modules/.installed: site/package.json
398+
cd site
399+
../scripts/pnpm_install.sh
400+
401+
site/out/index.html: site/package.json site/node_modules/.installed $(shell find ./site $(FIND_EXCLUSIONS) -type f \( -name '*.ts' -o -name '*.tsx' \))
391402
cd site
392403
# prevents this directory from getting to big, and causing "too much data" errors
393404
rm -rf out/assets/
394-
../scripts/pnpm_install.sh
395405
pnpm build
396406

397-
offlinedocs/out/index.html: $(shell find ./offlinedocs $(FIND_EXCLUSIONS) -type f) $(shell find ./docs $(FIND_EXCLUSIONS) -type f | sed 's: :\\ :g')
407+
offlinedocs/out/index.html: offlinedocs/node_modules/.installed $(shell find ./offlinedocs $(FIND_EXCLUSIONS) -type f) $(shell find ./docs $(FIND_EXCLUSIONS) -type f | sed 's: :\\ :g')
398408
cd offlinedocs
399409
../scripts/pnpm_install.sh
400410
pnpm export
@@ -425,7 +435,7 @@ fmt/go:
425435
go run mvdan.cc/[email protected] -w -l .
426436
.PHONY: fmt/go
427437

428-
fmt/ts:
438+
fmt/ts: site/node_modules/.installed
429439
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/ts$(RESET)"
430440
cd site
431441
# Avoid writing files in CI to reduce file write activity
@@ -468,7 +478,7 @@ lint/site-icons:
468478
./scripts/check_site_icons.sh
469479
.PHONY: lint/site-icons
470480

471-
lint/ts:
481+
lint/ts: site/node_modules/.installed
472482
cd site
473483
pnpm lint
474484
.PHONY: lint/ts
@@ -643,14 +653,12 @@ site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./
643653
# -C sets the directory for the go run command
644654
go run -C ./scripts/apitypings main.go > $@
645655

646-
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
656+
site/e2e/provisionerGenerated.ts: site/node_modules/.installed provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
647657
cd site
648-
../scripts/pnpm_install.sh
649658
pnpm run gen:provisioner
650659

651-
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
660+
site/src/theme/icons.json: site/node_modules/.installed $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
652661
go run ./scripts/gensite/ -icons "$@"
653-
./scripts/pnpm_install.sh
654662
pnpm -C site/ exec biome format --write src/theme/icons.json
655663

656664
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
@@ -674,24 +682,20 @@ site/src/api/rbacresourcesGenerated.ts: scripts/typegen/codersdk.gotmpl scripts/
674682
site/src/api/countriesGenerated.ts: scripts/typegen/countries.tstmpl scripts/typegen/main.go codersdk/countries.go
675683
go run scripts/typegen/main.go countries > "$@"
676684

677-
docs/admin/integrations/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
685+
docs/admin/integrations/prometheus.md: node_modules/.installed scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
678686
go run scripts/metricsdocgen/main.go
679-
./scripts/pnpm_install.sh
680687
pnpm exec prettier --write ./docs/admin/integrations/prometheus.md
681688

682-
docs/reference/cli/index.md: scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES)
689+
docs/reference/cli/index.md: node_modules/.installed scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES)
683690
CI=true BASE_PATH="." go run ./scripts/clidocgen
684-
./scripts/pnpm_install.sh
685691
pnpm exec prettier --write ./docs/reference/cli/index.md ./docs/reference/cli/*.md ./docs/manifest.json
686692

687-
docs/admin/security/audit-logs.md: coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
693+
docs/admin/security/audit-logs.md: node_modules/.installed coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
688694
go run scripts/auditdocgen/main.go
689-
./scripts/pnpm_install.sh
690695
pnpm exec prettier --write ./docs/admin/security/audit-logs.md
691696

692-
coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS) -type f) $(wildcard coderd/*.go) $(wildcard enterprise/coderd/*.go) $(wildcard codersdk/*.go) $(wildcard enterprise/wsproxy/wsproxysdk/*.go) $(DB_GEN_FILES) .swaggo docs/manifest.json coderd/rbac/object_gen.go
697+
coderd/apidoc/swagger.json: node_modules/.installed $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS) -type f) $(wildcard coderd/*.go) $(wildcard enterprise/coderd/*.go) $(wildcard codersdk/*.go) $(wildcard enterprise/wsproxy/wsproxysdk/*.go) $(DB_GEN_FILES) .swaggo docs/manifest.json coderd/rbac/object_gen.go
693698
./scripts/apidocgen/generate.sh
694-
./scripts/pnpm_install.sh
695699
pnpm exec prettier --write ./docs/reference/api ./docs/manifest.json ./coderd/apidoc/swagger.json
696700

697701
update-golden-files: \
@@ -874,5 +878,5 @@ test-clean:
874878
.PHONY: test-clean
875879

876880
.PHONY: test-e2e
877-
test-e2e:
881+
test-e2e: site/node_modules/.installed
878882
cd ./site && DEBUG=pw:api pnpm playwright:test --forbid-only --workers 1

scripts/pnpm_install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ pnpm_flags+=("$@")
3333

3434
echo "+ pnpm install ${pnpm_flags[*]}"
3535
pnpm install "${pnpm_flags[@]}"
36+
37+
# Used for Makefile optimizations
38+
touch node_modules/.installed

0 commit comments

Comments
 (0)