@commercetools-frontend/mc-scripts 21.0.0-rc.5 → 21.0.0

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.
@@ -23,15 +23,13 @@ const safeResolvePath = (packageName, fileRelativePath) => {
23
23
  * @param {string[]} options.postcssImportPaths[] - A list of paths where to look for files used by the `@import` statements.
24
24
  * @param {string[]} options.postcssCustomMediaPaths[] - A list of paths where to look for files with custom media queries.
25
25
  * @param {string[]} options.postcssCustomPropertiesPaths[] - A list of paths where to look for files with custom properties.
26
- * @param {string[]} options.postcssColorModPaths[] - A list of paths where to look for files with color-mod properties.
27
26
  */
28
27
 
29
28
 
30
29
  module.exports = function createPostcssConfig({
31
30
  postcssImportPaths = [],
32
31
  postcssCustomMediaPaths = [],
33
- postcssCustomPropertiesPaths = [],
34
- postcssColorModPaths = []
32
+ postcssCustomPropertiesPaths = []
35
33
  } = {}) {
36
34
  return {
37
35
  parser: false,
@@ -72,10 +70,6 @@ module.exports = function createPostcssConfig({
72
70
  require('postcss-custom-properties')({
73
71
  preserve: false,
74
72
  importFrom: [safeResolvePath('@commercetools-uikit/design-system', 'materials/custom-properties.css'), ...postcssCustomPropertiesPaths]
75
- }), // TODO: we should deprecate/remove this, as it's not maintained and it doesn't
76
- // officially support postcss v8 yet.
77
- require('postcss-color-mod-function')({
78
- importFrom: postcssColorModPaths
79
73
  }),
80
74
  /**
81
75
  * Plugin to `console.log()` the messages (warnings, etc.)
@@ -240,7 +240,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
240
240
  // "css" loader resolves paths in CSS and adds assets as dependencies.
241
241
  // "style" loader turns CSS into JS modules that inject <style> tags.
242
242
  {
243
- test: /\.mod\.css$/,
243
+ test: /\.(mod|module)\.css$/,
244
244
  include: mergedOptions.sourceFolders,
245
245
  use: [require.resolve('style-loader'), {
246
246
  loader: require.resolve('css-loader'),
@@ -248,7 +248,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
248
248
  modules: {
249
249
  mode: 'local',
250
250
  localIdentName: '[name]__[local]___[hash:base64:5]',
251
- localIdentHashPrefix: 'ct'
251
+ localIdentHashSalt: 'ct'
252
252
  },
253
253
  importLoaders: 1
254
254
  }
@@ -271,7 +271,15 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
271
271
  oneOf: [{
272
272
  // Use "postcss" for all the included source folders.
273
273
  include: mergedOptions.sourceFolders,
274
- use: [require.resolve('style-loader'), require.resolve('css-loader'), {
274
+ use: [require.resolve('style-loader'), {
275
+ loader: require.resolve('css-loader'),
276
+ options: {
277
+ modules: {
278
+ mode: 'icss'
279
+ },
280
+ importLoaders: 1
281
+ }
282
+ }, {
275
283
  loader: require.resolve('postcss-loader'),
276
284
  options: {
277
285
  postcssOptions: createPostcssConfig(mergedOptions.postcssOptions)
@@ -280,7 +288,15 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
280
288
  }, {
281
289
  // For all other vendor CSS, do not use "postcss" loader.
282
290
  include: /node_modules/,
283
- use: [require.resolve('style-loader'), require.resolve('css-loader')]
291
+ use: [require.resolve('style-loader'), {
292
+ loader: require.resolve('css-loader'),
293
+ options: {
294
+ modules: {
295
+ mode: 'icss'
296
+ },
297
+ importLoaders: 1
298
+ }
299
+ }]
284
300
  }]
285
301
  }, // Fix for react-intl
286
302
  // https://github.com/formatjs/formatjs/issues/143#issuecomment-518774786
@@ -254,8 +254,12 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
254
254
  }, // "postcss" loader applies autoprefixer to our CSS
255
255
  // "css" loader resolves paths in CSS and adds assets as dependencies.
256
256
  // "style" loader turns CSS into JS modules that inject <style> tags.
257
+ // In production, we use MiniCSSExtractPlugin to extract that CSS
258
+ // to a file, but in development "style" loader enables hot editing
259
+ // of CSS.
260
+ // By default we support CSS Modules with the extension `.mod.css` and `.module.css`.
257
261
  {
258
- test: /\.mod\.css$/,
262
+ test: /\.(mod|module)\.css$/,
259
263
  include: mergedOptions.sourceFolders,
260
264
  use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin.loader : require.resolve('style-loader'), {
261
265
  loader: require.resolve('css-loader'),
@@ -263,7 +267,7 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
263
267
  modules: {
264
268
  mode: 'local',
265
269
  localIdentName: '[name]__[local]___[hash:base64:5]',
266
- localIdentHashPrefix: 'ct'
270
+ localIdentHashSalt: 'ct'
267
271
  },
268
272
  importLoaders: 1
269
273
  }
@@ -286,7 +290,15 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
286
290
  oneOf: [{
287
291
  // Use "postcss" for all the included source folders.
288
292
  include: mergedOptions.sourceFolders,
289
- use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin.loader : require.resolve('style-loader'), require.resolve('css-loader'), {
293
+ use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin.loader : require.resolve('style-loader'), {
294
+ loader: require.resolve('css-loader'),
295
+ options: {
296
+ modules: {
297
+ mode: 'icss'
298
+ },
299
+ importLoaders: 1
300
+ }
301
+ }, {
290
302
  loader: require.resolve('postcss-loader'),
291
303
  options: {
292
304
  postcssOptions: createPostcssConfig(mergedOptions.postcssOptions)
@@ -296,7 +308,15 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
296
308
  // For all other vendor CSS, do not use "postcss" loader.
297
309
  // But still use MiniCssExtractPlugin :)
298
310
  include: /node_modules/,
299
- use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin.loader : require.resolve('style-loader'), require.resolve('css-loader')]
311
+ use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin.loader : require.resolve('style-loader'), {
312
+ loader: require.resolve('css-loader'),
313
+ options: {
314
+ modules: {
315
+ mode: 'icss'
316
+ },
317
+ importLoaders: 1
318
+ }
319
+ }]
300
320
  }]
301
321
  }, // Fix for react-intl
302
322
  // https://github.com/formatjs/formatjs/issues/143#issuecomment-518774786
@@ -73,13 +73,10 @@ module.exports = ({
73
73
  devServer.app.set('views', devAuthentication.views);
74
74
  devServer.app.set('view engine', devAuthentication.config.viewEngine);
75
75
  devServer.app.post('/api/graphql', (request, response) => {
76
- response.statusCode = 400;
76
+ response.statusCode = 404;
77
77
  response.setHeader('Content-Type', 'application/json');
78
- const errorMessage = `This GraphQL endpoint is not available in ${process.env.NODE_ENV} mode, as it's not necessary. The menu configuration is loaded from the file "menu.json" (more info at https://www.npmjs.com/package/@commercetools-frontend/application-shell). In case you do need to test things out, you can pass a "mcProxyApiUrl" to your application config (in the "additionalEnv" properties) and point it to the production environment, for example for GCP-EU use "https://mc.europe-west1.gcp.commercetools.com/api/graphql".`;
79
- const fakeApolloError = new Error(errorMessage);
80
78
  response.end(JSON.stringify({
81
- data: null,
82
- error: fakeApolloError
79
+ message: `This GraphQL endpoint is only available in production in the [Merchant Center Proxy Router](https://docs.commercetools.com/custom-applications/concepts/merchant-center-proxy-router). Please check that you are not calling this endpoint in development mode.`
83
80
  }));
84
81
  });
85
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-scripts",
3
- "version": "21.0.0-rc.5",
3
+ "version": "21.0.0",
4
4
  "description": "Configuration and scripts for developing a MC application",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -28,18 +28,18 @@
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.7",
30
30
  "@babel/runtime-corejs3": "^7.16.8",
31
- "@commercetools-frontend/application-config": "21.0.0-rc.5",
32
- "@commercetools-frontend/assets": "21.0.0-rc.1",
33
- "@commercetools-frontend/babel-preset-mc-app": "21.0.0-rc.5",
34
- "@commercetools-frontend/mc-dev-authentication": "21.0.0-rc.1",
35
- "@commercetools-frontend/mc-html-template": "21.0.0-rc.5",
31
+ "@commercetools-frontend/application-config": "21.0.0",
32
+ "@commercetools-frontend/assets": "21.0.0",
33
+ "@commercetools-frontend/babel-preset-mc-app": "21.0.0",
34
+ "@commercetools-frontend/mc-dev-authentication": "21.0.0",
35
+ "@commercetools-frontend/mc-html-template": "21.0.0",
36
36
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
37
37
  "@svgr/webpack": "6.2.0",
38
- "autoprefixer": "10.4.2",
38
+ "autoprefixer": "^10.4.2",
39
39
  "babel-loader": "8.2.3",
40
- "browserslist": "4.19.1",
40
+ "browserslist": "^4.19.1",
41
41
  "core-js": "^3.20.3",
42
- "css-loader": "5.2.7",
42
+ "css-loader": "6.5.1",
43
43
  "css-minimizer-webpack-plugin": "3.4.1",
44
44
  "dotenv": "10.0.0",
45
45
  "dotenv-expand": "5.1.0",
@@ -47,13 +47,12 @@
47
47
  "graphql-tag": "^2.12.6",
48
48
  "html-webpack-plugin": "5.5.0",
49
49
  "json-loader": "0.5.7",
50
- "mini-css-extract-plugin": "1.6.2",
50
+ "mini-css-extract-plugin": "2.5.3",
51
51
  "moment-locales-webpack-plugin": "1.2.0",
52
52
  "mri": "1.2.0",
53
- "postcss": "8.4.5",
54
- "postcss-color-mod-function": "3.0.3",
53
+ "postcss": "8.4.6",
55
54
  "postcss-custom-media": "8.0.0",
56
- "postcss-custom-properties": "11.0.0",
55
+ "postcss-custom-properties": "12.1.4",
57
56
  "postcss-import": "14.0.2",
58
57
  "postcss-loader": "6.2.1",
59
58
  "postcss-reporter": "7.0.5",