Skip to content

Commit a889023

Browse files
jamieomaguirexander-marjoramashleynolan
authored
PIE - v1.18.0 - Fix various windows issues (sass and builds) (#44)
* remove dist on yarn dev * use rimraf package * Downgrade yarn to v1 and re-structure yarn scripts * update readme * fake commit * another test commit * use test:ci in husky * remove temp scss change * update versions and changelogs * fix typo * use actions/cache@v3 * update install command * try to fix yarn install * try to fix yarn install again * rebuild yarn lock * convert build.sh to javascript in pie-icons * revert to using yarn test in pre-commit * remove test from pre-commit * update changelogs * lock node version at 16 * update changelog * add quotes to mkdir for windows * update changelog to explain yarn downgrade * BREAKING: revert yarn downgrade * Yarn 2+ Husky config * RACE CONDITION: sass reload works but out of order with browser reload * add trivial delay to page reload * Use eleventy-sass plugin * Add version hashing (and cleaning of old versions) * update readme and clean dist on yarn dev command * change heading used in readme * update changelogs * add back yarn 2 requirement and steps to readme * Update README.md Co-authored-by: Xander Marjoram <[email protected]> * add back in removed package manager line * move licence line back to original place * Update apps/pie-microsite/CHANGELOG.md Co-authored-by: Ashley Watson-Nolan <[email protected]> * Update apps/pie-microsite/CHANGELOG.md Co-authored-by: Ashley Watson-Nolan <[email protected]> Co-authored-by: Xander Marjoram <[email protected]> Co-authored-by: Ashley Watson-Nolan <[email protected]>
1 parent f6d5627 commit a889023

File tree

17 files changed

+755
-488
lines changed

17 files changed

+755
-488
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
# Restore node_modules if cache exists. If not, cache is created at end of build.
3232
- name: Cache Node Modules
3333
id: cache-node-modules
34-
uses: actions/cache@v2
34+
uses: actions/cache@v3
3535
with:
3636
path: '**/node_modules'
3737
key: node-modules-${{ hashFiles('**/yarn.lock') }}
@@ -56,14 +56,14 @@ jobs:
5656
# Restore node_modules - Cache should exist as one was created in previous 'install' job
5757
- name: Cache Node Modules
5858
id: cache-node-modules
59-
uses: actions/cache@v2
59+
uses: actions/cache@v3
6060
with:
6161
path: '**/node_modules'
6262
key: node-modules-${{ hashFiles('**/yarn.lock') }}
6363
# Restore Turborepo's 'dist' cache - If not, cache is created at end of build.
6464
- name: Cache Turborepo Dist
6565
id: turborepo-dist-cache
66-
uses: actions/cache@v2
66+
uses: actions/cache@v3
6767
with:
6868
path: .turbo
6969
key: turborepo-dist-cache-${{ github.ref_name }}-${{ github.sha }}
@@ -101,14 +101,14 @@ jobs:
101101
# Restore node_modules - Cache should exist as one was created in previous 'install' job
102102
- name: Cache Node Modules
103103
id: cache-node-modules
104-
uses: actions/cache@v2
104+
uses: actions/cache@v3
105105
with:
106106
path: '**/node_modules'
107107
key: node-modules-${{ hashFiles('**/yarn.lock') }}
108108
# Restore Turborepo's 'dist' cache - If not, cache is created at end of build.
109109
- name: Cache Turborepo Dist
110110
id: turborepo-dist-cache
111-
uses: actions/cache@v2
111+
uses: actions/cache@v3
112112
with:
113113
path: .turbo
114114
key: turborepo-dist-cache-${{ github.ref_name }}-${{ github.sha }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,5 @@ esm
153153
.turbo
154154
build/**
155155
dist/**
156+
157+
.plugin-clean

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ git-secrets --pre_commit_hook -- "$@"
1717

1818
yarn lint:scripts
1919
yarn lint:style
20-
yarn test

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
44
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
55

6+
7+
v1.18.0
8+
------------------------------
9+
*November 1, 2022*
10+
11+
### Added
12+
- `nvmrc` file to lock the node version at 16 for local development
13+
14+
### Changed
15+
- Use `actions/cache@v3` instead of `v2` to use Node 16 (was 12 before)
16+
17+
### Removed
18+
- Remove `test` command in `husky` to prevent building entire monorepo on each commit
19+
20+
621
v1.17.0
722
------------------------------
823
*October 22, 2022*

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
## To Run
2323

24-
- From the root run `yarn dev`
24+
- From the root run `yarn dev --filter=YOUR_PROJECT_NAME` (otherwise it will try to run all projects in dev mode)
2525

2626
## Helpful Links
2727

@@ -33,3 +33,20 @@
3333
#### Turborepo
3434

3535
- https://turborepo.org/docs
36+
37+
---
38+
39+
## Running project-level commands that rely on root-level dependencies
40+
If you have a project-level command, such as `yarn lint:style` within the pie-microsite project, you will see that it has `run -T` in front of the `stylelint` command.
41+
42+
This is because `stylelint` is a root-level dependency (so it can shared across monorepo projects). The problem is that if you cd into `/apps/pie-microsite` and run the command, you will get a `command not found` error because `stylelint` does not exist at the project level.
43+
44+
Using the `run -T` expression will tell yarn to look in the root of the repository for that dependency.
45+
46+
Example:
47+
48+
```
49+
"lint:style": "run -T stylelint ./src/**/*.{css,scss}"
50+
```
51+
52+
[Yarn docs reference for this](https://yarnpkg.com/getting-started/qa#how-to-share-scripts-between-workspaces)

apps/pie-microsite/.eleventy.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ const {
66
} = require('./src/_11ty');
77

88
module.exports = eleventyConfig => {
9-
// Watch target scss folder for all changes.
10-
eleventyConfig.addWatchTarget('src/assets/styles/');
11-
129
// Copy over img directory to dist directory.
1310
eleventyConfig.addPassthroughCopy({ 'src/assets/img': 'assets/img' });
1411

1512
// Plugins
1613
plugins.addAllPlugins(eleventyConfig);
17-
14+
1815
// Filters
1916
filters.addAllFilters(eleventyConfig);
2017

apps/pie-microsite/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
44
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
55

66

7+
v1.18.0
8+
------------------------------
9+
*November 1, 2022*
10+
11+
### Added
12+
- `eleventy-plugin-rev` to hash CSS
13+
14+
### Changed
15+
- Re-structure yarn scripts for sass watching and compilation
16+
- Clear the previously compiled css in `/dist` when running `yarn dev` command to correctly reload on SCSS changes when serving
17+
- Use Eleventy plugins to compile SCSS to CSS (`eleventy-sass`, `eleventy-plugin-rev` and `eleventy-plugin-clean`)
18+
19+
### Removed
20+
- Old sass and post-css yarn scripts
21+
22+
723
v1.17.0
824
------------------------------
925
*October 26, 2022*

apps/pie-microsite/package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
{
22
"name": "pie-microsite",
33
"description": "todo",
4-
"version": "1.17.0",
4+
"version": "1.18.0",
55
"main": "index.js",
66
"keywords": [],
77
"author": "JustEatTakeaway - Vue Design System Team",
88
"license": "MIT",
99
"packageManager": "[email protected]",
1010
"scripts": {
11-
"watch:sass": "sass --watch --load-path=../../node_modules/ src/assets/styles:dist/assets/styles",
12-
"watch:eleventy": "eleventy --serve",
13-
"build:sass": "sass --load-path=../../node_modules/ src/assets/styles:dist/assets/styles",
14-
"build:eleventy": "eleventy",
15-
"dev": "npm-run-all build:sass --parallel watch:sass watch:eleventy post-css",
16-
"build": "npm-run-all build:eleventy build:sass post-css",
17-
"lint:style": "stylelint ./src/**/*.{css,scss}",
18-
"lint:style:fix": "yarn lint:style --fix",
19-
"post-css": "postcss dist/assets/styles/main.css -o dist/assets/styles/main.css --use autoprefixer --use cssnano"
11+
"build": "eleventy",
12+
"clean:dist": "run -T rimraf dist",
13+
"dev": "yarn clean:dist && eleventy --serve",
14+
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
15+
"lint:style:fix": "yarn lint:style --fix"
2016
},
2117
"browserslist": [
2218
"extends @justeat/browserslist-config-fozzie"
2319
],
2420
"devDependencies": {
25-
"@11ty/eleventy": "1.0.1",
26-
"@11ty/eleventy-navigation": "^0.3.3"
21+
"@11ty/eleventy": "1.0.2",
22+
"@11ty/eleventy-navigation": "0.3.5",
23+
"eleventy-plugin-clean": "1.1.3",
24+
"eleventy-plugin-rev": "1.0.2",
25+
"eleventy-sass": "2.1.3"
2726
}
2827
}

apps/pie-microsite/src/_11ty/plugins/index.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation');
22

3+
const eleventySass = require('eleventy-sass');
4+
const eleventyPluginRev = require('eleventy-plugin-rev');
5+
const eleventyPluginClean = require('eleventy-plugin-clean');
6+
7+
const postcss = require('postcss');
8+
const autoprefixer = require('autoprefixer');
9+
const cssnano = require('cssnano');
10+
311
/**
412
* Adds all 11ty plugins
5-
* @param {object} eleventyConfig
13+
* @param {object} eleventyConfig
614
*/
715
const addAllPlugins = eleventyConfig => {
816
eleventyConfig.addPlugin(eleventyNavigationPlugin);
17+
eleventyConfig.addPlugin(eleventyPluginRev);
18+
eleventyConfig.addPlugin(eleventyPluginClean);
19+
eleventyConfig.addPlugin(eleventySass, {
20+
postcss: postcss([
21+
autoprefixer,
22+
cssnano
23+
]),
24+
rev: true,
25+
sass: {
26+
loadPaths: [
27+
'../../node_modules/'
28+
],
29+
sourceMap: true,
30+
}
31+
});
932
};
1033

1134
module.exports = {

0 commit comments

Comments
 (0)