Skip to content

Commit 2201c77

Browse files
committed
fix: set package.json fields when using tap@16 + ts
1 parent 84d1bef commit 2201c77

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

lib/config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ const getFullConfig = async ({
166166
deleteJsExt: esm ? 'js' : 'cjs',
167167
// tap
168168
tap18: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 18,
169+
tap16: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 16,
169170
// booleans to control application of updates
170171
isForce,
171172
isDogFood,
@@ -198,11 +199,13 @@ const getFullConfig = async ({
198199
if (pkgConfig.typescript) {
199200
defaultsDeep(pkgConfig, { allowPaths: [], requiredPackages: { devDependencies: [] } })
200201
pkgConfig.distPaths = ['dist/']
202+
pkgConfig.allowDistPaths = false
201203
pkgConfig.allowPaths.push('/src/')
202204
pkgConfig.requiredPackages.devDependencies.push(
203205
'typescript',
204206
'tshy',
205-
'@typescript-eslint/parser'
207+
'@typescript-eslint/parser',
208+
...derived.tap16 ? ['c8', 'ts-node'] : []
206209
)
207210
}
208211

@@ -252,7 +255,7 @@ const getFullConfig = async ({
252255
]),
253256
...isRoot && pkgConfig.lockfile ? ['!/package-lock.json'] : [],
254257
...(pkgConfig.allowPaths || []).map((p) => `!${p}`),
255-
...(pkgConfig.distPaths || []).map((p) => `!/${p}`),
258+
...pkgConfig.allowDistPaths ? (pkgConfig.distPaths || []).map((p) => `!/${p}`) : [],
256259
...(pkgConfig.ignorePaths || []),
257260
]),
258261
// these cant be sorted since they rely on order

lib/content/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ module.exports = {
155155
'bin/',
156156
'lib/',
157157
],
158+
allowDistPaths: true,
158159
allowPaths: [
159160
'/.eslintrc.local.*',
160161
'**/.gitignore',

lib/content/package-json.hbs

+12-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"postlint": "template-oss-check",
88
"template-oss-apply": "template-oss-apply --force",
99
"lintfix": "{{ localNpmPath }} run lint -- --fix",
10-
"snap": "tap",
11-
"test": "tap",
10+
"snap": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
11+
"test": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
1212
"posttest": "{{ localNpmPath }} run lint",
1313
{{#if isRootMono}}
1414
"test-all": "{{ localNpmPath }} run test {{ allFlags }}",
@@ -34,6 +34,16 @@
3434
{{#if workspacePaths}}
3535
"test-ignore": "^({{ join workspacePaths "|" }})/",
3636
{{/if}}
37+
{{#if typescript}}
38+
{{#if tap16}}
39+
"coverage": false,
40+
"node-arg": [
41+
"--no-warnings",
42+
"--loader",
43+
"ts-node/esm"
44+
],
45+
{{/if}}
46+
{{/if}}
3747
"nyc-arg": {{#if tap18}}{{{ del }}}{{else}}[
3848
{{#each workspaceGlobs}}
3949
"--exclude",

0 commit comments

Comments
 (0)