@walkeros/config 4.6.0 → 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 +4 -0
- package/package.json +1 -1
- package/tsup/index.mjs +15 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/tsup/index.mjs
CHANGED
|
@@ -9,17 +9,22 @@ const baseConfig = {
|
|
|
9
9
|
splitting: false,
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
const
|
|
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
|
-
|
|
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
|