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

Commit

Permalink
Allow package.json#source to be an array or a string (#125)
Browse files Browse the repository at this point in the history
* fix error in yarn test with ts-node 9.1.1

* support array syntax for package.json#source
  • Loading branch information
nweber-gh authored Jan 16, 2023
1 parent e556e95 commit fa0aa3e
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 25 deletions.
184 changes: 162 additions & 22 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"ts-jest": "^26.5.2",
"ts-node": "^9.1.1"
"ts-node": "^10.9.1"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface PackageJson {
name: string;
version: string;
main?: string;
source?: string;
source?: string | string[];
dependencies?: { [name: string]: string };
optionalDependencies?: { [name: string]: string };
devDependencies?: { [name: string]: string };
Expand Down
5 changes: 4 additions & 1 deletion src/presets/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ const preset: Preset = {
getConfig: ({ packageJson, hasPackage }) => {
const hasFlow = hasPackage('flow-bin');
const extensions = ['.js', '.jsx', '.ts', '.tsx'];
const sourceFiles = Array.isArray(packageJson.source)
? packageJson.source
: [packageJson.source];

const entry = Array.from(
new Set(
resolveFilesSync(
[
packageJson.source,
...sourceFiles,
'./src/index',
'./src/main',
'./index',
Expand Down

0 comments on commit fa0aa3e

Please sign in to comment.