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

Adjust Asset Pipeline #73

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ jobs:
install-yarn: true
- node/install-packages:
pkg-manager: yarn
- run: npx gulp copyAssets
- run: npx gulp compile
- run: echo -e $DEV_PRIVATE_KEY > dev_key.pem
- run: echo -e $DEV_PUBLIC_CERT > dev_cert.pem
- run: echo 'export CF_PASSWORD=$CF_PASSWORD_DEV' >> $BASH_ENV
Expand Down
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
ruby 3.2.4
nodejs 20.15.1
yarn 1.22.22
69 changes: 69 additions & 0 deletions DEVCONFIG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Challenge.Gov

The Challenge.Gov Platform

## Requirements

* PostgreSQL 16+
* Ruby 3.2+
* Node.js 20.x
* Yarn 1.22.x

## Install and Setup

Install PostgreSQL according to your OS of choice, for MacOS [Postgres.app](https://postgresapp.com/) is recommended.

Install of the languages needed can be done via ASDF or Nix

### ASDF Option

To install Ruby and NodeJS it is recommended to use the [asdf version manager](https://asdf-vm.com/#/). Install instructions are copied here for MacOS, for other OSs see [asdf docs](https://asdf-vm.com/#/core-manage-asdf-vm). This also assumes you have [HomeBrew](https://brew.sh/) installed.

```bash
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.0
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile

brew install \
coreutils automake autoconf openssl \
libyaml readline libxslt libtool unixodbc
```

Once asdf is set up, install each language. NodeJS may require setting up keys, and should display help to guide you.

```bash
asdf plugin-add ruby
asdf install ruby 3.2.4

asdf plugin-add nodejs
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf install nodejs 20.15.1

asdf plugin-add yarn
asdf install yarn 1.22.22
```

### Nix Shell Option

Once on your machine, you need to install [the nix package manager](https://nixos.org/download.html#nix-install-macos) by following their multi-user installer. Once nix is installed, setup [direnv](https://direnv.net/) by hooking into your shell. This only has to be done on your machine once.

```bash
nix-env -f '<nixpkgs>' -iA direnv
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
```

Once direnv is installed and your shell is restarted, clone the project and `cd` into it. You should see direnv warn about an untrusted `.envrc` file. Allow the file and finish installing dependencies and setting up the application.

1. Allow direnv to use the envrc file `direnv allow`

## Running Locally

1. Install rubygems dependencies with `bundle install`
1. Install nodejs dependencies `yarn install`
1. Set up your uswds files in the build directory `npx gulp copyAssets`
Copy link
Contributor

Choose a reason for hiding this comment

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

nice, this saved me

1. Setup the database `rake db:create`, note that postgres must be running for this to work
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to note the shared DB with Phoenix here? if a user has their DB created and seeded on that repo, they don't need this step

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably, but I figured we'd see how things shake out and update this pretty often

1. Boot the system, this will run the sass, esbuild, and uswds watchers along with the rails server
1. `./bin/dev`

Now you can visit [`localhost:3000`](http://localhost:3000) from your browser.

14 changes: 4 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ ruby "3.2.4"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.1.3", ">= 7.1.3.4"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use postgresql as the database for Active Record
gem "pg"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
# Use simple asset pipeline
gem "propshaft", "~> 0.9.0"
gem "cssbundling-rails", "~> 1.4"
gem "jsbundling-rails", "~> 1.3"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
Expand Down Expand Up @@ -76,8 +75,3 @@ group :test do
gem 'rspec_junit_formatter'
gem 'simplecov'
end

gem "cssbundling-rails", "~> 1.4"

# Use Sass to process CSS
gem "sassc-rails"
39 changes: 11 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ GEM
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
crass (1.0.6)
cssbundling-rails (1.4.0)
cssbundling-rails (1.4.1)
railties (>= 6.0.0)
date (3.3.4)
debug (1.9.2)
Expand All @@ -111,26 +111,20 @@ GEM
docile (1.1.5)
drb (2.2.1)
erubi (1.13.0)
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
foreman (0.88.1)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.7.2)
irb (1.14.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jbuilder (2.12.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jsbundling-rails (1.3.1)
railties (>= 6.0.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
logger (1.6.0)
Expand Down Expand Up @@ -171,6 +165,11 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.6)
propshaft (0.9.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
psych (5.1.2)
stringio
public_suffix (6.0.0)
Expand Down Expand Up @@ -257,14 +256,6 @@ GEM
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
selenium-webdriver (4.23.0)
base64 (~> 0.2)
logger (~> 1.4)
Expand All @@ -276,19 +267,11 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.5.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.1)
strscan (3.1.0)
thor (1.3.1)
tilt (2.3.0)
timeout (0.4.1)
turbo-rails (2.0.6)
actionpack (>= 6.0.0)
Expand All @@ -315,6 +298,7 @@ PLATFORMS
aarch64-linux
arm64-darwin-21
arm64-darwin-22
arm64-darwin-23
x86_64-darwin-22
x86_64-linux

Expand All @@ -326,18 +310,17 @@ DEPENDENCIES
cssbundling-rails (~> 1.4)
debug
foreman
importmap-rails
jbuilder
jsbundling-rails (~> 1.3)
pg
propshaft (~> 0.9.0)
puma (>= 5.0)
rails (~> 7.1.3, >= 7.1.3.4)
rspec-rails
rspec_junit_formatter
rubocop
sassc-rails
selenium-webdriver
simplecov
sprockets-rails
stimulus-rails
turbo-rails
tzinfo-data
Expand Down
2 changes: 2 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
web: env RUBY_DEBUG_OPEN=true bin/rails server
css: yarn build:css --watch
js: yarn build --watch
uswds: npx gulp watch
9 changes: 0 additions & 9 deletions app/assets/config/manifest.js
Copy link
Contributor

Choose a reason for hiding this comment

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

ig this is only relevant for sprockets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah

This file was deleted.

Loading
Loading