PWA Studio extension generator

October 27, 2020 ยท View on GitHub

PWA Studio extension generator

An extension generator for Magento PWA Studio includes all you need to build an amazing extension

  • ๐Ÿ“ ESLint - JavaScript linter
  • ๐Ÿ’– Prettier - Opinionated Code Formatter
  • ๐Ÿ“„ Jest - Setup React Testing Library
    • ๐Ÿฆ‰ @testing-library/jest-dom - Custom jest matchers the state of the DOM
    • ๐Ÿ @testing-library/react-hooks - React hooks testing utilities that encourage good testing practices
  • ๐Ÿถ Husky - Use git hooks with ease
  • โšก Automatically installs project's peer dependencies -
  • ๐Ÿ—‚ Basic Module structure

๐Ÿš€ Getting started

yarn create @larsroettig/pwa-extension 
npm init @magento/pwa
ParameterDescription
--template @yournamespace/templatecustom template for code generator
-venable verbose log for code generator
-ddebug download from node registry

Create your own templates

Via a parameter, you can define your own template --template @yournamespace/template
The code generator will copy any file from a node package. It solves and download packages via npm view --json ${packageName} for it should work for a private repository as well.

My starter template you can find here: https://github.com/larsroettig/create-pwa-studio-extension/tree/main/packages/cpse-template

:heavy_exclamation_mark: Attention by default LICENSE will be delete from your template but if you want to define LICENSE file you can use LICENSE.template

A minimal template need the following files: package.json

{
  "name": "@your-name/cpse-template",
  "author": "your-name <your-mail@domain.tdl>",
  "version": "2.0.0",
  "license": "MIT",
  "publishConfig": {
    "access": "public"
  }
}

package.json.template

{
  "name": "@larsroettig/pwa-extension-template",
  "author": "Lars Roettig <hello@larsroettig.de>",
  "version": "0.0.0",
  "main": "src/index.js",
}

Optional

.gitignore.template

node_modules