Skip to content

Commit df8e1d9

Browse files
committed
chore: Prepare to use TypeScript natively
1 parent 8270534 commit df8e1d9

File tree

7 files changed

+18
-11
lines changed

7 files changed

+18
-11
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ jobs:
228228
with:
229229
node-version: '20.10.0'
230230

231+
- name: Install dependencies
232+
run: npm ci --ignore-scripts
233+
231234
- name: Download compiled binaries
232235
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # 6.0.0
233236
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ target
44
node_modules
55
coverage
66
dist
7+
js-dist
78
dump
89
checksums.txt
910
yarn-error.log

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
!README.md
77
!LICENSE
88
!bin/sentry-cli
9-
!js
9+
!js-dist
1010
!scripts/install.js
1111
!checksums.txt
1212

bin/sentry-cli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'use strict';
44

55
const childProcess = require('child_process');
6-
const SentryCli = require('../js');
6+
const SentryCli = require('../js-dist');
77

88
const child = childProcess
99
.spawn(SentryCli.getPath(), process.argv.slice(2), {

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"engines": {
1010
"node": ">= 10"
1111
},
12-
"main": "js/index.js",
13-
"types": "js/index.d.ts",
12+
"main": "js-dist/index.js",
13+
"types": "js-dist/index.d.ts",
1414
"bin": {
1515
"sentry-cli": "bin/sentry-cli"
1616
},
@@ -29,7 +29,7 @@
2929
"jest": "^27.5.1",
3030
"npm-run-all": "^4.1.5",
3131
"prettier": "2.8.8",
32-
"typescript": "~5.8.3"
32+
"typescript": "5.8.3"
3333
},
3434
"optionalDependencies": {
3535
"@sentry/cli-darwin": "2.58.2",
@@ -42,7 +42,9 @@
4242
"@sentry/cli-win32-arm64": "2.58.2"
4343
},
4444
"scripts": {
45-
"postinstall": "node ./scripts/install.js",
45+
"postinstall": "npm run build && node ./scripts/install.js",
46+
"build": "tsc",
47+
"prepack": "npm run build",
4648
"fix": "npm-run-all fix:eslint fix:prettier",
4749
"fix:eslint": "eslint --fix bin/* scripts/**/*.js js/**/*.js",
4850
"fix:prettier": "prettier --write bin/* scripts/**/*.js js/**/*.js",

scripts/install.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const ProgressBar = require('progress');
1616
const Proxy = require('proxy-from-env');
1717
const which = require('which');
1818

19-
const helper = require('../js/helper');
19+
const helper = require('../js-dist/helper');
2020
const pkgInfo = require('../package.json');
21-
const Logger = require('../js/logger');
21+
const Logger = require('../js-dist/logger');
2222

2323
const logger = new Logger(getLogStream('stderr'));
2424

tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"compilerOptions": {
33
"allowJs": true,
44
"checkJs": true,
5-
"noEmit": true,
65
"resolveJsonModule": true,
76
"target": "ES2015",
87
"moduleResolution": "node",
9-
"skipLibCheck": true
8+
"skipLibCheck": true,
9+
"rootDir": "js",
10+
"outDir": "js-dist"
1011
},
11-
"include": ["js/**/*.js"],
12+
"include": ["js/**/*.ts", "js/**/*.js"],
1213
"exclude": ["**/__tests__/**", "**/__mocks__/**"]
1314
}

0 commit comments

Comments
 (0)