Skip to content

Commit 742c7e9

Browse files
committed
fix: Don't mix generated declaration files with ts source files.
TypeScript seems to get confused when a .d.ts and a .ts file of the same basename are in the same directory. This causes a consuming project to think it needs to compile the *.ts files that are imported from the index.d.ts file. Also did some other maintainance while I was here: * use yarn instead of npm for script execution. * enable sourcemaps so consuming projects will see the right source when navigating code and so debugging sessions can navigate the typescript code. * Update engine support to exlude node 11 now that 12 is released.
1 parent dfc8506 commit 742c7e9

File tree

10 files changed

+36
-15
lines changed

10 files changed

+36
-15
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules
22
tmp
3+
lib
34
*.js
45
*.d.ts
5-
!types/
6+
!types/

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
77
"files": [
8-
"lib"
8+
"lib",
9+
"src"
910
],
1011
"scripts": {
11-
"test": "npm run test:js",
12+
"test": "yarn run test:js",
1213
"test:js": "mocha --require ts-node/register tests/*-test.ts",
1314
"test:js:debug": "mocha debug --require ts-node/register tests/*-test.ts",
14-
"build": "tsc",
15-
"prepublish": "tsc"
15+
"build": "tsc --build tsconfig.publish.json",
16+
"prepublish": "tsc --build tsconfig.publish.json"
1617
},
1718
"keywords": [
1819
"broccoli"
1920
],
2021
"author": "Stefan Penner, David J. Hamilton, Chad Hietala",
2122
"license": "MIT",
2223
"dependencies": {
23-
"@types/symlink-or-copy": "^1.2.0",
2424
"heimdalljs-logger": "^0.1.7",
2525
"object-assign": "^4.1.0",
2626
"path-posix": "^1.0.0",
@@ -31,6 +31,7 @@
3131
"@types/fs-extra": "^5.0.4",
3232
"@types/mocha": "^5.2.5",
3333
"@types/node": "^10.12.21",
34+
"@types/symlink-or-copy": "^1.2.0",
3435
"chai": "^3.3.0",
3536
"fs-extra": "^1.0.0",
3637
"mocha": "^2.3.3",
@@ -39,7 +40,7 @@
3940
"walk-sync": "^0.3.1"
4041
},
4142
"engines": {
42-
"node": "6.* || 8.* || >= 10.*"
43+
"node": "6.* || 8.* || 10.* || >= 12.*"
4344
},
4445
"repository": {
4546
"type": "git",
File renamed without changes.
File renamed without changes.

lib/util.ts renamed to src/util.ts

File renamed without changes.

tests/entry-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs = require('fs-extra');
22
import chai = require('chai');
3-
import Entry from '../lib/entry';
3+
import Entry from '../src/entry';
44

55
const { expect } = chai;
66
const FIXTURE_DIR = 'fixture';

tests/fs-tree-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import fs = require('fs-extra');
22
import path = require('path');
33
import chai = require('chai');
44
import walkSync = require('walk-sync');
5-
import FSTree = require('../lib/index');
6-
import Entry from '../lib/entry';
5+
import FSTree = require('../src/index');
6+
import Entry from '../src/entry';
77

88
const { expect } = chai;
99
const context = describe;

tests/util-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
basename,
55
computeImpliedEntries,
66
sortAndExpand
7-
} from '../lib/util';
8-
import Entry from '../lib/entry';
7+
} from '../src/util';
8+
import Entry from '../src/entry';
99

1010
const { expect } = chai;
1111

tsconfig.publish.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
"rootDir": "src",
5+
"outDir": "lib",
6+
"declaration": true,
7+
"declarationMap": true,
8+
"sourceMap": true,
9+
"strict": true,
10+
"moduleResolution": "node",
11+
"module": "commonjs",
12+
"target": "es5",
13+
"paths": {
14+
"*": ["types/*"]
15+
},
16+
"baseUrl": "."
17+
},
18+
"include": ["src"]
19+
}

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ type-detect@^1.0.0:
294294
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
295295

296296
typescript@^3.3.3:
297-
version "3.3.3"
298-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3.tgz#f1657fc7daa27e1a8930758ace9ae8da31403221"
299-
integrity sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A==
297+
version "3.4.5"
298+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99"
299+
integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==
300300

301301
walk-sync@^0.3.1:
302302
version "0.3.4"

0 commit comments

Comments
 (0)