Skip to content

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

Merged
merged 5 commits into from
Apr 5, 2023

Conversation

sean-perkins
Copy link
Contributor

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 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 check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

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?

  • 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
  • No

Other information

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions bot added package: angular @ionic/angular package package: react @ionic/react package package: vue @ionic/vue package labels Mar 29, 2023
@sean-perkins sean-perkins marked this pull request as ready for review April 4, 2023 16:07
@@ -2,6 +2,9 @@

set -e

# Delete old packages
rm -rf *.tgz
Copy link
Contributor

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?

Copy link
Contributor Author

@sean-perkins sean-perkins Apr 4, 2023

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

Copy link
Contributor

@liamdebeasi liamdebeasi Apr 4, 2023

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.

Copy link
Contributor

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).

Copy link
Contributor

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.

Copy link
Contributor

@liamdebeasi liamdebeasi left a 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!

@sean-perkins
Copy link
Contributor Author

True, the recursive flag isn't needed here. I'll update that before merging.

@sean-perkins sean-perkins enabled auto-merge April 5, 2023 19:14
@sean-perkins sean-perkins added this pull request to the merge queue Apr 5, 2023
Merged via the queue into main with commit ca9b9b6 Apr 5, 2023
@sean-perkins sean-perkins deleted the chore/sync-script-tgz branch April 5, 2023 20:33
liamdebeasi added a commit that referenced this pull request Apr 17, 2023
<!-- 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]>
liamdebeasi added a commit that referenced this pull request Apr 19, 2023
<!-- 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package package: react @ionic/react package package: vue @ionic/vue package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants