@commercetools-frontend/mc-scripts 20.10.6 → 20.11.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.
package/build/bin/cli.js CHANGED
@@ -41,6 +41,7 @@ Commands:
41
41
  compile-html Compiles "index.html.template" file into a "index.html" with all the required runtime configuration. Outputs a "public" folder. Additionally, the security headers are also compiled and printed to stdout, unless you use a "transformer".
42
42
  More info at https://docs.commercetools.com/custom-applications/deployment/compiling-a-custom-application.
43
43
  --transformer <path> (optional) The path to a JS module that can be used to generate a configuration for a specific cloud provider (e.g. Netlify, Vercel, Firebase).
44
+ --inline-csp (optional) If defined, the CSP config is inlined in the HTML head as a meta tag. This might be useful to keep using a static config for a hosting provider without the dynamically generated Content-Security-Policy header.
44
45
 
45
46
  start Starts the application in development mode using Webpack Dev Server.
46
47
 
@@ -78,7 +79,7 @@ const applicationDirectory = fs.realpathSync(process.cwd());
78
79
  // Do this as the first thing so that any code reading it knows the right env.
79
80
  process.env.NODE_ENV = 'production'; // Get specific flag for this command.
80
81
 
81
- const commandArgs = getArgsForCommand(['transformer']);
82
+ const commandArgs = getArgsForCommand(['transformer', 'inline-csp']);
82
83
  proxyCommand({
83
84
  commandArgs
84
85
  });
@@ -17,7 +17,9 @@ const {
17
17
  compileHtml
18
18
  } = require('@commercetools-frontend/mc-html-template');
19
19
 
20
- const flags = mri(process.argv.slice(2));
20
+ const flags = mri(process.argv.slice(2), {
21
+ boolean: ['inline-csp']
22
+ });
21
23
  const appDirectory = fs.realpathSync(process.cwd());
22
24
 
23
25
  const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
@@ -60,7 +62,9 @@ try {
60
62
  shelljs.cp('-R', path.join(assetsFrom, '/*'), publicAssetsPath);
61
63
 
62
64
  const generateStatic = async () => {
63
- const compiled = await compileHtml(paths.indexHtmlTemplatePath);
65
+ const compiled = await compileHtml(paths.indexHtmlTemplatePath, {
66
+ inlineCsp: flags['inline-csp']
67
+ });
64
68
  fs.writeFileSync(paths.indexHtmlPath, compiled.indexHtmlContent, {
65
69
  encoding: 'utf8'
66
70
  });
@@ -25,7 +25,9 @@ class LocalHtmlWebpackPlugin {
25
25
  apply(compiler) {
26
26
  compiler.hooks.compilation.tap('LocalHtmlWebpackPlugin', compilation => {
27
27
  HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync('LocalHtmlWebpackPlugin', (data, cb) => {
28
- data.html = replaceHtmlPlaceholders(data.html, enhancedLocalEnv);
28
+ data.html = replaceHtmlPlaceholders(data.html, {
29
+ env: enhancedLocalEnv
30
+ });
29
31
  cb(null, data);
30
32
  });
31
33
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-scripts",
3
- "version": "20.10.6",
3
+ "version": "20.11.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,11 +28,11 @@
28
28
  "dependencies": {
29
29
  "@babel/runtime": "7.15.4",
30
30
  "@babel/runtime-corejs3": "7.15.4",
31
- "@commercetools-frontend/application-config": "20.10.6",
31
+ "@commercetools-frontend/application-config": "20.11.0",
32
32
  "@commercetools-frontend/assets": "20.10.6",
33
33
  "@commercetools-frontend/babel-preset-mc-app": "20.10.6",
34
34
  "@commercetools-frontend/mc-dev-authentication": "20.10.6",
35
- "@commercetools-frontend/mc-html-template": "20.10.6",
35
+ "@commercetools-frontend/mc-html-template": "20.11.0",
36
36
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.1",
37
37
  "@svgr/webpack": "5.5.0",
38
38
  "autoprefixer": "10.3.7",