Skip to content

Commit

Permalink
Merge branch 'release/2.4.0' into craft-webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Nov 11, 2020
2 parents 8b34868 + 79c405c commit 8af42f6
Show file tree
Hide file tree
Showing 78 changed files with 25,418 additions and 2,683 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
/cms/web/assets/*
/cms/web/cpresources/*
/cms/web/dist/*
/cms/web/favicon.*
/cms/web/sw.*

# BUILD FILES
node_modules
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# nystudio107/craft Change Log

## 2.3.15 - 2020.10.26
## 2.4.0 - 2020.11.10
### Added
* Updated buildchain to a modular webpack config system, using webpack 5 & PostCSS 8
* Added `yiisoft/yii2-shell` to `require-dev`
* Add `--no-dev --no-progress` to the composer install command

Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ The project is based on [Craft CMS](https://CraftCMS.com) using a unique `templa

* [Docker](https://www.docker.com/) Docker is used for local development; see **Setting Up Local Dev** below for details
* A base Twig templating setup as described in [An Effective Twig Base Templating Setup](https://nystudio107.com/blog/an-effective-twig-base-templating-setup)
* [webpack](https://webpack.js.org/) is used for the build system as per [An Annotated webpack 4 Config for Frontend Web Development](https://nystudio107.com/blog/an-annotated-webpack-4-config-for-frontend-web-development)
* [webpack 5](https://webpack.js.org/) is used for the build system as per [An Annotated webpack 4 Config for Frontend Web Development](https://nystudio107.com/blog/an-annotated-webpack-4-config-for-frontend-web-development)
* [TypeScript](https://www.typescriptlang.org/) for strictly typed JavaScript code
* [Vue.js 3.0](https://vuejs.org/) is used for some of the interactive bits on the website, and Vue.js 3.x allows us to leverage the [Composition API](https://composition-api.vuejs.org/)
* [Tailwind CSS](https://tailwindcss.com/) for the site-wide CSS
* [Tailwind CSS](https://tailwindcss.com/) for the site-wide CSS with CSS splitting as per the [Speeding Up Tailwind CSS Builds](https://nystudio107.com/blog/speeding-up-tailwind-css-builds) article
* JSON-LD structured data as per [Annotated JSON-LD Structured Data Examples](https://nystudio107.com/blog/annotated-json-ld-structured-data-examples)
* [Google AMP](https://developers.google.com/amp/) versions of the podcast episode and other pages
* Image transforms are done via a [Serverless Image Handler](https://aws.amazon.com/solutions/serverless-image-handler/) lambda function, as described in the [Setting Up Your Own Image Transform Service](https://nystudio107.com/blog/setting-up-your-own-image-transform-service) article
Expand Down Expand Up @@ -55,9 +55,6 @@ You'll need Docker desktop for your platform installed to run the project in loc
* Set up a `.env` file in the `cms/` directory, based off of the provided `example.env`
* Set up a `.env.sh.` file in the `scripts/` directory, based off of the provided `example.env.sh`
* Start up the site with `docker-compose up` (the first build will be somewhat lengthy)
* On the first time setting it up, the `craft_php_1` container will fail; this is normal
* Import the `seed_db.sql` database dump the first time from the `scripts/` dir with `./docker_restore_db.sh seed_db.sql`
* Then hit `^C` (Control-C) to stop the Docker containers, and restart them with `docker-compose up` and `craft_php_1` should then work properly, since the db has been seeded
* Navigate to `http://localhost:8000` to use the site; the `webpack-dev-server` runs off of `http://localhost:8080`

The CP login credentials are initially set as follows:
Expand All @@ -75,9 +72,9 @@ rm cms/composer.lock
docker-compose up
```

To update to the latest npm packages (as constrained by the `docker-config/node-dev-webpack/package.json` semvers), do:
To update to the latest npm packages (as constrained by the `buildchain/package.json` semvers), do:
```
rm docker-config/node-dev-webpack/package-lock.json
rm buildchain/package-lock.json
docker-compose up
```

Expand Down
7 changes: 1 addition & 6 deletions buddy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
docker_image_name: "nystudio107/webpack-dev-base"
docker_image_tag: "latest"
execute_commands:
- "cd docker-config/node-dev-webpack"
- "cd buildchain"
- "npm ci"
- "npm run build"
volume_mappings:
Expand Down Expand Up @@ -74,7 +74,6 @@
- "echo \"Symlinking: persistent files & directories\""
- "ln -nfs $REMOTE_PROJECT_ROOT/.env $REMOTE_PROJECT_ROOT/releases/$BUDDY_EXECUTION_REVISION"
- "ln -nfs $REMOTE_PROJECT_ROOT/storage $REMOTE_PROJECT_ROOT/releases/$BUDDY_EXECUTION_REVISION"
- "ln -nfs $REMOTE_PROJECT_ROOT/transcoder $REMOTE_PROJECT_ROOT/releases/$BUDDY_EXECUTION_REVISION/web"
- "echo \"Linking current to revision: $BUDDY_EXECUTION_REVISION\""
- "rm -f current"
- "ln -s releases/$BUDDY_EXECUTION_REVISION current"
Expand All @@ -93,8 +92,6 @@
commands:
- "# Ensure the craft script is executable"
- "chmod a+x craft"
- "# Turn Craft off"
- "php craft off --retry=60"
- "# Restart our long running queue listener process"
- "echo \"\" | sudo -S supervisorctl restart all"
- "# Backup the database just in case any migrations or Project Config changes have issues"
Expand All @@ -103,8 +100,6 @@
- "php craft clear-caches/all"
- "php craft migrate/all"
- "php craft project-config/apply"
- "# Turn Craft on"
- "php craft on"
trigger_condition: "ALWAYS"
run_as_script: true
shell: "BASH"
Expand Down
8 changes: 8 additions & 0 deletions buildchain/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"@typescript-eslint/no-var-requires": 0
},
"env": {
"browser": true,
"amd": true,
"node": true
},
"plugins": [
"@typescript-eslint"
],
Expand Down
86 changes: 86 additions & 0 deletions buildchain/get-webpack-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// node modules
const { merge } = require('webpack-merge');

/**
* return a webpack settings file
* @param name string
* @returns {{}}
*/
const getWebpackSettings = (name) => {
let settings = {};
try {
settings = require('./webpack-settings/' + name + '.settings.js');
} catch (e) {
// that's okay
}

return settings;
};

/**
* return a webpack settings file combined with the 'app' settings
* @param name string
* @returns {{}}
*/
const getCombinedWebpackSettings = (name) => ({
...getWebpackSettings('app'),
...getWebpackSettings(name),
});

/**
* return a legacy webpack config file
* @param name
* @returns {{}}
*/
const getLegacyWebpackConfig = (name) => require('./webpack-configs/' + name + '.config.js')('legacy', getCombinedWebpackSettings(name));

/**
* return a modern webpack config file
* @param name
* @returns {{}}
*/
const getModernWebpackConfig = (name) => require('./webpack-configs/' + name + '.config.js')('modern', getCombinedWebpackSettings(name));

/**
* return an array of webpack configs using the function provided in getWebpackConfig
* @param names string[]
* @param getWebpackConfig function
* @returns {{}}
*/
const webpackConfigs = (names, getWebpackConfig) => {
let config = {};
names.forEach((name) => config = merge(config, getWebpackConfig(name)));

return config;
};

/**
* return an array of build webpack configs
* @param names string
* @returns {{}}
*/
const buildWebpackConfigs = (...names) => webpackConfigs(names, getModernWebpackConfig);

/**
* return an array of legacy webpack configs
* @param names string
* @returns {{}}
*/
const legacyWebpackConfigs = (...names) => webpackConfigs(names, getLegacyWebpackConfig);

/**
* return an array of modern webpack configs
* @param names string
* @returns {{}}
*/
const modernWebpackConfigs = (...names) => webpackConfigs(names, getModernWebpackConfig);

// module exports
module.exports = {
getWebpackSettings,
getLegacyWebpackConfig,
getModernWebpackConfig,
buildWebpackConfigs,
legacyWebpackConfigs,
modernWebpackConfigs,
};
Loading

0 comments on commit 8af42f6

Please sign in to comment.