-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support other js package managers (#349)
* feat: use `package_json` to manage `package.json` * fix: add `require` back maybe? * fix: use `read` and leave the package manager to `package_json` (as it now has an env variable) * fix: update `PackageJson` call * fix: don't check yarn anymore * fix: use bang method & exit early on error * fix: use `package_json` rather than `yarn bin` to exec webpack * fix: replace `check_yarn` with `check_manager` task * fix: show general package manager name & version in info task * refactor: make runners use of `PackageJson` opt-in * refactor: make rake tasks use of `PackageJson` opt-in * refactor: restore `check_yarn` rake task, based on opt-in flag for `PackageJson` * refactor: make use of `PackageJson` in template tasks opt-in * fix: only use `npm` for getting node package version if not using `package_json` gem * fix: preserve old load paths when requiring `package-json` gem It seems that requires which happen after this are mucked up due to the load paths having been changed - this really only seems to impact RSpec which requires the diff library lazily * fix: read `package.json` within app path * fix: address minor bugs discovered from adding specs for when `package_json` is enabled * test: update generator specs * ci: run tests both with and without using `package_json` gem to ensure everything is valid * docs: include a section about `SHAKAPACKER_USE_PACKAGE_JSON_GEM` * fix: properly set babel preset for react * feat: support bun * feat: properly include `package_json` as a dependency * ci: run generator specs with and without `package_json` gem in parallel * docs: add changelog entry
- Loading branch information
Showing
35 changed files
with
784 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require "shakapacker/utils/misc" | ||
|
||
namespace :shakapacker do | ||
desc "Verifies if the expected JS package manager is installed" | ||
task :check_manager do |task| | ||
unless Shakapacker::Utils::Misc.use_package_json_gem | ||
prefix = task.name.split(/#|shakapacker:/).first | ||
Rake::Task["#{prefix}shakapacker:check_manager"].invoke | ||
next | ||
end | ||
|
||
require "package_json" | ||
|
||
package_json = PackageJson.read | ||
pm = package_json.manager.binary | ||
|
||
begin | ||
version = package_json.manager.version | ||
|
||
$stdout.puts "using #{pm}@#{version} to manage dependencies and scripts in package.json" | ||
rescue PackageJson::Error | ||
$stderr.puts "#{pm} not installed - please ensure it is installed before trying again" | ||
$stderr.puts "Exiting!" | ||
exit! | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.