Skip to content

Commit 73dd20f

Browse files
[LG-3525] Fix create command (#1943)
* tools/create base dir off of scope * update package & tsconfig templates * Create giant-ears-dress.md
1 parent 3aad511 commit 73dd20f

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

.changeset/giant-ears-dress.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@lg-tools/create': patch
3+
---
4+
5+
Fixes broken package.json & tsconfig.json templates.
6+
Default `directory` is now based off `scope` parameter, if provided.

tools/create/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function createPackage(name: string, options: CreatePackageOptions) {
2424

2525
const { scopes } = getLGConfig();
2626
const scope = options.scope ?? Object.keys(scopes)[0];
27-
const directory = options.directory ?? Object.values(scopes)[0];
27+
const directory = options.directory ?? scopes[scope];
2828

2929
// Construct all required parameters
3030
const packageNameKebab = kebabCase(name);

tools/create/src/templates/component/package.json.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ export const pkgJson = ({
77
}: Pick<
88
TemplateParameters,
99
'scope' | 'packageNameKebab' | 'packageNameTitle'
10-
>) => ` "name": "${scope}/${packageNameKebab}",
10+
>) => `
11+
{
12+
"name": "${scope}/${packageNameKebab}",
1113
"version": "0.1.0",
1214
"description": "LeafyGreen UI Kit ${packageNameTitle}",
1315
"main": "./dist/index.js",
@@ -26,9 +28,6 @@ export const pkgJson = ({
2628
"@leafygreen-ui/emotion": "^4.0.4",
2729
"@leafygreen-ui/lib": "^10.4.0"
2830
},
29-
"devDependencies": {
30-
"@lg-tools/cli": "^0.0.1"
31-
},
3231
"homepage": "https://github.com/mongodb/leafygreen-ui/tree/main/packages/${packageNameKebab}",
3332
"repository": {
3433
"type": "git",
@@ -37,4 +36,5 @@ export const pkgJson = ({
3736
"bugs": {
3837
"url": "https://jira.mongodb.org/projects/PD/summary"
3938
}
40-
}`;
39+
}
40+
`;

tools/create/src/templates/component/tsconfig.json.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ export const tsConfig = `{
2222
"path": "../lib"
2323
}
2424
]
25-
}`;
25+
}
26+
`;

0 commit comments

Comments
 (0)