Skip to content

Instantly share code, notes, and snippets.

@tom-combet
Last active March 21, 2022 11:45
Show Gist options
  • Save tom-combet/dd963b5445bbc05d2290ee1300b72ccd to your computer and use it in GitHub Desktop.
Save tom-combet/dd963b5445bbc05d2290ee1300b72ccd to your computer and use it in GitHub Desktop.
Create new module from kjmodulebedrock
#!/bin/bash
# Usage: ./create-new-module.sh <module-full-name>
# <module-full-name>: PREFIX,ModuleClassName
# To use at the root of your PrestaShop environment.
[[ -z "$1" ]] && { echo "Module class name is missing." ; exit 1; }
githubName=Kaudaj # Replace with your own GitHub name/organization
moduleFullName="$1"
moduleName=$(echo "${className,,}" | sed 's/,//g')
[[ -z "$moduleName" ]] && { echo "Module name is empty." ; exit 1; }
bin/console fop:module:rename KJ,ModuleBedrock $moduleFullName -k
[[ ! -d "modules/$moduleName" ]] && { echo "New module not found." ; exit 1; }
cd modules/$moduleName
rm -rf .git
rm README.md
mv README_BEDROCK.md README.md
git init
./vendor/bin/grumphp git:init
git add .
git commit -m "Start from kjmodulebedrock"
git remote add origin git@github.com:$githubName/$moduleName.git
git push -u origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment