Skip to content

Commit

Permalink
fix(cli-plugin-scaffold-extensions): generate valid component name
Browse files Browse the repository at this point in the history
Pavel910 committed Jul 16, 2024
1 parent 3dafa75 commit 067528f
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/cli-plugin-scaffold-extensions/package.json
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
"execa": "^5.0.0",
"glob": "^7.1.2",
"load-json-file": "^6.2.0",
"lodash": "^4.17.21",
"ncp": "^2.0.0",
"replace-in-path": "^1.1.0",
"ts-morph": "^11.0.0",
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from "fs";
import path from "path";
import camelCase from "lodash/camelCase";
import { formatCode } from "@webiny/cli-plugin-scaffold/utils";
import { ExtensionWorkspace } from "./getExtensionsFromFilesystem";

@@ -9,7 +10,7 @@ export const generateAdminExtensions = async (extensions: ExtensionWorkspace[])
const code: string[][] = [];

extensions.forEach(extension => {
const name = path.basename(extension.path);
const name = camelCase(path.basename(extension.path));
const ucFirstName = name.charAt(0).toUpperCase() + name.slice(1);
const componentName = ucFirstName + "Extension";
const importStatement = `import { Extension as ${componentName}} from "${extension.packageJson.name}";`;
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -18730,6 +18730,7 @@ __metadata:
execa: ^5.0.0
glob: ^7.1.2
load-json-file: ^6.2.0
lodash: ^4.17.21
ncp: ^2.0.0
replace-in-path: ^1.1.0
rimraf: ^5.0.5
@@ -33457,6 +33458,20 @@ __metadata:
languageName: node
linkType: hard

"new-entry-wizard@workspace:extensions/new-entry-wizard":
version: 0.0.0-use.local
resolution: "new-entry-wizard@workspace:extensions/new-entry-wizard"
dependencies:
"@webiny/app-headless-cms": 0.0.0
"@webiny/app-headless-cms-common": 0.0.0
"@webiny/form": 0.0.0
"@webiny/react-router": 0.0.0
"@webiny/ui": 0.0.0
"@webiny/validation": 0.0.0
react: 18.2.0
languageName: unknown
linkType: soft

"nice-try@npm:^1.0.4":
version: 1.0.5
resolution: "nice-try@npm:1.0.5"

0 comments on commit 067528f

Please sign in to comment.