Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add npm dev script #5031

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ clean-prepack: clean-package-files
@rm -f prepack

.PHONY: clean-ts
clean-ts:
clean-ts:
@npm run clean
@rm -f -r $(BINARY_RELEASES_FOLDER_TS_CLI)

Expand Down Expand Up @@ -183,7 +183,7 @@ $(BINARY_WRAPPER_DIR)/src/generated/sha256sums.txt:
build-binary-wrapper: pre-build-binary-wrapper $(BINARY_WRAPPER_DIR)/src/generated/version $(BINARY_WRAPPER_DIR)/src/generated/sha256sums.txt
@echo "-- Building Typescript Binary Wrapper ($(BINARY_WRAPPER_DIR)/dist/)"
@cd $(BINARY_WRAPPER_DIR); npm run build

.PHONY: clean-binary-wrapper
clean-binary-wrapper:
@rm -f $(BINARY_WRAPPER_DIR)/config.default.json
Expand Down Expand Up @@ -273,3 +273,18 @@ format:
ls-protocol-metadata: $(BINARY_RELEASES_FOLDER_TS_CLI)/version
@echo "-- Generating protocol metadata"
@pushd $(EXTENSIBLE_CLI_DIR) && $(MAKE) generate-ls-protocol-metadata bindir=$(WORKING_DIR)/$(BINARY_OUTPUT_FOLDER) && popd

.PHONY: run
run: build require-args
$(wildcard $(WORKING_DIR)/$(BINARY_OUTPUT_FOLDER)/snyk-*) $(ARGS)

.PHONY: run-ts
run-ts: require-args
@npm install
npm run dev "$(ARGS)"
PeterSchafer marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: require-args
require-args:
ifndef ARGS
$(error cannot run: ARGS is undefined)
endif
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"test:unit": "jest --runInBand --testPathPattern '/test(/jest)?/unit/'",
"test:acceptance": "jest --runInBand --testPathPattern '/test(/jest)?/acceptance/'",
"test:tap": "tap -Rspec --timeout=300 test/tap/*.test.* ",
"test:smoke": "./scripts/run-smoke-tests-locally.sh"
"test:smoke": "./scripts/run-smoke-tests-locally.sh",
"dev": "ts-node ./src/cli/index.ts"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: In order to facilitate the usage of the Makefile, how about adding this to the Makefile? For example like this:

make run // runs the Extensible CLI
make run-ts // runs only the TS/Legacy CLI

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final goal could be to not be required to use npm calls anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Both targets check for an ARGS variable, which is used to specify the CLI arguments through make.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference would be to keep the npm script, but also wrap it with make. The npm script is easier to use with a debug launch profile in VSCode, and it inherits the right $PATH.

},
"keywords": [
"security",
Expand Down
Loading