Skip to content

Instantly share code, notes, and snippets.

@protosam
Last active June 20, 2022 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save protosam/a5d1d05fa6ef08172586b33e45b74d96 to your computer and use it in GitHub Desktop.
Save protosam/a5d1d05fa6ef08172586b33e45b74d96 to your computer and use it in GitHub Desktop.

Simple makefile to simplify building and installing this vscode extension locally: github.com/tintinweb/vscode-interactive-graphviz

Build from specific branch:

CHECKOUT=110-formatter-deletes-comments-and-all-whitespace-on-save make build

Install the vsix that was packaged:

make install

Uninstall the package.

make uninstall

Reload vscode after installing/uninstalling packages.

VSCODE=code
BUILD_CONTAINER_NAME=vscode-ext-build
# Figure out if docker or podman should be used
ifndef $(ocimanager)
ifneq (, $(shell docker ps 2> /dev/null))
ocimanager=docker
else ifneq (, $(shell podman ps 2> /dev/null))
ocimanager=podman
else
$(error "failed to identify OCI manager, manually set ocimanager=docker, ocimanager=podman, or other ")
endif
endif
define help_message
Options available are:
make help
Displays this help message
make clean
Runs make stop
Destroys build container
Deletes ./build/artifacts directory
make stop
Stops build container
make build
Starts a build container
Clones vscode-interactive-graphviz repo in build container
Performs checkout if CHECKOUT is defined
Package related preparation/installation
Runs vsce package command
Makes directory ./build/artifacts
Copies /workspace/graphviz-interactive-preview-*.vsix to ./build/artifacts/graphviz-interactive-preview.vsix
make install
Runs make uninstall
Installs ./build/artifacts/graphviz-interactive-preview.vsix to vscode
make uninstall
Uninstalls ./build/artifacts/graphviz-interactive-preview.vsix from vscode
endef
help:
$(info $(help_message))
clean: stop
$(ocimanager) rm $(BUILD_CONTAINER_NAME) 2> /dev/null || true
clean-all: clean
-@rm -rf build/artifacts
stop:
$(ocimanager) kill $(BUILD_CONTAINER_NAME) 2> /dev/null || true
build : .build stop
.build:
$(ocimanager) run -d --name $(BUILD_CONTAINER_NAME) --platform linux/x86_64 -w /workspace node:16 bash -c '[ -p /pause ] || mkfifo /pause && echo "[$(date)]" pausing container && </pause'
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) git clone https://github.com/tintinweb/vscode-interactive-graphviz.git .
ifdef CHECKOUT
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) git checkout $(CHECKOUT)
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) git branch -v
endif
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) npm set progress=false
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) npm install . --verbose
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) npm install --global vsce .
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) vsce package
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) npm run lint
$(ocimanager) exec -it $(BUILD_CONTAINER_NAME) bash -c 'mv /workspace/graphviz-interactive-preview-*.vsix /workspace/graphviz-interactive-preview.vsix'
mkdir -p build/artifacts
$(ocimanager) cp $(BUILD_CONTAINER_NAME):/workspace/graphviz-interactive-preview.vsix build/artifacts/graphviz-interactive-preview.vsix
install: uninstall
$(VSCODE) --install-extension build/artifacts/graphviz-interactive-preview.vsix
uninstall:
-$(VSCODE) --uninstall-extension tintinweb.graphviz-interactive-preview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment