-
Notifications
You must be signed in to change notification settings - Fork 13.4k
chore: sync script deletes existing tgz packages #27045
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
Conversation
|
packages/vue/scripts/sync.sh
Outdated
@@ -2,6 +2,9 @@ | |||
|
|||
set -e | |||
|
|||
# Delete old packages | |||
rm -rf *.tgz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no. I'm not familiar with Windows bash commands, do you know if something like this would work?
if [[ "$(expr substr $(uname -s) 1 6)" == "CYGWIN" ]]; then
del /s *.tgz
else
rm -rf *.tgz
fi
Edit: Maybe something like this? (confirmed the linux/unix command works):
#!/bin/bash
set -e
# Delete old packages
if [[ "$(uname)" == "Darwin" || "$(expr substr $(uname -s) 1 5)" == "Linux" ]]; then
# Linux/Unix
find . -type f -name "*.tgz" -delete
elif [[ "$(expr substr $(uname -s) 1 6)" == "CYGWIN" ]]; then
# Windows/Cygwin
del /s *.tgz
fi
# Pack @ionic/core
npm pack ../../core
# Pack @ionic/vue-router
npm pack ../vue-router
# Install Dependencies
npm install *.tgz --no-save
# Cleanup
if [[ "$(uname)" == "Darwin" || "$(expr substr $(uname -s) 1 5)" == "Linux" ]]; then
# Linux/Unix
find . -type f -name "*.tgz" -delete
elif [[ "$(expr substr $(uname -s) 1 6)" == "CYGWIN" ]]; then
# Windows/Cygwin
del /s *.tgz
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used rimraf before and it's worked pretty well. Maybe we could do that and have rimraf
as a project-level dependency?
edit: Actually hmm that may not be a good idea on CI since we'll need to cache node modules for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm -rf
works just fine 👀 I just have to do it in a bash terminal (which is already the case with the rest of the script).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! In that case, let's just stick with rm
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Do we even need the recursive flag here since we're only deleting archives and not directories?
Otherwise this looks good. Thanks for taking care of this!
True, the recursive flag isn't needed here. I'll update that before merging. |
<!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> ## Pull request checklist Please check if your PR fulfills the following requirements: - [ ] Tests for the changes have been added (for bug fixes / features) - [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features) - Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See the [contributing guide](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation) for details. - [ ] Build (`npm run build`) was run locally and any changes were pushed - [ ] Lint (`npm run lint`) has passed locally and any fixes were made for failures ## Pull request type <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type, submit multiple pull requests if needed. --> Please check the type of change your PR introduces: - [ ] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [x] Build related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When testing changes locally, you can have an existing test app that you sync the package contents to. If you have done this across different versions of Ionic, it can install the wrong .tgz file instead of the local changes. Experienced here: #27040 (review) <!-- Issues are required for both bug fixes and features. --> Issue URL: N/A ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Sync script deletes all .tgz files local to the directory before locally packing and installing the contents of the parent local packages ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> --------- Co-authored-by: Liam DeBeasi <[email protected]>
<!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> ## Pull request checklist Please check if your PR fulfills the following requirements: - [ ] Tests for the changes have been added (for bug fixes / features) - [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features) - Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See the [contributing guide](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation) for details. - [ ] Build (`npm run build`) was run locally and any changes were pushed - [ ] Lint (`npm run lint`) has passed locally and any fixes were made for failures ## Pull request type <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type, submit multiple pull requests if needed. --> Please check the type of change your PR introduces: - [ ] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [x] Build related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When testing changes locally, you can have an existing test app that you sync the package contents to. If you have done this across different versions of Ionic, it can install the wrong .tgz file instead of the local changes. Experienced here: #27040 (review) <!-- Issues are required for both bug fixes and features. --> Issue URL: N/A ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Sync script deletes all .tgz files local to the directory before locally packing and installing the contents of the parent local packages ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> --------- Co-authored-by: Liam DeBeasi <[email protected]>
Pull request checklist
Please check if your PR fulfills the following requirements:
ionic-docs
repo, in a separate PR. See the contributing guide for details.npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
When testing changes locally, you can have an existing test app that you sync the package contents to. If you have done this across different versions of Ionic, it can install the wrong .tgz file instead of the local changes.
Experienced here: #27040 (review)
Issue URL: N/A
What is the new behavior?
Does this introduce a breaking change?
Other information