Skip to content

Commit

Permalink
feat: run typescript files
Browse files Browse the repository at this point in the history
  • Loading branch information
TimMikeladze committed Jan 7, 2024
1 parent 0b3c1c5 commit e28d683
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ Build package with `tsup` for production.
yarn build
```

### ▶️ Running files written in TypeScript

To run a `.ts` file through Node.js you can simply the `ts` shorthand script in `package.json`.

```console
yarn ts ./path/to/file.ts
```

This is useful for running scripts, starting a server, or any other code you want to run while remaining type-safe.

### 🖇️ Linking

Often times you want to `link` this package to another project when developing locally, circumventing the need to publish to NPM to consume it.
Expand Down
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"release": "yarn build && yarn release-it",
"link:self": "yarn yalc publish && yarn link"
"link:self": "yarn yalc publish && yarn link",
"ts": "node node_modules/.bin/ts-node -r tsconfig-paths/register -O '{\"module\": \"commonjs\", \"moduleResolution\": \"classic\", \"resolveJsonModule\": false }' --transpile-only --project ./tsconfig.json"
},
"types": "./dist/index.d.ts",
"exports": {
Expand Down Expand Up @@ -75,16 +76,16 @@
"@storybook/react": "7.6.7",
"@storybook/react-webpack5": "7.6.7",
"@storybook/testing-library": "0.2.2",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^14.0.0",
"@testing-library/jest-dom": "6.0.0",
"@testing-library/react": "14.0.0",
"@types/node": "20.10.6",
"@types/react": "18.2.46",
"@types/react-dom": "18.2.18",
"@types/react-test-renderer": "18.0.7",
"@typescript-eslint/eslint-plugin": "6.17.0",
"@typescript-eslint/parser": "6.17.0",
"@vitejs/plugin-react": "^4.0.3",
"@vitest/coverage-v8": "^1.0.0",
"@vitejs/plugin-react": "4.0.3",
"@vitest/coverage-v8": "1.0.0",
"babel-loader": "9.1.3",
"concurrently": "8.2.2",
"eslint": "8.56.0",
Expand All @@ -96,12 +97,12 @@
"eslint-plugin-prettier": "5.1.2",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-sort-class-members": "^1.18.0",
"eslint-plugin-sort-class-members": "1.18.0",
"eslint-plugin-storybook": "0.6.15",
"eslint-plugin-typescript-sort-keys": "3.1.0",
"eslint-plugin-unused-imports": "3.0.0",
"husky": "8.0.3",
"jsdom": "^23.0.0",
"jsdom": "23.0.0",
"lint-staged": "15.2.0",
"prettier": "3.1.1",
"prop-types": "15.8.1",
Expand All @@ -110,9 +111,11 @@
"react-test-renderer": "18.2.0",
"release-it": "17.0.1",
"storybook": "7.6.7",
"ts-node": "10.9.2",
"tsconfig-paths": "4.2.0",
"tsup": "8.0.1",
"typescript": "5.3.3",
"vitest": "^1.0.0",
"vitest": "1.0.0",
"yalc": "1.0.0-pre.53"
},
"peerDependencies": {
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12995,6 +12995,25 @@ ts-node@^10.8.1:
v8-compile-cache-lib "^3.0.1"
yn "3.1.1"

ts-node@^10.9.2:
version "10.9.2"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f"
integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==
dependencies:
"@cspotcode/source-map-support" "^0.8.0"
"@tsconfig/node10" "^1.0.7"
"@tsconfig/node12" "^1.0.7"
"@tsconfig/node14" "^1.0.0"
"@tsconfig/node16" "^1.0.2"
acorn "^8.4.1"
acorn-walk "^8.1.1"
arg "^4.1.0"
create-require "^1.1.0"
diff "^4.0.1"
make-error "^1.1.1"
v8-compile-cache-lib "^3.0.1"
yn "3.1.1"

tsconfig-paths@^3.15.0:
version "3.15.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4"
Expand All @@ -13005,6 +13024,15 @@ tsconfig-paths@^3.15.0:
minimist "^1.2.6"
strip-bom "^3.0.0"

tsconfig-paths@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz#ef78e19039133446d244beac0fd6a1632e2d107c"
integrity sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==
dependencies:
json5 "^2.2.2"
minimist "^1.2.6"
strip-bom "^3.0.0"

tslib@^1.13.0, tslib@^1.8.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
Expand Down

0 comments on commit e28d683

Please sign in to comment.