From c2f2489bc17c7c06ce5a6cce310ba8148cd3f863 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 10:26:56 +0100 Subject: [PATCH 01/19] Fix: Initial fix and husky internal prepare --- .husky/pre-commit | 2 +- bin/cli.js | 106 +++++++++++++++++++++++++++++++++ configs/eslint.helper.mjs | 19 ++++++ configs/lint-staged.config.mjs | 23 +++++++ eslint.config.mjs | 4 +- package.json | 6 +- 6 files changed, 156 insertions(+), 4 deletions(-) mode change 100644 => 100755 .husky/pre-commit create mode 100755 bin/cli.js create mode 100644 configs/eslint.helper.mjs create mode 100644 configs/lint-staged.config.mjs diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755 index 0cf3a8f..250844c --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -npx lint-staged --config lint-staged.config.js \ No newline at end of file +npx blocks internal-lint \ No newline at end of file diff --git a/bin/cli.js b/bin/cli.js new file mode 100755 index 0000000..7969b30 --- /dev/null +++ b/bin/cli.js @@ -0,0 +1,106 @@ +#!/usr/bin/env node + +/*global console*/ + +import { execSync } from 'child_process'; +import path from 'path'; +import fs from 'fs'; +import process from 'process'; +import { fileURLToPath } from 'url'; +import { createRequire } from 'module'; + +const require = createRequire(import.meta.url); +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +// --- Path Resolution --- +const userAppRoot = process.cwd(); +const engineRoot = path.resolve(__dirname, '..'); +const internalModulesPath = path.resolve(engineRoot, 'node_modules'); +const internalBinPath = path.resolve(internalModulesPath, '.bin'); + +// Safely find binary paths for the internal tools +const getBinPath = (pkgName, binSubPath) => { + try { + const pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`)); + return path.join(pkgRoot, binSubPath); + } catch { + return path.resolve(internalBinPath, pkgName); + } +}; + +const huskyBin = getBinPath('husky', 'bin.js'); +const lintStagedBin = getBinPath('lint-staged', 'bin/lint-staged.js'); + +const command = process.argv[2]; + +// --------------------------------------------------------- +// COMMAND: setup-git +// --------------------------------------------------------- +if (command === 'setup-git') { + console.log('🐶 Setting up @build-in-blocks git hooks...'); + try { + execSync(`node "${huskyBin}"`, { stdio: 'inherit' }); + const preCommitPath = path.join(userAppRoot, '.husky/pre-commit'); + + // Use 'npx blocks' to ensure portability in the User App + const hookContent = 'npx blocks internal-lint'; + + fs.writeFileSync(preCommitPath, hookContent, { mode: 0o755 }); + + console.log('✅ Git hooks integrated successfully.'); + } catch { + console.error('❌ Git hook setup failed.'); + } +} + +// --------------------------------------------------------- +// COMMAND: internal-lint +// --------------------------------------------------------- +if (command === 'internal-lint') { + const configPath = path.resolve(engineRoot, 'configs/lint-staged.config.mjs'); + try { + // Detect the correct PATH key (Windows compatibility) + const pathKey = + process.platform === 'win32' + ? Object.keys(process.env).find((k) => k.toUpperCase() === 'PATH') || + 'PATH' + : 'PATH'; + + const env = { + ...process.env, + [pathKey]: `${internalBinPath}${path.delimiter}${process.env[pathKey]}`, + NODE_PATH: internalModulesPath, + NODE_OPTIONS: '--no-warnings', + }; + + execSync(`node "${lintStagedBin}" --config "${configPath}"`, { + stdio: 'inherit', + cwd: userAppRoot, + env, + }); + } catch { + process.exit(1); + } +} + +// if (command === 'internal-lint') { +// const lintStagedConfig = path.resolve(engineRoot, 'configs/lint-staged.config.mjs'); + +// try { +// const env = { +// ...process.env, +// PATH: `${internalBinPath}${path.delimiter}${process.env.PATH}`, +// // We tell Node to look in the engine's node_modules +// // when the User App's config tries to resolve its imports. +// NODE_PATH: internalModulesPath, +// }; + +// execSync(`node ${lintStagedBin} --config ${lintStagedConfig}`, { +// stdio: 'inherit', +// env +// }); +// } catch (e) { +// process.exit(1); +// } +// } diff --git a/configs/eslint.helper.mjs b/configs/eslint.helper.mjs new file mode 100644 index 0000000..2d4555c --- /dev/null +++ b/configs/eslint.helper.mjs @@ -0,0 +1,19 @@ + +import { createRequire } from 'module'; +import blocksDevSetupBaseConfig from '../eslint.config.mjs'; + +const require = createRequire(import.meta.url); + +// Dynamic Discovery: Find ESLint wherever the package manager put it +const eslintConfigPath = require.resolve('eslint/config'); +const { defineConfig } = require(eslintConfigPath); + +export { defineConfig, blocksDevSetupBaseConfig }; + + + +// dev.setup/configs/eslint.helper.mjs +// import { defineConfig } from 'eslint/config'; +// import blocksDevSetupBaseConfig from '../eslint.config.mjs'; + +// export { defineConfig, blocksDevSetupBaseConfig }; \ No newline at end of file diff --git a/configs/lint-staged.config.mjs b/configs/lint-staged.config.mjs new file mode 100644 index 0000000..3d4f6c2 --- /dev/null +++ b/configs/lint-staged.config.mjs @@ -0,0 +1,23 @@ + +import { createRequire } from 'module'; +import path from 'path'; + +const require = createRequire(import.meta.url); +const resolveBin = (pkgName, binRelativePath) => { + const pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`)); + return `node ${path.join(pkgRoot, binRelativePath)}`; +}; + +const eslint = resolveBin('eslint', 'bin/eslint.js'); +const prettier = resolveBin('prettier', 'bin/prettier.cjs'); + +export default { + '*.{mjs,js,ts}': [ + // We use absolute paths to binaries to avoid ENOENT + `${eslint} --fix --no-warn-ignored`, + `${prettier} --write` + ], + '*.{html,css,scss}': [ + `${prettier} --write` + ] +}; diff --git a/eslint.config.mjs b/eslint.config.mjs index d9d7067..d92b06c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -6,7 +6,7 @@ import { defineConfig } from 'eslint/config'; import tseslint from 'typescript-eslint'; import eslintConfigPrettier from 'eslint-config-prettier/flat'; -export default defineConfig( +const blocksDevSetupBaseConfig = defineConfig( eslint.configs.recommended, tseslint.configs.recommended, tseslint.configs.stylistic, @@ -19,3 +19,5 @@ export default defineConfig( }, eslintConfigPrettier, ); + +export default blocksDevSetupBaseConfig; diff --git a/package.json b/package.json index 27a4485..5ec168b 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,14 @@ "type": "module", "main": "eslint.config.mjs", "bin": { + "blocks": "./bin/cli.js", "husky-ls-config-init": "bin/user-app.husky.lint-staged.js", "internal-husky-ls-init": "bin/internal.husky.lint-staged.js" }, "exports": { ".": "./eslint.config.mjs", - "./prettier": "./prettier.config.mjs" + "./prettier": "./prettier.config.mjs", + "./config": "./configs/eslint.helper.mjs" }, "publishConfig": { "registry": "https://registry.npmjs.org/" @@ -18,7 +20,7 @@ "scripts": { "eslint:lint": "eslint .", "prettier:format": "prettier --write \"**/*.{js,ts,css,html}\"", - "prepare": "husky" + "prepare": "node ./bin/cli.js setup-git" }, "dependencies": { "@eslint/js": "^10.0.1", From 3184e3ad579c111419455db362c580c2a09c4092 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 14:13:41 +0100 Subject: [PATCH 02/19] Fix: Use better custom blocks command --- bin/cli.js | 106 ----------------- bin/pkg.internal.cli.js | 111 ++++++++++++++++++ .../eslint.helper.mjs | 12 +- .../lint-staged.config.mjs | 4 +- package.json | 7 +- 5 files changed, 121 insertions(+), 119 deletions(-) delete mode 100755 bin/cli.js create mode 100755 bin/pkg.internal.cli.js rename {configs => config.programmed}/eslint.helper.mjs (56%) rename {configs => config.programmed}/lint-staged.config.mjs (77%) diff --git a/bin/cli.js b/bin/cli.js deleted file mode 100755 index 7969b30..0000000 --- a/bin/cli.js +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env node - -/*global console*/ - -import { execSync } from 'child_process'; -import path from 'path'; -import fs from 'fs'; -import process from 'process'; -import { fileURLToPath } from 'url'; -import { createRequire } from 'module'; - -const require = createRequire(import.meta.url); -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// --- Path Resolution --- -const userAppRoot = process.cwd(); -const engineRoot = path.resolve(__dirname, '..'); -const internalModulesPath = path.resolve(engineRoot, 'node_modules'); -const internalBinPath = path.resolve(internalModulesPath, '.bin'); - -// Safely find binary paths for the internal tools -const getBinPath = (pkgName, binSubPath) => { - try { - const pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`)); - return path.join(pkgRoot, binSubPath); - } catch { - return path.resolve(internalBinPath, pkgName); - } -}; - -const huskyBin = getBinPath('husky', 'bin.js'); -const lintStagedBin = getBinPath('lint-staged', 'bin/lint-staged.js'); - -const command = process.argv[2]; - -// --------------------------------------------------------- -// COMMAND: setup-git -// --------------------------------------------------------- -if (command === 'setup-git') { - console.log('🐶 Setting up @build-in-blocks git hooks...'); - try { - execSync(`node "${huskyBin}"`, { stdio: 'inherit' }); - const preCommitPath = path.join(userAppRoot, '.husky/pre-commit'); - - // Use 'npx blocks' to ensure portability in the User App - const hookContent = 'npx blocks internal-lint'; - - fs.writeFileSync(preCommitPath, hookContent, { mode: 0o755 }); - - console.log('✅ Git hooks integrated successfully.'); - } catch { - console.error('❌ Git hook setup failed.'); - } -} - -// --------------------------------------------------------- -// COMMAND: internal-lint -// --------------------------------------------------------- -if (command === 'internal-lint') { - const configPath = path.resolve(engineRoot, 'configs/lint-staged.config.mjs'); - try { - // Detect the correct PATH key (Windows compatibility) - const pathKey = - process.platform === 'win32' - ? Object.keys(process.env).find((k) => k.toUpperCase() === 'PATH') || - 'PATH' - : 'PATH'; - - const env = { - ...process.env, - [pathKey]: `${internalBinPath}${path.delimiter}${process.env[pathKey]}`, - NODE_PATH: internalModulesPath, - NODE_OPTIONS: '--no-warnings', - }; - - execSync(`node "${lintStagedBin}" --config "${configPath}"`, { - stdio: 'inherit', - cwd: userAppRoot, - env, - }); - } catch { - process.exit(1); - } -} - -// if (command === 'internal-lint') { -// const lintStagedConfig = path.resolve(engineRoot, 'configs/lint-staged.config.mjs'); - -// try { -// const env = { -// ...process.env, -// PATH: `${internalBinPath}${path.delimiter}${process.env.PATH}`, -// // We tell Node to look in the engine's node_modules -// // when the User App's config tries to resolve its imports. -// NODE_PATH: internalModulesPath, -// }; - -// execSync(`node ${lintStagedBin} --config ${lintStagedConfig}`, { -// stdio: 'inherit', -// env -// }); -// } catch (e) { -// process.exit(1); -// } -// } diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js new file mode 100755 index 0000000..cde3c0e --- /dev/null +++ b/bin/pkg.internal.cli.js @@ -0,0 +1,111 @@ +#!/usr/bin/env node + +/*global console*/ + +import { execSync } from 'child_process'; +import path from 'path'; +import fs from 'fs'; +import process from 'process'; +import { fileURLToPath } from 'url'; +import { createRequire } from 'module'; + +const require = createRequire(import.meta.url); +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const userAppArg = { + huskyGitSetup: 'dev:husky:setup:git', + internalLint: 'dev:internal:lint', +}; + +const args_ = process.argv.slice(2); +const command = args_[0]; + +const pkgArgDetected = + args_.length === 1 && + (command === userAppArg.huskyGitSetup || command === userAppArg.internalLint); + +if (pkgArgDetected) { + //----------------------------------------------------------------- + // Path Resolution from userAppRoot (i.e. this could be from within + // this library, or the web app that this library is used in). + //----------------------------------------------------------------- + const userAppRoot = process.cwd(); + const engineRoot = path.resolve(__dirname, '..'); + const internalModulesPath = path.resolve(engineRoot, 'node_modules'); + const internalBinPath = path.resolve(internalModulesPath, '.bin'); + + // ----------------------------------------------- + // Safely find binary paths for the internal tools + // ----------------------------------------------- + const getBinPath = (pkgName, binSubPath) => { + try { + const pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`)); + return path.join(pkgRoot, binSubPath); + } catch { + return path.resolve(internalBinPath, pkgName); + } + }; + //- + const huskyBin = getBinPath('husky', 'bin.js'); + const lintStagedBin = getBinPath('lint-staged', 'bin/lint-staged.js'); + + // --------------------------------------------------------- + // Set up husky to work with git i.e. initially generate the + // husky folder, with content that includes pre-commit file. + // --------------------------------------------------------- + if (command === userAppArg.huskyGitSetup) { + console.log('🐶 Setting up @build-in-blocks git hooks...'); + try { + execSync(`node "${huskyBin}"`, { stdio: 'inherit' }); + const preCommitPath = path.join(userAppRoot, '.husky/pre-commit'); + + //------------------------------------------------------------------------------------- + // Use 'npx @build-in-blocks/[library] [command]' to ensure portability in the User App + //------------------------------------------------------------------------------------- + const hookContent = `npx @build-in-blocks/dev.setup@1.0.2 ${userAppArg.internalLint}`; + + fs.writeFileSync(preCommitPath, hookContent, { mode: 0o755 }); + + console.log('✅ Git hooks integrated successfully.'); + } catch { + console.error('❌ Git hook setup failed.'); + } + } + + // ---------------------------------------------------- + // Apply linting and formatting on git commit operation + // ---------------------------------------------------- + if (command === userAppArg.internalLint) { + const configPath = path.resolve( + engineRoot, + 'config.programmed/lint-staged.config.mjs', + ); + try { + //----------------------------------------------------- + // Check to detect the correct PATH key. Treat the PATH + // difference between windows OS and other OS. + //----------------------------------------------------- + const pathKey = + process.platform === 'win32' + ? Object.keys(process.env).find((k) => k.toUpperCase() === 'PATH') || + 'PATH' + : 'PATH'; + + const env = { + ...process.env, + [pathKey]: `${internalBinPath}${path.delimiter}${process.env[pathKey]}`, + NODE_PATH: internalModulesPath, + NODE_OPTIONS: '--no-warnings', + }; + + execSync(`node "${lintStagedBin}" --config "${configPath}"`, { + stdio: 'inherit', + cwd: userAppRoot, + env, + }); + } catch { + process.exit(1); + } + } +} diff --git a/configs/eslint.helper.mjs b/config.programmed/eslint.helper.mjs similarity index 56% rename from configs/eslint.helper.mjs rename to config.programmed/eslint.helper.mjs index 2d4555c..999ec5a 100644 --- a/configs/eslint.helper.mjs +++ b/config.programmed/eslint.helper.mjs @@ -4,16 +4,10 @@ import blocksDevSetupBaseConfig from '../eslint.config.mjs'; const require = createRequire(import.meta.url); +//------------------------------------------------------------------- // Dynamic Discovery: Find ESLint wherever the package manager put it +//------------------------------------------------------------------- const eslintConfigPath = require.resolve('eslint/config'); const { defineConfig } = require(eslintConfigPath); -export { defineConfig, blocksDevSetupBaseConfig }; - - - -// dev.setup/configs/eslint.helper.mjs -// import { defineConfig } from 'eslint/config'; -// import blocksDevSetupBaseConfig from '../eslint.config.mjs'; - -// export { defineConfig, blocksDevSetupBaseConfig }; \ No newline at end of file +export { defineConfig, blocksDevSetupBaseConfig }; \ No newline at end of file diff --git a/configs/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs similarity index 77% rename from configs/lint-staged.config.mjs rename to config.programmed/lint-staged.config.mjs index 3d4f6c2..48cc5de 100644 --- a/configs/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -13,7 +13,9 @@ const prettier = resolveBin('prettier', 'bin/prettier.cjs'); export default { '*.{mjs,js,ts}': [ - // We use absolute paths to binaries to avoid ENOENT + //------------------------------------------------- + // Using absolute paths to binaries to avoid ENOENT + //------------------------------------------------- `${eslint} --fix --no-warn-ignored`, `${prettier} --write` ], diff --git a/package.json b/package.json index 5ec168b..6e63985 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,15 @@ "type": "module", "main": "eslint.config.mjs", "bin": { - "blocks": "./bin/cli.js", + "@build-in-blocks/dev.setup": "bin/pkg.internal.cli.js", + "blocks.pkg.dev.setup": "bin/pkg.internal.cli.js", "husky-ls-config-init": "bin/user-app.husky.lint-staged.js", "internal-husky-ls-init": "bin/internal.husky.lint-staged.js" }, "exports": { ".": "./eslint.config.mjs", "./prettier": "./prettier.config.mjs", - "./config": "./configs/eslint.helper.mjs" + "./config": "./config.programmed/eslint.helper.mjs" }, "publishConfig": { "registry": "https://registry.npmjs.org/" @@ -20,7 +21,7 @@ "scripts": { "eslint:lint": "eslint .", "prettier:format": "prettier --write \"**/*.{js,ts,css,html}\"", - "prepare": "node ./bin/cli.js setup-git" + "prepare": "node ./bin/pkg.internal.cli.js dev:husky:setup:git" }, "dependencies": { "@eslint/js": "^10.0.1", From c9f33303c2b63f8604b16241c4cbf45e4694ae9d Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:05:08 +0100 Subject: [PATCH 03/19] Fix: Centralize package imports and root exports --- bin/pkg.internal.cli.js | 33 ++++++++++++------------ config.programmed/lint-staged.config.mjs | 27 +++++++++++-------- config.root/external.packages.js | 26 +++++++++++++++++++ config.root/root.js | 29 +++++++++++++++++++++ package.json | 2 ++ 5 files changed, 90 insertions(+), 27 deletions(-) create mode 100644 config.root/external.packages.js create mode 100644 config.root/root.js diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js index cde3c0e..a423a84 100755 --- a/bin/pkg.internal.cli.js +++ b/bin/pkg.internal.cli.js @@ -2,16 +2,15 @@ /*global console*/ -import { execSync } from 'child_process'; -import path from 'path'; -import fs from 'fs'; -import process from 'process'; -import { fileURLToPath } from 'url'; -import { createRequire } from 'module'; +import { + fs, + path, + execSync, + process, +} from '../config.root/external.packages.js'; +import { binPath, __dirname } from '../config.root/root.js'; -const require = createRequire(import.meta.url); -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const internalCommand = '@build-in-blocks/dev.setup@1.0.2'; const userAppArg = { huskyGitSetup: 'dev:husky:setup:git', @@ -38,17 +37,19 @@ if (pkgArgDetected) { // ----------------------------------------------- // Safely find binary paths for the internal tools // ----------------------------------------------- - const getBinPath = (pkgName, binSubPath) => { + const getBinPath = ({ pkgName, binSubPath }) => { try { - const pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`)); - return path.join(pkgRoot, binSubPath); + return binPath({ pkgName, binSubPath }); } catch { return path.resolve(internalBinPath, pkgName); } }; //- - const huskyBin = getBinPath('husky', 'bin.js'); - const lintStagedBin = getBinPath('lint-staged', 'bin/lint-staged.js'); + const huskyBin = getBinPath({ pkgName: 'husky', binSubPath: 'bin.js' }); + const lintStagedBin = getBinPath({ + pkgName: 'lint-staged', + binSubPath: 'bin/lint-staged.js', + }); // --------------------------------------------------------- // Set up husky to work with git i.e. initially generate the @@ -63,7 +64,7 @@ if (pkgArgDetected) { //------------------------------------------------------------------------------------- // Use 'npx @build-in-blocks/[library] [command]' to ensure portability in the User App //------------------------------------------------------------------------------------- - const hookContent = `npx @build-in-blocks/dev.setup@1.0.2 ${userAppArg.internalLint}`; + const hookContent = `npx ${internalCommand} ${userAppArg.internalLint}`; fs.writeFileSync(preCommitPath, hookContent, { mode: 0o755 }); @@ -99,7 +100,7 @@ if (pkgArgDetected) { NODE_OPTIONS: '--no-warnings', }; - execSync(`node "${lintStagedBin}" --config "${configPath}"`, { + execSync(`node "${lintStagedBin}" --config "${configPath}" --no-stash`, { stdio: 'inherit', cwd: userAppRoot, env, diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 48cc5de..64d7fbe 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -1,25 +1,30 @@ +import { path, process } from '../config.root/external.packages.js'; +import { binPath } from '../config.root/root.js'; -import { createRequire } from 'module'; -import path from 'path'; +const userAppRoot = process.cwd(); -const require = createRequire(import.meta.url); -const resolveBin = (pkgName, binRelativePath) => { - const pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`)); - return `node ${path.join(pkgRoot, binRelativePath)}`; -}; + const resolveBin = ({ pkgName, binRelativePath }) => { + const _binPath = binPath({ pkgName, binSubPath: binRelativePath }); + return `node ${_binPath}`; + }; + +const eslint = resolveBin({ pkgName: 'eslint', binRelativePath: 'bin/eslint.js' }); +const prettier = resolveBin({ pkgName: 'prettier', binRelativePath: 'bin/prettier.cjs' }); -const eslint = resolveBin('eslint', 'bin/eslint.js'); -const prettier = resolveBin('prettier', 'bin/prettier.cjs'); +//-------------------------------------------- +// Automatically detect the user's config file +//-------------------------------------------- +const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); export default { '*.{mjs,js,ts}': [ //------------------------------------------------- // Using absolute paths to binaries to avoid ENOENT //------------------------------------------------- - `${eslint} --fix --no-warn-ignored`, + `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, `${prettier} --write` ], - '*.{html,css,scss}': [ + '*.{json,html,css,scss}': [ `${prettier} --write` ] }; diff --git a/config.root/external.packages.js b/config.root/external.packages.js new file mode 100644 index 0000000..d85d5c5 --- /dev/null +++ b/config.root/external.packages.js @@ -0,0 +1,26 @@ +//------------- +// Node-related +//------------- + +import fs from 'fs'; +import path from 'path'; +import { execSync } from 'child_process'; +import process from 'process'; +import { fileURLToPath } from 'url'; +import { createRequire } from 'module'; + +export { + //- + fs, + //- + path, + //- + execSync, + //- + process, + //- + fileURLToPath, + //- + createRequire, + //- +}; diff --git a/config.root/root.js b/config.root/root.js new file mode 100644 index 0000000..eb388a8 --- /dev/null +++ b/config.root/root.js @@ -0,0 +1,29 @@ +import { path, fileURLToPath, createRequire } from './external.packages.js'; + +// ------------------------------------------------ +// ESM & Resolution Helpers: +// Recreate 'require' and '__dirname' for ESM scope +// ------------------------------------------------ +const require = createRequire(import.meta.url); +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +//------------------------------------------------- +// Get bin part relative to user app's package.json +//------------------------------------------------- +const binPath = ({ pkgName, binSubPath }) => { + const _pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`)); + return path.join(_pkgRoot, binSubPath); +}; + +export { + //------------------------------- + // Export global access variables + //------------------------------- + require, + __filename, + __dirname, + //- + binPath, + //- +}; diff --git a/package.json b/package.json index 6e63985..49cd42e 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,8 @@ ], "files": [ "bin/", + "config.programmed/", + "config.root/", "eslint.config.mjs", "prettier.config.mjs", "lint-staged.config.js", From 0edc38da9b87b05fec2bce52f116614a45ed9466 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:13:32 +0100 Subject: [PATCH 04/19] Fix: Prettier fix on git commit (test) --- config.programmed/lint-staged.config.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 64d7fbe..7e527ee 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -15,6 +15,7 @@ const prettier = resolveBin({ pkgName: 'prettier', binRelativePath: 'bin/prettie // Automatically detect the user's config file //-------------------------------------------- const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); +const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); export default { '*.{mjs,js,ts}': [ @@ -22,9 +23,9 @@ export default { // Using absolute paths to binaries to avoid ENOENT //------------------------------------------------- `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, - `${prettier} --write` + `${prettier} ${userPrettierConfig} --write --ignore-unknown` ], '*.{json,html,css,scss}': [ - `${prettier} --write` + `${prettier} ${userPrettierConfig} --write --ignore-unknown` ] }; From 31329146cce0b218d94055c7c98d9fc0e3cd375a Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:15:14 +0100 Subject: [PATCH 05/19] Fix: Prettier fix on git commit (test - 2) --- config.programmed/lint-staged.config.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 7e527ee..eabb9ba 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -1,6 +1,8 @@ import { path, process } from '../config.root/external.packages.js'; import { binPath } from '../config.root/root.js'; +/*global console */ + const userAppRoot = process.cwd(); const resolveBin = ({ pkgName, binRelativePath }) => { @@ -11,12 +13,16 @@ const userAppRoot = process.cwd(); const eslint = resolveBin({ pkgName: 'eslint', binRelativePath: 'bin/eslint.js' }); const prettier = resolveBin({ pkgName: 'prettier', binRelativePath: 'bin/prettier.cjs' }); +console.log(prettier) + //-------------------------------------------- // Automatically detect the user's config file //-------------------------------------------- const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); +console.log(userAppRoot, prettier) + export default { '*.{mjs,js,ts}': [ //------------------------------------------------- From 4594b73d481d57b18739ec258bc2b6384d13452c Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:18:34 +0100 Subject: [PATCH 06/19] Fix: Prettier fix on git commit (test - 3) --- config.programmed/lint-staged.config.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index eabb9ba..bbb2be4 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -21,14 +21,14 @@ console.log(prettier) const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); -console.log(userAppRoot, prettier) +// console.log(userAppRoot, prettier) export default { '*.{mjs,js,ts}': [ //------------------------------------------------- // Using absolute paths to binaries to avoid ENOENT //------------------------------------------------- - `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, + // `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, `${prettier} ${userPrettierConfig} --write --ignore-unknown` ], '*.{json,html,css,scss}': [ From b1a58bda4981288188f318f4bf923acbdc5e4b2d Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:22:27 +0100 Subject: [PATCH 07/19] Fix: Prettier fix on git commit (test - 3) --- config.programmed/lint-staged.config.mjs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index bbb2be4..6bd9c63 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -1,8 +1,6 @@ import { path, process } from '../config.root/external.packages.js'; import { binPath } from '../config.root/root.js'; -/*global console */ - const userAppRoot = process.cwd(); const resolveBin = ({ pkgName, binRelativePath }) => { @@ -13,8 +11,6 @@ const userAppRoot = process.cwd(); const eslint = resolveBin({ pkgName: 'eslint', binRelativePath: 'bin/eslint.js' }); const prettier = resolveBin({ pkgName: 'prettier', binRelativePath: 'bin/prettier.cjs' }); -console.log(prettier) - //-------------------------------------------- // Automatically detect the user's config file //-------------------------------------------- @@ -28,10 +24,10 @@ export default { //------------------------------------------------- // Using absolute paths to binaries to avoid ENOENT //------------------------------------------------- - // `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, - `${prettier} ${userPrettierConfig} --write --ignore-unknown` + `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, + `${prettier} --config ${userPrettierConfig} --write --ignore-unknown` ], '*.{json,html,css,scss}': [ - `${prettier} ${userPrettierConfig} --write --ignore-unknown` + `${prettier} --config ${userPrettierConfig} --write --ignore-unknown` ] -}; +} \ No newline at end of file From c49ec45fe67993874b8a757b8be649c6d8eab582 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:27:52 +0100 Subject: [PATCH 08/19] Fix: Prettier fix on git commit (test - 4) --- config.programmed/lint-staged.config.mjs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 6bd9c63..1df7bc6 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -17,17 +17,15 @@ const prettier = resolveBin({ pkgName: 'prettier', binRelativePath: 'bin/prettie const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); -// console.log(userAppRoot, prettier) - export default { '*.{mjs,js,ts}': [ //------------------------------------------------- // Using absolute paths to binaries to avoid ENOENT //------------------------------------------------- `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, - `${prettier} --config ${userPrettierConfig} --write --ignore-unknown` + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown` ], '*.{json,html,css,scss}': [ - `${prettier} --config ${userPrettierConfig} --write --ignore-unknown` + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown` ] } \ No newline at end of file From 9cb94cf491e8a32beda476e7a8cd35afd23b1658 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:34:31 +0100 Subject: [PATCH 09/19] Fix: Prettier fix on git commit (test - 5) --- bin/pkg.internal.cli.js | 28 ++++++++---------------- config.programmed/lint-staged.config.mjs | 24 +++++++++++--------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js index a423a84..247c5ac 100755 --- a/bin/pkg.internal.cli.js +++ b/bin/pkg.internal.cli.js @@ -2,12 +2,7 @@ /*global console*/ -import { - fs, - path, - execSync, - process, -} from '../config.root/external.packages.js'; +import { fs, path, execSync, process } from '../config.root/external.packages.js'; import { binPath, __dirname } from '../config.root/root.js'; const internalCommand = '@build-in-blocks/dev.setup@1.0.2'; @@ -20,9 +15,7 @@ const userAppArg = { const args_ = process.argv.slice(2); const command = args_[0]; -const pkgArgDetected = - args_.length === 1 && - (command === userAppArg.huskyGitSetup || command === userAppArg.internalLint); +const pkgArgDetected = args_.length === 1 && (command === userAppArg.huskyGitSetup || command === userAppArg.internalLint); if (pkgArgDetected) { //----------------------------------------------------------------- @@ -78,26 +71,23 @@ if (pkgArgDetected) { // Apply linting and formatting on git commit operation // ---------------------------------------------------- if (command === userAppArg.internalLint) { - const configPath = path.resolve( - engineRoot, - 'config.programmed/lint-staged.config.mjs', - ); + const configPath = path.resolve(engineRoot, 'config.programmed/lint-staged.config.mjs'); try { //----------------------------------------------------- // Check to detect the correct PATH key. Treat the PATH // difference between windows OS and other OS. //----------------------------------------------------- - const pathKey = - process.platform === 'win32' - ? Object.keys(process.env).find((k) => k.toUpperCase() === 'PATH') || - 'PATH' - : 'PATH'; + const pathKey = process.platform === 'win32' ? Object.keys(process.env).find((k) => k.toUpperCase() === 'PATH') || 'PATH' : 'PATH'; const env = { ...process.env, [pathKey]: `${internalBinPath}${path.delimiter}${process.env[pathKey]}`, NODE_PATH: internalModulesPath, - NODE_OPTIONS: '--no-warnings', + //-------------------------------------------------------- + // This helps ESM-based configs (like prettier.config.mjs) + // resolve their own dependencies from your engine + //-------------------------------------------------------- + NODE_OPTIONS: '--no-warnings --experimental-specifier-resolution=node', }; execSync(`node "${lintStagedBin}" --config "${configPath}" --no-stash`, { diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 1df7bc6..090beb6 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -18,14 +18,18 @@ const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); export default { - '*.{mjs,js,ts}': [ - //------------------------------------------------- - // Using absolute paths to binaries to avoid ENOENT - //------------------------------------------------- - `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, - `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown` - ], - '*.{json,html,css,scss}': [ - `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown` - ] + '*.{mjs,js,ts}': (filenames) => { + // We map the filenames to ensure they are quoted for the shell + const files = filenames.join(' '); + return [ + `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored ${files}`, + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown ${files}` + ]; + }, + '*.{json,html,css,scss}': (filenames) => { + const files = filenames.join(' '); + return [ + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown ${files}` + ]; + } } \ No newline at end of file From 9815d0cdabf70e2fffc968ee7782510b7490cd6a Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:36:37 +0100 Subject: [PATCH 10/19] Fix: Prettier fix on git commit (test - 6) --- bin/pkg.internal.cli.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js index 247c5ac..06a55f6 100755 --- a/bin/pkg.internal.cli.js +++ b/bin/pkg.internal.cli.js @@ -12,6 +12,8 @@ const userAppArg = { internalLint: 'dev:internal:lint', }; +// test + const args_ = process.argv.slice(2); const command = args_[0]; From 751d7abb52de17bb685f805c6476763537a2b4c6 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:37:21 +0100 Subject: [PATCH 11/19] Fix: Prettier fix on git commit (test - 7) --- bin/pkg.internal.cli.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js index 06a55f6..247c5ac 100755 --- a/bin/pkg.internal.cli.js +++ b/bin/pkg.internal.cli.js @@ -12,8 +12,6 @@ const userAppArg = { internalLint: 'dev:internal:lint', }; -// test - const args_ = process.argv.slice(2); const command = args_[0]; From 68948ce171a8429d5e3e1a4c36522598c6ff27a9 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:47:36 +0100 Subject: [PATCH 12/19] Fix: Prettier fix on git commit (test - 8) --- bin/pkg.internal.cli.js | 6 +----- config.programmed/lint-staged.config.mjs | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js index 247c5ac..3504249 100755 --- a/bin/pkg.internal.cli.js +++ b/bin/pkg.internal.cli.js @@ -83,11 +83,7 @@ if (pkgArgDetected) { ...process.env, [pathKey]: `${internalBinPath}${path.delimiter}${process.env[pathKey]}`, NODE_PATH: internalModulesPath, - //-------------------------------------------------------- - // This helps ESM-based configs (like prettier.config.mjs) - // resolve their own dependencies from your engine - //-------------------------------------------------------- - NODE_OPTIONS: '--no-warnings --experimental-specifier-resolution=node', + NODE_OPTIONS: '--no-warnings', }; execSync(`node "${lintStagedBin}" --config "${configPath}" --no-stash`, { diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 090beb6..1df7bc6 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -18,18 +18,14 @@ const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); export default { - '*.{mjs,js,ts}': (filenames) => { - // We map the filenames to ensure they are quoted for the shell - const files = filenames.join(' '); - return [ - `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored ${files}`, - `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown ${files}` - ]; - }, - '*.{json,html,css,scss}': (filenames) => { - const files = filenames.join(' '); - return [ - `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown ${files}` - ]; - } + '*.{mjs,js,ts}': [ + //------------------------------------------------- + // Using absolute paths to binaries to avoid ENOENT + //------------------------------------------------- + `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown` + ], + '*.{json,html,css,scss}': [ + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown` + ] } \ No newline at end of file From cb118de5761edfc7a5c86ab07c7abe2075cb2320 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:58:06 +0100 Subject: [PATCH 13/19] Fix: Prettier fix on git commit (test - 9) --- bin/pkg.internal.cli.js | 6 ++- config.programmed/lint-staged.config.mjs | 50 +++++++++++++++++------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js index 3504249..247c5ac 100755 --- a/bin/pkg.internal.cli.js +++ b/bin/pkg.internal.cli.js @@ -83,7 +83,11 @@ if (pkgArgDetected) { ...process.env, [pathKey]: `${internalBinPath}${path.delimiter}${process.env[pathKey]}`, NODE_PATH: internalModulesPath, - NODE_OPTIONS: '--no-warnings', + //-------------------------------------------------------- + // This helps ESM-based configs (like prettier.config.mjs) + // resolve their own dependencies from your engine + //-------------------------------------------------------- + NODE_OPTIONS: '--no-warnings --experimental-specifier-resolution=node', }; execSync(`node "${lintStagedBin}" --config "${configPath}" --no-stash`, { diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 1df7bc6..893ee27 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -1,12 +1,14 @@ import { path, process } from '../config.root/external.packages.js'; import { binPath } from '../config.root/root.js'; +// TODO: Prettier doesn't affect this particular file (on git commit - not sure why) + const userAppRoot = process.cwd(); - const resolveBin = ({ pkgName, binRelativePath }) => { - const _binPath = binPath({ pkgName, binSubPath: binRelativePath }); - return `node ${_binPath}`; - }; +const resolveBin = ({ pkgName, binRelativePath }) => { + const _binPath = binPath({ pkgName, binSubPath: binRelativePath }); + return `node ${_binPath}`; +}; const eslint = resolveBin({ pkgName: 'eslint', binRelativePath: 'bin/eslint.js' }); const prettier = resolveBin({ pkgName: 'prettier', binRelativePath: 'bin/prettier.cjs' }); @@ -17,15 +19,33 @@ const prettier = resolveBin({ pkgName: 'prettier', binRelativePath: 'bin/prettie const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); +const formatFiles = (filenames) => filenames.map(f => `"${f}"`).join(' '); + export default { - '*.{mjs,js,ts}': [ - //------------------------------------------------- - // Using absolute paths to binaries to avoid ENOENT - //------------------------------------------------- - `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, - `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown` - ], - '*.{json,html,css,scss}': [ - `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown` - ] -} \ No newline at end of file + '*.{mjs,js,ts}': (filenames) => { + const files = formatFiles(filenames); + return [ + `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored ${files}`, + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown ${files}`, + ]; + }, + '*.{json,html,css,scss,md}': (filenames) => { + const files = formatFiles(filenames); + return [ + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown ${files}` + ]; + } +}; + +// export default { +// '*.{mjs,js,ts}': [ +// //------------------------------------------------- +// // Using absolute paths to binaries to avoid ENOENT +// //------------------------------------------------- +// `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, +// `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`, +// ], +// '*.{json,html,css,scss}': [ +// `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`, +// ] +// }; \ No newline at end of file From 7fa78ce3f80f356665885170c8cbd82e13854363 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 18:59:00 +0100 Subject: [PATCH 14/19] Fix: Prettier fix on git commit (test - 10) --- config.programmed/eslint.helper.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.programmed/eslint.helper.mjs b/config.programmed/eslint.helper.mjs index 999ec5a..83cd954 100644 --- a/config.programmed/eslint.helper.mjs +++ b/config.programmed/eslint.helper.mjs @@ -10,4 +10,5 @@ const require = createRequire(import.meta.url); const eslintConfigPath = require.resolve('eslint/config'); const { defineConfig } = require(eslintConfigPath); -export { defineConfig, blocksDevSetupBaseConfig }; \ No newline at end of file +export { defineConfig, blocksDevSetupBaseConfig }; +// \ No newline at end of file From eed1141e41a81eaa249bef654ec68a0ba3a93c89 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 19:07:13 +0100 Subject: [PATCH 15/19] Fix: Prettier fix on git commit (test - 11) --- .prettierignore | 7 ++-- bin/pkg.internal.cli.js | 6 +--- config.programmed/eslint.helper.mjs | 2 -- config.programmed/lint-staged.config.mjs | 42 ++++++------------------ 4 files changed, 16 insertions(+), 41 deletions(-) diff --git a/.prettierignore b/.prettierignore index 162a220..7138a86 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,11 +4,14 @@ # 2. Allow directories !*/ -# 3. Specifically allow these FOUR types +# 3. Specifically allow these SEVEN file types +!*.mjs !*.js !*.ts -!*.css +!*.json !*.html +!*.css +!*.scss # 4. Standard ignores node_modules/ diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js index 247c5ac..3504249 100755 --- a/bin/pkg.internal.cli.js +++ b/bin/pkg.internal.cli.js @@ -83,11 +83,7 @@ if (pkgArgDetected) { ...process.env, [pathKey]: `${internalBinPath}${path.delimiter}${process.env[pathKey]}`, NODE_PATH: internalModulesPath, - //-------------------------------------------------------- - // This helps ESM-based configs (like prettier.config.mjs) - // resolve their own dependencies from your engine - //-------------------------------------------------------- - NODE_OPTIONS: '--no-warnings --experimental-specifier-resolution=node', + NODE_OPTIONS: '--no-warnings', }; execSync(`node "${lintStagedBin}" --config "${configPath}" --no-stash`, { diff --git a/config.programmed/eslint.helper.mjs b/config.programmed/eslint.helper.mjs index 83cd954..7263d7f 100644 --- a/config.programmed/eslint.helper.mjs +++ b/config.programmed/eslint.helper.mjs @@ -1,4 +1,3 @@ - import { createRequire } from 'module'; import blocksDevSetupBaseConfig from '../eslint.config.mjs'; @@ -11,4 +10,3 @@ const eslintConfigPath = require.resolve('eslint/config'); const { defineConfig } = require(eslintConfigPath); export { defineConfig, blocksDevSetupBaseConfig }; -// \ No newline at end of file diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 893ee27..2b880f4 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -1,13 +1,11 @@ import { path, process } from '../config.root/external.packages.js'; import { binPath } from '../config.root/root.js'; -// TODO: Prettier doesn't affect this particular file (on git commit - not sure why) - const userAppRoot = process.cwd(); const resolveBin = ({ pkgName, binRelativePath }) => { - const _binPath = binPath({ pkgName, binSubPath: binRelativePath }); - return `node ${_binPath}`; + const _binPath = binPath({ pkgName, binSubPath: binRelativePath }); + return `node ${_binPath}`; }; const eslint = resolveBin({ pkgName: 'eslint', binRelativePath: 'bin/eslint.js' }); @@ -19,33 +17,13 @@ const prettier = resolveBin({ pkgName: 'prettier', binRelativePath: 'bin/prettie const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); -const formatFiles = (filenames) => filenames.map(f => `"${f}"`).join(' '); - export default { - '*.{mjs,js,ts}': (filenames) => { - const files = formatFiles(filenames); - return [ - `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored ${files}`, - `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown ${files}`, - ]; - }, - '*.{json,html,css,scss,md}': (filenames) => { - const files = formatFiles(filenames); - return [ - `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown ${files}` - ]; - } + '*.{mjs,js,ts}': [ + //------------------------------------------------- + // Using absolute paths to binaries to avoid ENOENT + //------------------------------------------------- + `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`, + ], + '*.{json,html,css,scss}': [`${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`], }; - -// export default { -// '*.{mjs,js,ts}': [ -// //------------------------------------------------- -// // Using absolute paths to binaries to avoid ENOENT -// //------------------------------------------------- -// `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, -// `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`, -// ], -// '*.{json,html,css,scss}': [ -// `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`, -// ] -// }; \ No newline at end of file From 70174e628ce8eed041e017f3abef9f8edf3a3002 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 20:06:50 +0100 Subject: [PATCH 16/19] Fix: Remove old code with new code --- bin/common/common.husky.lint-staged.js | 22 ---------------------- bin/internal.husky.lint-staged.js | 7 ------- bin/user-app.husky.lint-staged.js | 7 ------- config.programmed/lint-staged.config.mjs | 9 ++++++++- lint-staged.config.js | 11 ----------- package.json | 16 ++++++---------- 6 files changed, 14 insertions(+), 58 deletions(-) delete mode 100755 bin/common/common.husky.lint-staged.js delete mode 100755 bin/internal.husky.lint-staged.js delete mode 100755 bin/user-app.husky.lint-staged.js delete mode 100644 lint-staged.config.js diff --git a/bin/common/common.husky.lint-staged.js b/bin/common/common.husky.lint-staged.js deleted file mode 100755 index 7aeaff9..0000000 --- a/bin/common/common.husky.lint-staged.js +++ /dev/null @@ -1,22 +0,0 @@ -/*global console*/ - -import { execSync } from 'child_process'; -import fs from 'fs'; - -export const huskyLintStagePrep = ({ nodeModulePrefix }) => { - try { - console.log('☞ Preparing husky + lint-staged pre-commit environment...'); - execSync('npx husky init', { stdio: 'inherit' }); - //---------------------------------------------------------------------------------------- - // Reference the config file inside the node_modules of the app the uses dev.setup library - //---------------------------------------------------------------------------------------- - const hook = `npx lint-staged --config ${nodeModulePrefix}lint-staged.config.js`; - fs.writeFileSync('.husky/pre-commit', hook); - console.log('✔ Husky + lint-staged pre-commit setup completed!'); - } catch (error) { - console.error( - '❌ Husky + lint-staged pre-commit setup failed:\n', - error.message, - ); - } -}; diff --git a/bin/internal.husky.lint-staged.js b/bin/internal.husky.lint-staged.js deleted file mode 100755 index 32a2ddd..0000000 --- a/bin/internal.husky.lint-staged.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -import { huskyLintStagePrep } from './common/common.husky.lint-staged.js'; - -huskyLintStagePrep({ - nodeModulePrefix: '', -}); diff --git a/bin/user-app.husky.lint-staged.js b/bin/user-app.husky.lint-staged.js deleted file mode 100755 index 69e559c..0000000 --- a/bin/user-app.husky.lint-staged.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -import { huskyLintStagePrep } from './common/common.husky.lint-staged.js'; - -huskyLintStagePrep({ - nodeModulePrefix: 'node_modules/@build-in-blocks/dev.setup/', -}); diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 2b880f4..28a191f 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -22,8 +22,15 @@ export default { //------------------------------------------------- // Using absolute paths to binaries to avoid ENOENT //------------------------------------------------- + // Formats script file types + //-------------------------- `${eslint} --config "${userEslintConfig}" --fix --no-warn-ignored`, `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`, ], - '*.{json,html,css,scss}': [`${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`], + '*.{json,html,css,scss}': [ + //------------------------- + // Formats other file types + //------------------------- + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`, + ], }; diff --git a/lint-staged.config.js b/lint-staged.config.js deleted file mode 100644 index d3926ba..0000000 --- a/lint-staged.config.js +++ /dev/null @@ -1,11 +0,0 @@ -export default { - '*.{js,jsx,ts,tsx}': [ - // Formats script file types - 'eslint --fix', - 'prettier --write', - ], - '*.{html,css,scss}': [ - // Formats other file types - 'prettier --write', - ], -}; diff --git a/package.json b/package.json index 49cd42e..dd35a08 100644 --- a/package.json +++ b/package.json @@ -3,24 +3,21 @@ "version": "1.0.2", "description": "Code linting, formatting, pre-commit hook and GitHub Actions Continuous Integration (CI) (including node version compatiblity check) development environment setup for your typescript code repository", "type": "module", - "main": "eslint.config.mjs", + "main": "config.programmed/eslint.helper.mjs", "bin": { "@build-in-blocks/dev.setup": "bin/pkg.internal.cli.js", - "blocks.pkg.dev.setup": "bin/pkg.internal.cli.js", - "husky-ls-config-init": "bin/user-app.husky.lint-staged.js", - "internal-husky-ls-init": "bin/internal.husky.lint-staged.js" + "blocks.pkg.dev.setup": "bin/pkg.internal.cli.js" }, "exports": { - ".": "./eslint.config.mjs", - "./prettier": "./prettier.config.mjs", - "./config": "./config.programmed/eslint.helper.mjs" + ".": "./config.programmed/eslint.helper.mjs", + "./prettier": "./prettier.config.mjs" }, "publishConfig": { "registry": "https://registry.npmjs.org/" }, "scripts": { "eslint:lint": "eslint .", - "prettier:format": "prettier --write \"**/*.{js,ts,css,html}\"", + "prettier:format": "prettier --write \"**/*.{mjs,js,ts,json,html,css,scss}\"", "prepare": "node ./bin/pkg.internal.cli.js dev:husky:setup:git" }, "dependencies": { @@ -43,7 +40,7 @@ }, "license": "AGPL-3.0", "author": "Mary Obiagba", - "contributors": [ + "contributors": [ "Find list of contributors in project README: https://github.com/build-in-blocks/dev.setup?tab=readme-ov-file#contributors" ], "keywords": [ @@ -78,7 +75,6 @@ "config.root/", "eslint.config.mjs", "prettier.config.mjs", - "lint-staged.config.js", "README.md" ] } From 7643980c35e0a07db47e8fa7378c1462a91ae7da Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 20:50:39 +0100 Subject: [PATCH 17/19] Fix: lint-staged file change on commit, version bump to v1.0.3 --- .husky/pre-commit | 2 +- README.md | 2 +- bin/pkg.internal.cli.js | 9 +- package-lock.json | 380 ++++++++++++++++------------------------ package.json | 3 +- 5 files changed, 164 insertions(+), 232 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 250844c..05ab555 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -npx blocks internal-lint \ No newline at end of file +npx @build-in-blocks/dev.setup@1.0.3 dev:internal:lint \ No newline at end of file diff --git a/README.md b/README.md index ebf0182..fea8978 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ npm install -D @build-in-blocks/dev.setup # ----------------------------------------------------------------- # This points to the shared library repository's "central" workflow # ----------------------------------------------------------------- - uses: build-in-blocks/dev.setup/.github/workflows/central-blocks-ci.yml@v1.0.2 + uses: build-in-blocks/dev.setup/.github/workflows/central-blocks-ci.yml@v1.0.3 with: run_tests: true # ------------------------------------------------- diff --git a/bin/pkg.internal.cli.js b/bin/pkg.internal.cli.js index 3504249..34b1caa 100755 --- a/bin/pkg.internal.cli.js +++ b/bin/pkg.internal.cli.js @@ -5,7 +5,7 @@ import { fs, path, execSync, process } from '../config.root/external.packages.js'; import { binPath, __dirname } from '../config.root/root.js'; -const internalCommand = '@build-in-blocks/dev.setup@1.0.2'; +const internalCommand = '@build-in-blocks/dev.setup@1.0.3'; const userAppArg = { huskyGitSetup: 'dev:husky:setup:git', @@ -84,9 +84,14 @@ if (pkgArgDetected) { [pathKey]: `${internalBinPath}${path.delimiter}${process.env[pathKey]}`, NODE_PATH: internalModulesPath, NODE_OPTIONS: '--no-warnings', + //-------------------------------------------------------------------------- + // This prevents lint-staged from using its "smart" backup logic which often + // causes the "tampering"feel. + //-------------------------------------------------------------------------- + LINT_STAGED_BACKUP: '0', }; - execSync(`node "${lintStagedBin}" --config "${configPath}" --no-stash`, { + execSync(`node "${lintStagedBin}" --config "${configPath}"`, { stdio: 'inherit', cwd: userAppRoot, env, diff --git a/package-lock.json b/package-lock.json index 08588bb..477d173 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@build-in-blocks/dev.setup", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@build-in-blocks/dev.setup", - "version": "1.0.2", + "version": "1.0.3", "license": "AGPL-3.0", "dependencies": { "@eslint/js": "^10.0.1", @@ -15,12 +15,11 @@ "husky": "^9.1.7", "lint-staged": "^16.3.2", "prettier": "^3.8.1", - "typescript": "^5.9.3", "typescript-eslint": "^8.56.1" }, "bin": { - "husky-ls-config-init": "bin/user-app.husky.lint-staged.js", - "internal-husky-ls-init": "bin/internal.husky.lint-staged.js" + "blocks.pkg.dev.setup": "bin/pkg.internal.cli.js", + "dev.setup": "bin/pkg.internal.cli.js" } }, "node_modules/@eslint-community/eslint-utils": { @@ -63,12 +62,12 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.23.3", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.3.tgz", - "integrity": "sha512-j+eEWmB6YYLwcNOdlwQ6L2OsptI/LO6lNBuLIqe5R7RetD658HLoF+Mn7LzYmAWWNNzdC6cqP+L6r8ujeYXWLw==", + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^3.0.3", + "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", "minimatch": "^10.2.4" }, @@ -77,21 +76,21 @@ } }, "node_modules/@eslint/config-helpers": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.3.tgz", - "integrity": "sha512-lzGN0onllOZCGroKJmRwY6QcEHxbjBw1gwB8SgRSqK8YbbtEXMvKynsXc3553ckIEBxsbMBU7oOZXKIPGZNeZw==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.5.tgz", + "integrity": "sha512-eIJYKTCECbP/nsKaaruF6LW967mtbQbsw4JTtSVkUQc9MneSkbrgPJAbKl9nWr0ZeowV8BfsarBmPpBzGelA2w==", "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^1.1.1" + "@eslint/core": "^1.2.1" }, "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" } }, "node_modules/@eslint/core": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.1.1.tgz", - "integrity": "sha512-QUPblTtE51/7/Zhfv8BDwO0qkkzQL7P/aWWbqcf4xWLEYn1oKjdO0gglQBB4GAsu7u6wjijbCmzsUTy6mnk6oQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", "license": "Apache-2.0", "dependencies": { "@types/json-schema": "^7.0.15" @@ -121,21 +120,21 @@ } }, "node_modules/@eslint/object-schema": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.3.tgz", - "integrity": "sha512-iM869Pugn9Nsxbh/YHRqYiqd23AmIbxJOcpUMOuWCVNdoQJ5ZtwL6h3t0bcZzJUlC3Dq9jCFCESBZnX0GTv7iQ==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", "license": "Apache-2.0", "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" } }, "node_modules/@eslint/plugin-kit": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.6.1.tgz", - "integrity": "sha512-iH1B076HoAshH1mLpHMgwdGeTs0CYwL0SPMkGuSebZrwBp16v415e9NZXg2jtrqPVQjf6IANe2Vtlr5KswtcZQ==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.1.tgz", + "integrity": "sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ==", "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^1.1.1", + "@eslint/core": "^1.2.1", "levn": "^0.4.1" }, "engines": { @@ -209,19 +208,19 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.56.1.tgz", - "integrity": "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.58.1.tgz", + "integrity": "sha512-eSkwoemjo76bdXl2MYqtxg51HNwUSkWfODUOQ3PaTLZGh9uIWWFZIjyjaJnex7wXDu+TRx+ATsnSxdN9YWfRTQ==", "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/type-utils": "8.56.1", - "@typescript-eslint/utils": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", + "@typescript-eslint/scope-manager": "8.58.1", + "@typescript-eslint/type-utils": "8.58.1", + "@typescript-eslint/utils": "8.58.1", + "@typescript-eslint/visitor-keys": "8.58.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -231,9 +230,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.56.1", + "@typescript-eslint/parser": "^8.58.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { @@ -246,16 +245,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.56.1.tgz", - "integrity": "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.58.1.tgz", + "integrity": "sha512-gGkiNMPqerb2cJSVcruigx9eHBlLG14fSdPdqMoOcBfh+vvn4iCq2C8MzUB89PrxOXk0y3GZ1yIWb9aOzL93bw==", "license": "MIT", "peer": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", + "@typescript-eslint/scope-manager": "8.58.1", + "@typescript-eslint/types": "8.58.1", + "@typescript-eslint/typescript-estree": "8.58.1", + "@typescript-eslint/visitor-keys": "8.58.1", "debug": "^4.4.3" }, "engines": { @@ -267,17 +266,17 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.56.1.tgz", - "integrity": "sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.58.1.tgz", + "integrity": "sha512-gfQ8fk6cxhtptek+/8ZIqw8YrRW5048Gug8Ts5IYcMLCw18iUgrZAEY/D7s4hkI0FxEfGakKuPK/XUMPzPxi5g==", "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.56.1", - "@typescript-eslint/types": "^8.56.1", + "@typescript-eslint/tsconfig-utils": "^8.58.1", + "@typescript-eslint/types": "^8.58.1", "debug": "^4.4.3" }, "engines": { @@ -288,17 +287,17 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.56.1.tgz", - "integrity": "sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.58.1.tgz", + "integrity": "sha512-TPYUEqJK6avLcEjumWsIuTpuYODTTDAtoMdt8ZZa93uWMTX13Nb8L5leSje1NluammvU+oI3QRr5lLXPgihX3w==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1" + "@typescript-eslint/types": "8.58.1", + "@typescript-eslint/visitor-keys": "8.58.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -309,9 +308,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.56.1.tgz", - "integrity": "sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.58.1.tgz", + "integrity": "sha512-JAr2hOIct2Q+qk3G+8YFfqkqi7sC86uNryT+2i5HzMa2MPjw4qNFvtjnw1IiA1rP7QhNKVe21mSSLaSjwA1Olw==", "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -321,20 +320,20 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.56.1.tgz", - "integrity": "sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.58.1.tgz", + "integrity": "sha512-HUFxvTJVroT+0rXVJC7eD5zol6ID+Sn5npVPWoFuHGg9Ncq5Q4EYstqR+UOqaNRFXi5TYkpXXkLhoCHe3G0+7w==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/utils": "8.56.1", + "@typescript-eslint/types": "8.58.1", + "@typescript-eslint/typescript-estree": "8.58.1", + "@typescript-eslint/utils": "8.58.1", "debug": "^4.4.3", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -345,13 +344,13 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/types": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.56.1.tgz", - "integrity": "sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.58.1.tgz", + "integrity": "sha512-io/dV5Aw5ezwzfPBBWLoT+5QfVtP8O7q4Kftjn5azJ88bYyp/ZMCsyW1lpKK46EXJcaYMZ1JtYj+s/7TdzmQMw==", "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -362,20 +361,20 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.56.1.tgz", - "integrity": "sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.58.1.tgz", + "integrity": "sha512-w4w7WR7GHOjqqPnvAYbazq+Y5oS68b9CzasGtnd6jIeOIeKUzYzupGTB2T4LTPSv4d+WPeccbxuneTFHYgAAWg==", "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.56.1", - "@typescript-eslint/tsconfig-utils": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", + "@typescript-eslint/project-service": "8.58.1", + "@typescript-eslint/tsconfig-utils": "8.58.1", + "@typescript-eslint/types": "8.58.1", + "@typescript-eslint/visitor-keys": "8.58.1", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -385,19 +384,19 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.56.1.tgz", - "integrity": "sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.58.1.tgz", + "integrity": "sha512-Ln8R0tmWC7pTtLOzgJzYTXSCjJ9rDNHAqTaVONF4FEi2qwce8mD9iSOxOpLFFvWp/wBFlew0mjM1L1ihYWfBdQ==", "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1" + "@typescript-eslint/scope-manager": "8.58.1", + "@typescript-eslint/types": "8.58.1", + "@typescript-eslint/typescript-estree": "8.58.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -408,16 +407,16 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.56.1.tgz", - "integrity": "sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.58.1.tgz", + "integrity": "sha512-y+vH7QE8ycjoa0bWciFg7OpFcipUuem1ujhrdLtq1gByKwfbC7bPeKsiny9e0urg93DqwGcHey+bGRKCnF1nZQ==", "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.1", + "@typescript-eslint/types": "8.58.1", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -515,9 +514,9 @@ } }, "node_modules/brace-expansion": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", - "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", + "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" @@ -526,18 +525,6 @@ "node": "18 || 20 || >=22" } }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/cli-cursor": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", @@ -652,18 +639,18 @@ } }, "node_modules/eslint": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.0.3.tgz", - "integrity": "sha512-COV33RzXZkqhG9P2rZCFl9ZmJ7WL+gQSCRzE7RhkbclbQPtLAWReL7ysA0Sh4c8Im2U9ynybdR56PV0XcKvqaQ==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.2.0.tgz", + "integrity": "sha512-+L0vBFYGIpSNIt/KWTpFonPrqYvgKw1eUI5Vn7mEogrQcWtWYtNQ7dNqC+px/J0idT3BAkiWrhfS7k+Tum8TUA==", "license": "MIT", "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", - "@eslint/config-array": "^0.23.3", - "@eslint/config-helpers": "^0.5.2", - "@eslint/core": "^1.1.1", - "@eslint/plugin-kit": "^0.6.1", + "@eslint/config-array": "^0.23.4", + "@eslint/config-helpers": "^0.5.4", + "@eslint/core": "^1.2.0", + "@eslint/plugin-kit": "^0.7.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", @@ -674,7 +661,7 @@ "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", - "espree": "^11.1.1", + "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -835,6 +822,23 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "license": "MIT" }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, "node_modules/file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", @@ -847,18 +851,6 @@ "node": ">=16.0.0" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -889,9 +881,9 @@ } }, "node_modules/flatted": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.4.tgz", - "integrity": "sha512-3+mMldrTAPdta5kjX2G2J7iX4zxtnwpdA8Tr2ZSjkyPSanvbZAcy6flmtnXbEybHrDcU9641lxrMfFuUxVz9vA==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", + "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", "license": "ISC" }, "node_modules/get-east-asian-width": { @@ -987,15 +979,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1043,16 +1026,16 @@ } }, "node_modules/lint-staged": { - "version": "16.3.2", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-16.3.2.tgz", - "integrity": "sha512-xKqhC2AeXLwiAHXguxBjuChoTTWFC6Pees0SHPwOpwlvI3BH7ZADFPddAdN3pgo3aiKgPUx/bxE78JfUnxQnlg==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-16.4.0.tgz", + "integrity": "sha512-lBWt8hujh/Cjysw5GYVmZpFHXDCgZzhrOm8vbcUdobADZNOK/bRshr2kM3DfgrrtR1DQhfupW9gnIXOfiFi+bw==", "license": "MIT", "dependencies": { "commander": "^14.0.3", "listr2": "^9.0.5", - "micromatch": "^4.0.8", + "picomatch": "^4.0.3", "string-argv": "^0.3.2", - "tinyexec": "^1.0.2", + "tinyexec": "^1.0.4", "yaml": "^2.8.2" }, "bin": { @@ -1132,19 +1115,6 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/mimic-function": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", @@ -1158,12 +1128,12 @@ } }, "node_modules/minimatch": { - "version": "10.2.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", - "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^5.0.2" + "brace-expansion": "^5.0.5" }, "engines": { "node": "18 || 20 || >=22" @@ -1265,12 +1235,12 @@ } }, "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" @@ -1433,22 +1403,22 @@ } }, "node_modules/tinyexec": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", - "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.1.1.tgz", + "integrity": "sha512-VKS/ZaQhhkKFMANmAOhhXVoIfBXblQxGX1myCQ2faQrfmobMftXeJPcZGp0gS07ocvGJWDLZGyOZDadDBqYIJg==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.16.tgz", + "integrity": "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==", "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -1457,52 +1427,10 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/ts-api-utils": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.4.0.tgz", - "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", "license": "MIT", "engines": { "node": ">=18.12" @@ -1524,9 +1452,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.2.tgz", + "integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==", "license": "Apache-2.0", "peer": true, "bin": { @@ -1538,15 +1466,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.56.1.tgz", - "integrity": "sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ==", + "version": "8.58.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.58.1.tgz", + "integrity": "sha512-gf6/oHChByg9HJvhMO1iBexJh12AqqTfnuxscMDOVqfJW3htsdRJI/GfPpHTTcyeB8cSTUY2JcZmVgoyPqcrDg==", "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.56.1", - "@typescript-eslint/parser": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/utils": "8.56.1" + "@typescript-eslint/eslint-plugin": "8.58.1", + "@typescript-eslint/parser": "8.58.1", + "@typescript-eslint/typescript-estree": "8.58.1", + "@typescript-eslint/utils": "8.58.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1557,7 +1485,7 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/uri-js": { @@ -1628,9 +1556,9 @@ } }, "node_modules/yaml": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", - "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz", + "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==", "license": "ISC", "bin": { "yaml": "bin.mjs" diff --git a/package.json b/package.json index dd35a08..c051b54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@build-in-blocks/dev.setup", - "version": "1.0.2", + "version": "1.0.3", "description": "Code linting, formatting, pre-commit hook and GitHub Actions Continuous Integration (CI) (including node version compatiblity check) development environment setup for your typescript code repository", "type": "module", "main": "config.programmed/eslint.helper.mjs", @@ -27,7 +27,6 @@ "husky": "^9.1.7", "lint-staged": "^16.3.2", "prettier": "^3.8.1", - "typescript": "^5.9.3", "typescript-eslint": "^8.56.1" }, "homepage": "https://github.com/build-in-blocks/dev.setup#readme", From 28703ec3d998e1bb7b4ab73b4972004a2cdf6a07 Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 20:56:32 +0100 Subject: [PATCH 18/19] Fix: Consistency in allowed file names for eslint/prettier --- .prettierignore | 2 +- README.md | 2 +- config.programmed/lint-staged.config.mjs | 2 +- docs.users/README.md | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.prettierignore b/.prettierignore index 7138a86..fcb32dd 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,8 +6,8 @@ # 3. Specifically allow these SEVEN file types !*.mjs -!*.js !*.ts +!*.js !*.json !*.html !*.css diff --git a/README.md b/README.md index fea8978..48f923e 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ npm install -D @build-in-blocks/dev.setup // NOTE: Change folder name to where your ts files reside const TARGET_FOLDER = 'src'; - const TARGET_FILES = `${TARGET_FOLDER}/**/*.{ts,js,tsx}`; + const TARGET_FILES = `${TARGET_FOLDER}/**/*.{mjs,ts,js}`; export default defineConfig([ //------------------------------------------------------------------ diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs index 28a191f..a767dbb 100644 --- a/config.programmed/lint-staged.config.mjs +++ b/config.programmed/lint-staged.config.mjs @@ -18,7 +18,7 @@ const userEslintConfig = path.resolve(userAppRoot, 'eslint.config.mjs'); const userPrettierConfig = path.resolve(userAppRoot, 'prettier.config.mjs'); export default { - '*.{mjs,js,ts}': [ + '*.{mjs,ts,js}': [ //------------------------------------------------- // Using absolute paths to binaries to avoid ENOENT //------------------------------------------------- diff --git a/docs.users/README.md b/docs.users/README.md index fe95c77..7cf37e3 100644 --- a/docs.users/README.md +++ b/docs.users/README.md @@ -88,7 +88,7 @@ import { defineConfig } from 'eslint/config'; import blocksDevSetupConfig from '@build-in-blocks/dev.setup'; const TARGET_FOLDER = 'src'; // NOTE: Change folder name to where your ts files reside -const TARGET_FILES = `${TARGET_FOLDER}/**/*.{ts,js,tsx}`; +const TARGET_FILES = `${TARGET_FOLDER}/**/*.{mjs,ts,js}`; export default defineConfig([ //--------------------------------------------------------------------------- diff --git a/package.json b/package.json index c051b54..cdb34e2 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "scripts": { "eslint:lint": "eslint .", - "prettier:format": "prettier --write \"**/*.{mjs,js,ts,json,html,css,scss}\"", + "prettier:format": "prettier --write \"**/*.{mjs,ts,js,json,html,css,scss}\"", "prepare": "node ./bin/pkg.internal.cli.js dev:husky:setup:git" }, "dependencies": { From 3fe7e542c03171b56ea48d2c86d23ad96372443a Mon Sep 17 00:00:00 2001 From: Ifycode Date: Wed, 8 Apr 2026 22:51:35 +0100 Subject: [PATCH 19/19] package.json keywords update, docs update: root README, contributor, user and release --- README.md | 132 ++++++++++++++++++++---------------- docs.contributors/README.md | 6 +- docs.release/README.md | 35 ++++++++++ docs.users/README.md | 20 ++++-- package.json | 16 +++-- 5 files changed, 135 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 48f923e..842702a 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,24 @@ # @build-in-blocks/dev.setup -**Supported Node.js versions:** Node.js v20.x, v22.x, v24.x and v25.x +![Latest Version](https://img.shields.io/npm/v/@build-in-blocks/dev.setup.svg?label=latest&color=brightgreen&style=flat-square) ![NPM Downloads](https://img.shields.io/npm/d18m/%40build-in-blocks%2Fdev.setup?color=blue&label=downloads%20(last%2018%20months)) ![build passing](https://img.shields.io/badge/build-passing-brightgreen?style=flat-square) + +[![License: AGPL v3.0](https://img.shields.io/badge/license-AGPL%20v3.0-blue.svg?style=flat-square)](https://www.gnu.org/licenses/agpl-3.0) [![All Contributors](https://img.shields.io/github/all-contributors/build-in-blocks/dev.setup?color=ee8449&style=flat-square)](#contributors) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat-square)](https://github.com/build-in-blocks/dev.setup/blob/develop/docs.contributors/README.md) + +# + +**Built with:** Node.js v24.0.2 + +# + +**Supported Node.js versions:** Node.js v20.x, v22.x, v24.x and v25.x - Monitored by (internal) central Blocks CI # -**Description:** Code linting, formatting, pre-commit hook and GitHub actions development environment setup for your `typescript` code repository. +**Overview:** Code linting, formatting, pre-commit hook and GitHub actions development environment setup for your `typescript` code repository. # -**How it works:** Using code quality checks from `eslint`, `husky` works with `lint-staged` to prevent code that don't meet your code quality requirements, from being commited to git and pushed to your repository's remote - it also formats your code with `prettier` based on your code formatting preferences at this point. `GitHub Actions` then runs the code quality and node version compatibilty checks on pull requests, on push or on merge to your repository's `develop` and/or `main` branch. Ensuring code from all code contributors working on your project pass through the quality checks that you've configured. +**Description:** **@build-in-blocks/dev.setup** provides TS development environment setup and comes with preconfigured settings. It helps to automate code compatibilty, quality and formatting checks within your typescript code repository's Git workflow, ensuring that only clean, consistent code is committed to the repository. It also includes GitHub Actions Continuous Integration (CI) setup for running these checks on the contributions submitted to your repository, by your open source contributors or work colleagues. Of course, you can configure it to use your preferred settings too. # @@ -31,87 +41,89 @@ #### 1. Main package installation -Install our dev setup in your project: +Install our dev setup package as a `devDependency` in your project: ```` npm install -D @build-in-blocks/dev.setup ```` -#### 2. Eslint with typescript installation and setup +#### 2. When to install `typescript` -- Install the same group of eslint-related and typescript-related package versions that our dev setup uses in your project: +If you are using both this library and [@build-in-blocks/dev.build](https://www.npmjs.com/package/@build-in-blocks/dev.build) together in your project, then you don't need to install `typescript` in your project (the **@build-in-blocks/dev.build** library already does that internally, relative to your project). - ```` - npm install -D eslint@^10.0.2 @eslint/js@^10.0.1 typescript@^5.9.3 typescript-eslint@^8.56.1 - ```` - -- Create a `eslint.config.mjs` file at root of your project and add this setup: +Otherwise, you'll need to manually install `typescript` in your project. See `typescript` table in the general guide for more information: [Typescript compatibility and usage](https://github.com/build-in-blocks/.github/wiki/Repo-User-Guide-Extension#table-typescript-compatibility-and-usage). - ```` - // @ts-check - - import { defineConfig } from 'eslint/config'; - import blocksDevSetupConfig from '@build-in-blocks/dev.setup'; - - // NOTE: Change folder name to where your ts files reside - const TARGET_FOLDER = 'src'; - const TARGET_FILES = `${TARGET_FOLDER}/**/*.{mjs,ts,js}`; - - export default defineConfig([ - //------------------------------------------------------------------ - // USE OUR PRECONFIGURED SETTINGS & UPDATE IT WITH YOUR TARGET FILES - //------------------------------------------------------------------ - blocksDevSetupConfig.map(config => ({ - ...config, - files: [TARGET_FILES], - })), - ]); - ```` +#### 3. Eslint config setup -#### 3. Prettier installation and setup +Create a `eslint.config.mjs` file at root of your project and add this setup: -- Install the same group of prettier-related package versions that our dev setup uses in your project: +```` +// @ts-check + +import { defineConfig, blocksDevSetupBaseConfig } from '@build-in-blocks/dev.setup'; + +//------------------------------------------------------- +// NOTE: Change folder name to where your ts files reside +//------------------------------------------------------- +const TARGET_FOLDER = 'src'; +const TARGET_FILES = `${TARGET_FOLDER}/**/*.{mjs,ts,js}`; + +export default defineConfig([ + //------------------------------------------------------------------ + // USE OUR PRECONFIGURED SETTINGS & UPDATE IT WITH YOUR TARGET FILES + //------------------------------------------------------------------ + blocksDevSetupBaseConfig.map((/** @type {any} */ config) => ({ + ...config, + files: [TARGET_FILES], + })), +]); +```` - ```` - npm install -D prettier@^3.8.1 eslint-config-prettier@^10.1.8 - ```` -- Create a `prettier.config.mjs` file at root of your project and add this setup: +#### 4. Prettier installation and setup - ```` - import basePrettier from '@build-in-blocks/dev.setup/prettier'; +Create a `prettier.config.mjs` file at root of your project and add this setup: - export default { - //------------------------------- - // USE OUR PRECONFIGURED SETTINGS - //------------------------------- - ...basePrettier, - }; - ```` +```` +import basePrettier from '@build-in-blocks/dev.setup/prettier'; + +export default { + //------------------------------- + // USE OUR PRECONFIGURED SETTINGS + //------------------------------- + ...basePrettier, +}; +```` -#### 4. Husky + lint-staged installation and setup +#### 5. Husky + lint-staged initial setup > [!NOTE] > **Before you proceed with husky setup:** Your project must be a git repository, and you must have made at least one commit to git. If you have done that already, then proceed to follow the husky-related step below. If it's not a git repository, first run the `git init` command at the root of your project to initialize it as a git repository, add and commit one or more files to git as needed, then proceed to follow the husky-related steps below. -- Install the same husky and lint-staged package versions that our dev setup uses in your project: +- Add this prepare script to your `package.json` scripts: ```` - npm i -D husky@^9.1.7 lint-staged@^16.3.2 + "scripts": { + "prepare": "npx @build-in-blocks/dev.setup@1.0.3 dev:husky:setup:git" + // your other npm scripts in your project goes here as usual + }, ```` -- Initialize husky and lint-staged: + > [!IMPORTANT] + > About `@build-in-blocks/dev.setup@[VERSION_NUMBER_HERE]` in the script: Make sure the version number used your in your `prepare` script is the same as the version of the `@build-in-blocks/dev.setup` package in your `package.json` file's `devDependencies`. + +- Initialize husky and lint-staged by running this script command: ```` - npx husky-ls-config-init + npm run prepare ```` > [!NOTE] - > After doing the above, husky will automatically add the `"prepare": "husky"` npm script command to your `package.json` file. Do not remove this script command, this is what husky will use to automate the process. + > After doing the above, husky will add the `.husky` folder with content including the `pre-commit` file. Make sure to add and commit this `pre-commit` file to git. -#### 5. Git commit test - Check that what you've setup so far works +#### 6. Git commit test - Check that what you've setup so far works - **Add this incorrectly formatted code:** Create a `.ts` file (in the `TARGET_FOLDER` that you specified in your eslint config i.e. `src` folder in this case). Copy and paste this sample code (just as it is) into the `.ts` file (don't make any corrections to the code): @@ -143,14 +155,14 @@ npm install -D @build-in-blocks/dev.setup - **Eslint + typescript intellisense:** Additinally, you should already be able to see `eslint` + `typescript` intellisense working in your code editor i.e. red and yellow wiggly lines in the new `.ts` file - that is `eslint` notifying you about the code quality-related errors and warnings present in the code. If the intellisense isn't showing for you, see the **troubleshooting** section at the end of this installation guide. -#### 6. Running Eslint and prettier manually without husky +#### 7. Running Eslint and prettier manually without husky - Add eslint and prettier script commands to your scripts in your project's `package.json` file: ```` "scripts": { "eslint:lint": "eslint .", - "prettier:format": "prettier --write \"**/*.{js,ts,css,html}\"" + "prettier:format": "prettier --write \"**/*.{mjs,ts,js,json,html,css,scss}\"", // your other npm scripts in your project goes here as usual }, ```` @@ -171,7 +183,7 @@ npm install -D @build-in-blocks/dev.setup ```` -#### 7. GitHub Actions setup +#### 8. GitHub Actions setup - Add `.github/workflows/blocks-ci.yml` file in your project, and paste the workflow code below into the file: @@ -217,20 +229,20 @@ npm install -D @build-in-blocks/dev.setup > You can update the name of the branches in the `.yml` file, remove or add as you see fit, based on what branch names your repository uses. -#### 8. Extra notes +#### 9. Extra notes Make sure to add and commit all your setup files to git, and push/merge it to your remote on GitHub. Once you do this, any contributor who clones your project's repository (or pull these new changes) will automatically have these settings work for them. All they have to do is clone the repository and install the packages in your project's `package.json` as usual - that's all! -#### 9. Troubleshooting +#### 10. Troubleshooting -- **Eslint + typescript intellisense:** If the `eslint` + `typescript` intellisense is not showing red and yellow wiggle lines in your file, first check that you have `eslint` extension installed in your code editor (that is, if you are using VScode). If you have the extension and it still doesn't show up, closing and reopening your code editor (or just the file you are editing) may fix it. +**Eslint + typescript intellisense:** If the `eslint` + `typescript` intellisense is not showing red and yellow wiggly lines in your code file, first check that you have `eslint` extension installed in your code editor (that is, if you are using VScode). If you have the extension and it still doesn't show up, closing and reopening your code editor (or just the file you are editing) may fix it. # ### Contributors -[![All Contributors](https://img.shields.io/github/all-contributors/build-in-blocks/dev.setup?color=ee8449&style=flat-square)](#contributors) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/build-in-blocks/dev.setup/blob/develop/docs.contributors/README.md) [![License: AGPL v3.0](https://img.shields.io/badge/License-AGPL%20v3.0-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) +Thanks to these amazing contributors to the **@build-in-blocks/dev.setup** project. This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. See [emoji key](https://allcontributors.org/docs/en/emoji-key). Contributions of any kind welcome! diff --git a/docs.contributors/README.md b/docs.contributors/README.md index 05a3e53..99ed2d1 100644 --- a/docs.contributors/README.md +++ b/docs.contributors/README.md @@ -63,12 +63,12 @@ Follow the instructions to fork and clone this repository locally unto your comp Complete the setup for husky and lint-staged: ```` - npx internal-husky-ls-init + npm run prepare ```` - **For your TS app:** Open a terminal specifically for your typescript app, cd into the root of your typescript app. - - **Step 1:** Follow the installation steps in the [root README.md](https://github.com/build-in-blocks/dev.setup), not from the beginning though; start from the **2. Eslint with typescript installation and setup** section (and continue till the end). + - **Step 1:** Follow the installation steps in the [root README.md](https://github.com/build-in-blocks/dev.setup), not from the beginning though; start from the **2. When to install `typescript`** section (and continue till the end). - **Step 2:** Add this to your app's package.json dependencies (take note incase library version changes in the future: use the exact version number in the `@build-in-blocks/dev.setup` library's package.json. At the time of writing, it is 1.0.0): @@ -82,7 +82,7 @@ Follow the instructions to fork and clone this repository locally unto your comp npm link ../dev.setup ``` - - **Step 3:** In your code editor, go to any `.ts` file in your app and update as needed. Check that the preconfigured settings specified in [docs.users README.md](https://github.com/build-in-blocks/dev.setup/blob/develop/docs.users/README.md) are applied. + - **Step 3:** In your code editor, go to any `.ts`, (`mjs` or `js`) file in your app and update as needed. Check that the preconfigured settings specified in [docs.users README.md](https://github.com/build-in-blocks/dev.setup/blob/develop/docs.users/README.md) are applied. # diff --git a/docs.release/README.md b/docs.release/README.md index 0c12f55..d7f0be2 100644 --- a/docs.release/README.md +++ b/docs.release/README.md @@ -4,10 +4,45 @@ > [!NOTE] > Before releasing/publishing a newer version of this package, do the following so that users and contributors are not affected negatively. Once the requirements below are satisfied, you can publish to the npm registry 🎉 +# + +> [!NOTE] +> Some or all of the processes below will be automated later. For now, ensure to "triple check" these before release. + +# + +#### This library + +- Change version number in `pkg.internal.cli.js` and `pre-commit` files. +- In the **root README** always remember to change version number: + - In `@build-in-blocks/dev.setup@[VERSION_NUMBER]` for the npm scripts part of the docs too, as you bump up the `package.json` version. + - For the .yml file's `call-shared-logic` in `uses: build-in-blocks/dev.setup/.github/workflows/central-blocks-ci.yml@v[VERSION_NUMBER_HERE]`. +- You may want to use your code editor's global search to ensure that there are no other places that need this version number change. + + +# + +#### Connected user apps + +- Before release (of your "user app" i.e. especially if it's a web library to be published), you always have to check that npx is referencing the correct/updated version in the scripts section of the package.json e.g. @1.0.0 in this case. + + ```` + "scripts": { + "prepare": "npx @build-in-blocks/dev.setup@1.0.0 dev:husky:setup:git" + // your other npm scripts in your project goes here as usual + }, + ```` + +# + +#### Build in blocks libraries in general + - **Update contributors list:** Check to see that all contributors who contributed to the success of the new release have been added to the **contributors list** on the **root README**. - **Ensure related-code works:** Check that all features to be released in the new version are working as expected, and are complete as shown on our project board. +- **General user guide update:** Check that the wiki for the general user guide has been updated when e.g. typescript version and compatibility has changed in the library's code, or a new **@build-in-blocks** library has been published etc. + - **Confirm package.json & docs content:** Always confirm that the content of the `package.json` (`scripts`, the `keywords` array etc.), as well as the **root README**, **user docs**, **contributor docs** and **release docs** content are in good/acceptable shape for the release. - **Version bumping:** Pending the time when we will automate the version bumping process, always remember to update the version number to a new one in the `package.json` file. diff --git a/docs.users/README.md b/docs.users/README.md index 7cf37e3..eac60a5 100644 --- a/docs.users/README.md +++ b/docs.users/README.md @@ -11,6 +11,12 @@ User installation and setup instructions can in the [root README.md](https://git # +### User guide extension + +More info on **@build-in-blocks** framework libraries in general can be found at: https://github.com/build-in-blocks/.github/wiki/Repo-User-Guide-Extension + +# + ### Preconfigured Eslint alert settings #### Eslint warnings @@ -57,8 +63,8 @@ In addition to `prettier`'s default settings, our preconfigured settings tells ` ### Preconfigured Husky + lint-staged settings -- Run `eslint` and `prettier` anytime a developer tries to commit code to git. -- Prevent code commit to git when any of the code linting and formatting requirements are not met. +- Runs `eslint` and `prettier` anytime a developer tries to commit code to git. +- Prevents code commit to git when any of the code linting and formatting requirements are not met. # @@ -84,17 +90,19 @@ You can find more detailed guidance in `eslint` and `typescript-eslint` document ```` // @ts-check -import { defineConfig } from 'eslint/config'; -import blocksDevSetupConfig from '@build-in-blocks/dev.setup'; +import { defineConfig, blocksDevSetupBaseConfig } from '@build-in-blocks/dev.setup'; -const TARGET_FOLDER = 'src'; // NOTE: Change folder name to where your ts files reside +//------------------------------------------------------- +// NOTE: Change folder name to where your ts files reside +//------------------------------------------------------- +const TARGET_FOLDER = 'src'; const TARGET_FILES = `${TARGET_FOLDER}/**/*.{mjs,ts,js}`; export default defineConfig([ //--------------------------------------------------------------------------- // 1. USE OUR PRECONFIGURED SETTINGS & UPDATE IT WITH YOUR TARGET FILES FIRST //--------------------------------------------------------------------------- - blocksDevSetupConfig.map(config => ({ + blocksDevSetupBaseConfig.map((/** @type {any} */ config) => ({ ...config, files: [TARGET_FILES], })), diff --git a/package.json b/package.json index cdb34e2..2a0e780 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,17 @@ "framework", "library", "package", + "typescript", + "javascript", + "node", + "web", + "shared", + "core", + "local development", + "local", + "development", + "dev", + "setup", "eslint", "prettier", "husky", @@ -59,12 +70,7 @@ "pre-commit hook", "code quality", "code formatting", - "typescript", - "javascript", - "node", "config", - "setup", - "dev environment", "ci", "continuous integration" ],