diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755 index 0cf3a8f..05ab555 --- 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 @build-in-blocks/dev.setup@1.0.3 dev:internal:lint \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 162a220..fcb32dd 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,11 +4,14 @@ # 2. Allow directories !*/ -# 3. Specifically allow these FOUR types -!*.js +# 3. Specifically allow these SEVEN file types +!*.mjs !*.ts -!*.css +!*.js +!*.json !*.html +!*.css +!*.scss # 4. Standard ignores node_modules/ diff --git a/README.md b/README.md index ebf0182..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}/**/*.{ts,js,tsx}`; - - 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: @@ -188,7 +200,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 # ------------------------------------------------- @@ -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/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/pkg.internal.cli.js b/bin/pkg.internal.cli.js new file mode 100755 index 0000000..34b1caa --- /dev/null +++ b/bin/pkg.internal.cli.js @@ -0,0 +1,103 @@ +#!/usr/bin/env node + +/*global console*/ + +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.3'; + +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 { + return binPath({ pkgName, binSubPath }); + } catch { + return path.resolve(internalBinPath, pkgName); + } + }; + //- + 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 + // 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 ${internalCommand} ${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', + //-------------------------------------------------------------------------- + // 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}"`, { + stdio: 'inherit', + cwd: userAppRoot, + env, + }); + } catch { + process.exit(1); + } + } +} 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/eslint.helper.mjs b/config.programmed/eslint.helper.mjs new file mode 100644 index 0000000..7263d7f --- /dev/null +++ b/config.programmed/eslint.helper.mjs @@ -0,0 +1,12 @@ +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 }; diff --git a/config.programmed/lint-staged.config.mjs b/config.programmed/lint-staged.config.mjs new file mode 100644 index 0000000..a767dbb --- /dev/null +++ b/config.programmed/lint-staged.config.mjs @@ -0,0 +1,36 @@ +import { path, process } from '../config.root/external.packages.js'; +import { binPath } from '../config.root/root.js'; + +const userAppRoot = process.cwd(); + +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' }); + +//-------------------------------------------- +// 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,ts,js}': [ + //------------------------------------------------- + // 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}': [ + //------------------------- + // Formats other file types + //------------------------- + `${prettier} --config "${userPrettierConfig}" --write --ignore-unknown`, + ], +}; 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/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 fe95c77..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 -const TARGET_FILES = `${TARGET_FOLDER}/**/*.{ts,js,tsx}`; +//------------------------------------------------------- +// 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/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/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-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 27a4485..2a0e780 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "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": "eslint.config.mjs", + "main": "config.programmed/eslint.helper.mjs", "bin": { - "husky-ls-config-init": "bin/user-app.husky.lint-staged.js", - "internal-husky-ls-init": "bin/internal.husky.lint-staged.js" + "@build-in-blocks/dev.setup": "bin/pkg.internal.cli.js", + "blocks.pkg.dev.setup": "bin/pkg.internal.cli.js" }, "exports": { - ".": "./eslint.config.mjs", + ".": "./config.programmed/eslint.helper.mjs", "./prettier": "./prettier.config.mjs" }, "publishConfig": { @@ -17,8 +17,8 @@ }, "scripts": { "eslint:lint": "eslint .", - "prettier:format": "prettier --write \"**/*.{js,ts,css,html}\"", - "prepare": "husky" + "prettier:format": "prettier --write \"**/*.{mjs,ts,js,json,html,css,scss}\"", + "prepare": "node ./bin/pkg.internal.cli.js dev:husky:setup:git" }, "dependencies": { "@eslint/js": "^10.0.1", @@ -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", @@ -40,7 +39,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": [ @@ -52,6 +51,17 @@ "framework", "library", "package", + "typescript", + "javascript", + "node", + "web", + "shared", + "core", + "local development", + "local", + "development", + "dev", + "setup", "eslint", "prettier", "husky", @@ -60,20 +70,16 @@ "pre-commit hook", "code quality", "code formatting", - "typescript", - "javascript", - "node", "config", - "setup", - "dev environment", "ci", "continuous integration" ], "files": [ "bin/", + "config.programmed/", + "config.root/", "eslint.config.mjs", "prettier.config.mjs", - "lint-staged.config.js", "README.md" ] }