Skip to content

Commit

Permalink
🐛 Fix(package.json,config): prepare repo to npm publish
Browse files Browse the repository at this point in the history
  • Loading branch information
INeedJobToStartWork committed Jan 9, 2024
1 parent 86ada6d commit 42fafae
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 12 deletions.
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
*
9 changes: 9 additions & 0 deletions clean-package.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"indent": 4,
"remove": ["devDependencies", "dependencies", "lint-staged"],
"replace": {
"scripts": {
"npm:postpack": "clean-package restore"
}
}
}
2 changes: 1 addition & 1 deletion config/webpack/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default merge(webpackBaseConfig, {
inlinedLibraries: ["zod", "@"]
}
},
outFile: "index.d.ts",
outFile: "main.d.ts",
compilationOptions: {},
removeEmptyLines: false,
removeEmptyExports: false
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
{
"name": "commitsmile",
"version": "0.3.2",
"version": "0.3.4",
"description": "Make smile on your commits",
"keywords": [],
"license": "ISC",
"author": "ineedjobtostartwork",
"type": "module",
"main": "index.js",
"main": "main.cjs",
"module": "./dist/main.cjs",
"types": "./dist/main.d.ts",
"bin": {
"commitsmile": "./dist/main.cjs"
},
"files": [
"dist"
],
"scripts": {
"build": "webpack --config ./config/webpack/webpack.prod.js",
"dev": "webpack --config ./config/webpack/webpack.dev.js",
"format": "pnpm prettier . --write && pnpm prettier . --check",
"link-cli": "pnpm unlink --global && pnpm link --global",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"npm:postpack": "clean-package restore",
"npm:prepack": "clean-package",
"pre": "git add . && npx lint-staged",
"prepare": "husky install",
"start": "node ./dist/main.cjs",
Expand Down
25 changes: 25 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ program
js: { filename: "commitSmile.json", path: path.join(path.resolve(), "../templates/configs/config.js.hbs") },
json: { filename: "commitSmile.json", path: path.join(process.cwd(), "../templates/configs/config.json.hbs") }
};
const answers = { ext: "", module: "", fileName: "" };
const answers = {} as Record<string, string | undefined>;

answers.ext = (await prompter.select({
label: "Choose config template:",
Expand All @@ -70,13 +70,16 @@ program
{ label: "{} JSON", value: "json" }
]
})) as string;
answers.module = (await prompter.select({
label: "Choose module type:",
options: [
{ label: "EcmaScript", value: "esm", hint: "default - import/export" },
{ label: "CommonJS", value: "commonjs", hint: "require/module.exports" }
]
})) as string;
answers.module =
answers.ext != "json"
? ((await prompter.select({
label: "Choose module type:",
options: [
{ label: "EcmaScript", value: "esm", hint: "default - import/export" },
{ label: "CommonJS", value: "commonjs", hint: "require/module.exports" }
]
})) as string)
: undefined;
answers.fileName = (await prompter.text({
label: "Choose file name:",
placeholder: `${defaultTemp[answers.ext].filename}`,
Expand Down

0 comments on commit 42fafae

Please sign in to comment.