Skip to content

Commit

Permalink
Build and publish javascript artifacts as part of the regular release…
Browse files Browse the repository at this point in the history
… task
  • Loading branch information
cbeer committed Feb 3, 2023
1 parent ae63f0a commit 7287bd2
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 794 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ pkg/*
/spec/examples.txt
node_modules/*
package-lock.json
/app/assets/javascripts/blacklight
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ components in the gem are changed, this bundle should be rebuild with the
following steps:
1. [Install npm](https://www.npmjs.com/get-npm)
1. run `npm install` to download dependencies
1. run `npm run js-compile-bundle` to build the bundle
1. run `npm run prepare` to build the bundle
1. run `npm publish` to push the javascript package to https://npmjs.org/package/blacklight-frontend

## Using the javascript
Expand Down
18 changes: 18 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ end

Bundler::GemHelper.install_tasks

# Hook up our NPM tasks to the standard uild and release tasks
Rake::Task['build'].enhance(['build:npm'])
Rake::Task['release'].enhance(['release:npm'])

# rubocop:disable Rails/RakeEnvironment
desc 'build javascript assets'
task 'build:npm' do
sh 'npm install'
sh 'npm run prepare'
end

desc "Publish javascript assets to npm\n" \
"To prevent publishing in NPM use e.g. `npm_push=no rake release`"
task 'release:npm' do
sh 'npm publish' unless %w[n no nil false off 0].include?(ENV["npm_push"].to_s.downcase)
end
# rubocop:enable Rails/RakeEnvironment

load "tasks/blacklight.rake"
load "lib/railties/blacklight.rake"

Expand Down
Loading

0 comments on commit 7287bd2

Please sign in to comment.