@appweaver/tooling 0.0.0-stage → 3.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luka Matosevic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,52 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <a href="https://appweaver.co" target="_blank"><img src="https://raw.githubusercontent.com/lmatosevic/appweaver/refs/heads/main/resources/appweaver-logo.svg" width="460" alt="Appweaver Logo" /></a>
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ <p align="center">
6
+ The lint, format and test tooling of Appweaver, the AI-first <a href="https://nodejs.org" target="_blank">Node.js</a> framework for backends built with agents.
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/@appweaver/tooling" target="_blank"><img src="https://img.shields.io/npm/v/@appweaver/tooling.svg" alt="NPM Version" /></a>
11
+ <a href="https://github.com/lmatosevic/appweaver/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/npm/l/@appweaver/tooling.svg" alt="Package License" /></a>
12
+ <a href="https://www.npmjs.com/package/@appweaver/tooling" target="_blank"><img src="https://img.shields.io/npm/dw/@appweaver/tooling.svg" alt="NPM Downloads" /></a>
13
+ <a href="https://github.com/lmatosevic/appweaver/actions/workflows/ci.yml?query=branch%3Amain" target="_blank"><img src="https://img.shields.io/github/actions/workflow/status/lmatosevic/appweaver/ci.yml?branch=main&label=CI" alt="CI Status" /></a>
14
+ <a href="https://codecov.io/gh/lmatosevic/appweaver" target="_blank"><img src="https://codecov.io/gh/lmatosevic/appweaver/graph/badge.svg" alt="Test Coverage" /></a>
15
+ <a href="https://nodejs.org" target="_blank"><img src="https://img.shields.io/node/v/@appweaver/tooling.svg" alt="Node Version" /></a>
16
+ </p>
17
+
18
+ ## Description
19
+
20
+ The ESLint, Prettier and Jest setup of an [Appweaver](https://github.com/lmatosevic/appweaver) project, released with
21
+ the framework: the tools are dependencies of this package, so a project has one dev dependency instead of every package
22
+ of its lint, format and test tooling, at the versions the framework is tested with.
23
+
24
+ A project created with `npm create @appweaver` has it as a dev dependency, already configured:
25
+
26
+ | Entry point | Holds |
27
+ | ----------------------------- | -------------------------------------------------------------------------------------------- |
28
+ | `@appweaver/tooling/eslint` | `eslintConfig({ rootDir, runtime?, ignores? })`, the flat config of `eslint.config.mjs` |
29
+ | `@appweaver/tooling/prettier` | The Prettier config, `"prettier": "@appweaver/tooling/prettier"` in `package.json` |
30
+ | `@appweaver/tooling` (Jest) | The Jest preset on Node, `"preset": "@appweaver/tooling"` in `jest.config.json` (SWC, JUnit) |
31
+
32
+ ```js
33
+ // eslint.config.mjs
34
+ import { eslintConfig } from '@appweaver/tooling/eslint';
35
+
36
+ export default eslintConfig({ rootDir: import.meta.dirname });
37
+ ```
38
+
39
+ The `weaver` commands run the tools of this package, resolved from it wherever the package manager placed them
40
+ (`toolBin`), so the project's scripts need no binary of their own:
41
+
42
+ ```bash
43
+ npx weaver lint [--fix] [patterns...] # ESLint, the project by default
44
+ npx weaver format [--check] [patterns...] # Prettier, ./**/*.ts by default
45
+ npx weaver test [--e2e] [--coverage] # Jest on Node, bun test on Bun
46
+ ```
47
+
48
+ Without the package, `weaver lint`, `weaver format` and `weaver test` (on Node) exit with 1, naming the install command:
49
+
50
+ ```bash
51
+ npm install --save-dev @appweaver/tooling
52
+ ```
package/eslint.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { Linter } from 'eslint';
2
+ /** The options of `eslintConfig`. */
3
+ export type EslintConfigOptions = {
4
+ /** The root directory of the project, holding its `tsconfig.json` (`import.meta.dirname` of `eslint.config.mjs`) */
5
+ rootDir: string;
6
+ /** The runtime the tests run on: the Jest rules and globals on `node`, the globals of `bun test` on `bun` */
7
+ runtime?: 'node' | 'bun';
8
+ /** More paths to ignore, besides the dependencies, the build output, the Prisma client and the JavaScript files */
9
+ ignores?: string[];
10
+ };
11
+ /**
12
+ * Creates the ESLint flat config of an Appweaver project: the recommended rules of ESLint and of the type checked
13
+ * typescript-eslint, Prettier, and Jest on Node. In `eslint.config.mjs`:
14
+ *
15
+ * ```js
16
+ * import { eslintConfig } from '@appweaver/tooling/eslint';
17
+ *
18
+ * export default eslintConfig({ rootDir: import.meta.dirname });
19
+ * ```
20
+ *
21
+ * @param {EslintConfigOptions} options - The root directory of the project, its runtime and more ignored paths.
22
+ * @return {Linter.Config[]} The flat config.
23
+ */
24
+ export declare function eslintConfig(options: EslintConfigOptions): Linter.Config[];
package/eslint.js ADDED
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.eslintConfig = eslintConfig;
7
+ const js_1 = __importDefault(require("@eslint/js"));
8
+ const eslint_plugin_jest_1 = __importDefault(require("eslint-plugin-jest"));
9
+ const recommended_1 = __importDefault(require("eslint-plugin-prettier/recommended"));
10
+ const globals_1 = __importDefault(require("globals"));
11
+ const typescript_eslint_1 = __importDefault(require("typescript-eslint"));
12
+ /** The rules of typescript-eslint an Appweaver project turns off: the framework types its schemas loosely. */
13
+ const relaxedRules = {
14
+ '@typescript-eslint/explicit-function-return-type': 'off',
15
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
16
+ '@typescript-eslint/restrict-template-expressions': 'off',
17
+ '@typescript-eslint/require-await': 'off',
18
+ '@typescript-eslint/unbound-method': 'off',
19
+ '@typescript-eslint/no-redundant-type-constituents': 'off',
20
+ '@typescript-eslint/no-misused-promises': 'off',
21
+ '@typescript-eslint/no-explicit-any': 'off',
22
+ '@typescript-eslint/no-empty-object-type': 'off',
23
+ '@typescript-eslint/no-unused-vars': 'off',
24
+ '@typescript-eslint/no-unsafe-member-access': 'off',
25
+ '@typescript-eslint/no-unsafe-assignment': 'off',
26
+ '@typescript-eslint/no-unsafe-argument': 'off',
27
+ '@typescript-eslint/no-unsafe-call': 'off',
28
+ '@typescript-eslint/no-unsafe-return': 'off'
29
+ };
30
+ /**
31
+ * Creates the ESLint flat config of an Appweaver project: the recommended rules of ESLint and of the type checked
32
+ * typescript-eslint, Prettier, and Jest on Node. In `eslint.config.mjs`:
33
+ *
34
+ * ```js
35
+ * import { eslintConfig } from '@appweaver/tooling/eslint';
36
+ *
37
+ * export default eslintConfig({ rootDir: import.meta.dirname });
38
+ * ```
39
+ *
40
+ * @param {EslintConfigOptions} options - The root directory of the project, its runtime and more ignored paths.
41
+ * @return {Linter.Config[]} The flat config.
42
+ */
43
+ function eslintConfig(options) {
44
+ const bun = options.runtime === 'bun';
45
+ return [
46
+ {
47
+ ignores: [
48
+ 'node_modules',
49
+ 'dist',
50
+ 'database/client',
51
+ '**/*.js',
52
+ '**/*.mjs',
53
+ '**/*.cjs',
54
+ '**/*.d.ts',
55
+ ...(options.ignores ?? [])
56
+ ]
57
+ },
58
+ js_1.default.configs.recommended,
59
+ ...typescript_eslint_1.default.configs.recommendedTypeChecked,
60
+ recommended_1.default,
61
+ ...(bun ? [] : [eslint_plugin_jest_1.default.configs['flat/recommended']]),
62
+ {
63
+ languageOptions: {
64
+ globals: {
65
+ ...globals_1.default.node,
66
+ ...(bun ? globals_1.default.bunBuiltin : globals_1.default.jest)
67
+ },
68
+ sourceType: 'module',
69
+ parserOptions: {
70
+ projectService: true,
71
+ tsconfigRootDir: options.rootDir
72
+ }
73
+ }
74
+ },
75
+ { rules: relaxedRules }
76
+ ];
77
+ }
package/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /** The tools `@appweaver/tooling` carries, run by `weaver lint`, `weaver format` and `weaver test`. */
2
+ export type Tool = 'eslint' | 'prettier' | 'jest';
3
+ /**
4
+ * Resolves the script of a tool, from the dependencies of this package, so a project runs the versions its
5
+ * `@appweaver/tooling` was released with, wherever the package manager placed them.
6
+ *
7
+ * @param {Tool} tool - The tool.
8
+ * @return {string} The absolute path of its executable script, run with `node`.
9
+ */
10
+ export declare function toolBin(tool: Tool): string;
package/index.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.toolBin = toolBin;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ /** The executable of each tool, by its `bin` name. */
10
+ const TOOL_BINS = {
11
+ eslint: 'eslint',
12
+ prettier: 'prettier',
13
+ jest: 'jest'
14
+ };
15
+ /**
16
+ * Resolves the script of a tool, from the dependencies of this package, so a project runs the versions its
17
+ * `@appweaver/tooling` was released with, wherever the package manager placed them.
18
+ *
19
+ * @param {Tool} tool - The tool.
20
+ * @return {string} The absolute path of its executable script, run with `node`.
21
+ */
22
+ function toolBin(tool) {
23
+ const manifestPath = require.resolve(`${tool}/package.json`, {
24
+ paths: [__dirname]
25
+ });
26
+ const manifest = JSON.parse(node_fs_1.default.readFileSync(manifestPath, 'utf8'));
27
+ const bin = typeof manifest.bin === 'string'
28
+ ? manifest.bin
29
+ : manifest.bin?.[TOOL_BINS[tool]];
30
+ if (!bin) {
31
+ throw new Error(`The ${tool} package declares no ${TOOL_BINS[tool]} executable`);
32
+ }
33
+ return node_path_1.default.join(node_path_1.default.dirname(manifestPath), bin);
34
+ }
@@ -0,0 +1,12 @@
1
+ import type { Config } from 'jest';
2
+ /**
3
+ * The Jest preset of an Appweaver project on Node, `"preset": "@appweaver/tooling"`: SWC compiles the TypeScript, and
4
+ * the results are reported in the JUnit format of `reports/junit.xml` too. The transformer and the reporter are
5
+ * resolved from this package, wherever the package manager placed them. TypeBox and `content-disposition` ship ES
6
+ * modules only, so SWC compiles them to CommonJS too, wherever they are installed: only the package of the last
7
+ * `node_modules` of a path is checked, so a copy nested under another package (`node_modules/x/node_modules/typebox`,
8
+ * the `.pnpm` store) is compiled too. The end-to-end tests of `test/e2e` are left out: their config sets
9
+ * `testPathIgnorePatterns` to `["/node_modules/", "/dist/"]`.
10
+ */
11
+ declare const preset: Config;
12
+ export = preset;
package/jest-preset.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /**
3
+ * The Jest preset of an Appweaver project on Node, `"preset": "@appweaver/tooling"`: SWC compiles the TypeScript, and
4
+ * the results are reported in the JUnit format of `reports/junit.xml` too. The transformer and the reporter are
5
+ * resolved from this package, wherever the package manager placed them. TypeBox and `content-disposition` ship ES
6
+ * modules only, so SWC compiles them to CommonJS too, wherever they are installed: only the package of the last
7
+ * `node_modules` of a path is checked, so a copy nested under another package (`node_modules/x/node_modules/typebox`,
8
+ * the `.pnpm` store) is compiled too. The end-to-end tests of `test/e2e` are left out: their config sets
9
+ * `testPathIgnorePatterns` to `["/node_modules/", "/dist/"]`.
10
+ */
11
+ const preset = {
12
+ moduleFileExtensions: ['js', 'mjs', 'json', 'ts'],
13
+ testEnvironment: 'node',
14
+ testMatch: ['**/*.test.ts'],
15
+ testPathIgnorePatterns: ['/node_modules/', '/dist/', '/test/e2e/'],
16
+ transform: {
17
+ '^.+\\.(t|m?j)s$': [
18
+ require.resolve('@swc/jest'),
19
+ {
20
+ jsc: {
21
+ parser: { syntax: 'typescript', dynamicImport: true },
22
+ target: 'es2024'
23
+ },
24
+ module: { type: 'commonjs' },
25
+ sourceMaps: 'inline'
26
+ }
27
+ ]
28
+ },
29
+ transformIgnorePatterns: [
30
+ '/node_modules/(?!(?:content-disposition|cookie|@fastify/cookie|typebox)/)(?!.*/node_modules/)'
31
+ ],
32
+ reporters: [
33
+ 'default',
34
+ [
35
+ require.resolve('jest-junit'),
36
+ { outputDirectory: './reports', outputName: 'junit.xml' }
37
+ ]
38
+ ],
39
+ coverageReporters: ['cobertura', 'text'],
40
+ coverageDirectory: './reports'
41
+ };
42
+ module.exports = preset;
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
2
  "name": "@appweaver/tooling",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "3.0.0",
4
+ "description": "Appweaver - the backend framework for AI-first development (@tooling)",
5
+ "author": "Luka Matosevic",
6
+ "license": "MIT",
7
+ "main": "./index.js",
8
+ "types": "./index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./index.d.ts",
12
+ "default": "./index.js"
13
+ },
14
+ "./eslint": {
15
+ "types": "./eslint.d.ts",
16
+ "default": "./eslint.js"
17
+ },
18
+ "./prettier": {
19
+ "types": "./prettier.d.ts",
20
+ "default": "./prettier.js"
21
+ },
22
+ "./jest-preset": "./jest-preset.js",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "keywords": [
26
+ "appweaver",
27
+ "eslint-config",
28
+ "prettier-config",
29
+ "jest-preset",
30
+ "eslint",
31
+ "prettier",
32
+ "jest",
33
+ "swc"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/lmatosevic/appweaver.git",
38
+ "directory": "packages/tooling"
39
+ },
40
+ "maintainers": [
41
+ {
42
+ "name": "Luka Matosevic",
43
+ "email": "lukamatosevic5@gmail.com",
44
+ "web": "https://lukamatosevic.com"
45
+ }
46
+ ],
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "engines": {
51
+ "node": ">= 24.7"
52
+ },
53
+ "dependencies": {
54
+ "@eslint/js": "10.0.1",
55
+ "@swc/core": "1.15.41",
56
+ "@swc/jest": "0.2.39",
57
+ "@types/jest": "30.0.0",
58
+ "@types/node": "26.0.0",
59
+ "eslint": "10.16.0",
60
+ "eslint-config-prettier": "10.1.9",
61
+ "eslint-plugin-jest": "29.17.2",
62
+ "eslint-plugin-prettier": "5.5.7",
63
+ "globals": "17.6.0",
64
+ "jest": "30.5.2",
65
+ "jest-junit": "17.0.0",
66
+ "prettier": "3.8.4",
67
+ "typescript-eslint": "8.74.0"
68
+ }
69
+ }
package/prettier.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { Config } from 'prettier';
2
+ /** The Prettier config of an Appweaver project, `"prettier": "@appweaver/tooling/prettier"` in its `package.json`. */
3
+ declare const config: Config;
4
+ export = config;
package/prettier.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /** The Prettier config of an Appweaver project, `"prettier": "@appweaver/tooling/prettier"` in its `package.json`. */
3
+ const config = {
4
+ endOfLine: 'lf',
5
+ singleQuote: true,
6
+ trailingComma: 'none',
7
+ tabWidth: 2,
8
+ printWidth: 80
9
+ };
10
+ module.exports = config;