Skip to content

Commit c2bcc15

Browse files
committed
fix: improve validation
- chore: enable npmPublish semantic-release
1 parent c25b3ae commit c2bcc15

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.github/workflows/releaser.yml

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
- name: Clean install NPM dependencies
3838
# npm ci (clean-install) removes the existing node_modules directory
3939
run: npm ci
40+
- name: Build
41+
run: npm run build
4042
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
4143
run: npm audit signatures
4244
- name: Bump version and release if needed

release.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
["@semantic-release/release-notes-generator"],
1010
// { npmPublish } is disabled by default only if the "private" property
1111
// in package.json is true.
12-
["@semantic-release/npm", { npmPublish: false }],
12+
["@semantic-release/npm", { npmPublish: true }],
1313
["@semantic-release/github"],
1414
[
1515
"@semantic-release/git",

src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ async function loadFolders(folders: string[], dirPath: string, loadCallback: Loa
104104
if (!Array.isArray(folders)) {
105105
throw new Error(`Invalid folders: ${folders}. Must be a string array.`);
106106
}
107-
if (typeof dirPath !== "string") {
107+
if (typeof dirPath !== "string" || dirPath.trim() === "") {
108108
throw new Error(`Invalid directory path: ${dirPath}. Must be a non-empty string.`);
109109
}
110110
if (typeof loadCallback !== "function") {
111111
throw new Error(`Invalid load callback: ${loadCallback}. Must be a function.`);
112112
}
113113
const loadOptions = { ...DEFAULT_LOAD_FOLDER_OPTIONS, ...options };
114114
const processMode = loadOptions.processMode;
115-
if (!processMode || !DEFAULT_PROCESS_MODES.includes(processMode)) {
115+
if (typeof processMode !== "string" || !DEFAULT_PROCESS_MODES.includes(processMode)) {
116116
throw new Error(`Invalid process mode: ${processMode}. Must be a non-empty string.`);
117117
}
118118
const isLoadCallbackAsync = isAsyncFunction(loadCallback);
@@ -192,7 +192,7 @@ async function loadModules(modules: string[], dirPath: string, loadCallback: Loa
192192
if (!Array.isArray(modules)) {
193193
throw new Error(`Invalid modules: ${modules}. Must be a string array.`);
194194
}
195-
if (typeof dirPath !== "string") {
195+
if (typeof dirPath !== "string" || dirPath.trim() === "") {
196196
throw new Error(`Invalid directory path: ${dirPath}. Must be a non-empty string.`);
197197
}
198198
if (typeof loadCallback !== "function") {
@@ -209,7 +209,7 @@ async function loadModules(modules: string[], dirPath: string, loadCallback: Loa
209209
if (!exportType || !DEFAULT_EXPORT_TYPES.includes(exportType)) {
210210
throw new Error(`Invalid exportType: ${exportType}. Must be a non-empty string.`);
211211
}
212-
if (!preferredExportName || typeof preferredExportName !== "string") {
212+
if (typeof preferredExportName !== "string" || preferredExportName.trim() === "") {
213213
throw new Error(`Invalid preferred export name: ${preferredExportName}. Must be a non-empty string.`);
214214
}
215215
if (typeof isImportEnabled !== "boolean") {

0 commit comments

Comments
 (0)