-
Notifications
You must be signed in to change notification settings - Fork 21
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
DEV - Improve bundling and release #418
Merged
Merged
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
07fe9b8
:wrench: Simplify webpack configuration and add proper production tar…
trallard a5e66c6
:heavy_plus_sign: Add terser as dev dependency
trallard ad55f0b
Update docs to use production target
trallard c227ab8
Update yarn.lock
trallard d3723d9
Simplify webpack config
trallard 1a030cd
Update logo path
trallard 28eb1cc
Add style-loader to dev dependencies
trallard 38133a2
Update yarn.lock
trallard 30268e2
:wrench: Update webpack.config
trallard c169527
Merge branch 'main' into trallard/update-bundle
trallard 3f617d5
Update yarn.lock
trallard 6320175
Update release notes
trallard 00d6b73
Update readme
trallard 50d9d94
Update release instructions
trallard 4e3b545
Apply suggestions from code review
trallard 7601537
Merge branch 'main' into trallard/update-bundle
trallard 1bb0b3f
Update webpack config
trallard 6fd0cc9
Merge branch 'main' into trallard/update-bundle
trallard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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,7 +1,4 @@ | ||
{ | ||
"extends": "./tsconfig", | ||
"include": [ | ||
"src/**/*", | ||
"test/**/*", | ||
] | ||
"include": ["src/**/*", "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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,105 @@ | ||
/* | ||
* Copyright (c) 2022, Quansight | ||
* Copyright (c) 2020, conda-store development team | ||
* | ||
* This file is part of the tree-finder library, distributed under the terms of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this was completely re-worked we do not need this heading |
||
* the BSD 3 Clause license. The full license can be found in the LICENSE file. | ||
* This file is distributed under the terms of the BSD 3 Clause license. | ||
* The full license can be found in the LICENSE file. | ||
*/ | ||
const HtmlWebpackPlugin = require("html-webpack-plugin"); | ||
|
||
const path = require("path"); | ||
const HtmlWebpackPlugin = require("html-webpack-plugin"); | ||
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | ||
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); | ||
const TerserPlugin = require("terser-webpack-plugin"); | ||
const Dotenv = require("dotenv-webpack"); | ||
const webpack = require("webpack"); | ||
|
||
// const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin"); | ||
// To improve build times for large projects enable fork-ts-checker-webpack-plugin | ||
// const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); | ||
const isProd = process.env.NODE_ENV === "production"; | ||
const ASSET_PATH = isProd ? "" : "/"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed so that we can bundle the UI for conda-store-server |
||
|
||
const { | ||
dependencySrcMapRules, | ||
stylingRules, | ||
svgUrlRules, | ||
getContext, | ||
getOptimization, | ||
getResolve, | ||
tsRules | ||
} = require("./webpack.rules"); | ||
// Calculate hash based on content, will be used when generating production | ||
// bundles | ||
const cssLoader = { | ||
loader: "css-loader", | ||
options: { | ||
modules: { | ||
auto: true, | ||
localIdentName: isProd ? "[hash:base64]" : "[name]__[local]--[hash:base64:5]", | ||
}, | ||
}, | ||
}; | ||
|
||
const isProd = process.env.NODE_ENV === "production"; | ||
const rules = [ | ||
{ | ||
test: /\.js$/, | ||
use: "source-map-loader", | ||
enforce: "pre", | ||
exclude: /node_modules/, | ||
}, | ||
{ | ||
test: /\.(css|less)$/, | ||
use: [ | ||
isProd ? MiniCssExtractPlugin.loader : "style-loader", | ||
cssLoader, | ||
"less-loader", | ||
], | ||
}, | ||
{ | ||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, | ||
type: "asset", | ||
parser: { | ||
dataUrlCondition: { | ||
maxSize: 10 * 1024, // 10kb | ||
}, | ||
}, | ||
}, | ||
{ | ||
test: /\.tsx?$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
{ | ||
loader: "ts-loader", | ||
options: { | ||
transpileOnly: true, | ||
experimentalWatchApi: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
const basicConfig = { | ||
module.exports = { | ||
mode: isProd ? "production" : "development", | ||
// generate a sourcemap for production, in dev we generate mapping faster | ||
devtool: isProd ? "source-map" : "eval-cheap-module-source-map", | ||
devServer: { | ||
port: 8000, | ||
// enable hot module replacement | ||
hot: true, | ||
gabalafou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
devtool: isProd ? false : "source-map", | ||
entry: ["src/index.tsx", "src/main.tsx"], | ||
watch: false, | ||
...getContext(__dirname), | ||
|
||
output: { | ||
path: path.resolve(__dirname, "dist"), | ||
filename: "[name].js", | ||
publicPath: "/" | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
...dependencySrcMapRules, | ||
...stylingRules, | ||
...svgUrlRules, | ||
...tsRules, | ||
] | ||
filename: isProd ? "[name].[contenthash].js" : "[name].js", | ||
publicPath: ASSET_PATH, | ||
clean: true, | ||
trallard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
|
||
module: { rules }, | ||
resolve: { | ||
...getResolve(__dirname) | ||
modules: ["node_modules", path.resolve(__dirname)], | ||
trallard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
extensions: [".tsx", ".ts", ".jsx", ".js", ".less", ".css"], | ||
}, | ||
|
||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
title: "conda-store" | ||
new HtmlWebpackPlugin({ title: "conda-store" }), | ||
new MiniCssExtractPlugin({ | ||
filename: isProd ? "[name].[contenthash].css" : "[name].css", | ||
}), | ||
new MiniCssExtractPlugin(), | ||
new Dotenv(), | ||
new webpack.EnvironmentPlugin(['REACT_APP_VERSION']) | ||
new webpack.EnvironmentPlugin(["REACT_APP_VERSION"]), | ||
new webpack.ids.HashedModuleIdsPlugin(), | ||
], | ||
|
||
mode: isProd ? "production" : "development", | ||
|
||
optimization: { | ||
minimize: isProd, | ||
...(isProd && getOptimization()) | ||
} | ||
}; | ||
|
||
module.exports = [basicConfig]; | ||
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()], | ||
gabalafou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
runtimeChunk: "single", | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why repeat the same info from the issue template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People sometimes look for the release.md file if curious vs. an issue template, so it would not hurt to keep this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is more about the repeated content, which then has to be updated in two places instead of one if these two documents are not going to get out of sync