From 8bd316f2d6a4319d1e2973ea98f274e478da5113 Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Tue, 8 Nov 2022 23:00:30 +0200 Subject: [PATCH] update nextjs tpl --- .vscode/settings.json | 3 ++- scaffolds/nextjs/.vscode/snippets.code-snippets | 2 +- scripts/tpl.sh | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a01da527..693e642e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,6 @@ "cSpell.words": [ "dotfiles" ], - "python.linting.enabled": true + "python.linting.enabled": true, + "i18next.i18nPaths": "/Users/chen/.dotfiles/scaffolds/nextjs/public/locales" } diff --git a/scaffolds/nextjs/.vscode/snippets.code-snippets b/scaffolds/nextjs/.vscode/snippets.code-snippets index 184f2d61..306621f9 100644 --- a/scaffolds/nextjs/.vscode/snippets.code-snippets +++ b/scaffolds/nextjs/.vscode/snippets.code-snippets @@ -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 }} }']),", " }", "}", ], diff --git a/scripts/tpl.sh b/scripts/tpl.sh index 84ffce1f..46004402 100755 --- a/scripts/tpl.sh +++ b/scripts/tpl.sh @@ -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