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

feat: improve clean and deep-clean scripts #336

Merged
merged 5 commits into from
Feb 6, 2025
Merged

Conversation

MantisClone
Copy link
Member

@MantisClone MantisClone commented Feb 5, 2025

Changes

  • Make clean script delete dist/ and .sveltekit/ directories
  • Make deep-clean script execute clean script and also delete node_modules/ and .turbo/ directories.

Example output:

mantisclone@mantisclone-Inspiron-7620:~/projects/web-components$ npm run deep-clean

> @requestnetwork/[email protected] deep-clean
> npm run clean && npm run deep-clean:turbo && npm run deep-clean:node-modules


> @requestnetwork/[email protected] clean
> npm run clean:dist && npm run clean:sveltekit


> @requestnetwork/[email protected] clean:dist
> find . -path ./node_modules -prune -o -name 'dist' -type d -exec rm -rf '{}' + -exec echo '{}' deleted \;

./packages/add-stakeholder/dist deleted
./packages/invoice-dashboard/dist deleted
./packages/create-invoice-form/dist deleted
./packages/payment-widget/dist deleted
./packages/single-invoice/dist deleted

> @requestnetwork/[email protected] clean:sveltekit
> find . -name '.svelte-kit' -type d -exec rm -rf '{}' + -exec echo '{}' deleted \;

./packages/add-stakeholder/.svelte-kit deleted
./packages/invoice-dashboard/.svelte-kit deleted
./packages/create-invoice-form/.svelte-kit deleted
./packages/payment-widget/.svelte-kit deleted
./packages/single-invoice/.svelte-kit deleted

> @requestnetwork/[email protected] deep-clean:turbo
> find . -name '.turbo' -type d -exec rm -rf '{}' + -exec echo '{}' deleted \;

./packages/add-stakeholder/.turbo deleted
./packages/invoice-dashboard/.turbo deleted
./packages/create-invoice-form/.turbo deleted
./packages/payment-widget/.turbo deleted
./packages/single-invoice/.turbo deleted
./.turbo deleted

> @requestnetwork/[email protected] deep-clean:node-modules
> find . -name 'node_modules' -type d -exec rm -rf '{}' + -exec echo '{}' deleted \;

./node_modules deleted
./node_modules/engine.io-client/node_modules deleted
./node_modules/stream-browserify/node_modules deleted
./node_modules/@tanstack/svelte-query/node_modules deleted
./node_modules/stream-http/node_modules deleted
./node_modules/bs58/node_modules deleted
./node_modules/miller-rabin/node_modules deleted
./node_modules/npm-packlist/node_modules deleted
./node_modules/@web3modal/polyfills/node_modules deleted
./node_modules/@web3modal/ui/node_modules deleted
./node_modules/@web3modal/scaffold-ui/node_modules deleted
./node_modules/@web3modal/scaffold/node_modules deleted
./node_modules/@web3modal/siwe/node_modules deleted
./node_modules/@babel/highlight/node_modules deleted
./node_modules/@babel/helper-compilation-targets/node_modules deleted
./node_modules/@babel/core/node_modules deleted
./node_modules/mlly/node_modules deleted
./node_modules/@scure/bip39/node_modules deleted
./node_modules/@scure/bip32/node_modules deleted
./node_modules/yaml/browser/dist/node_modules deleted
./node_modules/eciesjs/node_modules deleted
./node_modules/eciesjs/node_modules/@noble/curves/node_modules deleted
./node_modules/axios/node_modules deleted
./node_modules/ignore-walk/node_modules deleted
./node_modules/json-rpc-engine/node_modules deleted
./node_modules/filelist/node_modules deleted
./node_modules/tsify/node_modules deleted
./node_modules/http-errors/node_modules deleted
./node_modules/@manypkg/find-root/node_modules deleted
./node_modules/@manypkg/get-packages/node_modules deleted
./node_modules/@near-js/signers/node_modules deleted
./node_modules/@near-js/providers/node_modules deleted
./node_modules/@near-js/transactions/node_modules deleted
./node_modules/clean-css/node_modules deleted
./node_modules/svelte/node_modules deleted
./node_modules/postcss-load-config/node_modules deleted
./node_modules/viem/node_modules deleted
./node_modules/resolve/test/shadowed_core/node_modules deleted
./node_modules/resolve/test/resolver/symlinked/_/node_modules deleted
./node_modules/@superfluid-finance/sdk-core/node_modules deleted
./node_modules/r1csfile/node_modules deleted
./node_modules/cbw-sdk/node_modules deleted
./node_modules/create-ecdh/node_modules deleted
./node_modules/@lit-protocol/accs-schemas/node_modules deleted
./node_modules/@lit-protocol/types/node_modules deleted
./node_modules/terser/node_modules deleted
./node_modules/@parcel/watcher/node_modules deleted
./node_modules/@parcel/watcher-wasm/node_modules deleted
./node_modules/keccak/node_modules deleted
./node_modules/sirv/node_modules deleted
./node_modules/eth-json-rpc-filters/node_modules deleted
./node_modules/@changesets/read/node_modules deleted
./node_modules/@changesets/parse/node_modules deleted
./node_modules/@changesets/pre/node_modules deleted
./node_modules/@changesets/apply-release-plan/node_modules deleted
./node_modules/@changesets/cli/node_modules deleted
./node_modules/@changesets/write/node_modules deleted
./node_modules/@changesets/config/node_modules deleted
./node_modules/@isaacs/cliui/node_modules deleted
./node_modules/@ethersproject/signing-key/node_modules deleted
./node_modules/@ethersproject/signing-key/node_modules/elliptic/node_modules deleted
./node_modules/postcss-nested/node_modules deleted
./node_modules/periscopic/node_modules deleted
./node_modules/@walletconnect/relay-auth/node_modules deleted
./node_modules/@walletconnect/environment/node_modules deleted
./node_modules/@walletconnect/events/node_modules deleted
./node_modules/@walletconnect/window-getters/node_modules deleted
./node_modules/@walletconnect/time/node_modules deleted
./node_modules/@walletconnect/window-metadata/node_modules deleted
./node_modules/@walletconnect/safe-json/node_modules deleted
./node_modules/@walletconnect/jsonrpc-utils/node_modules deleted
./node_modules/@walletconnect/jsonrpc-ws-connection/node_modules deleted
./node_modules/node-stdlib-browser/node_modules deleted
./node_modules/asn1.js/node_modules deleted
./node_modules/uri-js/node_modules deleted
./node_modules/postcss/node_modules deleted
./node_modules/browserify/node_modules deleted
./node_modules/browserify/node_modules/assert/node_modules deleted
./node_modules/turbo/node_modules deleted
./node_modules/readable-stream/node_modules deleted
./node_modules/duplexify/node_modules deleted
./node_modules/pkg-dir/node_modules deleted
./node_modules/unstorage/node_modules deleted
./node_modules/escodegen/node_modules deleted
./node_modules/code-red/node_modules deleted
./node_modules/@coinbase/wallet-sdk/node_modules deleted
./node_modules/@hinkal/common/node_modules deleted
./node_modules/source-map-support/node_modules deleted
./node_modules/pino/test/fixtures/eval/node_modules deleted
./node_modules/ethereum-cryptography/node_modules deleted
./node_modules/public-encrypt/node_modules deleted
./node_modules/html-minifier-terser/node_modules deleted
./node_modules/html-minifier-terser/node_modules/terser/node_modules deleted
./node_modules/jsonpath/node_modules deleted
./node_modules/read-yaml-file/node_modules deleted
./node_modules/@wagmi/connectors/node_modules deleted
./node_modules/@requestnetwork/transaction-manager/node_modules deleted
./node_modules/@requestnetwork/currency/node_modules deleted
./node_modules/@requestnetwork/data-access/node_modules deleted
./node_modules/@requestnetwork/utils/node_modules deleted
./node_modules/@requestnetwork/request-logic/node_modules deleted
./node_modules/@requestnetwork/request-client.js/node_modules deleted
./node_modules/@requestnetwork/web3-signature/node_modules deleted
./node_modules/@requestnetwork/smart-contracts/node_modules deleted
./node_modules/@requestnetwork/multi-format/node_modules deleted
./node_modules/@requestnetwork/epk-signature/node_modules deleted
./node_modules/@requestnetwork/data-format/node_modules deleted
./node_modules/@requestnetwork/payment-processor/node_modules deleted
./node_modules/@requestnetwork/payment-detection/node_modules deleted
./node_modules/@requestnetwork/advanced-logic/node_modules deleted
./node_modules/secp256k1/node_modules deleted
./node_modules/near-api-js/node_modules deleted
./node_modules/@metamask/rpc-errors/node_modules deleted
./node_modules/@metamask/utils/node_modules deleted
./node_modules/@metamask/eth-json-rpc-provider/node_modules deleted
./node_modules/@metamask/eth-json-rpc-provider/node_modules/@metamask/json-rpc-engine/node_modules deleted
./node_modules/@metamask/json-rpc-middleware-stream/node_modules deleted
./node_modules/@metamask/providers/node_modules deleted
./node_modules/@metamask/object-multiplex/node_modules deleted
./node_modules/@metamask/sdk/node_modules deleted
./node_modules/npm-run-path/node_modules deleted
./node_modules/sucrase/node_modules deleted
./node_modules/webauthn-p256/node_modules deleted
./node_modules/elliptic/node_modules deleted
./node_modules/extension-port-stream/node_modules deleted
./node_modules/ox/node_modules deleted
./node_modules/ox/node_modules/@noble/curves/node_modules deleted
./node_modules/tailwindcss/node_modules deleted
./node_modules/diffie-hellman/node_modules deleted
./node_modules/vite/node_modules deleted
./node_modules/eth-block-tracker/node_modules deleted
./node_modules/path-scurry/node_modules deleted
./shared/components/node_modules deleted

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Streamlined cleanup routines with updated commands for targeted removal of build artifacts and dependency directories, ensuring a more efficient maintenance process.
    • Enhanced feedback during cleanup with messages indicating which directories have been deleted.

@MantisClone MantisClone self-assigned this Feb 5, 2025
@MantisClone MantisClone requested a review from sstefdev February 5, 2025 21:28
Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

Walkthrough

This pull request updates the cleaning scripts in the package.json file. The existing clean and deep-clean scripts have been refactored to run additional sub-scripts. Specifically, the clean script now sequentially triggers commands to remove the dist and .svelte-kit directories, while the deep-clean script is modified to run a chain of cleaning commands targeting additional directories such as .turbo and node_modules.

Changes

File Change Summary
package.json - Updated the "clean" script to run "clean:dist" and "clean:sveltekit" scripts, which remove the dist and .svelte-kit directories respectively.
- Updated the "deep-clean" script to run the new sequence: "clean", "deep-clean:turbo", and "deep-clean:node-modules".
- Added "clean:dist", "clean:sveltekit", "deep-clean:turbo", and "deep-clean:node-modules" scripts for more granular cleaning.

Sequence Diagram(s)

sequenceDiagram
    participant U as User/Terminal
    participant S as Shell/Package Manager
    U->>S: npm run clean
    S->>S: Execute clean:dist
    S->>S: Execute clean:sveltekit
Loading
sequenceDiagram
    participant U as User/Terminal
    participant S as Shell/Package Manager
    U->>S: npm run deep-clean
    S->>S: Execute npm run clean
    S->>S: Execute deep-clean:turbo
    S->>S: Execute deep-clean:node-modules
Loading

Suggested reviewers

  • rodrigopavezi
  • sstefdev

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
package.json (1)

20-21: Targeted Directory Removal with find Commands
Both "clean:dist" and "clean:sveltekit" scripts use find to identify and delete the respective directories. Note that the previous version suppressed error messages and provided a deletion log via -printf '%p deleted\n' which is now omitted. If you require similar logging or error redirection, consider appending those options here. Additionally, ensure that these commands work as expected across your development environments (especially on non-Unix platforms, if applicable).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c9950f and ce3cdc2.

📒 Files selected for processing (1)
  • package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (3)
package.json (3)

19-19: Modular Clean Script Refactoring
The updated "clean" script now delegates the removal responsibilities to two focused scripts (clean:dist and clean:sveltekit), which improves both readability and modularity. Please verify that the output messages (if any) meet your logging or debugging expectations.


22-22: Sequential Deep-Clean Command Chaining
The revised "deep-clean" script now chains the cleaning commands by first running the standard clean steps and then proceeding to remove additional directories (.turbo and node_modules). This sequential chaining ensures that a partial clean does not inadvertently leave residual build artifacts. Confirm that this sequential approach meets your performance and reliability expectations.


23-24: Extended Cleanup Targets Verification
The newly added "deep-clean:turbo" and "deep-clean:node-modules" scripts correctly address the removal of rarely cleaned directories. Please ensure that deleting these directories does not interfere with any local development dependencies or caching mechanisms that you might want to preserve in some contexts.

@MantisClone MantisClone marked this pull request as draft February 5, 2025 22:34
@MantisClone
Copy link
Member Author

Converting back to draft because it's not quite working

@MantisClone MantisClone marked this pull request as ready for review February 5, 2025 22:44
@MantisClone
Copy link
Member Author

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
package.json (1)

22-22: Enhanced Deep-Clean Command Chaining

The "deep-clean" script now chains multiple steps: it first calls the regular clean-up process and then proceeds to execute deep-cleaning for additional directories (i.e., .turbo and node_modules). This sequential chaining ensures that the base cleaning is completed before more intensive operations. Consider adding an overall completion message for improved developer feedback.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c9950f and 48d41b2.

📒 Files selected for processing (1)
  • package.json (1 hunks)
🔇 Additional comments (4)
package.json (4)

19-19: Clean Script Modularization

The updated "clean" script now delegates its functionality by sequentially calling "clean:dist" and "clean:sveltekit". This modular approach enhances readability and maintainability by breaking the task into smaller, focused commands.


20-20: Targeted Deletion for 'dist' Directories

The new "clean:dist" script uses a find command to remove directories named dist (while excluding the node_modules path via -prune). The addition of an echo message provides useful feedback about deletions. Ensure that the command works as intended on all supported environments.


21-21: Clean Script for '.svelte-kit' Directory

The "clean:sveltekit" script similarly targets .svelte-kit directories. The command structure mirrors that of "clean:dist", promoting consistency in handling different directories.


23-24: Deep-Clean for Additional Directories

The new "deep-clean:turbo" and "deep-clean:node-modules" commands extend the cleaning functionality by targeting .turbo and node_modules, respectively. Both scripts employ a similar find command pattern with an echo for deletion feedback, which maintains consistency across the cleaning operations. Note that invoking rm -rf always demands caution; please verify that only the intended directories are deleted.

@MantisClone MantisClone merged commit 9cce435 into main Feb 6, 2025
2 of 3 checks passed
@MantisClone MantisClone deleted the clean-scripts branch February 6, 2025 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants