Skip to content

Commit ac358bc

Browse files
authored
Merge pull request #83 from underctrl-io/add-macro-plugin
chore: replace version inject plugin with macro plugin
2 parents a2cf4cc + dc7beb9 commit ac358bc

File tree

4 files changed

+193
-142
lines changed

4 files changed

+193
-142
lines changed

packages/commandkit/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
"@types/node": "^22.10.2",
5454
"@types/yargs": "^17.0.32",
5555
"discord.js": "^14.16.3",
56-
"esbuild-plugin-version-injector": "^1.2.1",
5756
"tsconfig": "workspace:*",
5857
"tsx": "^4.7.0",
5958
"typescript": "^5.7.2",
59+
"use-macro": "^1.0.1",
6060
"vitest": "^1.2.1"
6161
},
6262
"peerDependencies": {

packages/commandkit/src/index.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ export * from './components';
33
export * from './config';
44
export type * from './types';
55

6+
function getCommandKitVersion(): string {
7+
'use macro';
8+
return require('../package.json').version;
9+
}
10+
611
/**
712
* The current version of CommandKit.
813
*/
9-
// Note to developers: This needs to explicitly be `string` so it is not typed as a "const string" that gets injected by esbuild
10-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
11-
export const version: string = '[VI]{{inject}}[/VI]';
14+
export const version = getCommandKitVersion();

packages/commandkit/tsup.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineConfig } from 'tsup';
2-
import { esbuildPluginVersionInjector } from 'esbuild-plugin-version-injector';
2+
import { esbuildPluginUseMacro } from 'use-macro';
33

44
export default defineConfig({
55
format: ['cjs', 'esm'],
@@ -13,5 +13,5 @@ export default defineConfig({
1313
shims: true,
1414
skipNodeModulesBundle: true,
1515
clean: true,
16-
esbuildPlugins: [esbuildPluginVersionInjector()],
16+
esbuildPlugins: [esbuildPluginUseMacro()],
1717
});

0 commit comments

Comments
 (0)