Skip to content

Commit 73de2e8

Browse files
muncusgcf-owl-bot[bot]pattishin
authored
feat: add Makefile for consistent behavior across samples (#3563)
* feat: add Makefile for consistent behavior across samples * fix default directory detection * update lint action per discussion with Patti. * fix project id env var name to match proposal * fix lint error in unrelated sample * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Patti Shin <[email protected]>
1 parent 2c008f8 commit 73de2e8

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

Makefile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Makefile for running typical developer workflow actions.
2+
# To run actions in a subdirectory of the repo:
3+
# make lint build dir=translate/snippets
4+
5+
INTERFACE_ACTIONS="build test lint"
6+
7+
.ONESHELL: #ease subdirectory work by using the same subshell for all commands
8+
.-PHONY: *
9+
10+
# Default to current dir if not specified.
11+
dir ?= $(shell pwd)
12+
13+
export GOOGLE_CLOUD_PROJECT = ${GOOGLE_SAMPLES_PROJECT}
14+
15+
build:
16+
cd ${dir}
17+
npm install
18+
npm run build --if-present
19+
20+
test: check-env build
21+
cd ${dir}
22+
npm test
23+
24+
lint:
25+
cd ${dir}
26+
npx gts fix
27+
npx gts lint
28+
29+
check-env:
30+
ifndef GOOGLE_SAMPLES_PROJECT
31+
$(error GOOGLE_SAMPLES_PROJECT environment variable is required to perform this action)
32+
endif
33+
34+
list-actions:
35+
@ echo ${INTERFACE_ACTIONS}
36+

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
"gts": "^5.0.1",
2828
"mocha": "^10.2.0",
2929
"nunjucks": "^3.2.4",
30-
"prettier": "^3.0.0",
30+
"prettier": "^3.0.3",
3131
"typescript": "^5.0.4"
3232
},
3333
"dependencies": {
34-
"commander": "^11.0.0"
34+
"commander": "^11.0.0",
35+
"eslint": "^8.53.0"
3536
}
3637
}

0 commit comments

Comments
 (0)