Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Added
Browse files Browse the repository at this point in the history
- Added `--no-tablespaces` to the mysqldump command options to work around changes in MySQL

 Fixed
- Modern config only for local dev, [fixing multi-compiler issues](webpack/webpack-dev-server#2355) with HRM
- Fix redis session config to use `App::sessionConfig()`

Changed
- Remove `[hash]` from dev config to eliminate potential [memory errors](webpack/webpack-dev-server#438)
- Use `[contenthash]` in production instead of [hash or chunkhash](webpack/webpack.js.org#2096)

- Readme file to give proper credit

-
-
-
  • Loading branch information
Bcdo committed Aug 14, 2020
1 parent 65b3c33 commit f0ba4f8
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 42 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@

## [Unreleased]

- Explore an atomic deployment solution
- Update in the readme file what to do before deployment, as well as how to deploy.
- Set up a assets volume with the aws settings ready as example.
- Set up a assets volume with the aws settings ready as example, export new seed_db.

## [2.5.1] - 2020-08-14

### Added
- Added `--no-tablespaces` to the mysqldump command options to work around changes in MySQL

### Fixed
- Modern config only for local dev, [fixing multi-compiler issues](https://github.com/webpack/webpack-dev-server/issues/2355) with HRM
- Fix redis session config to use `App::sessionConfig()`

### Changed
- Remove `[hash]` from dev config to eliminate potential [memory errors](https://github.com/webpack/webpack-dev-server/issues/438)
- Use `[contenthash]` in production instead of [hash or chunkhash](https://github.com/webpack/webpack.js.org/issues/2096)

### Updated
- Readme file to give proper credit

## [2.5.0] - 2020-08-09

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# NOEN Reklamebyrå scaffolding

## What is this?
This is a Craft CMS scaffolding project based on the nystudio107´s docker scaffolding. I needed it to work with vm instead of docker, so I have adjusted it to be used with Craft Nitro. Before trying to use this, make sure you install Nitro first. I will keep updating this project based on my own preferences, as well as follow ups on nystudio107´s updates.

## Required Technology Stack
- Craft Nitro
- PHP 7.4
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bcdo/project",
"description": "A scaffolding for projects",
"version": "2.5.0",
"version": "2.5.1",
"type": "project",
"license": "MIT",

Expand Down
25 changes: 14 additions & 11 deletions config/app.web.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@

return [
'components' => [
'session' => [
'class' => \yii\redis\Session::class,
'redis' => [
'hostname' => App::env('REDIS_HOSTNAME'),
'port' => App::env('REDIS_PORT'),
'database' => App::env('REDIS_CRAFT_DB'),
],
'as session' => [
'class' => \craft\behaviors\SessionBehavior::class,
],
],
'session' => static function() {
// Get the default component config
$config = craft\helpers\App::sessionConfig();
// Override the class to use Redis' session class and our config settings
$config['class'] = yii\redis\Session::class;
$config['redis'] = [
'hostname' => App::env('REDIS_HOSTNAME'),
'port' => App::env('REDIS_PORT'),
'database' => App::env('REDIS_CRAFT_DB'),
];
// Instantiate and return it
return Craft::createObject($config);
},

],
];
1 change: 1 addition & 0 deletions scripts/common/common_mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ done
# Additional arguments for mysqldump
MYSQLDUMP_ADDITIONAL_ARGS=""
MYSQLDUMP_ADDITIONAL_ARGS+="--add-drop-table "
MYSQLDUMP_ADDITIONAL_ARGS+="--no-tablespaces "
MYSQLDUMP_ADDITIONAL_ARGS+="--comments "
MYSQLDUMP_ADDITIONAL_ARGS+="--create-options "
MYSQLDUMP_ADDITIONAL_ARGS+="--dump-date "
Expand Down
10 changes: 6 additions & 4 deletions webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const configureImageLoader = () => {
{
loader: 'file-loader',
options: {
name: 'img/[name].[hash].[ext]'
name: 'img/[name].[ext]'
}
}
]
Expand All @@ -64,7 +64,6 @@ const configurePostcssLoader = () => {
{
loader: 'css-loader',
options: {
url: false,
importLoaders: 2,
sourceMap: true
}
Expand All @@ -75,7 +74,10 @@ const configurePostcssLoader = () => {
{
loader: 'postcss-loader',
options: {
sourceMap: true
sourceMap: true,
config: {
path: path.resolve(__dirname),
}
}
}
]
Expand All @@ -87,7 +89,7 @@ module.exports = merge(
common.modernConfig,
{
output: {
filename: path.join('./js', '[name].[hash].js'),
filename: path.join('./js', '[name].js'),
publicPath: settings.devServerConfig.public() + '/',
},
mode: 'development',
Expand Down
51 changes: 27 additions & 24 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,6 @@ const configureBanner = () => {
}
};

// Configure Bundle Analyzer
const configureBundleAnalyzer = (buildType) => {
if (buildType === LEGACY_CONFIG) {
return {
analyzerMode: 'static',
reportFilename: 'report-legacy.html',
};
}
if (buildType === MODERN_CONFIG) {
return {
analyzerMode: 'static',
reportFilename: 'report-modern.html',
};
}
};

// Configure Compression webpack plugin
const configureCompression = () => {
return {
Expand All @@ -113,6 +97,22 @@ const configureCompression = () => {
};
};

// Configure Bundle Analyzer
const configureBundleAnalyzer = (buildType) => {
if (buildType === LEGACY_CONFIG) {
return {
analyzerMode: 'static',
reportFilename: 'report-legacy.html',
};
}
if (buildType === MODERN_CONFIG) {
return {
analyzerMode: 'static',
reportFilename: 'report-modern.html',
};
}
};

// Configure Critical CSS
const configureCriticalCss = () => {
return (settings.criticalCssConfig.pages.map((row) => {
Expand Down Expand Up @@ -167,7 +167,7 @@ const configureImageLoader = (buildType) => {
{
loader: 'file-loader',
options: {
name: 'img/[name].[hash].[ext]'
name: 'img/[name].[contenthash].[ext]'
}
}
]
Expand All @@ -180,7 +180,7 @@ const configureImageLoader = (buildType) => {
{
loader: 'file-loader',
options: {
name: 'img/[name].[hash].[ext]'
name: 'img/[name].[contenthash].[ext]'
}
},
{
Expand Down Expand Up @@ -274,6 +274,9 @@ const configurePostcssLoader = (buildType) => {
{
loader: 'postcss-loader',
options: {
config: {
path: path.resolve(__dirname),
},
sourceMap: true
}
}
Expand Down Expand Up @@ -349,7 +352,7 @@ module.exports = [
common.legacyConfig,
{
output: {
filename: path.join('./js', '[name]-legacy.[chunkhash].js'),
filename: path.join('./js', '[name]-legacy.[contenthash].js'),
},
mode: 'production',
devtool: 'source-map',
Expand All @@ -363,7 +366,7 @@ module.exports = [
plugins: [
new MiniCssExtractPlugin({
path: path.resolve(__dirname, settings.paths.dist.base),
filename: path.join('./css', '[name].[chunkhash].css'),
filename: path.join('./css', '[name].[contenthash].css'),
}),
new PurgecssPlugin(
configurePurgeCss()
Expand All @@ -377,16 +380,16 @@ module.exports = [
new WebappWebpackPlugin(
configureWebapp()
),
new CompressionPlugin(
configureCompression()
),
new CreateSymlinkPlugin(
settings.createSymlinkConfig,
true
),
new SaveRemoteFilePlugin(
settings.saveRemoteFileConfig
),
new CompressionPlugin(
configureCompression()
),
new BundleAnalyzerPlugin(
configureBundleAnalyzer(LEGACY_CONFIG),
),
Expand All @@ -399,7 +402,7 @@ module.exports = [
common.modernConfig,
{
output: {
filename: path.join('./js', '[name].[chunkhash].js'),
filename: path.join('./js', '[name].[contenthash].js'),
},
mode: 'production',
devtool: 'source-map',
Expand Down

0 comments on commit f0ba4f8

Please sign in to comment.