@baseplate-dev/tools 0.1.1 → 0.1.3
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/README.md +24 -0
- package/package.json +3 -3
- package/src-subpath-import-plugin.js +28 -25
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @baseplate-dev/tools
|
|
2
|
+
|
|
3
|
+
This package contains common development tools and configurations used throughout the Baseplate monorepo.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
The tools package provides:
|
|
8
|
+
|
|
9
|
+
- Shared ESLint configurations for Node.js and React projects
|
|
10
|
+
- Prettier configurations for consistent code formatting
|
|
11
|
+
- TypeScript configurations for various project types
|
|
12
|
+
- Vitest configurations for testing
|
|
13
|
+
- Common development tool settings
|
|
14
|
+
|
|
15
|
+
## Configurations Included
|
|
16
|
+
|
|
17
|
+
- **ESLint**: Base, Node.js, React, and Storybook configurations
|
|
18
|
+
- **Prettier**: Node.js and React specific formatting rules
|
|
19
|
+
- **TypeScript**: Base configs for CLI, library, and Vite projects
|
|
20
|
+
- **Vitest**: Test runner configurations for Node.js and React
|
|
21
|
+
|
|
22
|
+
## Part of Baseplate Monorepo
|
|
23
|
+
|
|
24
|
+
This package is part of the Baseplate monorepo and provides standardized development configurations to ensure consistency across all packages.
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baseplate-dev/tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Shared dev configurations for linting, formatting, and testing Baseplate projects",
|
|
5
|
-
"homepage": "https://www.
|
|
5
|
+
"homepage": "https://www.baseplate.dev",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/halfdomelabs/baseplate",
|
|
9
9
|
"directory": "packages/tools"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "MPL-2.0",
|
|
12
12
|
"author": "Half Dome Labs LLC",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"type": "module",
|
|
@@ -28,38 +28,41 @@ export function srcSubpathImportPlugin(dirname) {
|
|
|
28
28
|
|
|
29
29
|
return {
|
|
30
30
|
name: 'custom-src-resolve',
|
|
31
|
-
resolveId
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
resolveId: {
|
|
32
|
+
order: 'pre',
|
|
33
|
+
handler(id, importer) {
|
|
34
|
+
// Only handle #src imports
|
|
35
|
+
if (!id.startsWith('#src')) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// Skip if no importer (entry point) or importer is in node_modules
|
|
40
|
+
if (!importer || importer.includes('node_modules')) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
// Check if importer is within the project directory
|
|
45
|
+
const resolvedImporter = path.resolve(importer);
|
|
46
|
+
const projectRoot = path.resolve(dirname);
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
if (!resolvedImporter.startsWith(projectRoot)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
// Replace #src with the actual src path
|
|
53
|
+
const basePath = id.replace(/^#src/, srcPath).replace(/\.js$/, '');
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
// Try each extension
|
|
56
|
+
for (const ext of EXTENSIONS) {
|
|
57
|
+
const resolvedPath = basePath + ext;
|
|
58
|
+
if (fs.existsSync(resolvedPath)) {
|
|
59
|
+
return resolvedPath;
|
|
60
|
+
}
|
|
58
61
|
}
|
|
59
|
-
}
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
// If no extension matches, return the base path
|
|
64
|
+
return basePath;
|
|
65
|
+
},
|
|
63
66
|
},
|
|
64
67
|
};
|
|
65
68
|
}
|