@remaginer-io/rm-configs 0.2.0 → 0.3.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/package.json CHANGED
@@ -1,35 +1,45 @@
1
1
  {
2
- "name": "@remaginer-io/rm-configs",
3
- "version": "0.2.0",
4
- "private": false,
5
- "description": "Shared TypeScript, ESLint, and test configuration for Remaginer repositories.",
6
- "license": "MIT",
7
- "files": [
8
- "typescript/",
9
- "eslint/",
10
- "tsup/",
11
- "vitest/"
12
- ],
13
- "exports": {
14
- "./eslint": "./eslint/index.mjs",
15
- "./tsup": "./tsup/index.mjs",
16
- "./typescript/base": "./typescript/base.json",
17
- "./typescript/module": "./typescript/module.json",
18
- "./typescript/next": "./typescript/next.json",
19
- "./typescript/vite": "./typescript/vite.json",
20
- "./typescript/react-library": "./typescript/react-library.json"
21
- },
22
- "publishConfig": {
23
- "access": "restricted"
24
- },
25
- "dependencies": {
26
- "@eslint/js": "9.39.2",
27
- "eslint": "9.39.2",
28
- "eslint-config-prettier": "10.1.8",
29
- "globals": "16.5.0",
30
- "typescript-eslint": "8.67.0"
31
- },
32
- "engines": {
33
- "node": ">=20"
34
- }
35
- }
2
+ "name": "@remaginer-io/rm-configs",
3
+ "version": "0.3.0",
4
+ "private": false,
5
+ "description": "Shared TypeScript, ESLint, and test configuration for Remaginer repositories.",
6
+ "license": "MIT",
7
+ "files": [
8
+ "typescript/",
9
+ "eslint/",
10
+ "tsup/",
11
+ "vite/",
12
+ "vitest/"
13
+ ],
14
+ "exports": {
15
+ "./eslint": "./eslint/index.mjs",
16
+ "./tsup": {
17
+ "types": "./tsup/index.d.ts",
18
+ "import": "./tsup/index.mjs",
19
+ "require": "./tsup/index.js"
20
+ },
21
+ "./vite": {
22
+ "types": "./vite/index.d.ts",
23
+ "import": "./vite/index.mjs"
24
+ },
25
+ "./typescript/base": "./typescript/base.json",
26
+ "./typescript/module": "./typescript/module.json",
27
+ "./typescript/node-next": "./typescript/node-next.json",
28
+ "./typescript/next": "./typescript/next.json",
29
+ "./typescript/vite": "./typescript/vite.json",
30
+ "./typescript/react-library": "./typescript/react-library.json"
31
+ },
32
+ "publishConfig": {
33
+ "access": "restricted"
34
+ },
35
+ "dependencies": {
36
+ "@eslint/js": "9.39.2",
37
+ "eslint": "9.39.2",
38
+ "eslint-config-prettier": "10.1.8",
39
+ "globals": "16.5.0",
40
+ "typescript-eslint": "8.67.0"
41
+ },
42
+ "engines": {
43
+ "node": ">=20"
44
+ }
45
+ }
@@ -0,0 +1,5 @@
1
+ import type { Options } from 'tsup';
2
+
3
+ export declare function createReactLibraryConfig(
4
+ options?: Options & { useClient?: boolean },
5
+ ): Options;
package/tsup/index.js ADDED
@@ -0,0 +1,18 @@
1
+ function createReactLibraryConfig({
2
+ entry = 'src/index.tsx',
3
+ useClient = false,
4
+ ...overrides
5
+ } = {}) {
6
+ return {
7
+ entry,
8
+ format: ['cjs', 'esm'],
9
+ dts: true,
10
+ external: ['react', 'react-dom'],
11
+ ...(useClient ? { banner: { js: "'use client'" } } : {}),
12
+ ...overrides,
13
+ };
14
+ }
15
+
16
+ module.exports = {
17
+ createReactLibraryConfig,
18
+ };
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./base.json",
4
+ "compilerOptions": {
5
+ "module": "NodeNext",
6
+ "moduleResolution": "NodeNext",
7
+ "types": ["node"],
8
+ "noEmit": true
9
+ },
10
+ "exclude": ["node_modules"]
11
+ }
@@ -0,0 +1,14 @@
1
+ import { InlineConfig } from 'vite';
2
+
3
+ export interface ViteConfigOptions {
4
+ /** Source directory for path alias @ (default: './src') */
5
+ srcDir?: string;
6
+ /** Override any config property */
7
+ overrides?: Partial<InlineConfig>;
8
+ }
9
+
10
+ /**
11
+ * Creates a standardized Vite config for React + Router + Tailwind applications.
12
+ * Includes: React, TanStack Router, Tailwind CSS, Vitest with browser support.
13
+ */
14
+ export function createViteConfig(options?: ViteConfigOptions): InlineConfig;
package/vite/index.mjs ADDED
@@ -0,0 +1,61 @@
1
+ import path from 'path';
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import tailwindcss from '@tailwindcss/vite';
5
+ import { tanstackRouter } from '@tanstack/router-plugin/vite';
6
+ import { playwright } from '@vitest/browser-playwright';
7
+ import { fileURLToPath } from 'url';
8
+
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+
11
+ /**
12
+ * Creates a standardized Vite config for React + Router + Tailwind applications.
13
+ * Standard setup includes:
14
+ * - React plugin
15
+ * - TanStack Router with code splitting
16
+ * - Tailwind CSS
17
+ * - Vitest with browser support (Playwright)
18
+ * - Path alias: @ → ./src
19
+ *
20
+ * @param {Object} options - Configuration options
21
+ * @param {string} options.srcDir - Source directory for alias (default: './src')
22
+ * @param {Object} options.overrides - Override any config property
23
+ * @returns {Object} Vite config object
24
+ */
25
+ export function createViteConfig({ srcDir = './src', overrides = {} } = {}) {
26
+ return defineConfig({
27
+ plugins: [
28
+ tanstackRouter({
29
+ target: 'react',
30
+ autoCodeSplitting: true,
31
+ }),
32
+ react(),
33
+ tailwindcss(),
34
+ ],
35
+ resolve: {
36
+ alias: {
37
+ '@': path.resolve(srcDir),
38
+ },
39
+ },
40
+ test: {
41
+ silent: 'passed-only',
42
+ unstubEnvs: true,
43
+ browser: {
44
+ enabled: true,
45
+ provider: playwright(),
46
+ instances: [{ browser: 'chromium' }],
47
+ },
48
+ coverage: {
49
+ exclude: [
50
+ 'src/components/ui/**',
51
+ 'src/assets/**',
52
+ 'src/tanstack-table.d.ts',
53
+ 'src/routeTree.gen.ts',
54
+ 'src/test-utils/**',
55
+ 'src/routes/**',
56
+ ],
57
+ },
58
+ },
59
+ ...overrides,
60
+ });
61
+ }