Support vendoring npm module code

This commit is contained in:
Râu Cao 2023-03-07 18:30:09 +08:00
parent 8eb5f093a4
commit b03c6e9513
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
4 changed files with 14 additions and 0 deletions

View File

@ -78,6 +78,13 @@ The setup task will first delete any existing entries in the directory tree
Note that all 389ds data is stored in `tmp/389ds`. So if you want to start over Note that all 389ds data is stored in `tmp/389ds`. So if you want to start over
with a fresh installation, delete both that directory as well as the container. with a fresh installation, delete both that directory as well as the container.
### Adding npm modules to use with Stimulus controllers
The following command downloads the specified npm module to `vendor/javascript`
and adds an entry for it to `config/importmap.rb`.
bin/importmap pin bech32 --download
### Solargraph ### Solargraph
[Solargraph](https://solargraph.org/) is a Ruby language server, which you may [Solargraph](https://solargraph.org/) is a Ruby language server, which you may
@ -98,6 +105,7 @@ command:
* [Tailwind CSS](https://tailwindcss.com/) * [Tailwind CSS](https://tailwindcss.com/)
* [Sass](https://sass-lang.com/documentation) * [Sass](https://sass-lang.com/documentation)
* [Stimulus](https://stimulus.hotwired.dev/handbook/)
### Testing ### Testing

View File

@ -1,3 +1,4 @@
//= link_tree ../images //= link_tree ../images
//= link_tree ../../javascript .js //= link_tree ../../javascript .js
//= link_tree ../builds //= link_tree ../builds
//= link_tree ../../../vendor/javascript .js

4
bin/importmap Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require_relative "../config/application"
require "importmap/commands"

View File

@ -5,3 +5,4 @@ pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
pin_all_from "app/javascript/controllers", under: "controllers" pin_all_from "app/javascript/controllers", under: "controllers"
pin "bech32" # @2.0.0