Skip to content

Instantly share code, notes, and snippets.

@waldekmastykarz
Last active August 31, 2022 06:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save waldekmastykarz/92fea35dfcccaae6b978cb6b100a6f23 to your computer and use it in GitHub Desktop.
Save waldekmastykarz/92fea35dfcccaae6b978cb6b100a6f23 to your computer and use it in GitHub Desktop.
Bash script to create a set of SharePoint Framework projects
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
#set -o xtrace
version=$1
cmd_base='yo @microsoft/sharepoint --solutionName spfx --component-name HelloWorld --component-description HelloWorld --skip-install'
cmd_v1_1="$cmd_base --no-skip-feature-deployment"
cmd_v1_3="$cmd_v1_1 --environment spo"
cmd_v1_7="$cmd_v1_3 --no-is-domain-isolated"
cmd="$cmd_v1_7"
if [ -z "$1" ]; then
echo "Specify the SharePoint Framework number to create projects for, eg. '151'"
exit 1
fi
# spfx-$1-applicationcustomizer
echo "Creating application customizer..."
mkdir spfx-$1-applicationcustomizer && cd $_
$cmd --component-type extension --extensionType ApplicationCustomizer
echo "DONE"
cd ..
# spfx-$1-fieldcustomizer-react
echo "Creating field customizer react..."
mkdir spfx-$1-fieldcustomizer-react && cd $_
$cmd --component-type extension --extensionType FieldCustomizer --framework react
echo "DONE"
cd ..
# spfx-$1-listviewcommandset
echo "Creating list view command set..."
mkdir spfx-$1-listviewcommandset && cd $_
$cmd --component-type extension --extensionType ListViewCommandSet
echo "DONE"
cd ..
# spfx-$1-webpart-nolib
echo "Creating no library web part..."
mkdir spfx-$1-webpart-nolib && cd $_
$cmd --component-type webpart --framework none
echo "DONE"
cd ..
# spfx-$1-webpart-react
echo "Creating React web part..."
mkdir spfx-$1-webpart-react && cd $_
$cmd --component-type webpart --framework react
echo "DONE"
cd ..
# spfx-$1-ace
echo "Creating ACE..."
mkdir spfx-$1-ace && cd $_
$cmd --component-type adaptiveCardExtension --aceTemplateType PrimaryText
echo "DONE"
cd ..
# spfx-$1-formCustomizer-nolib
echo "Creating no library form customizer..."
mkdir spfx-$1-formCustomizer-nolib && cd $_
$cmd --component-type extension --extensionType FormCustomizer --framework none
echo "DONE"
cd ..
# spfx-$1-formCustomizer-react
echo "Creating React form customizer..."
mkdir spfx-$1-formCustomizer-react && cd $_
$cmd --component-type extension --extensionType FormCustomizer --framework react
echo "DONE"
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment