update nextjs tpl

This commit is contained in:
Chen Asraf
2022-11-08 23:00:30 +02:00
parent 051f63272f
commit 8bd316f2d6
3 changed files with 10 additions and 4 deletions

View File

@@ -2,5 +2,6 @@
"cSpell.words": [
"dotfiles"
],
"python.linting.enabled": true
"python.linting.enabled": true,
"i18next.i18nPaths": "/Users/chen/.dotfiles/scaffolds/nextjs/public/locales"
}

View File

@@ -21,7 +21,7 @@
"body": [
"export async function getStaticProps({ locale }: NextPageContext) {",
" return {",
" props: await getI18nProps(locale ?? 'he', ['${1:{{ hyphenCase name }}}']),",
" props: await getI18nProps(locale ?? 'he', ['${1:{{ hyphenCase name }} }']),",
" }",
"}",
],

View File

@@ -5,7 +5,12 @@ tpl() {
case $tpl_name in
nextjs | cra)
app_name="$1"
shift
tpl_data=""
mkdir $app_name
cd $app_name
echo "Creating '$tpl_name' app in directory: '$(pwd)'"
case $tpl_name in
nextjs)
tpl_data='{"nextComponents":true}'
@@ -19,8 +24,8 @@ tpl() {
yes | rm -rf ./src/
;;
esac
npx -y simple-scaffold@latest -t "$SCAFFOLDS_DIR/$tpl_name" -w 1 -o . -d $tpl_data $@
npx -y simple-scaffold@latest -t "$SCAFFOLDS_DIR/react-app-common" -w 1 -o $src_dir -d $tpl_data $@
npx -y simple-scaffold@latest -t "$SCAFFOLDS_DIR/$tpl_name" -w 1 -o . -d $tpl_data $app_name
npx -y simple-scaffold@latest -t "$SCAFFOLDS_DIR/react-app-common" -w 1 -o $src_dir -d $tpl_data $app_name
echo_gray "Merging package.json..."
jq 'reduce inputs as $s (.; .*$s)' ./package.json $SCAFFOLDS_DIR/_merge/$tpl_name/package.json >./package.json.tmp
mv -f ./package.json.tmp ./package.json && rm -f ./package.json.tmp