Skip to content

Latest commit

 

History

History
1620 lines (985 loc) · 112 KB

File metadata and controls

1620 lines (985 loc) · 112 KB

@commercetools-frontend/mc-scripts

21.8.1

Patch Changes

21.8.0

Minor Changes

  • #2613 20e648d2 Thanks @emmenko! - Migrate CLI to TypeScript.

    Internally, the CLI now uses cac to handle CLI commands and options.

    Deprecated entry points

    Importing the function createPostcssConfig from the main entry point @commercetools-frontend/mc-scripts is now deprecated. Use the entry point @commercetools-frontend/mc-scripts/postcss instead.

    const {
      createPostcssConfig,
    -} = require('@commercetools-frontend/mc-scripts');
    +} = require('@commercetools-frontend/mc-scripts/postcss');

    Importing the functions createWebpackConfigForDevelopment and createWebpackConfigForProduction from the main entry point @commercetools-frontend/mc-scripts is now deprecated. Use the entry point @commercetools-frontend/mc-scripts/webpack instead.

    const {
      createWebpackConfigForDevelopment,
      createWebpackConfigForProduction,
    -} = require('@commercetools-frontend/mc-scripts');
    +} = require('@commercetools-frontend/mc-scripts/webpack');

Patch Changes

21.7.0

Patch Changes

  • #2630 c0516c5b Thanks @emmenko! - > These changes are only relevant when using the experimental Vite bundler (ENABLE_EXPERIMENTAL_VITE_BUNDLER=true).

    Allow to load a Vite config in addition to the default config. This is useful for using extra Rollup/Vite plugins, or other Vite options.

  • Updated dependencies [0b3ea758, eea4f5fa]:

21.6.0

Minor Changes

  • #2535 dc5b02eb Thanks @Rhotimee! - The config:sync command now shows the diff changes before updating an existing Custom Application config.

Patch Changes

21.5.0

Patch Changes

21.4.0

Minor Changes

  • #2568 5bcf106a Thanks @emmenko! - Enable opt-in support for using Vite.js bundler. To enable it, set the environment variable ENABLE_EXPERIMENTAL_VITE_BUNDLER="true" in your dotenv file.

    Why Vite

    Vite (French word for "quick", pronounced /vit/, like "veet") is a build tool that aims to provide a faster and leaner development experience for modern web projects.

    You can learn more about the rationale behind the project in the Why Vite documentation.

    Native ES Modules support

    Vite is optimized for using native ES Modules via <script type="module"> tags and ES Modules dynamic import.

    CLI compatibility

    All the mc-scripts CLI commands are fully compatible with the new bundler, so you can continue using them as before.

    Unsupported features

    The cdnUrl value is not supported at the moment when using Vite.

    Required file extensions

    Vite relies on the file extensions to determine how to process the file in the best possible way. For example, a file using JSX should use the extension .jsx, or .tsx for TypeScript.

    Up until now we didn't enforce this with Webpack, so using .js or .jsx works in both cases. If you are still using .js for files including the JSX syntax, you need to rename the file to .jsx.

    To help with the renaming, you can use our codemod rename-js-to-jsx:

    npx @commercetools-frontend/codemod rename-js-to-jsx 'src/**/*.js'
    

Patch Changes

21.3.4

Patch Changes

  • #2544 08a689bb Thanks @emmenko! - Fix problem with file name in Windows when name contains characters like :.

21.3.3

Patch Changes

21.3.2

Patch Changes

21.3.1

Patch Changes

  • #2534 6b25e4ee Thanks @emmenko! - Downgrade react-refresh to v0.11.0. This fixes a problem with starting the development server.

21.3.0

Minor Changes

  • #2524 ea1bee4c Thanks @Rhotimee! - Add new CLI command mc-script config:sync

    This command allows users to synchronize the local Custom Application config with the Merchant Center. The sync implies that a new Custom Application will be created or an existing one will be updated.

    Developers can use the config:sync command to automatically manage the configuration of a Custom Application from the config file instead of having to manually fill out the information in the Merchant Center.

    If a new Custom Application needs to be created, an interactive prompt will ask the user to select the Organization where the Custom Application should be configured to.

    Additionally, the Custom Application ID is automatically synced when running the config:sync command.

    Note that this command requires a valid API token. You can get one by using the mc-scripts login command.

    The command also supports a --dry-run option. If enabled, the command is exectured but does not send any mutation request. Instead, the request payload is logged.

  • #2506 b842c498 Thanks @Rhotimee! - Add a new CLI command mc-scripts login.

    This command enables users to log in to their Merchant Center account through the CLI. An interactive prompt will be displayed asking the user to enter the login credentials.

    Upon login, an API token is stored in the user's home directory $HOME/.commercetools/mc-credentials.json. The API token will be used by other CLI commands that require a valid API token.

Patch Changes

21.2.1

Patch Changes

21.1.2

Patch Changes

21.0.1

Patch Changes

21.0.0

Major Changes

  • #2430 bb1f7d75 Thanks @emmenko! - Following breaking changes were introduced:

    • In mc-scripts, the build command additionally compiles the index.html by default.
    • Running the compile-html command by default should not be necessary anymore. However, you can pass --build-only to the build command to opt-out of the compilation step, in case you want to run it separately, for example to use the --transformer.
    • Running the compile-html command by default does not print to stdout the JSON string with the security headers. You can opt into the old behavior by passing the --print-security-headers option.
    • The --inline-csp of compile-html has been dropped, as it's now the built-in behavior.
    • The dist folder created by the build command has been removed. Instead, the build command writes the production bundles directly into the public folder.

    For more information see Release notes v21.

  • #2430 bb1f7d75 Thanks @emmenko! - Upgrade Stylelint and PostCSS dependencies.

    The peer dependency min version for stylelint is now 14. If your project has a Stylelint config file, we recommend to follow the Migrating to 14.0.0 guide.

    Note that the syntax support for CSS-in-JS languages has been removed from Stylelint and therefore is not available by default in the jest-stylelint-runner.

    Moreover, the postcss-color-mod-function dependency has been removed, as the color-mod() function is not part of the CSS Color spec anymore. If you were relying on this function you need to find another solution.

Minor Changes

  • #2430 bb1f7d75 Thanks @emmenko! - Update css-loader to v6. Support both .mod.css and .module.css for CSS module files.

Patch Changes

  • #2430 bb1f7d75 Thanks @emmenko! - Include fallback polyfills in Webpack config for url and querystring.

21.0.0-rc.9

Minor Changes

  • #2467 1763f30b Thanks @emmenko! - Update css-loader to v6. Support both .mod.css and .module.css for CSS module files.

21.0.0-rc.8

Major Changes

  • #2465 91331314 Thanks @emmenko! - Upgrade Stylelint and PostCSS dependencies.

    The peer dependency min version for stylelint is now 14. If your project has a Stylelint config file, we recommend to follow the Migrating to 14.0.0 guide.

    Note that the syntax support for CSS-in-JS languages has been removed from Stylelint and therefore is not available by default in the jest-stylelint-runner.

    Moreover, the postcss-color-mod-function dependency has been removed, as the color-mod() function is not part of the CSS Color spec anymore. If you were relying on this function you need to find another solution.

21.0.0-rc.7

Patch Changes

21.0.0-rc.5

Patch Changes

21.0.0-rc.4

Patch Changes

21.0.0-rc.3

Patch Changes

21.0.0-rc.2

Patch Changes

  • #2430 d8e36891 Thanks @emmenko! - Include fallback polyfills in Webpack config for url and querystring.

21.0.0-rc.1

Patch Changes

21.0.0-rc.0

Major Changes

  • #2430 07f5b00f Thanks @emmenko! - Following breaking changes were introduced:

    • In mc-scripts, the build command additionally compiles the index.html by default.
    • Running the compile-html command by default should not be necessary anymore. However, you can pass --build-only to the build command to opt-out of the compilation step, in case you want to run it separately, for example to use the --transformer.
    • Running the compile-html command by default does not print to stdout the JSON string with the security headers. You can opt into the old behavior by passing the --print-security-headers option.
    • The --inline-csp of compile-html has been dropped, as it's now the built-in behavior.
    • The dist folder created by the build command has been removed. Instead, the build command writes the production bundles directly into the public folder.

    For more information see Release notes v21.

Patch Changes

20.13.0

Patch Changes

20.12.3

Patch Changes

20.12.1

Patch Changes

20.12.0

Patch Changes

20.11.0

Patch Changes

20.10.6

Patch Changes

20.10.4

Patch Changes

20.10.3

Patch Changes

  • #2376 9d879503 Thanks @emmenko! - > For commercetools only.

    Allow to use OIDC login when developing against a local running MC API.

20.10.1

Patch Changes

20.9.4

Patch Changes

20.9.3

Patch Changes

20.9.2

Patch Changes

20.9.1

Patch Changes

20.9.0

Patch Changes

20.8.0

Patch Changes

20.7.0

Patch Changes

20.5.2

Patch Changes

20.5.1

Patch Changes

20.5.0

Minor Changes

  • #2261 481fb8f8 Thanks @tdeekens! - Adds the ability to explicitly disable core-js for mc-scripts and the webpack configs

    Some environments or build targets might not require core-js. In order to opt-out of it you can specify a disableCoreJs option.

Patch Changes

20.4.0

Patch Changes

20.3.3

Patch Changes

20.3.1

Patch Changes

20.3.0

Patch Changes

20.2.1

Patch Changes

20.1.2

Patch Changes

20.1.1

Patch Changes

20.1.0

Minor Changes

  • #2191 b5058130 Thanks @emmenko! - New CLI options! 🎉

    Loading dotenv files

    The mc-script CLI now supports loading environment variables from dotenv files.

    Previously, we recommended to use dotenv-cli to load environment variables before executing the mc-scripts command. For example:

    dotenv -c development -- mc-scripts start
    
    NODE_ENV=production dotenv -- mc-scripts compile-html
    
    NODE_ENV=production dotenv -e .env.gcp-production-eu -- mc-scripts compile-html
    

    Now the mc-scripts CLI has the dotenv features built-in, so you don't need to install and use dotenv-cli anymore.

    By default, the following dotenv files are loaded according to the current environment values specified on each command: process.MC_APP_ENV or process.NODE_ENV. The priority of how the files are merged and overwritten goes from top to bottom (highest defined variable overrides lower).

    • .env.development.local, .env.test.local, .env.production.local: Local overrides of environment-specific settings.
    • .env.development, .env.test, .env.production: Environment-specific settings.
    • .env.local: Local overrides. This file is loaded for all environments except test.
    • .env

    Please refer to the dotenv documentation for more details.

    Furthermore, you can pass additional dotenv files by using the following option:

    • --env <path>: Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.

    These files will take higher priority over the standard environment dotenv files.

    The example above can then be refactored as following:

    -dotenv -c development -- mc-scripts start
    +mc-scripts start
    
    -NODE_ENV=production dotenv -- mc-scripts compile-html
    +NODE_ENV=production mc-scripts compile-html
    
    -NODE_ENV=production dotenv -e .env.gcp-production-eu -- mc-scripts compile-html
    +NODE_ENV=production mc-scripts --env .env.gcp-production-eu compile-html

    Prompt for selecting an application to start

    If you are developing multiple Custom Applications in the same repository, chances are that you use a mono-repository setup.

    If that's the case, you can now run the mc-scripts start command from the workspace root folder and pass the option --match <glob>. The option will attempt to gather a list of packages in the repository that match the glob pattern and show it as a prompt. You can then select the application that you want to start from that list.

    We hope you find it useful.

Patch Changes

20.0.3

Patch Changes

  • #2189 b8cc7c9f Thanks @dgoemans! - Temporary fix for parsing Webpack error messages until react-dev-utils supports Webpack v5.

20.0.2

Patch Changes

20.0.1

Patch Changes

19.4.1

Patch Changes

19.4.0

Minor Changes

  • #2165 d019bc54 Thanks @tdeekens! - Adds support for the *.mjs and *.cjs JavaScript file extensions.

    Updates the webpack configurations, Jest and ESLint presets to support the *.mjs and *.cjs extensions. This allows better integration with packages using ES modules.

19.3.1

Patch Changes

19.1.0

Minor Changes

  • #2143 53b27b0b Thanks @tdeekens! - Adds support for specifying the Permissions-Policy header supported in Chrome 90.

    Similar to the Feature-Policies header an application config now support a permissionsPolicies field.

    headers: {
      permissionPolicies: {
        mircophone: '()';
      }
    }

    More information about supported permission policies can be found here.

Patch Changes

19.0.1

Patch Changes

19.0.0

Major Changes

  • #2041 a240f657 Thanks @emmenko! - - Changes required Node.js engine version to >=12 || >=14 in package.json.
    • Uses webpack@5.

Patch Changes

18.7.0

Patch Changes

18.6.0

Patch Changes

18.5.8

Patch Changes

18.5.7

Patch Changes

18.5.6

Patch Changes

18.5.4

Patch Changes

18.5.3

Patch Changes

18.5.2

Patch Changes

18.5.1

Patch Changes

18.4.1

Patch Changes

18.4.0

Minor Changes

  • f940273d #2042 Thanks @emmenko! - Improve the Webpack configuration of mc-scripts.

    If you are using the createWebpackConfigForDevelopment and createWebpackConfigForProduction functions, the following options are now optional:

    • distPath: it defaults to the ./dist folder.
    • entryPoint: it defaults to the file./src/index, with the file extension being one of js | jsx | ts | tsx.
    • sourceFolders: it defaults to the folders [./src].

    All paths are relative to the Custom Application folder.

    Additionally, there is a new option that can be used to enhance the Postcss configuration:

    • postcssOptions
    • postcssOptions.postcssImportPaths: a list of paths where to look for files used by the @import statements.
    • postcssOptions.postcssCustomMediaPaths: a list of paths where to look for files with custom media queries.
    • postcssOptions.postcssCustomPropertiesPaths: a list of paths where to look for files with custom properties.
    • postcssOptions.postcssColorModPaths: a list of paths where to look for files with color-mod properties.

    Furthermore, the postcss.config.js file that was shipped with the mc-scripts package has been removed in favor of the factory function createPostcssConfig, which accepts the same postcssOptions described above.

    In case you have your own postcss.config.js file in the root of your repository, you can use the createPostcssConfig function to have a pre-configured setup.

    # postcss.config.js
    
    -const postcssConfig = require('@commercetools-frontend/mc-scripts/postcss.config.js');
    +const { createPostcssConfig } = require('@commercetools-frontend/mc-scripts');
    
    -module.exports = postcssConfig;
    +module.exports = createPostcssConfig();

Patch Changes

18.2.0

Patch Changes

  • 7fbe0c71 #2018 Thanks @emmenko! - Include a postcss.config.js, which is used by the postcss-loader Webpack plugin.

18.1.4

Patch Changes

18.1.0

Patch Changes

18.0.2

Patch Changes

18.0.1

Patch Changes

18.0.0

Patch Changes

17.10.1

Patch Changes

17.10.0

Minor Changes

  • d86c2e8 #1934 Thanks @emmenko! - Introduce a new experimental opt-in feature to authenticate the application for local development, using an OIDC-like workflow.

    Disclaimer: this is an opt-in experimental feature. Use it at your own risk. We want to test this feature internally first. Until then, we discourage you to try it out.

    The feature can be enabled by setting the ENABLE_OIDC_FOR_DEVELOPMENT=true environment variable.

    In addition to that, we have a new package @commercetools-frontend/cypress, to include some useful commands for testing Custom Applications.

Patch Changes

17.9.0

Patch Changes

17.8.0

Minor Changes

  • bb65fa1 #1949 Thanks @emmenko! - The webpack.config.dev.js and webpack.config.prod.js files are not required anymore to be defined in the application folder and can be removed. The default behavior is now implicitly implemented in case the config file is not found. The default behavior requires the following paths to exist:

    • <application_folder>/dist
    • <application_folder>/src
    • <application_folder>/src/index.js

    You can still use the config files if you need to configure more specific behaviors.

Patch Changes

17.7.3

Patch Changes

17.7.2

Patch Changes

17.7.1

Patch Changes

17.7.0

Patch Changes

17.6.2

Patch Changes

17.6.1

Patch Changes

17.6.0

Patch Changes

17.4.1

Patch Changes

17.4.0

Patch Changes

17.3.1

Patch Changes

17.3.0

Patch Changes

17.2.1

Patch Changes

17.2.0

Patch Changes

17.1.4

Patch Changes

17.1.3

Patch Changes

17.1.2

Patch Changes

17.1.0

Minor Changes

  • eb545e0 #1819 Thanks @tdeekens! - feat: adds the ability to opt into the new automatic JSX runtime

    Recent React versions support a new JSX runtime. Read more about it here.

    You may opt into the new runtime in automatic mode by setting the ENABLE_NEW_JSX_TRANSFORM environment variable to true. Please note you need at least React v17 or v16.14 in your application. Opting into the new JSX transform automatically also changes the Babel, Jest and ESLint configurations. As a consequence ESLint will warn whenever it discovers React being in scope by importing it as import React from 'react'. You have to remove those imports using the respective codemod by running npx react-codemod update-react-imports.

    Lastly, all code of the Merchant Center Application Kit will continue to be bundled in classic mode to support older versions of React.

  • da0b4aa #1818 Thanks @emmenko! - Add support for experimental Fast Refresh for React. To enable it, set the enviornment variable FAST_REFRESH=true. More info here.

Patch Changes

17.0.1

Patch Changes

17.0.0

Major Changes

  • 633d8c7 #1805 Thanks @emmenko! - Remove the CLI flag --use-local-assets. The default behavior of mc-scripts compile-html now is to compile the assets locally, which is the only reasonable thing to do.

    Furthermore, the @commercetools-frontend/mc-http-server package has been deprecated and won't be published anymore. With the compile-html command there is no need to have a pre-configured HTTP server anymore.

    When running the mc-scripts compile-html command, the index.html is compiled for production usage and it lives in the public folder, together with the other static assets. This is all you need to deploy your application. You can decide to deploy the Custom Application statically to one of the popular cloud providers, or serve the files on your own using a static server.

    For example, to run locally the Custom Application using the production bundles:

    NODE_ENV=production MC_APP_ENV=development dotenv -- \
      mc-scripts compile-html \
      --transformer @commercetools-frontend/mc-dev-authentication/transformer-local.js
    
    mc-scripts serve

Patch Changes

16.18.0

Patch Changes

16.17.4

Patch Changes

16.17.2

Patch Changes

16.17.0

Patch Changes

16.16.4

Patch Changes

16.16.3

Patch Changes

16.16.1

Patch Changes

16.16.0

Minor Changes

  • 4216b92 #1685 Thanks @emmenko! - Refactor i18n package to consume compiled data from ui-kit translation messages. Furthermore, the @commercetools-frontend/i18n now exposes a compiled-data folder as well: @commercetools-frontend/i18n/compiled-data. This can be used the load pre-compiled messages and thus improving the runtime performance.

    Furthermore, the mc-scripts extract-intl command has been deprecated in favor of the more official message extraction with the @formatjs/cli: https://formatjs.io/docs/getting-started/message-extraction.

Patch Changes

16.15.8

Patch Changes

16.15.7

Patch Changes

16.15.4

Patch Changes

16.15.3

Patch Changes

16.15.2

Patch Changes

16.15.1

Patch Changes

16.15.0

Minor Changes

  • 728024c #1626 Thanks @emmenko! - This release introduces the usage of a new configuration file format and marks the deprecation of the env.json and headers.json files.

    For all the necessary information about migrating to the new configuration file, please read the release notes.

Patch Changes

16.14.0

Patch Changes

16.12.0

Patch Changes

16.10.0

Patch Changes

16.9.1

Patch Changes

16.9.0

Minor Changes

Patch Changes

16.8.8

Patch Changes

16.8.6

Patch Changes

16.8.5

Patch Changes

16.8.4

Patch Changes

16.8.1

Patch Changes