-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from kwheelan/issue.24
Setup webpack for development and production build
- Loading branch information
Showing
69 changed files
with
4,493 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,29 @@ | ||
# Ignore all .xlsx files | ||
# *.xlsx | ||
# *.xlsx | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test |
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
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes
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 @@ | ||
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Demo Budget Form</title><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" crossorigin="anonymous"><link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap" rel="stylesheet"><script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/popper.js@1.9.4/dist/umd/popper.min.js" crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" crossorigin="anonymous"></script><script defer="defer" src="bundle.js"></script></head><body><header><img src="d027d45141f87dc014af.png" alt="City of Detroit Logo" id="logo"><h1>FY2026 Budget Form</h1><h2 id="subtitle"></h2></header><div id="main-panel"><div id="welcome-page"><button class="btn step" id="step-upload">1. Upload your Excel data</button> <button class="btn step" id="step-revenue">2. Baseline request</button> <button class="btn step" id="step-initiatives">3. Name any new initiatives</button> <button class="btn step" id="step-finish">4. Confirm and finish</button></div><div id="prompt-div"><h3 id="prompt"></h3><br><button class="btn" id="option1"></button> <button class="btn" id="option2"></button></div><div class="table-container"><table class="table table-bordered mt-3" id="main-table"><thead class="thead-dark"></thead><tbody></tbody></table></div><div class="row"><div id="add-btn-div"><button class="btn btn-add" id="add-btn"></button></div></div><div class="row"><div class="col-md-12"><div id="nav-btns"><button class="btn" id="btn-last"><strong><< Previous</strong></button> <button class="btn" id="btn-next"><strong>Continue >></strong></button></div></div></div></div><div id="sidebar-panel"><div class="sidebar-content"><br><h4 id="sidebar-title">Summary</h4><br><h6 id="section-header"><strong>Baseline</strong></h6><div id="baseline-stats"><div class="sidebar-stat-line" id="target"><span class="stat-label">FY26 target:</span> <span class="stat"></span></div><div class="sidebar-stat-line" id="baseline-revenue"><span class="stat-label">Projected revenue:</span> <span class="stat"></span></div><div class="sidebar-stat-line" id="baseline-personnel"><span class="stat-label">Personnel cost:</span> <span class="stat"></span></div><div class="sidebar-stat-line" id="baseline-nonpersonnel"><span class="stat-label">Non-personnel cost:</span> <span class="stat"></span></div><div class="sidebar-stat-line" id="baseline-total"><span class="stat-label">Total baseline:</span> <span class="stat"></span></div></div><br><h6 id="section-header"><strong>Supplemental</strong></h6><div id="supp-stats"><div class="sidebar-stat-line" id="supp-revenue"><span class="stat-label">Revenue:</span> <span class="stat"></span></div><div class="sidebar-stat-line" id="supp-personnel"><span class="stat-label">Personnel cost:</span> <span class="stat"></span></div><div class="sidebar-stat-line" id="supp-nonpersonnel"><span class="stat-label">Non-personnel cost:</span> <span class="stat"></span></div><div class="sidebar-stat-line" id="supp-total"><span class="stat-label">Total supplemental:</span> <span class="stat"></span></div></div></div></div><div class="modal fade" id="main-modal" tabindex="-1"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="modal-title"></h5><button type="button" id="modal-close-x" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body" id="modal-body"></div></div></div></div></body></html> |
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,24 @@ | ||
{ | ||
"name": "budget-request-form", | ||
"description": "The City of Detroit's budget request form for Office of the Chief Financial Officer.", | ||
"scripts": { | ||
"build": "webpack --mode production", | ||
"start": "webpack-dev-server --mode development" | ||
}, | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@babel/core": "^7.24.9", | ||
"@babel/preset-env": "^7.24.8", | ||
"babel-loader": "^9.1.3", | ||
"css-loader": "^7.1.2", | ||
"html-loader": "^5.0.0", | ||
"html-webpack-plugin": "^5.6.0", | ||
"mini-css-extract-plugin": "^2.9.0", | ||
"optimize-css-assets-webpack-plugin": "^6.0.1", | ||
"style-loader": "^4.0.0", | ||
"webpack": "^5.93.0", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^5.0.4" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
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
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
js/components/accordion/accordion.js → src/js/components/accordion/accordion.js
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
File renamed without changes.
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
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
js/components/file_upload/file_upload.js → src/js/components/file_upload/file_upload.js
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
js/components/header/header.js → src/js/components/header/header.js
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
js/components/modal/modal.js → src/js/components/modal/modal.js
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import './modal.css'; | ||
|
||
function clearModal(){ | ||
updateModalTitle(''); | ||
|
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
js/components/nav_buttons/nav_buttons.js → src/js/components/nav_buttons/nav_buttons.js
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
js/components/prompt/prompt.js → src/js/components/prompt/prompt.js
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
js/components/sidebar/sidebar.js → src/js/components/sidebar/sidebar.js
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
js/components/table/table.js → src/js/components/table/table.js
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
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
js/components/welcome/welcome.js → src/js/components/welcome/welcome.js
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,79 @@ | ||
const path = require('path'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const TerserJSPlugin = require('terser-webpack-plugin'); | ||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | ||
|
||
// Determine mode from the environment, default to development | ||
const mode = process.env.NODE_ENV || 'development'; | ||
const isProduction = mode === 'production'; | ||
|
||
module.exports = { | ||
// Entry point for the application | ||
entry: './src/js/init.js', | ||
|
||
// Output configuration for the bundle | ||
output: { | ||
filename: isProduction ? 'bundle.[contenthash].js' : 'bundle.js', | ||
path: path.resolve(__dirname, 'build'), | ||
}, | ||
|
||
// Use the mode variable to set the mode | ||
mode, | ||
|
||
// Enable source maps for development mode | ||
devtool: isProduction ? 'source-map' : 'eval-cheap-module-source-map', | ||
|
||
// Module rules for processing different types of files | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, // Process any .js files | ||
exclude: /node_modules/, // Exclude the node_modules directory | ||
use: { | ||
loader: 'babel-loader', // Use babel-loader to transpile ES6+ to ES5 | ||
}, | ||
}, | ||
{ | ||
test: /\.css$/, // Process any .css files | ||
use: [ | ||
isProduction ? MiniCssExtractPlugin.loader : 'style-loader', | ||
'css-loader' | ||
], // Use style-loader in development for hot reloading | ||
}, | ||
{ | ||
test: /\.html$/, // Process any .html files | ||
use: ['html-loader'], | ||
}, | ||
{ | ||
test: /\.(png|svg|jpg|jpeg|gif)$/i, | ||
type: 'asset/resource', | ||
}, | ||
], | ||
}, | ||
|
||
// Plugins for additional functionality | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
template: './src/index.html', // Template file to use | ||
}), | ||
new MiniCssExtractPlugin({ | ||
filename: isProduction ? '[name].[contenthash].css' : '[name].css', | ||
}), | ||
], | ||
|
||
// Configuration for the development server | ||
devServer: { | ||
hot: true, // Enable hot module replacement | ||
open: true, // Open the browser after server had been started | ||
port: 3000, // Set the port to listen on | ||
}, | ||
|
||
// Optimization configuration, only configure minimizers if in production | ||
optimization: isProduction ? { | ||
minimizer: [ | ||
new TerserJSPlugin({}), // Minimize JavaScript | ||
new OptimizeCSSAssetsPlugin({}), // Minimize CSS | ||
], | ||
} : {}, | ||
}; |
Oops, something went wrong.