Skip to content

Commit

Permalink
fix: function name format
Browse files Browse the repository at this point in the history
  • Loading branch information
charlypoly committed Sep 21, 2023
1 parent 455a9d0 commit db7808c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 22 deletions.
3 changes: 2 additions & 1 deletion packages/defer-rw-setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"fs-extra": "^11.1.1",
"yargs": "^17.7.2",
"yargs-parser": "^21.1.1",
"humanize-string": "3.0.0"
"camel-case": "4.1.2",
"@types/camel-case": "1.2.1"
},
"devDependencies": {
"@types/findup-sync": "^4.0.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/defer-rw-setup/src/cron/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from "path";
import { Listr } from "listr2";
import fs from "fs-extra";
import humanize from "humanize-string";
import { camelCase } from "camel-case";
import "../dirname.js";
import pkg from "@redwoodjs/cli-helpers";
const { getPaths, writeFile } = pkg;
Expand Down Expand Up @@ -44,7 +44,7 @@ export const tasks = (options: FunctionOptions) => {
},
},
{
title: `Create ${humanize(options.name!)} CRON ...`,
title: `Create ${camelCase(options.name!)} CRON ...`,
task: () => {
createCronTask({
commandPaths,
Expand Down Expand Up @@ -81,8 +81,8 @@ export const createCronTask = ({
);

return writeFile(
path.join(commandPaths["SRC_DEFER_PATH"]!, `${humanize(name)}.ts`),
deferCronTemplate.replace(/sendMondayNewsletter/g, humanize(name)),
path.join(commandPaths["SRC_DEFER_PATH"]!, `${camelCase(name)}.ts`),
deferCronTemplate.replace(/sendMondayNewsletter/g, camelCase(name)),
{
existingFiles,
}
Expand Down
8 changes: 4 additions & 4 deletions packages/defer-rw-setup/src/function/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from "path";
import { Listr } from "listr2";
import fs from "fs-extra";
import humanize from "humanize-string";
import { camelCase } from "camel-case";
import pkg from "@redwoodjs/cli-helpers";
import "../dirname.js";
const { getPaths, writeFile } = pkg;
Expand Down Expand Up @@ -44,7 +44,7 @@ export const tasks = (options: FunctionOptions) => {
},
},
{
title: `Create ${humanize(options.name!)} background function ...`,
title: `Create ${camelCase(options.name!)} background function ...`,
task: () => {
createBackgroundFunctionTask({
commandPaths,
Expand Down Expand Up @@ -81,8 +81,8 @@ export const createBackgroundFunctionTask = ({
);

return writeFile(
path.join(commandPaths["SRC_DEFER_PATH"]!, `${humanize(name)}.ts`),
deferHelloWorldTemplate.replace(/helloWorld/g, humanize(name)),
path.join(commandPaths["SRC_DEFER_PATH"]!, `${camelCase(name)}.ts`),
deferHelloWorldTemplate.replace(/helloWorld/g, camelCase(name)),
{
existingFiles,
}
Expand Down
52 changes: 39 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,13 @@
resolved "https://registry.yarnpkg.com/@types/braces/-/braces-3.0.2.tgz#70009e5d385bc0d804f40f0a3f92285022536730"
integrity sha512-U5tlMYa0U/2eFTmJgKcPWQOEICP173sJDa6OjHbj5Tv+NVaYcrq2xmdWpNXOwWYGwJu+jER/pfTLdoQ31q8PzA==

"@types/[email protected]":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@types/camel-case/-/camel-case-1.2.1.tgz#c7ba835a1dca5ef82b40e24d7a7a807bb9fc0e4c"
integrity sha512-HHJnZUh4QwvROKhSmEUS26ZIqcoxmNAjlJR+3r2WELBAXDHmoYBG+ZK4vJZZ4wMLN4cpdeLa4dONDx1l7nvmRA==
dependencies:
camel-case "*"

"@types/[email protected]":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@types/cross-spawn/-/cross-spawn-6.0.2.tgz#168309de311cd30a2b8ae720de6475c2fbf33ac7"
Expand Down Expand Up @@ -1305,6 +1312,14 @@ callsites@^3.0.0:
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==

camel-case@*, [email protected]:
version "4.1.2"
resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-4.1.2.tgz#9728072a954f805228225a6deea6b38461e1bd5a"
integrity sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==
dependencies:
pascal-case "^3.1.2"
tslib "^2.0.3"

camelcase-keys@^6.2.2:
version "6.2.2"
resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0"
Expand Down Expand Up @@ -1584,11 +1599,6 @@ decamelize@^1.1.0, decamelize@^1.2.0:
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==

decamelize@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-6.0.0.tgz#8cad4d916fde5c41a264a43d0ecc56fe3d31749e"
integrity sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==

deep-is@^0.1.3:
version "0.1.4"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831"
Expand Down Expand Up @@ -2466,13 +2476,6 @@ human-signals@^4.3.0:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2"
integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==

[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/humanize-string/-/humanize-string-3.0.0.tgz#4ea0ef1daf1d23fd8d8c7864adf0117f74939455"
integrity sha512-jhWD2GAZRMELz0IEIfqpEdi0M4CMQF1GpJpBYIopFN6wT+78STiujfQTKcKqZzOJgUkIgJSo2xFeHdsg922JZQ==
dependencies:
decamelize "^6.0.0"

iconv-lite@^0.4.24:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
Expand Down Expand Up @@ -2977,6 +2980,13 @@ log-update@^5.0.1:
strip-ansi "^7.0.1"
wrap-ansi "^8.0.1"

lower-case@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28"
integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==
dependencies:
tslib "^2.0.3"

[email protected]:
version "7.18.3"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89"
Expand Down Expand Up @@ -3158,6 +3168,14 @@ [email protected]:
resolved "https://registry.yarnpkg.com/new-github-issue-url/-/new-github-issue-url-0.2.1.tgz#e17be1f665a92de465926603e44b9f8685630c1d"
integrity sha512-md4cGoxuT4T4d/HDOXbrUHkTKrp/vp+m3aOA7XXVYwNsUNMK49g3SQicTSeV5GIz/5QVGAeYRAOlyp9OvlgsYA==

no-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d"
integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==
dependencies:
lower-case "^2.0.2"
tslib "^2.0.3"

[email protected]:
version "2.6.12"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba"
Expand Down Expand Up @@ -3388,6 +3406,14 @@ parse-passwd@^1.0.0:
resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6"
integrity sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==

pascal-case@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.2.tgz#b48e0ef2b98e205e7c1dae747d0b1508237660eb"
integrity sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==
dependencies:
no-case "^3.0.4"
tslib "^2.0.3"

[email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-1.0.0.tgz#d2fd7d73f2969606d2b56e17f5261be41c43c381"
Expand Down Expand Up @@ -4145,7 +4171,7 @@ tslib@^1.9.2:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.0.0, tslib@^2.3.1:
tslib@^2.0.0, tslib@^2.0.3, tslib@^2.3.1:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
Expand Down

0 comments on commit db7808c

Please sign in to comment.