Skip to content

Commit

Permalink
fix: ensure all expected files are included in the resulting package (#…
Browse files Browse the repository at this point in the history
…300)

* fix: ensure all expected files are included in the resulting package

* Update Makefile

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: make target

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
udondan and coderabbitai[bot] authored Mar 25, 2024
1 parent c449617 commit 509e42c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ jobs:
sudo apt-get install -y tree
- name: Build source w/ jsii
run: npx jsii
run: |
lambda/build
npx jsii
make validate-package
- name: Build packages w/ jsii-pacmak
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Build source w/ jsii
run: npx jsii
run: |
lambda/build
npx jsii
make validate-package
- name: Build packages w/ jsii-pacmak
run: |
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ tsconfig.tsbuildinfo
.eslintrc
.prettierrc
tsconfig-lint.json
publish_output.txt

lambda/*
!lambda/code.zip
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,21 @@ eslint:
@echo -e "$(TARGET_COLOR)Running eslint $$(npx eslint --version)$(NO_COLOR)"
@npx eslint .; \
echo "Passed"

validate-package:
@echo -e "$(TARGET_COLOR)Checking package content$(NO_COLOR)"
@npm publish --dry-run 2>&1 | tee publish_output.txt
@\
FILES_TO_CHECK="lambda/code.zip lib/index.d.ts lib/index.js lib/types.d.ts lib/types.js"; \
MISSING_FILES=""; \
for file in $$FILES_TO_CHECK; do \
if ! grep -q $$file publish_output.txt; then \
MISSING_FILES="$$MISSING_FILES $$file"; \
fi; \
done; \
if [ -n "$$MISSING_FILES" ]; then \
echo "❌ The following files are NOT included in the package:$$MISSING_FILES"; \
rm publish_output.txt; \
exit 1; \
fi
@rm publish_output.txt

0 comments on commit 509e42c

Please sign in to comment.