baarkerlounger
3 years ago
48 changed files with 657 additions and 5380 deletions
@ -0,0 +1,2 @@
|
||||
web: bin/rails server -p 3000 |
||||
js: yarn build --watch |
@ -0,0 +1,7 @@
|
||||
// Load Active Admin's styles into Webpacker,
|
||||
// see `active_admin.scss` for customization.
|
||||
import "./styles/active_admin.scss"; |
||||
|
||||
import "@activeadmin/activeadmin"; |
||||
|
||||
import "chartkick/chart.js" |
@ -0,0 +1,13 @@
|
||||
// This file is automatically compiled by Webpack, along with any other files
|
||||
// present in this directory. You're encouraged to place your actual application logic in
|
||||
// a relevant structure within app/javascript and only use these pack files to reference
|
||||
// that code so it'll be compiled.
|
||||
require.context("govuk-frontend/govuk/assets") |
||||
|
||||
import "./styles/application.scss" |
||||
import "./controllers" |
||||
import "@hotwired/turbo-rails" |
||||
import { initAll } from "govuk-frontend" |
||||
|
||||
ActiveStorage.start() |
||||
initAll() |
@ -0,0 +1,19 @@
|
||||
// Load all the controllers within this directory and all subdirectories.
|
||||
// Controller files must be named *_controller.js.
|
||||
|
||||
import { application } from "./application" |
||||
|
||||
import AccessibleAutocompleteController from "./accessible_autocomplete_controller.js" |
||||
application.register("accessible-autocomplete", AccessibleAutocompleteController) |
||||
|
||||
import ConditionalQuestionController from "./conditional_question_controller.js" |
||||
application.register("conditional-question", ConditionalQuestionController) |
||||
|
||||
import GovukfrontendController from "./govukfrontend_controller.js" |
||||
application.register("govukfrontend", GovukfrontendController) |
||||
|
||||
import NumericQuestionController from "./numeric_question_controller.js" |
||||
application.register("numeric-question", NumericQuestionController) |
||||
|
||||
import TasklistController from "./tasklist_controller.js" |
||||
application.register("tasklist", TasklistController) |
@ -1,6 +1,6 @@
|
||||
// Load Active Admin's styles into Webpacker,
|
||||
// see `active_admin.scss` for customization.
|
||||
import "../styles/active_admin"; |
||||
import "styles/active_admin.scss"; |
||||
|
||||
import "@activeadmin/activeadmin"; |
||||
|
@ -1,9 +0,0 @@
|
||||
// Load all the controllers within this directory and all subdirectories.
|
||||
// Controller files must be named *_controller.js.
|
||||
|
||||
import { Application } from "@hotwired/stimulus" |
||||
import { definitionsFromContext } from "@hotwired/stimulus-webpack-helpers" |
||||
|
||||
const application = Application.start() |
||||
const context = require.context("controllers", true, /_controller\.js$/) |
||||
application.load(definitionsFromContext(context)) |
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
if ! command -v foreman &> /dev/null |
||||
then |
||||
echo "Installing foreman..." |
||||
gem install foreman |
||||
fi |
||||
|
||||
foreman start -f Procfile.dev "$@" |
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env ruby |
||||
|
||||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" |
||||
ENV["NODE_ENV"] ||= "development" |
||||
|
||||
require "pathname" |
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", |
||||
Pathname.new(__FILE__).realpath) |
||||
|
||||
require "bundler/setup" |
||||
|
||||
require "webpacker" |
||||
require "webpacker/webpack_runner" |
||||
|
||||
APP_ROOT = File.expand_path("..", __dir__) |
||||
Dir.chdir(APP_ROOT) do |
||||
Webpacker::WebpackRunner.run(ARGV) |
||||
end |
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env ruby |
||||
|
||||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" |
||||
ENV["NODE_ENV"] ||= "development" |
||||
|
||||
require "pathname" |
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", |
||||
Pathname.new(__FILE__).realpath) |
||||
|
||||
require "bundler/setup" |
||||
|
||||
require "webpacker" |
||||
require "webpacker/dev_server_runner" |
||||
|
||||
APP_ROOT = File.expand_path("..", __dir__) |
||||
Dir.chdir(APP_ROOT) do |
||||
Webpacker::DevServerRunner.run(ARGV) |
||||
end |
@ -1,5 +0,0 @@
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development' |
||||
|
||||
const environment = require('./environment') |
||||
|
||||
module.exports = environment.toWebpackConfig() |
@ -1,5 +0,0 @@
|
||||
const { environment } = require('@rails/webpacker') |
||||
const jquery = require('./plugins/jquery') |
||||
|
||||
environment.plugins.prepend('jquery', jquery) |
||||
module.exports = environment |
@ -1,7 +0,0 @@
|
||||
const webpack = require('webpack') |
||||
|
||||
module.exports = new webpack.ProvidePlugin({ |
||||
"$":"jquery", |
||||
"jQuery":"jquery", |
||||
"window.jQuery":"jquery" |
||||
}); |
@ -1,5 +0,0 @@
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production' |
||||
|
||||
const environment = require('./environment') |
||||
|
||||
module.exports = environment.toWebpackConfig() |
@ -1,5 +0,0 @@
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'staging' |
||||
|
||||
const environment = require('./environment') |
||||
|
||||
module.exports = environment.toWebpackConfig() |
@ -1,5 +0,0 @@
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development' |
||||
|
||||
const environment = require('./environment') |
||||
|
||||
module.exports = environment.toWebpackConfig() |
@ -1,102 +0,0 @@
|
||||
# Note: You must restart bin/webpack-dev-server for changes to take effect |
||||
|
||||
default: &default |
||||
source_path: app/webpacker |
||||
source_entry_path: packs |
||||
public_root_path: public |
||||
public_output_path: packs |
||||
cache_path: tmp/cache/webpacker |
||||
webpack_compile_output: true |
||||
|
||||
# Additional paths webpack should lookup modules |
||||
# ['app/assets', 'engine/foo/app/assets'] |
||||
additional_paths: ['node_modules/govuk-frontend/govuk'] |
||||
|
||||
# Cache manifest.json for performance |
||||
cache_manifest: true |
||||
|
||||
# Extract and emit a css file |
||||
extract_css: true |
||||
|
||||
# Production depends on precompilation of packs prior to booting for performance. |
||||
compile: false |
||||
|
||||
static_assets_extensions: |
||||
- .jpg |
||||
- .jpeg |
||||
- .png |
||||
- .gif |
||||
- .tiff |
||||
- .ico |
||||
- .svg |
||||
- .eot |
||||
- .otf |
||||
- .ttf |
||||
- .woff |
||||
- .woff2 |
||||
|
||||
extensions: |
||||
- .mjs |
||||
- .js |
||||
- .sass |
||||
- .scss |
||||
- .css |
||||
- .module.sass |
||||
- .module.scss |
||||
- .module.css |
||||
- .png |
||||
- .svg |
||||
- .gif |
||||
- .jpeg |
||||
- .jpg |
||||
|
||||
development: |
||||
<<: *default |
||||
compile: true |
||||
|
||||
# Reload manifest.json on all requests so we reload latest compiled packs |
||||
cache_manifest: false |
||||
|
||||
# Extract and emit a css file |
||||
extract_css: false |
||||
|
||||
# Reference: https://webpack.js.org/configuration/dev-server/ |
||||
dev_server: |
||||
https: false |
||||
host: localhost |
||||
port: 3035 |
||||
public: localhost:3035 |
||||
hmr: false |
||||
# Inline should be set to true if using HMR |
||||
inline: false |
||||
overlay: true |
||||
compress: true |
||||
disable_host_check: true |
||||
use_local_ip: false |
||||
quiet: false |
||||
pretty: false |
||||
headers: |
||||
'Access-Control-Allow-Origin': '*' |
||||
watch_options: |
||||
ignored: '**/node_modules/**' |
||||
|
||||
|
||||
test: |
||||
<<: *default |
||||
compile: true |
||||
|
||||
# Reload manifest.json on all requests so we reload latest compiled packs |
||||
cache_manifest: false |
||||
|
||||
# Extract and emit a css file |
||||
extract_css: false |
||||
|
||||
# Compile test packs to a separate directory |
||||
public_output_path: packs-test |
||||
|
||||
|
||||
staging: |
||||
<<: *default |
||||
|
||||
production: |
||||
<<: *default |
@ -0,0 +1,66 @@
|
||||
const path = require("path") |
||||
const webpack = require("webpack") |
||||
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin') |
||||
const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts') |
||||
const CopyPlugin = require("copy-webpack-plugin"); |
||||
|
||||
const mode = process.env.NODE_ENV === 'development' ? 'development' : 'production' |
||||
|
||||
module.exports = { |
||||
mode, |
||||
optimization: { |
||||
moduleIds: 'deterministic' |
||||
}, |
||||
devtool: "source-map", |
||||
entry: { |
||||
application: [ |
||||
"./app/frontend/application.js", |
||||
], |
||||
active_admin:[ |
||||
'./app/frontend/active_admin.js', |
||||
'./app/frontend/styles/active_admin.scss' |
||||
] |
||||
}, |
||||
module: { |
||||
rules: [ |
||||
{ |
||||
test: /\.(js)$/, |
||||
exclude: /node_modules/, |
||||
use: ['babel-loader'], |
||||
}, |
||||
{ |
||||
test: /\.(png|jpe?g|gif|eot|woff2|woff|ttf|svg|ico)$/i, |
||||
use: 'file-loader', |
||||
}, |
||||
{ |
||||
test: /\.(scss|css)/i, |
||||
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'], |
||||
} |
||||
], |
||||
}, |
||||
resolve: { |
||||
modules: ['node_modules', 'node_modules/govuk-frontend/govuk'] |
||||
}, |
||||
output: { |
||||
filename: "[name].js", |
||||
path: path.resolve(__dirname, "app/assets/builds"), |
||||
}, |
||||
plugins: [ |
||||
new RemoveEmptyScriptsPlugin(), |
||||
new MiniCssExtractPlugin(), |
||||
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }), |
||||
new CopyPlugin({ |
||||
patterns: [ |
||||
{ from: "node_modules/govuk-frontend/govuk/assets/images", to: "images" }, |
||||
{ from: "node_modules/govuk-frontend/govuk/assets/fonts", to: "fonts" }, |
||||
], |
||||
}), |
||||
new webpack.ProvidePlugin({ |
||||
$: 'jquery', |
||||
jQuery: 'jquery', |
||||
jquery: 'jquery', |
||||
'window.jQuery': 'jquery' |
||||
}) |
||||
] |
||||
} |
Loading…
Reference in new issue