Skip to content

Commit dfa4329

Browse files
authored
Gracefully handle incomplete package.json files (#239)
* Gracefully handle incomplete package.json files Previously, scip-typescript didn't emit the required `scip-typescript npm PACKAGE_NAME PACKAGE_VERSION` prefix for global symbols when a package.json file was missing either the `name` or `version` field. Now, scip-typescript guarantees that all global symbols have this prefix. When the `version` field is missing, we fallback to the version `"HEAD"`. * Empty commit to trigger ci * ESlint
1 parent bb7a95d commit dfa4329

File tree

15 files changed

+136
-12
lines changed

15 files changed

+136
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
.eslintcache
44
yarn-error.log
55
snapshots/output/**/*.scip
6+
tsconfig.tsbuildinfo
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "invalid-package-json",
3+
"version": "1.0.0",
4+
"description": "Example TS/JS project",
5+
"main": "src/main.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"private": true,
12+
"packageManager": "pnpm@7.20.0"
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@example/a",
3+
"description": "Example TS/JS project",
4+
"main": "src/a.ts",
5+
"scripts": {
6+
"test": "echo \"Error: no test specified\" && exit 1"
7+
},
8+
"author": "",
9+
"license": "ISC"
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function a(): string {
2+
return ''
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": ".",
5+
"baseUrl": ".",
6+
"outDir": "dist"
7+
},
8+
"include": ["src/*"]
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"description": "Example TS/JS project",
3+
"main": "src/b.ts",
4+
"scripts": {
5+
"test": "echo \"Error: no test specified\" && exit 1"
6+
},
7+
"author": "",
8+
"license": "ISC",
9+
"dependencies": {
10+
"@example/a": "1.0.0"
11+
}
12+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { a } from '@example/a'
2+
3+
export function b() {
4+
return a()
5+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": ".",
5+
"baseUrl": "./src",
6+
"sourceRoot": "src",
7+
"outDir": "dist"
8+
},
9+
"include": ["src/*"],
10+
"references": [{ "path": "../a" }]
11+
}

snapshots/input/invalid-package-json/pnpm-lock.yaml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- 'packages/*'

0 commit comments

Comments
 (0)