@commercetools-frontend/mc-scripts 21.0.0-rc.3 → 21.0.0-rc.8

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.)
@@ -61,23 +61,22 @@ module.exports = ({
61
61
 
62
62
  // Enable HTTPS if the HTTPS environment variable is set to 'true'
63
63
  // `proxy` is run between `before` and `after` `webpack-dev-server` hooks
64
- onBeforeSetupMiddleware({
65
- app
66
- }) {
64
+ setupMiddlewares(middlewares, devServer) {
67
65
  var _applicationConfig$en, _applicationConfig$en2;
68
66
 
69
- app.set('views', devAuthentication.views);
70
- app.set('view engine', devAuthentication.config.viewEngine); // This lets us open files from the runtime error overlay.
67
+ if (!devServer) {
68
+ throw new Error('webpack-dev-server is not defined');
69
+ } // This lets us open files from the runtime error overlay.
71
70
 
72
- app.use(errorOverlayMiddleware());
73
- app.use('/api/graphql', (request, response) => {
74
- response.statusCode = 400;
71
+
72
+ middlewares.unshift(errorOverlayMiddleware());
73
+ devServer.app.set('views', devAuthentication.views);
74
+ devServer.app.set('view engine', devAuthentication.config.viewEngine);
75
+ devServer.app.post('/api/graphql', (request, response) => {
76
+ response.statusCode = 404;
75
77
  response.setHeader('Content-Type', 'application/json');
76
- 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".`;
77
- const fakeApolloError = new Error(errorMessage);
78
78
  response.end(JSON.stringify({
79
- data: null,
80
- 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.`
81
80
  }));
82
81
  });
83
82
 
@@ -86,13 +85,15 @@ module.exports = ({
86
85
 
87
86
  // Handle login page for OIDC workflow when developing against a local MC API.
88
87
  if ((_applicationConfig$en3 = applicationConfig.env.__DEVELOPMENT__) !== null && _applicationConfig$en3 !== void 0 && (_applicationConfig$en4 = _applicationConfig$en3.oidc) !== null && _applicationConfig$en4 !== void 0 && _applicationConfig$en4.authorizeUrl.startsWith('http://localhost')) {
89
- app.use('/login/authorize', devAuthentication.middlewares.createLoginMiddleware(applicationConfig.env));
88
+ devServer.app.get('/login/authorize', devAuthentication.middlewares.createLoginMiddleware(applicationConfig.env));
90
89
  }
91
90
  } else {
92
- app.use('/login', devAuthentication.middlewares.createLoginMiddleware(applicationConfig.env)); // Intercept the /logout page and "remove" the auth cookie value
91
+ devServer.app.get('/login', devAuthentication.middlewares.createLoginMiddleware(applicationConfig.env)); // Intercept the /logout page and "remove" the auth cookie value
93
92
 
94
- app.use('/logout', devAuthentication.middlewares.createLogoutMiddleware(applicationConfig.env));
93
+ devServer.app.get('/logout', devAuthentication.middlewares.createLogoutMiddleware(applicationConfig.env));
95
94
  }
95
+
96
+ return middlewares;
96
97
  }
97
98
 
98
99
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-scripts",
3
- "version": "21.0.0-rc.3",
3
+ "version": "21.0.0-rc.8",
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,11 +28,11 @@
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.1",
31
+ "@commercetools-frontend/application-config": "21.0.0-rc.7",
32
32
  "@commercetools-frontend/assets": "21.0.0-rc.1",
33
- "@commercetools-frontend/babel-preset-mc-app": "21.0.0-rc.1",
33
+ "@commercetools-frontend/babel-preset-mc-app": "21.0.0-rc.7",
34
34
  "@commercetools-frontend/mc-dev-authentication": "21.0.0-rc.1",
35
- "@commercetools-frontend/mc-html-template": "21.0.0-rc.3",
35
+ "@commercetools-frontend/mc-html-template": "21.0.0-rc.7",
36
36
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
37
37
  "@svgr/webpack": "6.2.0",
38
38
  "autoprefixer": "10.4.2",
@@ -50,10 +50,9 @@
50
50
  "mini-css-extract-plugin": "1.6.2",
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",