1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

Makefile: GOESBUIILD changes

doesn't ever install it if it's already present. Also moved it to
optional dependencies in package.json.
This commit is contained in:
Harvey Tindall 2023-06-23 21:31:33 +01:00
parent e7d4b5051b
commit f1b7ef303d
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
4 changed files with 26 additions and 11 deletions

View File

@ -14,7 +14,7 @@ COMMIT ?= $(shell git rev-parse --short HEAD || echo unknown)
BUILDTIME ?= $(shell date +%s)
UPDATER ?= off
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.cssVersion=$(CSSVERSION) -X main.buildTimeUnix=$(BUILDTIME)
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.cssVersion=$(CSSVERSION) -X main.buildTimeUnix=$(BUILDTIME) $(if $(BUILTBY),-X 'main.builtBy=$(BUILTBY)',)
ifeq ($(UPDATER), on)
LDFLAGS := $(LDFLAGS) -X main.updater=binary
else ifneq ($(UPDATER), off)
@ -75,14 +75,23 @@ else
RACEDETECTOR :=
endif
ifeq (, $(shell which esbuild))
ESBUILDINSTALL := go install github.com/evanw/esbuild/cmd/esbuild@latest
else
ESBUILDINSTALL :=
endif
ifeq ($(GOESBUILD), on)
NPMIGNOREOPTIONAL := --no-optional
NPMOPTS := $(NPMIGNOREOPTIONAL); $(ESBUILDINSTALL)
else
NPMOPTS :=
endif
npm:
$(info installing npm dependencies)
npm install
@if [ "$(GOESBUILD)" = "off" ]; then\
npm install esbuild;\
else\
go install github.com/evanw/esbuild/cmd/esbuild@latest;\
fi
npm install $(NPMOPTS)
configuration:
$(info Fixing config-base)

6
package-lock.json generated
View File

@ -15,7 +15,6 @@
"any-date-parser": "^1.5.4",
"browserslist": "^4.21.7",
"cheerio": "^1.0.0-rc.12",
"esbuild": "^0.18.6",
"fs-cheerio": "^3.0.0",
"inline-source": "^8.0.2",
"jsdom": "^22.1.0",
@ -32,6 +31,9 @@
},
"devDependencies": {
"live-server": "^1.2.2"
},
"optionalDependencies": {
"esbuild": "^0.18.6"
}
},
"node_modules/@alloc/quick-lru": {
@ -1651,6 +1653,7 @@
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.6.tgz",
"integrity": "sha512-5QgxWaAhU/tPBpvkxUmnFv2YINHuZzjbk0LeUUnC2i3aJHjfi5yR49lgKgF7cb98bclOp/kans8M5TGbGFfJlQ==",
"hasInstallScript": true,
"optional": true,
"bin": {
"esbuild": "bin/esbuild"
},
@ -7899,6 +7902,7 @@
"version": "0.18.6",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.6.tgz",
"integrity": "sha512-5QgxWaAhU/tPBpvkxUmnFv2YINHuZzjbk0LeUUnC2i3aJHjfi5yR49lgKgF7cb98bclOp/kans8M5TGbGFfJlQ==",
"optional": true,
"requires": {
"@esbuild/android-arm": "0.18.6",
"@esbuild/android-arm64": "0.18.6",

View File

@ -23,7 +23,6 @@
"any-date-parser": "^1.5.4",
"browserslist": "^4.21.7",
"cheerio": "^1.0.0-rc.12",
"esbuild": "^0.18.6",
"fs-cheerio": "^3.0.0",
"inline-source": "^8.0.2",
"jsdom": "^22.1.0",
@ -40,5 +39,8 @@
},
"devDependencies": {
"live-server": "^1.2.2"
},
"optionalDependencies": {
"esbuild": "^0.18.6"
}
}

View File

@ -13,8 +13,8 @@ args = parser.parse_args()
def runcmd(cmd):
if os.name == "nt":
return subprocess.check_output(cmd, shell=True)
proc = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
return proc.communicate()
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as proc:
return proc.communicate()
def compile(mjml: Path):
fname = mjml.with_suffix(".html")