Skip to content

Commit f78820c

Browse files
authored
chore: general quality of life improvements (#25)
* Use `mochaHooks` * Use `.mocharc` config file * Use `dist` outdir BREAKING CHANGE: JS output files are now located in the `dist` directory. This only has an effect if you're requiring directly from it.
1 parent 62dcf1e commit f78820c

File tree

15 files changed

+42
-61
lines changed

15 files changed

+42
-61
lines changed

.mocharc.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"require": ["source-map-support/register", "dist/test/setup.js"]
3+
}

.npmignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
**/*
22
!bin/**
33
!src/**
4-
src/**/*.map
5-
src/**/*.ts
6-
!src/**/*.d.ts
4+
!dist/src/**
75
!readme.md

.vscode/launch.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
"args": [
1313
"--no-timeouts",
1414
"--colors",
15-
"${workspaceRoot}/test/helpers/*.js",
16-
"${workspaceRoot}/test/unit/*.js"
15+
"${workspaceRoot}/dist/test/unit/*.js"
1716
],
1817
"internalConsoleOptions": "openOnSessionStart",
1918
"sourceMaps": true,
2019
"outFiles": [
21-
"${workspaceRoot}/test/**/*.js",
22-
"${workspaceRoot}/src/**/*.js"
20+
"${workspaceRoot}/dist/**/*.js"
2321
]
2422
},
2523
{
@@ -30,14 +28,12 @@
3028
"args": [
3129
"--no-timeouts",
3230
"--colors",
33-
"${workspaceRoot}/test/helpers/*.js",
34-
"${workspaceRoot}/test/integration/*.js"
31+
"${workspaceRoot}/dist/test/integration/*.js"
3532
],
3633
"internalConsoleOptions": "openOnSessionStart",
3734
"sourceMaps": true,
3835
"outFiles": [
39-
"${workspaceRoot}/test/**/*.js",
40-
"${workspaceRoot}/src/**/*.js"
36+
"${workspaceRoot}/dist/**/*.js"
4137
]
4238
}
4339
]

bin/link-parent-bin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
process.title = 'parent-bin';
66

7-
require('../src/cli');
7+
require('../dist/src/cli');

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"name": "link-parent-bin",
33
"version": "1.0.2",
44
"description": "",
5-
"main": "src/ParentBinLinker.js",
6-
"typings": "src/ParentBinLinker.d.ts",
5+
"main": "dist/src/ParentBinLinker.js",
76
"bin": {
87
"link-parent-bin": "bin/link-parent-bin"
98
},
@@ -15,15 +14,14 @@
1514
"node": ">=10"
1615
},
1716
"scripts": {
18-
"clean": "node tasks/clean.js",
19-
"prebuild": "npm run clean",
17+
"all": "npm run clean && npm run build && npm run test",
18+
"clean": "rimraf dist reports",
2019
"build": "tsc -p .",
21-
"pretest": "npm run build",
22-
"test": "npm run unitTest && npm run integrationTest",
23-
"unitTest": "mocha test/helpers/*.js test/unit/**/*.js",
24-
"integrationTest": "mocha test/helpers/*.js test/integration/**/*.js",
20+
"test": "npm run test:unit && npm run test:integration",
21+
"test:unit": "mocha dist/test/unit/**/*.js",
22+
"test:integration": "mocha dist/test/integration/**/*.js",
2523
"start": "tsc -w",
26-
"preversion": "npm test",
24+
"preversion": "npm run all",
2725
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
2826
"postversion": "npm publish && git push && git push --tags",
2927
"release:patch": "npm version patch -m \"chore(release): %s\"",

src/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const program = {
1717
return program
1818
.storeOptionsAsProperties(false)
1919
.usage('[options]')
20-
.version(require('../package.json').version)
20+
.version(require('../../package.json').version)
2121
.option('-c, --child-directory-root <child-directory>', 'The directory that hosts the child packages relative to the parent root.', 'packages')
2222
.option('-d, --link-dev-dependencies <true|false>', describeLinking('devDependencies', true), parseBoolean, true)
2323
.option('-s, --link-dependencies <true|false>', describeLinking('dependencies', false), parseBoolean, false)

tasks/clean.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/helpers/chaiSetup.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/helpers/initSourceMapSupport.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/helpers/log4jsConfig.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)