@quintype/framework 7.0.1 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [7.0.2](https://github.com/quintype/quintype-node-framework/compare/v7.0.1...v7.0.2) (2022-01-05)
|
|
6
|
+
|
|
5
7
|
### [7.0.1](https://github.com/quintype/quintype-node-framework/compare/v6.3.0...v7.0.1) (2021-12-15)
|
|
6
8
|
|
|
7
9
|
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
## Migrate from v6 to v7 of @quintype/framework
|
|
2
|
+
|
|
3
|
+
In version 7 of @quintype/framework, we've bumped [webpack](https://www.npmjs.com/package/webpack) from version 4 to 5. Please refer webpack's official migration doc [here](https://webpack.js.org/migrate/5/)
|
|
4
|
+
|
|
5
|
+
PR in malibu for reference > https://github.com/quintype/malibu-advanced/pull/332/files
|
|
6
|
+
|
|
7
|
+
In your malibu app,
|
|
8
|
+
|
|
9
|
+
- bump `"@quintype/framework": "^7.x.x"`
|
|
10
|
+
- bump build `"@quintype/build": "^4.x.x",`
|
|
11
|
+
- bump components (if applicable) `"@quintype/components": "^3.x.x"`
|
|
12
|
+
- bump arrow (if applicable) `"@quintype/arrow": "^3.x.x"`
|
|
13
|
+
- bump SEO `"@quintype/seo": "^1.39.x"`
|
|
14
|
+
- update `react` and `react-dom` to latest minor version (16.14.0 at the time of writing)
|
|
15
|
+
- update `react-redux` to latest minor version (7.2.5 at the time of writing)
|
|
16
|
+
- you'll also need a library like [axios](https://www.npmjs.com/package/axios) or something similar to make api calls for HMR to work during development
|
|
17
|
+
- Bump following dependancies (whichever are applicable):
|
|
18
|
+
- "lint-staged": "^11.2.3",
|
|
19
|
+
"nodemon": "^2.0.14",
|
|
20
|
+
"postcss": "^8.3.11",
|
|
21
|
+
"eslint": "^8.1.0",
|
|
22
|
+
"prettier": "2.4.1",
|
|
23
|
+
"react-test-renderer": "^17.0.2",
|
|
24
|
+
"stylelint": "^14.0.0",
|
|
25
|
+
"stylelint-config-recommended-scss": "^5.0.0",
|
|
26
|
+
"stylelint-scss": "^4.0.0",
|
|
27
|
+
"svg-sprite-loader": "^6.0.10",
|
|
28
|
+
"svg-transform-loader": "^2.0.13",
|
|
29
|
+
"webpack": "^5.59.1",
|
|
30
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
31
|
+
"webpack-cli": "4.9.1",
|
|
32
|
+
"webpack-dev-server": "^4.3.1",
|
|
33
|
+
"svgo-loader": "^3.0.0"
|
|
34
|
+
- create a file called `nodemon.json`, add following to it
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"verbose": true,
|
|
38
|
+
"delay": 2500
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
- in `app/server/helpers/index.js`, change
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
function getAsset(asset, qtAssetHelpers) {
|
|
45
|
+
const { assetPath, readAsset } = qtAssetHelpers;
|
|
46
|
+
return assetPath(asset) ? readAsset(asset) : "";
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
to
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
async function getAsset(asset, qtAssetHelpers) {
|
|
54
|
+
const { assetPath, readAsset } = qtAssetHelpers;
|
|
55
|
+
const assetAbsolutePath = assetPath(asset);
|
|
56
|
+
|
|
57
|
+
if (process.env.NODE_ENV === "development") {
|
|
58
|
+
try {
|
|
59
|
+
// using axios here, can use any other package to make below call
|
|
60
|
+
const { data } = await axios.get(assetAbsolutePath);
|
|
61
|
+
return data;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.warn("HMR chunk rendering failure");
|
|
64
|
+
console.warn(error);
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return assetAbsolutePath ? readAsset(asset) : "";
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- webpack has changed the API of `webpack.config.js` (check migration doc given above fore more info), so we gotta change the config accordingly. _Please note that your project might not need below change if you're not using SVG sprites. In that case please change the webpack config as per the new API_
|
|
74
|
+
|
|
75
|
+
change what's applicable
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
const webpackConfig = require("@quintype/build/config/webpack");
|
|
79
|
+
const path = require("path");
|
|
80
|
+
|
|
81
|
+
const SpriteLoaderPlugin = require("svg-sprite-loader/plugin");
|
|
82
|
+
const svgSprite = {
|
|
83
|
+
test: /\.svg$/,
|
|
84
|
+
loader: "svg-sprite-loader",
|
|
85
|
+
options: {
|
|
86
|
+
extract: true,
|
|
87
|
+
publicPath: "/",
|
|
88
|
+
symbolId: (filePath) => {
|
|
89
|
+
return path.basename(filePath).replace(".svg", "").toLowerCase();
|
|
90
|
+
},
|
|
91
|
+
spriteFilename: process.env.NODE_ENV === "production" ? "sprite-[hash].svg" : "sprite.svg",
|
|
92
|
+
esModule: false,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
webpackConfig.module.rules.push(svgSprite);
|
|
97
|
+
webpackConfig.module.rules.find((rule) => rule.loader === "file-loader").exclude = [
|
|
98
|
+
/app\/assets\/icons\/[a-z-]+\.svg$/,
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
const svgPlugin = () =>
|
|
102
|
+
new SpriteLoaderPlugin({
|
|
103
|
+
plainSprite: true,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
webpackConfig.plugins.push(svgPlugin());
|
|
107
|
+
|
|
108
|
+
module.exports = {
|
|
109
|
+
...webpackConfig,
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
to
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
const SpriteLoaderPlugin = require("svg-sprite-loader/plugin");
|
|
117
|
+
const path = require("path");
|
|
118
|
+
const webpackConfig = require("@quintype/build/config/webpack");
|
|
119
|
+
|
|
120
|
+
const { plugins, output, module: webpackModule } = webpackConfig;
|
|
121
|
+
if (process.env.NODE_ENV !== "production") output.path = path.resolve("./public");
|
|
122
|
+
const getSpritePlugin = () => new SpriteLoaderPlugin({ plainSprite: true });
|
|
123
|
+
const insertIntoIndex = (arr, index, newItem) => [...arr.slice(0, index), newItem, ...arr.slice(index)];
|
|
124
|
+
const enhancedPlugins = insertIntoIndex(plugins, 1, getSpritePlugin());
|
|
125
|
+
const spriteRule = {
|
|
126
|
+
test: /\.svg$/,
|
|
127
|
+
use: [
|
|
128
|
+
{
|
|
129
|
+
loader: "svg-sprite-loader",
|
|
130
|
+
options: {
|
|
131
|
+
extract: true,
|
|
132
|
+
spriteFilename: process.env.NODE_ENV === "production" ? "svg-sprite-[hash].svg" : "svg-sprite.svg",
|
|
133
|
+
esModule: false,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
"svg-transform-loader",
|
|
137
|
+
"svgo-loader",
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const enhancedRules = insertIntoIndex(webpackModule.rules, 5, spriteRule);
|
|
142
|
+
enhancedRules[8] = {
|
|
143
|
+
test: /\.(jpe?g|gif|png|woff|woff2|eot|ttf|wav|mp3|ico|mp4)$/,
|
|
144
|
+
loader: "file-loader",
|
|
145
|
+
options: { context: "./app/assets", name: "[name].[ext]" },
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
module.exports = {
|
|
149
|
+
...webpackConfig,
|
|
150
|
+
module: { ...webpackModule, ...{ rules: enhancedRules } },
|
|
151
|
+
plugins: enhancedPlugins,
|
|
152
|
+
};
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- please test thoroughly. Also webpack 5 shows warnings in browser, please resolve them if present
|
package/jsdoc.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"homepage": "https://github.com/quintype/quintype-node-framework#readme",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
30
|
-
"@quintype/amp": "^2.4.
|
|
30
|
+
"@quintype/amp": "^2.4.18",
|
|
31
31
|
"@quintype/backend": "^2.1.0",
|
|
32
32
|
"@quintype/components": "^3.0.0",
|
|
33
33
|
"@quintype/prerender-node": "^3.2.24",
|