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

Bundle and lint plugins #22

Merged
merged 36 commits into from
Sep 19, 2023
Merged

Bundle and lint plugins #22

merged 36 commits into from
Sep 19, 2023

Conversation

daun
Copy link
Member

@daun daun commented Sep 12, 2023

Description

  • Update oclif and port to TS & ESM
  • Add build and lint commands, previously part of @swup/plugin
  • Clean up validation arguments a bit → breaking change
  • Load config file from multiple locations
  • Related PR: Remove build commands from @swup/plugin

UI

Polished up the UI a bit using interactive task lists.

Screen.Recording.2023-09-14.at.10.58.28.mov

Bundling packing

All bundling, linting, formatting functionality is grouped in a package:* topic. The functionality is exactly the same as the current implementation in @swup/plugin.

# check package info
swup package:check

# lint code
swup package:lint

# format code
swup package:format

# build for production
swup package:build

# develop in watch mode
swup package:dev

Creating plugins

The --type arg is no longer required if it can be inferred from the name:

# create a plugin
swup create MyCustomPlugin

# create a theme
swup create MyCustomTheme

Validating sites

The --crawl argument is now a flag and re-uses the base URL.

# validate a single page
swup validate --url https://example.net/about

# validate and crawl the whole site
swup validate --url https://example.net --crawl

Config file

The config file used for storing some of the validation information is now loaded using cosmiconfig, so that any of these are possible locations for the configuration:

  • a swup key in package.json
  • a swup.config.js file (as before)
  • a .swuprc.json, .swuprc.yml, .swuprc.js, .swuprc.mjs, or .swuprc.cjs file
  • a swup.config.js, swup.config.mjs, or swup.config.cjs file

Interestingly, the config file was never described in the readme, so not sure how to go about documenting this.

Checks

  • The PR is submitted to the master branch
  • The code was linted before pushing (npm run lint)
  • All tests are passing (npm run test)
  • New or updated tests are included
  • The documentation was updated as required

Additional information

Closes #19
Closes #23
Closes #24

@daun daun changed the title Update CLI framework Bundle and lint plugins Sep 13, 2023
@daun daun marked this pull request as ready for review September 13, 2023 23:32
@daun daun requested a review from a team September 13, 2023 23:35
@daun daun mentioned this pull request Sep 17, 2023
5 tasks
@daun daun requested review from a team and removed request for a team September 19, 2023 13:44
@daun
Copy link
Member Author

daun commented Sep 19, 2023

Ready for review :)

Copy link
Member

@hirasso hirasso left a comment

Choose a reason for hiding this comment

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

🍰

@daun daun merged commit c9308a3 into master Sep 19, 2023
@daun daun deleted the update branch September 19, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants