@rtorcato/js-tooling 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +16 -209
  2. package/dist/cli/commands/doctor.js +160 -0
  3. package/dist/cli/index.js +30 -1
  4. package/package.json +127 -30
  5. package/tooling/commitlint/commitlint.d.mts +4 -0
  6. package/tooling/esbuild/index.d.mts +6 -0
  7. package/tooling/eslint/base.d.mts +6 -0
  8. package/tooling/eslint/nextjs.d.mts +4 -0
  9. package/tooling/jest-presets/browser/jest-preset.d.mts +4 -0
  10. package/tooling/jest-presets/node/jest-preset.d.mts +4 -0
  11. package/tooling/prettier/index.d.mts +4 -0
  12. package/tooling/semantic-release/docker.d.mts +4 -0
  13. package/tooling/semantic-release/github.d.mts +4 -0
  14. package/tooling/semantic-release/index.d.mts +4 -0
  15. package/tooling/vitest/vitest.config.d.mts +4 -0
  16. package/tooling/vitest/vitest.config.mjs +9 -2
  17. package/tooling/vitest/vitest.config.react.d.mts +4 -0
  18. package/tooling/vitest/vitest.setup.d.mts +1 -0
  19. package/scripts/README.md +0 -8
  20. package/scripts/commitmessage.sh +0 -44
  21. package/scripts/helloworld.sh +0 -5
  22. package/tooling/esbuild/build-sample.mjs +0 -21
  23. package/tooling/eslint/package.json +0 -35
  24. package/tooling/nextjs/next.config.js +0 -4
  25. package/tooling/oxc/.gitkeep +0 -0
  26. package/tooling/oxc/README.md +0 -1
  27. package/tooling/playwright/playwright.config.ts +0 -0
  28. package/tooling/rolldown/.gitkeep +0 -0
  29. package/tooling/rollup/.gitkeep +0 -0
  30. package/tooling/tsdown/.gitkeep +0 -0
  31. package/tooling/tsup/tsconfig.cjs.json +0 -7
  32. package/tooling/tsup/tsconfig.esm.json +0 -9
  33. package/tooling/tsup/tsconfig.json +0 -11
  34. package/tooling/tsup/tsconfig.types.json +0 -9
  35. package/tooling/vellite/.gitkeep +0 -0
  36. package/tooling/vite/.gitkeep +0 -0
package/README.md CHANGED
@@ -1,229 +1,36 @@
1
1
  # js-tooling
2
2
 
3
- A comprehensive collection of JavaScript/TypeScript development tools and configurations for modern projects.
3
+ JavaScript and TypeScript tooling for Node.js, React, Next.js, and Vitest.
4
4
 
5
- ## Installation
6
-
7
- Install the package globally or use it directly with npx:
8
-
9
- ```bash
10
- # Install globally
11
- npm install -g @rtorcato/js-tooling
12
-
13
- # Or use with npx
14
- npx @rtorcato/js-tooling setup
15
- ```
16
-
17
- ## Getting started
18
-
19
- Use the interactive CLI to set up tooling for your project:
20
-
21
- ```bash
22
- npx @rtorcato/js-tooling setup
23
- ```
24
-
25
- Or import specific configurations:
26
-
27
- ```javascript
28
- import '@rtorcato/js-tooling/typescript/base';
29
- ```
30
-
31
- ## Available Tools
32
-
33
- This package includes configurations and presets for:
34
-
35
- - **TypeScript** - Base configurations for different project types
36
- - **ESLint** - Linting rules for JavaScript and TypeScript
37
- - **Prettier** - Code formatting configuration
38
- - **Biome** - Fast linter and formatter
39
- - **Vitest** - Testing framework configuration
40
- - **Jest** - Testing framework presets
41
- - **Commitlint** - Commit message linting
42
- - **Semantic Release** - Automated versioning and publishing
43
- - **GitHub Actions** - CI/CD workflow templates
44
- - **And more...**
45
-
46
- ## CI/CD Setup
47
-
48
- The package includes GitHub Actions workflows and semantic-release configuration. For automated publishing, set these secrets in your GitHub repository:
49
-
50
- 1. **`NPM_TOKEN`** - npm authentication token for publishing packages
51
- 2. **`GITHUB_TOKEN`** - automatically provided by GitHub Actions
52
-
53
- Repository settings: `https://github.com/your-username/your-repo/settings/secrets/actions`
54
-
55
- ## CLI Commands
56
-
57
- The package provides several CLI commands:
58
-
59
- ```bash
60
- # Interactive project setup wizard
61
- npx @rtorcato/js-tooling setup
62
-
63
- # Copy configuration files to current directory
64
- npx @rtorcato/js-tooling copy biome
65
- npx @rtorcato/js-tooling copy tsconfig
66
-
67
- # List all available configurations
68
- npx @rtorcato/js-tooling list
69
-
70
- # Run commit message helper
71
- npx @rtorcato/js-tooling commitmessage
72
-
73
- # Hello world example
74
- npx @rtorcato/js-tooling helloworld
75
- ```
76
-
77
- ## Configuration Usage
78
-
79
- ### Biome (Formatter & Linter)
80
-
81
- Since Biome doesn't support configuration extension, use the copy command to get the base configuration:
82
-
83
- ```bash
84
- # Copy base Biome configuration
85
- npx @rtorcato/js-tooling copy biome
86
- ```
87
-
88
- This creates a `biome.json` file with:
89
- - Tab indentation, 100 character line width
90
- - Single quotes, ES5 trailing commas
91
- - Recommended linting rules with sensible overrides
92
- - Smart file patterns excluding build directories
93
-
94
- After copying, customize for your project:
95
-
96
- ```json
97
- {
98
- "linter": {
99
- "rules": {
100
- "recommended": true,
101
- "suspicious": {
102
- "noExplicitAny": "error"
103
- }
104
- }
105
- }
106
- }
107
- ```
108
-
109
- ### TypeScript
110
-
111
- Import TypeScript configurations directly in your `tsconfig.json`:
112
-
113
- ```json
114
- {
115
- "extends": "@rtorcato/js-tooling/typescript/base"
116
- }
117
- ```
118
-
119
- Available configurations:
120
- - `typescript/base` - Base configuration for all projects
121
- - `typescript/react` - React-specific settings
122
- - `typescript/next` - Next.js optimized configuration
123
- - `typescript/node` - Node.js server configuration
124
- - `typescript/express` - Express.js API configuration
125
-
126
- ### ESLint
127
-
128
- ```javascript
129
- // eslint.config.js
130
- import baseConfig from '@rtorcato/js-tooling/eslint/base'
131
- import nextjsConfig from '@rtorcato/js-tooling/eslint/nextjs'
132
-
133
- export default [
134
- ...baseConfig,
135
- // Add project-specific rules
136
- ]
137
- ```
138
-
139
- ### Commitlint
140
-
141
- ```javascript
142
- // commitlint.config.js
143
- import config from '@rtorcato/js-tooling/commitlint/config'
144
- export default config
145
- ```
146
-
147
- ### Vitest
148
-
149
- ```javascript
150
- // vitest.config.js
151
- import { defineConfig } from 'vitest/config'
152
- import baseConfig from '@rtorcato/js-tooling/vitest/config'
153
-
154
- export default defineConfig({
155
- ...baseConfig,
156
- // Add project-specific settings
157
- })
158
- ```
159
-
160
- ### Semantic Release
161
-
162
- ```javascript
163
- // release.config.js
164
- import config from '@rtorcato/js-tooling/semantic-release/github'
165
- export default config
166
- ```
5
+ [![CI](https://github.com/rtorcato/js-tooling/actions/workflows/ci.yml/badge.svg)](https://github.com/rtorcato/js-tooling/actions/workflows/ci.yml)
6
+ [![npm version](https://badge.fury.io/js/@rtorcato%2Fjs-tooling.svg)](https://badge.fury.io/js/@rtorcato%2Fjs-tooling)
7
+ [![npm downloads](https://img.shields.io/npm/dm/@rtorcato%2Fjs-tooling)](https://www.npmjs.com/package/@rtorcato/js-tooling)
8
+ [![Bundle size](https://img.shields.io/bundlephobia/minzip/@rtorcato/js-tooling)](https://bundlephobia.com/package/@rtorcato/js-tooling)
9
+ [![Coverage](https://codecov.io/gh/rtorcato/js-tooling/branch/main/graph/badge.svg)](https://codecov.io/gh/rtorcato/js-tooling)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
167
11
 
168
- ## Using with Package Managers
12
+ Most tooling libraries give you one piece — just TypeScript configs, or just an ESLint preset. **js-tooling** covers the entire lifecycle: TypeScript, Biome/ESLint, Vitest/Jest, Commitlint, Husky, Semantic Release, and GitHub Actions CI — all wired together. The interactive `setup` wizard scaffolds everything in one shot; `doctor` checks an existing project for drift.
169
13
 
170
- ### With pnpm
171
- ```bash
172
- # Temporarily install and run
173
- pnpm --package=@rtorcato/js-tooling dlx setup
14
+ **[Full documentation →](https://rtorcato.github.io/js-tooling/)**
174
15
 
175
- # Or install globally
176
- pnpm add -g @rtorcato/js-tooling
177
- ```
16
+ ## Quick start
178
17
 
179
- ### With npm
180
18
  ```bash
181
- # Use directly
182
19
  npx @rtorcato/js-tooling setup
183
-
184
- # Or install globally
185
- npm install -g @rtorcato/js-tooling
186
20
  ```
187
21
 
188
- ## Development
189
-
190
- To work on this package locally:
191
-
192
- 1. Clone the repository:
193
- ```bash
194
- git clone https://github.com/rtorcato/js-tooling.git
195
- cd js-tooling
196
- ```
197
-
198
- 2. Install dependencies:
199
- ```bash
200
- pnpm install
201
- ```
202
-
203
- 3. Build the CLI:
204
- ```bash
205
- pnpm run build-cli
206
- ```
22
+ ## What's new
207
23
 
208
- 4. Link globally for testing:
209
- ```bash
210
- pnpm link --global
211
- ```
24
+ See [CHANGELOG.md](CHANGELOG.md) for the full history.
212
25
 
213
- For more details, refer to the [pnpm link documentation](https://pnpm.io/cli/link).
26
+ **v2.0.0** All 39 tool packages moved from `dependencies` to `peerDependencies`. Add them to your own `devDependencies`. Also ships: `doctor` subcommand, generator unit tests, Dependabot, CI matrix (Node 22 + 24).
214
27
 
215
- ## Status
216
-
217
- [![CI](https://github.com/rtorcato/js-tooling/actions/workflows/ci.yml/badge.svg)](https://github.com/rtorcato/js-tooling/actions/workflows/ci.yml)
218
- [![npm version](https://badge.fury.io/js/@rtorcato%2Fjs-tooling.svg)](https://badge.fury.io/js/@rtorcato%2Fjs-tooling)
219
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
220
- [![GitHub release (latest by date)](https://img.shields.io/github/v/release/rtorcato/js-tooling)](https://github.com/rtorcato/js-tooling/releases)
221
- [![GitHub issues](https://img.shields.io/github/issues/rtorcato/js-tooling)](https://github.com/rtorcato/js-tooling/issues)
28
+ **v1.1.0** — Stricter commitlint limits, fix for CLI path resolution when copying configs.
222
29
 
223
30
  ## Contributing
224
31
 
225
- Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTING.md) and feel free to submit issues and pull requests.
32
+ Contributions welcome see [CONTRIBUTING.md](CONTRIBUTING.md).
226
33
 
227
34
  ## License
228
35
 
229
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
36
+ MIT see [LICENSE](LICENSE).
@@ -0,0 +1,160 @@
1
+ import chalk from 'chalk';
2
+ import fs from 'fs-extra';
3
+ import path from 'node:path';
4
+ const PACKAGE = '@rtorcato/js-tooling';
5
+ const FILE_CHECKS = [
6
+ {
7
+ check: 'TypeScript',
8
+ candidates: ['tsconfig.json'],
9
+ expected: `extends "${PACKAGE}/typescript/*"`,
10
+ matcher: /@rtorcato\/js-tooling\/typescript\//,
11
+ hint: 'Set `"extends": "@rtorcato/js-tooling/typescript/base"` in tsconfig.json',
12
+ },
13
+ {
14
+ check: 'Biome',
15
+ candidates: ['biome.json', 'biome.jsonc'],
16
+ expected: `extends "${PACKAGE}/biome"`,
17
+ matcher: /@rtorcato\/js-tooling\/biome/,
18
+ optional: true,
19
+ hint: 'Run `npx @rtorcato/js-tooling copy biome` to scaffold',
20
+ },
21
+ {
22
+ check: 'ESLint',
23
+ candidates: ['eslint.config.js', 'eslint.config.mjs', 'eslint.config.cjs'],
24
+ expected: `imports "${PACKAGE}/eslint/*"`,
25
+ matcher: /@rtorcato\/js-tooling\/eslint\//,
26
+ optional: true,
27
+ hint: 'Import from @rtorcato/js-tooling/eslint/base in eslint.config.mjs',
28
+ },
29
+ {
30
+ check: 'Prettier',
31
+ candidates: ['prettier.config.js', 'prettier.config.mjs', 'prettier.config.cjs'],
32
+ expected: `imports "${PACKAGE}/prettier"`,
33
+ matcher: /@rtorcato\/js-tooling\/prettier/,
34
+ optional: true,
35
+ },
36
+ {
37
+ check: 'Vitest',
38
+ candidates: ['vitest.config.ts', 'vitest.config.js', 'vitest.config.mjs'],
39
+ expected: `imports "${PACKAGE}/vitest/config"`,
40
+ matcher: /@rtorcato\/js-tooling\/vitest\/config/,
41
+ optional: true,
42
+ },
43
+ {
44
+ check: 'Commitlint',
45
+ candidates: ['commitlint.config.js', 'commitlint.config.mjs', 'commitlint.config.cjs'],
46
+ expected: `exports "${PACKAGE}/commitlint/config"`,
47
+ matcher: /@rtorcato\/js-tooling\/commitlint\/config/,
48
+ optional: true,
49
+ },
50
+ ];
51
+ async function checkFile(dir, spec) {
52
+ for (const candidate of spec.candidates) {
53
+ const filepath = path.join(dir, candidate);
54
+ if (!(await fs.pathExists(filepath)))
55
+ continue;
56
+ const contents = await fs.readFile(filepath, 'utf-8');
57
+ if (spec.matcher.test(contents)) {
58
+ return {
59
+ check: spec.check,
60
+ status: 'ok',
61
+ detail: `${candidate} ${spec.expected}`,
62
+ };
63
+ }
64
+ return {
65
+ check: spec.check,
66
+ status: 'drift',
67
+ detail: `${candidate} found but does not ${spec.expected}`,
68
+ hint: spec.hint,
69
+ };
70
+ }
71
+ return {
72
+ check: spec.check,
73
+ status: spec.optional ? 'optional-missing' : 'missing',
74
+ detail: `no ${spec.candidates.join(' / ')} found`,
75
+ hint: spec.hint,
76
+ };
77
+ }
78
+ async function checkPackageJson(dir) {
79
+ const filepath = path.join(dir, 'package.json');
80
+ if (!(await fs.pathExists(filepath))) {
81
+ return {
82
+ check: 'package.json',
83
+ status: 'missing',
84
+ detail: 'no package.json found',
85
+ };
86
+ }
87
+ const pkg = await fs.readJson(filepath);
88
+ const deps = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) };
89
+ if (deps[PACKAGE]) {
90
+ return {
91
+ check: 'package.json',
92
+ status: 'ok',
93
+ detail: `${PACKAGE}@${deps[PACKAGE]} in dependencies`,
94
+ };
95
+ }
96
+ return {
97
+ check: 'package.json',
98
+ status: 'drift',
99
+ detail: `${PACKAGE} not in dependencies or devDependencies`,
100
+ hint: `Run \`pnpm add -D ${PACKAGE}\``,
101
+ };
102
+ }
103
+ export async function runDoctor(dir) {
104
+ const targetDir = path.resolve(dir);
105
+ const results = [];
106
+ results.push(await checkPackageJson(targetDir));
107
+ for (const spec of FILE_CHECKS) {
108
+ results.push(await checkFile(targetDir, spec));
109
+ }
110
+ return results;
111
+ }
112
+ const STATUS_ICONS = {
113
+ ok: chalk.green('✅'),
114
+ drift: chalk.yellow('⚠️ '),
115
+ missing: chalk.red('❌'),
116
+ 'optional-missing': chalk.gray('➖'),
117
+ };
118
+ function statusLabel(status) {
119
+ switch (status) {
120
+ case 'ok':
121
+ return chalk.green('ok');
122
+ case 'drift':
123
+ return chalk.yellow('drift');
124
+ case 'missing':
125
+ return chalk.red('missing');
126
+ case 'optional-missing':
127
+ return chalk.gray('not configured');
128
+ }
129
+ }
130
+ export function summarize(results) {
131
+ return {
132
+ ok: results.filter((r) => r.status === 'ok').length,
133
+ drift: results.filter((r) => r.status === 'drift').length,
134
+ missing: results.filter((r) => r.status === 'missing').length,
135
+ optionalMissing: results.filter((r) => r.status === 'optional-missing').length,
136
+ };
137
+ }
138
+ export async function doctorCommand(options = {}) {
139
+ const dir = options.directory ?? process.cwd();
140
+ const results = await runDoctor(dir);
141
+ if (options.json) {
142
+ console.log(JSON.stringify({ directory: path.resolve(dir), results }, null, 2));
143
+ }
144
+ else {
145
+ console.log(chalk.cyan(`\n🩺 Diagnosing ${path.resolve(dir)} against ${PACKAGE} presets...\n`));
146
+ for (const r of results) {
147
+ console.log(` ${STATUS_ICONS[r.status]} ${chalk.bold(r.check)} — ${statusLabel(r.status)}`);
148
+ console.log(` ${chalk.gray(r.detail)}`);
149
+ if (r.hint && (r.status === 'drift' || r.status === 'missing')) {
150
+ console.log(` ${chalk.dim('hint:')} ${chalk.dim(r.hint)}`);
151
+ }
152
+ }
153
+ const summary = summarize(results);
154
+ console.log();
155
+ console.log(` Summary: ${chalk.green(`${summary.ok} ok`)}, ${chalk.yellow(`${summary.drift} drift`)}, ${chalk.red(`${summary.missing} missing`)}, ${chalk.gray(`${summary.optionalMissing} not configured`)}\n`);
156
+ }
157
+ const summary = summarize(results);
158
+ const exitCode = summary.drift > 0 || summary.missing > 0 ? 1 : 0;
159
+ process.exitCode = exitCode;
160
+ }
package/dist/cli/index.js CHANGED
@@ -1,8 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ import path from 'node:path';
2
3
  import chalk from 'chalk';
3
4
  import { Command } from 'commander';
5
+ import fs from 'fs-extra';
4
6
  import packageJson from '../../package.json' with { type: 'json' };
7
+ import { doctorCommand } from './commands/doctor.js';
5
8
  import { setupProject } from './commands/setup.js';
9
+ async function isSelfRepo(dir) {
10
+ try {
11
+ const pkg = await fs.readJson(path.join(dir, 'package.json'));
12
+ return pkg.name === '@rtorcato/js-tooling';
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
6
18
  const program = new Command();
7
19
  program
8
20
  .name('@rtorcato/js-tooling')
@@ -38,7 +50,7 @@ program
38
50
  console.log(` ${chalk.green('●')} ${chalk.bold(key)}: ${chalk.gray(desc)}`);
39
51
  });
40
52
  console.log();
41
- return;
53
+ process.exit(1);
42
54
  }
43
55
  const { source, target, desc } = availableConfigs[config];
44
56
  try {
@@ -89,6 +101,23 @@ program
89
101
  });
90
102
  console.log(chalk.dim('\n💡 Run "js-tooling setup" to configure your project\n'));
91
103
  });
104
+ program
105
+ .command('doctor')
106
+ .description('🩺 Diagnose project alignment with @rtorcato/js-tooling presets')
107
+ .option('-d, --directory <path>', 'Target directory to diagnose', process.cwd())
108
+ .option('--json', 'Emit machine-readable JSON output')
109
+ .action(doctorCommand);
110
+ program.hook('preAction', async (_, actionCommand) => {
111
+ const name = actionCommand.name();
112
+ if (name === 'setup' || name === 'doctor') {
113
+ const dir = actionCommand.opts().directory ?? process.cwd();
114
+ if (await isSelfRepo(dir)) {
115
+ console.log(chalk.yellow('\n⚠️ This command cannot be run inside the @rtorcato/js-tooling repo itself.\n'));
116
+ console.log(chalk.gray(' setup and doctor are for consumer projects, not for the tooling repo.\n'));
117
+ process.exit(0);
118
+ }
119
+ }
120
+ });
92
121
  // Handle unknown commands
93
122
  program.on('command:*', () => {
94
123
  console.error(chalk.red(`\n❌ Unknown command: ${program.args.join(' ')}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtorcato/js-tooling",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "JavaScript and TypeScript tooling for Node.js, React, Next.js, and Vitest.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -20,8 +20,7 @@
20
20
  "url": "https://github.com/rtorcato/js-tooling/issues"
21
21
  },
22
22
  "scripts": {
23
- "build-dev": "rimraf ./dist && cross-env NODE_ENV=development node build.mjs && pnpm build-cli",
24
- "build-prod": "rimraf ./dist && cross-env NODE_ENV=production node build.mjs && pnpm build-cli",
23
+ "build": "pnpm build-cli",
25
24
  "build-cli": "rimraf ./dist/cli && tsc --project src/cli/tsconfig.json",
26
25
  "prepublishOnly": "./scripts/fix-bins.sh",
27
26
  "==================== Common ====================": "",
@@ -34,36 +33,65 @@
34
33
  "test": "vitest",
35
34
  "test:watch": "vitest --watch",
36
35
  "coverage": "vitest run --coverage",
36
+ "knip": "knip",
37
37
  "commit": "cz",
38
38
  "================================================": ""
39
39
  },
40
40
  "files": [
41
41
  "dist/cli/**/*.js",
42
- "tooling/*",
43
42
  "tooling/commitlint/commitlint.mjs",
43
+ "tooling/commitlint/commitlint.d.mts",
44
44
  "tooling/esbuild/index.mjs",
45
+ "tooling/esbuild/index.d.mts",
45
46
  "tooling/eslint/*.mjs",
47
+ "tooling/eslint/*.d.mts",
48
+ "tooling/eslint/types.d.ts",
46
49
  "tooling/jest-presets/**",
47
50
  "tooling/prettier/index.mjs",
51
+ "tooling/prettier/index.d.mts",
48
52
  "tooling/typescript/*.json",
49
53
  "tooling/typescript/reset.d.ts",
50
54
  "tooling/vitest/vitest.config.mjs",
55
+ "tooling/vitest/vitest.config.d.mts",
56
+ "tooling/vitest/vitest.config.react.mjs",
57
+ "tooling/vitest/vitest.config.react.d.mts",
58
+ "tooling/vitest/vitest.setup.mjs",
59
+ "tooling/vitest/vitest.setup.d.mts",
51
60
  "tooling/tsup/index.ts",
52
61
  "tooling/biome/biome.json",
53
- "tooling/biome/biome.jsonc",
54
62
  "tooling/semantic-release/*.mjs",
63
+ "tooling/semantic-release/*.d.mts",
55
64
  "README.md"
56
65
  ],
57
66
  "exports": {
58
67
  "./commitlint/config": {
68
+ "types": "./tooling/commitlint/commitlint.d.mts",
59
69
  "import": "./tooling/commitlint/commitlint.mjs"
60
70
  },
61
- "./esbuild": "./tooling/esbuild/index.mjs",
62
- "./eslint/base": "./tooling/eslint/base.mjs",
63
- "./eslint/nextjs": "./tooling/eslint/nextjs.mjs",
64
- "./jest-presets/browser/jest-preset": "./tooling/jest-presets/browser/jest-preset.mjs",
65
- "./jest-presets/node/jest-preset": "./tooling/jest-presets/node/jest-preset.mjs",
66
- "./prettier": "./tooling/prettier/index.mjs",
71
+ "./esbuild": {
72
+ "types": "./tooling/esbuild/index.d.mts",
73
+ "import": "./tooling/esbuild/index.mjs"
74
+ },
75
+ "./eslint/base": {
76
+ "types": "./tooling/eslint/base.d.mts",
77
+ "import": "./tooling/eslint/base.mjs"
78
+ },
79
+ "./eslint/nextjs": {
80
+ "types": "./tooling/eslint/nextjs.d.mts",
81
+ "import": "./tooling/eslint/nextjs.mjs"
82
+ },
83
+ "./jest-presets/browser/jest-preset": {
84
+ "types": "./tooling/jest-presets/browser/jest-preset.d.mts",
85
+ "import": "./tooling/jest-presets/browser/jest-preset.mjs"
86
+ },
87
+ "./jest-presets/node/jest-preset": {
88
+ "types": "./tooling/jest-presets/node/jest-preset.d.mts",
89
+ "import": "./tooling/jest-presets/node/jest-preset.mjs"
90
+ },
91
+ "./prettier": {
92
+ "types": "./tooling/prettier/index.d.mts",
93
+ "import": "./tooling/prettier/index.mjs"
94
+ },
67
95
  "./typescript/base": "./tooling/typescript/tsconfig.base.json",
68
96
  "./typescript/next": "./tooling/typescript/tsconfig.next.json",
69
97
  "./typescript/express": "./tooling/typescript/tsconfig.express.json",
@@ -71,23 +99,46 @@
71
99
  "./typescript/react": "./tooling/typescript/tsconfig.react.json",
72
100
  "./typescript/test": "./tooling/typescript/tsconfig.test.json",
73
101
  "./typescript/reset": "./tooling/typescript/reset.d.ts",
74
- "./vitest/config": "./tooling/vitest/vitest.config.mjs",
102
+ "./vitest/config": {
103
+ "types": "./tooling/vitest/vitest.config.d.mts",
104
+ "import": "./tooling/vitest/vitest.config.mjs"
105
+ },
106
+ "./vitest/react": {
107
+ "types": "./tooling/vitest/vitest.config.react.d.mts",
108
+ "import": "./tooling/vitest/vitest.config.react.mjs"
109
+ },
110
+ "./vitest/setup": {
111
+ "types": "./tooling/vitest/vitest.setup.d.mts",
112
+ "import": "./tooling/vitest/vitest.setup.mjs"
113
+ },
75
114
  "./tsup": "./tooling/tsup/index.ts",
76
115
  "./biome": "./tooling/biome/biome.json",
77
- "./semantic-release": "./tooling/semantic-release/index.mjs",
78
- "./semantic-release/github": "./tooling/semantic-release/github.mjs",
79
- "./semantic-release/docker": "./tooling/semantic-release/docker.mjs"
116
+ "./semantic-release": {
117
+ "types": "./tooling/semantic-release/index.d.mts",
118
+ "import": "./tooling/semantic-release/index.mjs"
119
+ },
120
+ "./semantic-release/github": {
121
+ "types": "./tooling/semantic-release/github.d.mts",
122
+ "import": "./tooling/semantic-release/github.mjs"
123
+ },
124
+ "./semantic-release/docker": {
125
+ "types": "./tooling/semantic-release/docker.d.mts",
126
+ "import": "./tooling/semantic-release/docker.mjs"
127
+ }
80
128
  },
81
129
  "dependencies": {
82
130
  "chalk": "^5.6.2",
83
- "commander": "^14.0.1",
131
+ "commander": "^14.0.3",
84
132
  "fs-extra": "^11.3.2",
85
- "inquirer": "^12.10.0"
133
+ "inquirer": "^14.0.0"
86
134
  },
87
135
  "devDependencies": {
88
136
  "@biomejs/biome": "^2.3.0",
137
+ "@commitlint/types": "^20.0.0",
138
+ "@eslint/js": "^9.38.0",
139
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.2",
89
140
  "@commitlint/cli": "^20.1.0",
90
- "@commitlint/config-conventional": "^20.0.0",
141
+ "@commitlint/config-conventional": "^21.0.1",
91
142
  "@next/eslint-plugin-next": "^16.0.0",
92
143
  "@playwright/test": "^1.56.1",
93
144
  "@semantic-release/changelog": "^6.0.3",
@@ -99,17 +150,17 @@
99
150
  "@semantic-release/release-notes-generator": "^14.1.0",
100
151
  "@total-typescript/ts-reset": "0.6.1",
101
152
  "@types/fs-extra": "^11.0.4",
102
- "@types/inquirer": "^9.0.9",
103
- "@types/node": "^24.9.1",
153
+ "@types/node": "^25.9.1",
104
154
  "@typescript-eslint/eslint-plugin": "^8.46.2",
105
155
  "@typescript-eslint/parser": "^8.46.2",
106
156
  "@vitejs/plugin-react": "^5.1.0",
157
+ "@vitest/coverage-v8": "^4.0.3",
107
158
  "commitizen": "^4.3.1",
108
- "conventional-changelog-conventionalcommits": "^9.1.0",
159
+ "conventional-changelog-conventionalcommits": "^9.3.1",
109
160
  "cross-env": "^10.1.0",
110
161
  "cz-conventional-changelog": "^3.3.0",
111
162
  "esbuild": "^0.25.11",
112
- "esbuild-node-externals": "^1.18.0",
163
+ "esbuild-node-externals": "^1.22.0",
113
164
  "eslint": "9.38.0",
114
165
  "eslint-config-airbnb": "^19.0.4",
115
166
  "eslint-config-prettier": "10.1.8",
@@ -120,6 +171,7 @@
120
171
  "eslint-plugin-react": "^7.37.5",
121
172
  "eslint-plugin-react-hooks": "^7.0.0",
122
173
  "eslint-plugin-vitest": "0.5.4",
174
+ "jest": "^29.7.0",
123
175
  "husky": "^9.1.7",
124
176
  "is-ci": "^4.1.0",
125
177
  "lint-staged": "^16.2.6",
@@ -128,15 +180,19 @@
128
180
  "rimraf": "6.0.1",
129
181
  "semantic-release": "^25.0.1",
130
182
  "ts-jest": "^29.4.5",
131
- "tsup": "8.5.0",
183
+ "tsup": "8.5.1",
132
184
  "typescript": "^5.9.3",
133
- "typescript-eslint": "latest",
134
- "vitest": "4.0.3"
185
+ "typescript-eslint": "^8.60.0",
186
+ "vitest": "4.0.3",
187
+ "knip": "^5.61.3"
135
188
  },
136
189
  "peerDependencies": {
137
190
  "@biomejs/biome": "^2.0.0",
191
+ "@commitlint/types": "^20.0.0",
192
+ "@eslint/js": "^9.0.0",
193
+ "@ianvs/prettier-plugin-sort-imports": "^4.0.0",
138
194
  "@commitlint/cli": "^20.0.0",
139
- "@commitlint/config-conventional": "^20.0.0",
195
+ "@commitlint/config-conventional": "^21.0.1",
140
196
  "@next/eslint-plugin-next": "^16.0.0",
141
197
  "@playwright/test": "^1.50.0",
142
198
  "@semantic-release/changelog": "^6.0.0",
@@ -153,7 +209,7 @@
153
209
  "commitizen": "^4.0.0",
154
210
  "conventional-changelog-conventionalcommits": "^9.0.0",
155
211
  "cz-conventional-changelog": "^3.0.0",
156
- "esbuild": "^0.25.0",
212
+ "esbuild": "^0.25.0 || ^0.27.0 || ^0.28.0",
157
213
  "esbuild-node-externals": "^1.0.0",
158
214
  "eslint": ">=9.0.0",
159
215
  "eslint-config-airbnb": "^19.0.0",
@@ -165,6 +221,7 @@
165
221
  "eslint-plugin-react": "^7.0.0",
166
222
  "eslint-plugin-react-hooks": "^7.0.0",
167
223
  "eslint-plugin-vitest": "^0.5.0",
224
+ "jest": "^29.0.0",
168
225
  "husky": "^9.0.0",
169
226
  "lint-staged": ">=16.0.0",
170
227
  "prettier": "^3.0.0",
@@ -180,6 +237,15 @@
180
237
  "@biomejs/biome": {
181
238
  "optional": true
182
239
  },
240
+ "@commitlint/types": {
241
+ "optional": true
242
+ },
243
+ "@eslint/js": {
244
+ "optional": true
245
+ },
246
+ "@ianvs/prettier-plugin-sort-imports": {
247
+ "optional": true
248
+ },
183
249
  "@commitlint/cli": {
184
250
  "optional": true
185
251
  },
@@ -270,6 +336,9 @@
270
336
  "eslint-plugin-vitest": {
271
337
  "optional": true
272
338
  },
339
+ "jest": {
340
+ "optional": true
341
+ },
273
342
  "husky": {
274
343
  "optional": true
275
344
  },
@@ -301,6 +370,36 @@
301
370
  "optional": true
302
371
  }
303
372
  },
373
+ "knip": {
374
+ "entry": [
375
+ "src/cli/index.ts",
376
+ "src/cli/commands/doctor.ts",
377
+ "tooling/**/*.{mjs,ts}"
378
+ ],
379
+ "project": [
380
+ "src/**/*.ts",
381
+ "tooling/**/*.{mjs,ts}"
382
+ ],
383
+ "ignoreDependencies": [
384
+ "cross-env",
385
+ "@playwright/test",
386
+ "eslint-config-airbnb",
387
+ "eslint-config-prettier",
388
+ "eslint-config-turbo",
389
+ "eslint-plugin-jsx-a11y",
390
+ "eslint-plugin-react",
391
+ "eslint-plugin-react-hooks",
392
+ "eslint-plugin-vitest",
393
+ "ts-jest",
394
+ "@semantic-release/commit-analyzer",
395
+ "@semantic-release/exec",
396
+ "@semantic-release/github",
397
+ "@semantic-release/npm",
398
+ "@semantic-release/release-notes-generator",
399
+ "conventional-changelog-conventionalcommits",
400
+ "lint-staged"
401
+ ]
402
+ },
304
403
  "lint-staged": {
305
404
  "*.{js,ts,json,md}": [
306
405
  "pnpm exec biome lint --config-path=tooling/biome/biome.json",
@@ -308,9 +407,7 @@
308
407
  ]
309
408
  },
310
409
  "bin": {
311
- "js-tooling": "./dist/cli/index.js",
312
- "commitmessage": "scripts/commitmessage.sh",
313
- "helloworld": "scripts/helloworld.sh"
410
+ "js-tooling": "./dist/cli/index.js"
314
411
  },
315
412
  "config": {
316
413
  "commitizen": {
@@ -0,0 +1,4 @@
1
+ import type { UserConfig } from '@commitlint/types'
2
+
3
+ declare const config: UserConfig
4
+ export default config
@@ -0,0 +1,6 @@
1
+ import type { BuildOptions, BuildResult } from 'esbuild'
2
+
3
+ export declare function buildCode(
4
+ entryPoints?: string[],
5
+ options?: Partial<BuildOptions>
6
+ ): Promise<BuildResult | undefined>
@@ -0,0 +1,6 @@
1
+ import type { Linter } from 'eslint'
2
+
3
+ declare const config: Linter.Config[]
4
+ export default config
5
+
6
+ export declare const restrictEnvAccess: Linter.Config[]
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint'
2
+
3
+ declare const config: Linter.Config[]
4
+ export default config
@@ -0,0 +1,4 @@
1
+ import type { Config } from 'jest'
2
+
3
+ declare const config: Config
4
+ export default config
@@ -0,0 +1,4 @@
1
+ import type { Config } from 'jest'
2
+
3
+ declare const config: Config
4
+ export default config
@@ -0,0 +1,4 @@
1
+ import type { Config } from 'prettier'
2
+
3
+ declare const config: Config
4
+ export default config
@@ -0,0 +1,4 @@
1
+ import type { Options } from 'semantic-release'
2
+
3
+ declare const config: Options
4
+ export default config
@@ -0,0 +1,4 @@
1
+ import type { Options } from 'semantic-release'
2
+
3
+ declare const config: Options
4
+ export default config
@@ -0,0 +1,4 @@
1
+ import type { Options } from 'semantic-release'
2
+
3
+ declare const config: Options
4
+ export default config
@@ -0,0 +1,4 @@
1
+ import type { UserConfig } from 'vitest/config'
2
+
3
+ declare const config: UserConfig
4
+ export default config
@@ -9,8 +9,15 @@ export default defineConfig({
9
9
  globals: true,
10
10
  environment: 'node',
11
11
  coverage: {
12
- provider: 'istanbul', // or 'v8'
13
- reporter: ['text', 'json', 'html'],
12
+ provider: 'v8',
13
+ reporter: ['text', 'json', 'html', 'json-summary'],
14
+ include: ['src/cli/generators/**/*.ts'],
15
+ thresholds: {
16
+ statements: 25,
17
+ lines: 25,
18
+ functions: 40,
19
+ branches: 17,
20
+ },
14
21
  },
15
22
  },
16
23
  resolve: {
@@ -0,0 +1,4 @@
1
+ import type { UserConfig } from 'vitest/config'
2
+
3
+ declare const config: UserConfig
4
+ export default config
@@ -0,0 +1 @@
1
+ export {}
package/scripts/README.md DELETED
@@ -1,8 +0,0 @@
1
- pnpx js-tooling commitmessage
2
- pnpx js-tooling version-bump
3
- pnpx js-tooling genpassword
4
-
5
- <!-- run before publish -->
6
- pnpm exec ./scripts/fix-bins.sh
7
-
8
- pnpm link --global
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # chmod +x scripts/commitmessage.sh
4
- set -e
5
-
6
- echo "Select commit type by number:"
7
- select type in "feat" "fix" "perf" "ci" "WIP" "chore" "docs" "test" "style" "refactor" "build" "BREAKING CHANGE" "revert"; do
8
- if [ -n "$type" ]; then
9
- break
10
- else
11
- echo "❌ Invalid selection. Try again."
12
- fi
13
- done
14
-
15
- if [[ "$type" =~ ^(feat|fix|perf)$ ]]; then
16
- echo "Select semantic version by number:"
17
- select semantic_version in "none" "patch" "minor" "major"; do
18
- [ -n "$semantic_version" ] && break
19
- done
20
- else
21
- semantic_version="none"
22
- fi
23
-
24
- read -p "Enter commit description: " description
25
- read -p "Skip CI? (y/n) [n]: " skip_ci
26
- skip_ci=${skip_ci:-n}
27
-
28
- msg="$type"
29
- [ "$semantic_version" != "none" ] && msg="$msg($semantic_version)"
30
- msg="$msg: $description"
31
- [ "$skip_ci" = "y" ] && msg="$msg [skip ci]"
32
-
33
- echo ""
34
- echo "🔍 Commit preview:"
35
- echo "$msg"
36
- read -p "Is this okay? (y/n): " confirm
37
- [ "$confirm" != "y" ] && echo "❌ Commit aborted." && exit 1
38
-
39
- git add -A
40
- git commit -m "$msg"
41
-
42
- echo ""
43
- read -p "Do you want to push the commit? (y/n): " push_confirm
44
- [ "$push_confirm" = "y" ] && git push || echo "🚫 Commit not pushed."
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # chmod +x scripts/helloworld.sh
4
-
5
- echo "👋 Hello, world from js-tooling!"
@@ -1,21 +0,0 @@
1
- /*
2
- Sample call to build.mjs in root of project.
3
-
4
- */
5
-
6
- import { buildCode, getEntrypointFolders } from './index.mjs'
7
- // import { buildCode, getEntrypointFolders } from '@rtorcato/js-tooling/esbuild/index.mjs'
8
-
9
- const folders = await getEntrypointFolders('src')
10
- const libEntryPointsArrays = await Promise.all(folders.map((folder) => getEntryPoints(folder)))
11
- const libEntryPoints = libEntryPointsArrays.flat()
12
- const allEntryPoints = [
13
- 'src/index.ts', // Main entry point
14
- ...libEntryPoints,
15
- // ...exampleEntryPoints,
16
- ]
17
- // Run the build function
18
- buildCode(allEntryPoints).catch((e) => {
19
- console.error(e)
20
- process.exit(1)
21
- })
@@ -1,35 +0,0 @@
1
- {
2
- "name": "@dropwallet/eslint-config",
3
- "private": true,
4
- "version": "0.3.0",
5
- "type": "module",
6
- "exports": {
7
- "./base": "./base.js",
8
- "./nextjs": "./nextjs.js"
9
- },
10
- "scripts": {
11
- "clean": "rm -rf .turbo node_modules",
12
- "format": "prettier --check . --ignore-path ../../.gitignore",
13
- "typecheck": "tsc --noEmit"
14
- },
15
- "dependencies": {
16
- "@next/eslint-plugin-next": "^14.2.3",
17
- "eslint-config-airbnb": "^19.0.4",
18
- "eslint-config-prettier": "9.1.0",
19
- "eslint-config-turbo": "^1.13.3",
20
- "eslint-plugin-import": "^2.29.1",
21
- "eslint-plugin-jest": "28.5.0",
22
- "eslint-plugin-jsx-a11y": "^6.8.0",
23
- "eslint-plugin-react": "^7.34.1",
24
- "eslint-plugin-react-hooks": "^4.6.2",
25
- "eslint-plugin-vitest": "0.5.4",
26
- "typescript-eslint": "7.9.0"
27
- },
28
- "devDependencies": {
29
- "@dropwallet/tsconfig": "workspace:*",
30
- "@eslint/js": "9.2.0",
31
- "eslint": "9.2.0",
32
- "prettier": "^3.2.5",
33
- "typescript": "^5.4.5"
34
- }
35
- }
@@ -1,4 +0,0 @@
1
- /** @type {import('next').NextConfig} */
2
- module.exports = {
3
- output: 'standalone',
4
- }
File without changes
@@ -1 +0,0 @@
1
- https://oxc.rs
File without changes
File without changes
File without changes
File without changes
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "module": "commonjs"
6
- }
7
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "module": "esnext",
6
- "emitDeclarationOnly": false,
7
- "noEmit": false
8
- }
9
- }
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "./../typescript/internal-package.json",
3
- "compilerOptions": {
4
- "tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
5
- "incremental": true,
6
- "outDir": "./dist",
7
- "baseUrl": "."
8
- },
9
- "include": ["./src/**/*.ts", "index.ts"],
10
- "exclude": ["node_modules"]
11
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "declaration": true,
6
- "noEmit": false,
7
- "emitDeclarationOnly": true
8
- }
9
- }
File without changes
File without changes