diff --git a/.husky/post-commit b/.husky/post-commit new file mode 100644 index 0000000..7e63942 --- /dev/null +++ b/.husky/post-commit @@ -0,0 +1,6 @@ +# .husky/post-commit +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +sh ./.husky/postcommit.sh + diff --git a/.husky/postcommit.sh b/.husky/postcommit.sh new file mode 100644 index 0000000..24607e8 --- /dev/null +++ b/.husky/postcommit.sh @@ -0,0 +1,8 @@ +#!/bin/sh +FILE="./client/wrangler.toml" +if [ -f "$FILE" ]; then + mv ~/tmp.wrangler.toml $FILE +else + echo "$FILE does not exist." +fi + diff --git a/.husky/pre-commit b/.husky/pre-commit index 1ca15f0..edd2f85 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,5 +2,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -sh ./.husky/precommit.sh - +sh ./.husky/precommit.sh \ No newline at end of file diff --git a/.husky/precommit.sh b/.husky/precommit.sh index 6eb3dce..996cf3e 100644 --- a/.husky/precommit.sh +++ b/.husky/precommit.sh @@ -1,6 +1,7 @@ #!/bin/sh FILE="./client/wrangler.toml" if [ -f "$FILE" ]; then + cp $FILE ~/tmp.wrangler.toml sed -i -e 's/account_id = ".*"/account_id = "**********"/' $FILE echo "$FILE updated" git add -A diff --git a/client/assets/pages.js b/client/assets/pages.js index 0b7e2d3..4e9db74 100644 --- a/client/assets/pages.js +++ b/client/assets/pages.js @@ -17,7 +17,7 @@ templates['body'] = template({"compiler":[8,">= 4.3.0"],"main":function(containe + " \r\n \r\n\r\n

This template is rendered by Handlebars in a Cloudflare Worker!

\r\n\r\n

\r\n Your name: " + alias3(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === "function" ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":24,"column":44},"end":{"line":24,"column":52}}}) : helper))) + "\r\n

\r\n\r\n
"
-    + alias3((lookupProperty(helpers,"asyncTest")||(depth0 && lookupProperty(depth0,"asyncTest"))||alias2).call(alias1,{"name":"asyncTest","hash":{"age":38,"name":"Vic Tester"},"data":data,"loc":{"start":{"line":27,"column":17},"end":{"line":27,"column":55}}}))
+    + alias3((lookupProperty(helpers,"asyncTest")||(depth0 && lookupProperty(depth0,"asyncTest"))||alias2).call(alias1,{"name":"asyncTest","hash":{"name":"Vic Tester"},"data":data,"loc":{"start":{"line":27,"column":17},"end":{"line":27,"column":48}}}))
     + "
\r\n\r\n \r\n \r\n\r\n\r\n" + ((stack1 = container.invokePartial(lookupProperty(partials,"structure/footer"),depth0,{"name":"structure/footer","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + "\r\n"; diff --git a/client/assets/partials.js b/client/assets/partials.js index 16b8393..e3a239e 100644 --- a/client/assets/partials.js +++ b/client/assets/partials.js @@ -16,5 +16,5 @@ Handlebars.partials['structure/header'] = template({"compiler":[8,">= 4.3.0"],"m return "\r\n
"; },"useData":true}); Handlebars.partials['structure/htmlhead'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { - return ""; + return "\r\n\r\n"; },"useData":true}); diff --git a/client/src/utils/hbsAsyncHelper.js b/client/src/utils/hbsAsyncHelper.js index 716d52e..8b2d577 100644 --- a/client/src/utils/hbsAsyncHelper.js +++ b/client/src/utils/hbsAsyncHelper.js @@ -11,7 +11,7 @@ export const registerHBHelper = () => registerAsyncHelper(Handlebars,'asyncTest' return new Promise((resolve, reject) => { setTimeout( function() { - resolve(`Async render with params: ${options.hash.name} || ${options.hash.age}`) + resolve(`Async render with params: ${options.hash.name}`) }, 200 ); diff --git a/client/src/views/pages/body.hbs b/client/src/views/pages/body.hbs index ce5e4dc..7b80430 100644 --- a/client/src/views/pages/body.hbs +++ b/client/src/views/pages/body.hbs @@ -24,7 +24,7 @@ Your name: {{name}}

-
{{asyncTest name='Vic Tester' age=38}}
+
{{asyncTest name='Vic Tester'}}
diff --git a/client/wrangler.toml b/client/wrangler.toml index 17672b3..f8a38ab 100644 --- a/client/wrangler.toml +++ b/client/wrangler.toml @@ -1,4 +1,8 @@ name = "tech" account_id = "**********" workers_dev = true -compatibility_date = "2024-07-11" \ No newline at end of file +compatibility_date = "2024-07-11" + +[build] +command="npm run build" +watch_dir="views/"g \ No newline at end of file