Skip to content

Commit

Permalink
fix: set package.json fields when using tap@16 + ts
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Nov 25, 2023
1 parent 84d1bef commit 2201c77
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const getFullConfig = async ({
deleteJsExt: esm ? 'js' : 'cjs',
// tap
tap18: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 18,
tap16: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 16,
// booleans to control application of updates
isForce,
isDogFood,
Expand Down Expand Up @@ -198,11 +199,13 @@ const getFullConfig = async ({
if (pkgConfig.typescript) {
defaultsDeep(pkgConfig, { allowPaths: [], requiredPackages: { devDependencies: [] } })
pkgConfig.distPaths = ['dist/']
pkgConfig.allowDistPaths = false
pkgConfig.allowPaths.push('/src/')
pkgConfig.requiredPackages.devDependencies.push(
'typescript',
'tshy',
'@typescript-eslint/parser'
'@typescript-eslint/parser',
...derived.tap16 ? ['c8', 'ts-node'] : []
)
}

Expand Down Expand Up @@ -252,7 +255,7 @@ const getFullConfig = async ({
]),
...isRoot && pkgConfig.lockfile ? ['!/package-lock.json'] : [],
...(pkgConfig.allowPaths || []).map((p) => `!${p}`),
...(pkgConfig.distPaths || []).map((p) => `!/${p}`),
...pkgConfig.allowDistPaths ? (pkgConfig.distPaths || []).map((p) => `!/${p}`) : [],
...(pkgConfig.ignorePaths || []),
]),
// these cant be sorted since they rely on order
Expand Down
1 change: 1 addition & 0 deletions lib/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ module.exports = {
'bin/',
'lib/',
],
allowDistPaths: true,
allowPaths: [
'/.eslintrc.local.*',
'**/.gitignore',
Expand Down
14 changes: 12 additions & 2 deletions lib/content/package-json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"postlint": "template-oss-check",
"template-oss-apply": "template-oss-apply --force",
"lintfix": "{{ localNpmPath }} run lint -- --fix",
"snap": "tap",
"test": "tap",
"snap": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
"test": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
"posttest": "{{ localNpmPath }} run lint",
{{#if isRootMono}}
"test-all": "{{ localNpmPath }} run test {{ allFlags }}",
Expand All @@ -34,6 +34,16 @@
{{#if workspacePaths}}
"test-ignore": "^({{ join workspacePaths "|" }})/",
{{/if}}
{{#if typescript}}
{{#if tap16}}
"coverage": false,
"node-arg": [
"--no-warnings",
"--loader",
"ts-node/esm"
],
{{/if}}
{{/if}}
"nyc-arg": {{#if tap18}}{{{ del }}}{{else}}[
{{#each workspaceGlobs}}
"--exclude",
Expand Down

0 comments on commit 2201c77

Please sign in to comment.