@walkeros/config 4.6.1 → 4.7.0-next-1790187973605

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/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @walkeros/config
2
2
 
3
+ ## 4.7.0-next-1790187973605
4
+
3
5
  ## 4.6.1
4
6
 
5
7
  ## 4.6.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walkeros/config",
3
- "version": "4.6.1",
3
+ "version": "4.7.0-next-1790187973605",
4
4
  "type": "module",
5
5
  "description": "Shared development configuration for walkerOS packages (TypeScript, ESLint, Jest, tsup)",
6
6
  "license": "MIT",
package/tsup/index.mjs CHANGED
@@ -9,17 +9,22 @@ const baseConfig = {
9
9
  splitting: false,
10
10
  };
11
11
 
12
- // Modules
13
- const buildModules = (customConfig = {}) => {
14
- // Auto-inject package version
15
- let version = '0.0.0';
12
+ // Package version for the __VERSION__ define
13
+ const getVersion = () => {
16
14
  try {
17
15
  const packagePath = resolve(process.cwd(), 'package.json');
18
16
  const pkg = JSON.parse(readFileSync(packagePath, 'utf8'));
19
- version = pkg.version || '0.0.0';
17
+ return pkg.version || '0.0.0';
20
18
  } catch (error) {
21
19
  console.warn('Could not read package.json for version injection:', error.message);
20
+ return '0.0.0';
22
21
  }
22
+ };
23
+
24
+ // Modules
25
+ const buildModules = (customConfig = {}) => {
26
+ // Auto-inject package version
27
+ const version = getVersion();
23
28
 
24
29
  return {
25
30
  ...baseConfig,
@@ -51,6 +56,11 @@ const buildExamples = (customConfig = {}) => ({
51
56
  return { js: format === 'esm' ? '.mjs' : '.js' };
52
57
  },
53
58
  ...customConfig,
59
+ // After the spread, so a caller's define merges in and cannot drop __VERSION__
60
+ define: {
61
+ __VERSION__: JSON.stringify(getVersion()),
62
+ ...customConfig.define,
63
+ },
54
64
  });
55
65
 
56
66
  // Browser