Skip to content

Commit

Permalink
fix: Don't mix generated declaration files with ts source files.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chriseppstein authored and stefanpenner committed Apr 29, 2019
1 parent dfc8506 commit 77bc99e
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,5 +1,6 @@
node_modules
tmp
lib
*.js
*.d.ts
!types/
!types/
11 changes: 6 additions & 5 deletions package.json
Expand Up @@ -5,22 +5,22 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib"
"lib",
"src"
],
"scripts": {
"test": "npm run test:js",
"test": "yarn run test:js",
"test:js": "mocha --require ts-node/register tests/*-test.ts",
"test:js:debug": "mocha debug --require ts-node/register tests/*-test.ts",
"build": "tsc",
"prepublish": "tsc"
"build": "tsc --build tsconfig.publish.json",
"prepublish": "tsc --build tsconfig.publish.json"
},
"keywords": [
"broccoli"
],
"author": "Stefan Penner, David J. Hamilton, Chad Hietala",
"license": "MIT",
"dependencies": {
"@types/symlink-or-copy": "^1.2.0",
"heimdalljs-logger": "^0.1.7",
"object-assign": "^4.1.0",
"path-posix": "^1.0.0",
Expand All @@ -31,6 +31,7 @@
"@types/fs-extra": "^5.0.4",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.21",
"@types/symlink-or-copy": "^1.2.0",
"chai": "^3.3.0",
"fs-extra": "^1.0.0",
"mocha": "^2.3.3",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/entry-test.ts
@@ -1,6 +1,6 @@
import fs = require('fs-extra');
import chai = require('chai');
import Entry from '../lib/entry';
import Entry from '../src/entry';

const { expect } = chai;
const FIXTURE_DIR = 'fixture';
Expand Down
4 changes: 2 additions & 2 deletions tests/fs-tree-test.ts
Expand Up @@ -2,8 +2,8 @@ import fs = require('fs-extra');
import path = require('path');
import chai = require('chai');
import walkSync = require('walk-sync');
import FSTree = require('../lib/index');
import Entry from '../lib/entry';
import FSTree = require('../src/index');
import Entry from '../src/entry';

const { expect } = chai;
const context = describe;
Expand Down
4 changes: 2 additions & 2 deletions tests/util-test.ts
Expand Up @@ -4,8 +4,8 @@ import {
basename,
computeImpliedEntries,
sortAndExpand
} from '../lib/util';
import Entry from '../lib/entry';
} from '../src/util';
import Entry from '../src/entry';

const { expect } = chai;

Expand Down
19 changes: 19 additions & 0 deletions tsconfig.publish.json
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "lib",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "node",
"module": "commonjs",
"target": "es5",
"paths": {
"*": ["types/*"]
},
"baseUrl": "."
},
"include": ["src"]
}
24 changes: 12 additions & 12 deletions yarn.lock
Expand Up @@ -250,9 +250,9 @@ sigmund@~1.0.0:
resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"

source-map-support@^0.5.6:
version "0.5.10"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.10.tgz#2214080bc9d51832511ee2bab96e3c2f9353120c"
integrity sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==
version "0.5.12"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599"
integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
Expand All @@ -275,9 +275,9 @@ to-iso-string@0.0.2:
resolved "https://registry.yarnpkg.com/to-iso-string/-/to-iso-string-0.0.2.tgz#4dc19e664dfccbe25bd8db508b00c6da158255d1"

ts-node@^8.0.2:
version "8.0.2"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.0.2.tgz#9ecdf8d782a0ca4c80d1d641cbb236af4ac1b756"
integrity sha512-MosTrinKmaAcWgO8tqMjMJB22h+sp3Rd1i4fdoWY4mhBDekOwIAKI/bzmRi7IcbCmjquccYg2gcF6NBkLgr0Tw==
version "8.1.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.1.0.tgz#8c4b37036abd448577db22a061fd7a67d47e658e"
integrity sha512-34jpuOrxDuf+O6iW1JpgTRDFynUZ1iEqtYruBqh35gICNjN8x+LpVcPAcwzLPi9VU6mdA3ym+x233nZmZp445A==
dependencies:
arg "^4.1.0"
diff "^3.1.0"
Expand All @@ -294,9 +294,9 @@ type-detect@^1.0.0:
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"

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

walk-sync@^0.3.1:
version "0.3.4"
Expand All @@ -306,6 +306,6 @@ walk-sync@^0.3.1:
matcher-collection "^1.0.0"

yn@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/yn/-/yn-3.0.0.tgz#0073c6b56e92aed652fbdfd62431f2d6b9a7a091"
integrity sha512-+Wo/p5VRfxUgBUGy2j/6KX2mj9AYJWOHuhMjMcbBFc3y54o9/4buK1ksBvuiK01C3kby8DH9lSmJdSxw+4G/2Q==
version "3.1.0"
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.0.tgz#fcbe2db63610361afcc5eb9e0ac91e976d046114"
integrity sha512-kKfnnYkbTfrAdd0xICNFw7Atm8nKpLcLv9AZGEt+kczL/WQVai4e2V6ZN8U/O+iI6WrNuJjNNOyu4zfhl9D3Hg==

0 comments on commit 77bc99e

Please sign in to comment.