From 4f03a5591cc742de193e0d612fe1a9a475d5290b Mon Sep 17 00:00:00 2001 From: reggi Date: Wed, 10 Sep 2025 10:48:50 -0400 Subject: [PATCH 1/3] jsdoc support --- lib/config.js | 1 + lib/content/eslintrc-js.hbs | 3 +++ lib/content/index.js | 2 +- lib/content/tsconfig-json.hbs | 19 +++++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/config.js b/lib/config.js index a3912cc0..6bdb04a3 100644 --- a/lib/config.js +++ b/lib/config.js @@ -194,6 +194,7 @@ const getFullConfig = async ({ __NAME__: NAME, __CONFIG_KEY__: CONFIG_KEY, __VERSION__: LATEST_VERSION, + jsdoc: pkgConfig.jsdoc, } if (!pkgConfig.eslint && Array.isArray(pkgConfig.requiredPackages?.devDependencies)) { diff --git a/lib/content/eslintrc-js.hbs b/lib/content/eslintrc-js.hbs index c01ead8e..0d9c67ed 100644 --- a/lib/content/eslintrc-js.hbs +++ b/lib/content/eslintrc-js.hbs @@ -21,6 +21,9 @@ module.exports = { }, }, {{/if}} + {{#if jsdoc}} + parser: '@typescript-eslint/parser', + {{/if}} extends: [ '@npmcli', ...localConfigs, diff --git a/lib/content/index.js b/lib/content/index.js index 4100bb7b..f2101652 100644 --- a/lib/content/index.js +++ b/lib/content/index.js @@ -28,7 +28,7 @@ const sharedRootAdd = name => ({ }, 'tsconfig.json': { file: 'tsconfig-json.hbs', - filter: p => p.config.typescript, + filter: p => p.config.typescript || p.config.jsdoc, parser: p => p.JsonMergeNoComment, }, // this lint commits which is only necessary for releases diff --git a/lib/content/tsconfig-json.hbs b/lib/content/tsconfig-json.hbs index 42776f85..895fb6f0 100644 --- a/lib/content/tsconfig-json.hbs +++ b/lib/content/tsconfig-json.hbs @@ -1,3 +1,21 @@ +{{#if jsdoc}} +{ + "compilerOptions": { + "target": "ES2022", + "module": "node16", + "allowJs": true, + "checkJs": true, + "noEmit": true, + "strict": true, + "moduleResolution": "node16", + "esModuleInterop": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "types": ["node"] + }, + "include": ["lib/**/*.js"] +} +{{else}} { "compilerOptions": { "jsx": "react", @@ -15,3 +33,4 @@ "module": "nodenext" } } +{{/if}} From 48240b1f5d555449471db01fb800e9fbd48bdef6 Mon Sep 17 00:00:00 2001 From: reggi Date: Wed, 10 Sep 2025 11:58:41 -0400 Subject: [PATCH 2/3] fix config --- lib/content/tsconfig-json.hbs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/content/tsconfig-json.hbs b/lib/content/tsconfig-json.hbs index 895fb6f0..ca6a25c3 100644 --- a/lib/content/tsconfig-json.hbs +++ b/lib/content/tsconfig-json.hbs @@ -5,7 +5,8 @@ "module": "node16", "allowJs": true, "checkJs": true, - "noEmit": true, + "declaration": true, + "emitDeclarationOnly": true, "strict": true, "moduleResolution": "node16", "esModuleInterop": true, @@ -13,7 +14,7 @@ "skipLibCheck": true, "types": ["node"] }, - "include": ["lib/**/*.js"] + "include": ["lib/**/*.js", "lib/**/*.ts"] } {{else}} { From ca41f1aa03382863a281b6fc0563b23114ddf5ac Mon Sep 17 00:00:00 2001 From: reggi Date: Wed, 10 Sep 2025 15:34:35 -0400 Subject: [PATCH 3/3] set devdeps --- lib/config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/config.js b/lib/config.js index 6bdb04a3..33b96ee2 100644 --- a/lib/config.js +++ b/lib/config.js @@ -241,6 +241,16 @@ const getFullConfig = async ({ ]) } + if (pkgConfig.jsdoc) { + defaultsDeep(pkgConfig, { requiredPackages: { devDependencies: [] } }) + pkgConfig.requiredPackages.devDependencies = uniq([ + ...pkgConfig.requiredPackages.devDependencies, + 'typescript', + '@typescript-eslint/parser', + '@types/node' + ]) + } + const gitUrl = await git.getUrl(rootPkg.path) if (gitUrl) { derived.repository = {