mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-12 14:05:16 +03:00
cli-ext: add make file rule for clean build
* Updated Readme.md * Updated Makefile with updated commands * Added help for Make * Fix for `cli-ext` building on mac https://github.com/hasura/graphql-engine-mono/issues/133 closes https://github.com/hasura/graphql-engine-mono/issues/133 PR-URL: https://github.com/hasura/graphql-engine-mono/pull/138 Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com> GitOrigin-RevId: 02f882896997ba49657a58f7c2c9bdc877e258d5
This commit is contained in:
parent
df143cf048
commit
e80804532e
@ -1,18 +1,39 @@
|
||||
BUILDDIR := bin
|
||||
BINARY_ASSETS := $(BUILDDIR)/cli-ext-hasura-node12-linux-x64 $(BUILDDIR)/cli-ext-hasura-node12-macos-x64 $(BUILDDIR)/cli-ext-hasura-node12-win-x64.exe $(BUILDDIR)/cli-ext-hasura-node12-linux-arm64 $(BUILDDIR)/cli-ext-hasura-node16-macos-arm64
|
||||
BINARY_ASSET_CHECKSUMS := $(patsubst %,%.sha256,$(BINARY_ASSETS))
|
||||
GLOBALBUILDDIR ?= /build
|
||||
|
||||
COMPRESS := gzip --best -k -c
|
||||
|
||||
deps:
|
||||
npm install
|
||||
|
||||
.PHONY: ci-deps
|
||||
## ci-deps: builds if not already build
|
||||
ci-deps:
|
||||
if [ ! -d "node_modules" ]; then npm ci; fi
|
||||
|
||||
.PHONY: clean-deps
|
||||
## clean-deps: deletes node_modules
|
||||
clean-deps:
|
||||
if [ -d "node_modules" ]; then rm -r node_modules; fi
|
||||
|
||||
.PHONY: build
|
||||
## build: generates build
|
||||
build: ci-deps
|
||||
npm run build
|
||||
$(MAKE) $(BINARY_ASSET_CHECKSUMS)
|
||||
|
||||
.PHONY: clean-build
|
||||
## clean-build: generates clean build
|
||||
clean-build: clean clean-deps ci-deps
|
||||
npm run build
|
||||
|
||||
.PHONY: ci-copy-assets
|
||||
ci-copy-assets:
|
||||
mkdir -p /build/_cli_ext_output
|
||||
cp $(BUILDDIR)/* /build/_cli_ext_output/
|
||||
## ci-copy-assets: copies assests to global build folder
|
||||
mkdir -p $(GLOBALBUILDDIR)/_cli_ext_output
|
||||
cp $(BUILDDIR)/* $(GLOBALBUILDDIR)/_cli_ext_output/
|
||||
|
||||
# Not supported: Refer https://github.com/zeit/pkg/issues/50
|
||||
upx-compress: $(BUILDDIR)
|
||||
@ -33,12 +54,13 @@ upx-compress: $(BUILDDIR)
|
||||
%.sha256: %
|
||||
shasum -a 256 $< > $@
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
npm run build
|
||||
$(MAKE) $(BINARY_ASSET_CHECKSUMS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(RM) -r $(BUILDDIR)
|
||||
|
||||
.PHONY: help
|
||||
## help: prints this help message
|
||||
help:
|
||||
@echo "Usage: \n"
|
||||
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
|
||||
|
||||
|
@ -5,6 +5,8 @@ The binaries are built using the [pkg](https://www.npmjs.com/package/pkg) packag
|
||||
```bash
|
||||
npm install
|
||||
npm run build
|
||||
OR
|
||||
make clean-build
|
||||
```
|
||||
|
||||
The binaries will be placed in the `bin` directory at root. Copy the binary to your PATH as `cli-ext`.
|
||||
|
Loading…
Reference in New Issue
Block a user