From 348f59fb2b048de34e09dff1e4e7256aa168c142 Mon Sep 17 00:00:00 2001 From: PG Date: Thu, 9 Nov 2023 17:11:28 +0100 Subject: [PATCH] Change change-case import & deprecated paramCase (#163) * Change change-case import & deprecated paramCase * Update changeCase usage --- cli/tasks/scaffold-component/scaffold-component.js | 2 +- cli/tasks/scaffold-wp/builders/block.js | 6 +++--- cli/tasks/scaffold-wp/builders/option-page.js | 4 ++-- cli/tasks/scaffold-wp/builders/page.js | 4 ++-- cli/tasks/scaffold-wp/builders/post-type.js | 4 ++-- cli/tasks/setup/modules/setup-package-json.js | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cli/tasks/scaffold-component/scaffold-component.js b/cli/tasks/scaffold-component/scaffold-component.js index 48cbda38..96c57bb2 100644 --- a/cli/tasks/scaffold-component/scaffold-component.js +++ b/cli/tasks/scaffold-component/scaffold-component.js @@ -1,5 +1,5 @@ import Inquirer from "inquirer" -import changeCase from "change-case" +import * as changeCase from "change-case" import createFile from "../../helpers/create-file.js" import config from "../../config.js" import logs from "../../helpers/logger.js" diff --git a/cli/tasks/scaffold-wp/builders/block.js b/cli/tasks/scaffold-wp/builders/block.js index 37c60242..0421355a 100644 --- a/cli/tasks/scaffold-wp/builders/block.js +++ b/cli/tasks/scaffold-wp/builders/block.js @@ -1,7 +1,7 @@ import logs from "../../../helpers/logger.js" import config from "../../../config.js" import Inquirer from "inquirer" -import changeCase from "change-case" +import * as changeCase from "change-case" import * as mfs from "@cher-ami/mfs" import createFile from "../../../helpers/create-file.js" @@ -61,7 +61,7 @@ const buildBlock = async () => { let blockName = "", blockTitle = "" await _askBlockName().then((answer) => { - blockName = changeCase.paramCase(answer.blockName) + blockName = changeCase.trainCase(answer.blockName) blockTitle = answer.blockTitle }) @@ -138,7 +138,7 @@ const buildBlockType = async () => { const formatedBlocks = blockFolder.map((block) => { const blockName = block.substring(block.lastIndexOf("/") + 1) return { - name: changeCase.paramCase(blockName), + name: changeCase.trainCase(blockName), upperCaseBlockName: changeCase.constantCase(blockName), pasclaCaseName: blockName, } diff --git a/cli/tasks/scaffold-wp/builders/option-page.js b/cli/tasks/scaffold-wp/builders/option-page.js index 94b1e94d..25ef707a 100644 --- a/cli/tasks/scaffold-wp/builders/option-page.js +++ b/cli/tasks/scaffold-wp/builders/option-page.js @@ -2,7 +2,7 @@ import logs from "../../../helpers/logger.js" import config from "../../../config.js" import createFile from "../../../helpers/create-file.js" import Inquirer from "inquirer" -import changeCase from "change-case" +import * as changeCase from "change-case" const _askOptionName = () => { return Inquirer.prompt([ @@ -59,7 +59,7 @@ const buildOptionPage = () => { let pageName = "", pageTitle = "" await _askOptionName().then((answer) => { - pageName = changeCase.paramCase(answer.pageName) + pageName = changeCase.trainCase(answer.pageName) pageTitle = answer.pageTitle }) diff --git a/cli/tasks/scaffold-wp/builders/page.js b/cli/tasks/scaffold-wp/builders/page.js index 85e3bd30..badc17fb 100644 --- a/cli/tasks/scaffold-wp/builders/page.js +++ b/cli/tasks/scaffold-wp/builders/page.js @@ -1,7 +1,7 @@ import logs from "../../../helpers/logger.js" import config from "../../../config.js" import Inquirer from "inquirer" -import changeCase from "change-case" +import * as changeCase from "change-case" import createFile from "../../../helpers/create-file.js" const _askPageName = () => { @@ -70,7 +70,7 @@ const buildPage = () => { let createTemplate; await _askPageName().then((answer) => { - pageName = changeCase.paramCase(answer.pageName) + pageName = changeCase.trainCase(answer.pageName) }) await _askIfTemplate().then((answer) => { diff --git a/cli/tasks/scaffold-wp/builders/post-type.js b/cli/tasks/scaffold-wp/builders/post-type.js index 795bd766..8ff3cb15 100644 --- a/cli/tasks/scaffold-wp/builders/post-type.js +++ b/cli/tasks/scaffold-wp/builders/post-type.js @@ -1,7 +1,7 @@ import logs from "../../../helpers/logger.js" import config from "../../../config.js" import Inquirer from "inquirer" -import changeCase from "change-case" +import * as changeCase from "change-case" import createFile from "../../../helpers/create-file.js" const _askPostTypeName = () => { @@ -93,7 +93,7 @@ const buildPostType = async () => { upperSingularPostTypeName = "", upperPluralPostTypeName = "" await _askPostTypeName().then((answer) => { - postTypeName = changeCase.paramCase(answer.postTypeName) + postTypeName = changeCase.trainCase(answer.postTypeName) upperSingularPostTypeName = answer.upperSingularPostTypeName upperPluralPostTypeName = answer.upperPluralPostTypeName }) diff --git a/cli/tasks/setup/modules/setup-package-json.js b/cli/tasks/setup/modules/setup-package-json.js index 096e26ef..4adccf36 100644 --- a/cli/tasks/setup/modules/setup-package-json.js +++ b/cli/tasks/setup/modules/setup-package-json.js @@ -1,5 +1,5 @@ import Inquirer from "inquirer" -import changeCase from "change-case" +import * as changeCase from "change-case" import * as mfs from "@cher-ami/mfs" import logs from "../../../helpers/logger.js" import path from "path" @@ -42,7 +42,7 @@ export default async ({ packageJson, defaultProjectName, fakeMode } = {}) => { type: "input", message: "What's the project name? (dash-case)", name: "projectName", - }).then((answer) => (projectName = changeCase.paramCase(answer.projectName))) + }).then((answer) => (projectName = changeCase.trainCase(answer.projectName))) log("> new project name:", projectName) // Ask user for author