Skip to content

Commit

Permalink
fix: define module
Browse files Browse the repository at this point in the history
  • Loading branch information
sethyates committed Aug 29, 2022
1 parent d6c2a1f commit b8820d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module "@conventional-actions/toolkit" {
export function parseMultiInput(files: string): string[]
export function paths(patterns: string[]): string[]
export function unmatchedPatterns(patterns: string[]): string[]
}
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as glob from 'glob'
import {statSync} from 'fs'

export const parseMultiInput = (files: string): string[] => {
export function parseMultiInput(files: string): string[] {
return files.split(/\r?\n/).reduce<string[]>(
(acc, line) =>
acc
Expand All @@ -12,15 +12,15 @@ export const parseMultiInput = (files: string): string[] => {
)
}

export const paths = (patterns: string[]): string[] => {
export function paths(patterns: string[]): string[] {
return patterns.reduce((acc: string[], pattern: string): string[] => {
return acc.concat(
glob.sync(pattern).filter(path => statSync(path).isFile())
)
}, [])
}

export const unmatchedPatterns = (patterns: string[]): string[] => {
export function unmatchedPatterns(patterns: string[]): string[] {
return patterns.reduce((acc: string[], pattern: string): string[] => {
return acc.concat(
glob.sync(pattern).filter(path => statSync(path).isFile()).length === 0
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
Expand Down

0 comments on commit b8820d2

Please sign in to comment.