Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
fix: sort generated package.json, param-case project name (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
phuctm97 committed Aug 8, 2022
1 parent 7de52e9 commit 4e4deeb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -65,6 +65,7 @@
"nanoid-dictionary": "^4.3.0",
"node-fetch": "^3.2.6",
"open": "^8.4.0",
"param-case": "^3.0.4",
"prettier": "^2.6.2",
"prompts": "^2.4.2",
"semantic-release": "^19.0.3",
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Expand Up @@ -3,6 +3,7 @@ import fs from "fs/promises";
import chalk from "chalk";
import updateCheck from "update-check";
import prompts from "prompts";
import { paramCase } from "param-case";
import { Command, Option } from "commander";

import requireInviteCode from "./require-invite-code";
Expand Down Expand Up @@ -70,6 +71,9 @@ async function run() {
}
projectDirectory = projectName;
}
if (projectDirectory) {
projectDirectory = paramCase(projectDirectory);
}
await create(path.resolve(projectDirectory), {
typescript: opts.ts || opts.typescript,
devtool: opts.devtool,
Expand Down
12 changes: 11 additions & 1 deletion src/utils/format-project.ts
Expand Up @@ -67,5 +67,15 @@ export async function formatProject(
)
);
}
await fs.writeFile(pkgJsonPath, toJson(pkg), "utf8");
await fs.writeFile(
pkgJsonPath,
toJson({
name: pkg.name,
version: pkg.version,
productName: pkg.productName,
description: pkg.description,
...pkg,
}),
"utf8"
);
}
16 changes: 16 additions & 0 deletions yarn.lock
Expand Up @@ -2239,6 +2239,14 @@ dir-glob@^3.0.0, dir-glob@^3.0.1:
dependencies:
path-type "^4.0.0"

dot-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.4.tgz#9b2b670d00a431667a8a75ba29cd1b98809ce751"
integrity sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==
dependencies:
no-case "^3.0.4"
tslib "^2.0.3"

dot-prop@^5.1.0, dot-prop@^5.2.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88"
Expand Down Expand Up @@ -4342,6 +4350,14 @@ pacote@^13.0.3, pacote@^13.0.5, pacote@^13.5.0, pacote@^13.6.0:
ssri "^9.0.0"
tar "^6.1.11"

param-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/param-case/-/param-case-3.0.4.tgz#7d17fe4aa12bde34d4a77d91acfb6219caad01c5"
integrity sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==
dependencies:
dot-case "^3.0.4"
tslib "^2.0.3"

parent-module@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
Expand Down

0 comments on commit 4e4deeb

Please sign in to comment.