Skip to content

Commit 6188457

Browse files
authored
Merge pull request #591 from underctrl-io/workflow-plugin
feat: workflow plugin
2 parents 2fa980d + 79f2515 commit 6188457

File tree

24 files changed

+1438
-1914
lines changed

24 files changed

+1438
-1914
lines changed

.github/workflows/publish-dev.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
"@commandkit/ai:packages/ai"
6262
"@commandkit/queue:packages/queue"
6363
"@commandkit/tasks:packages/tasks"
64+
"@commandkit/workflow:packages/workflow"
6465
)
6566
6667
for entry in "${PACKAGES[@]}"; do
@@ -84,6 +85,7 @@ jobs:
8485
"@commandkit/ai"
8586
"@commandkit/queue"
8687
"@commandkit/tasks"
88+
"@commandkit/workflow"
8789
)
8890
8991
for pkg in "${PACKAGES[@]}"; do

.github/workflows/publish-latest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
"@commandkit/ai:packages/ai"
7171
"@commandkit/queue:packages/queue"
7272
"@commandkit/tasks:packages/tasks"
73+
"@commandkit/workflow:packages/workflow"
7374
)
7475
7576
for entry in "${PACKAGES[@]}"; do

apps/test-bot/commandkit.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { cache } from '@commandkit/cache';
55
import { ai } from '@commandkit/ai';
66
import { tasks, setDriver } from '@commandkit/tasks';
77
import { BullMQDriver } from '@commandkit/tasks/bullmq';
8-
import { workflowRollupPlugin } from 'workflow/rollup';
8+
import { workflow } from '@commandkit/workflow';
99

1010
noBuildOnly(() => {
1111
setDriver(
@@ -16,7 +16,6 @@ noBuildOnly(() => {
1616
})();
1717

1818
export default defineConfig({
19-
rolldownPlugins: [workflowRollupPlugin()],
2019
plugins: [
2120
i18n(),
2221
devtools(),
@@ -25,5 +24,6 @@ export default defineConfig({
2524
tasks({
2625
initializeDefaultDriver: false,
2726
}),
27+
workflow(),
2828
],
2929
});

apps/test-bot/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
"@commandkit/i18n": "workspace:*",
1919
"@commandkit/legacy": "workspace:*",
2020
"@commandkit/tasks": "workspace:*",
21+
"@commandkit/workflow": "workspace:*",
2122
"commandkit": "workspace:*",
2223
"discord.js": "catalog:discordjs",
2324
"dotenv": "^16.4.7",
2425
"ms": "^2.1.3",
25-
"workflow": "4.0.1-beta.11",
26+
"workflow": "catalog:workflow",
2627
"zod": "^4.1.1"
2728
},
2829
"devDependencies": {

apps/website/docs/api-reference/commandkit/classes/compiler-plugin-runtime.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CompilerPluginRuntime is a runtime for managing compiler plugins in CommandKit.
2020
```ts title="Signature"
2121
class CompilerPluginRuntime {
2222
public readonly name = 'CompilerPluginRuntime';
23-
constructor(plugins: CompilerPlugin[])
23+
constructor(plugins: CompilerPlugin[], isDevMode: boolean)
2424
getPlugins() => ;
2525
isEmpty() => ;
2626
registerTemplate(name: string, handler: TemplateHandler) => ;
@@ -43,7 +43,7 @@ class CompilerPluginRuntime {
4343

4444
### constructor
4545

46-
<MemberInfo kind="method" type={`(plugins: <a href='/docs/api-reference/commandkit/classes/compiler-plugin#compilerplugin'>CompilerPlugin</a>[]) => CompilerPluginRuntime`} />
46+
<MemberInfo kind="method" type={`(plugins: <a href='/docs/api-reference/commandkit/classes/compiler-plugin#compilerplugin'>CompilerPlugin</a>[], isDevMode: boolean) => CompilerPluginRuntime`} />
4747

4848
Creates a new instance of CompilerPluginRuntime.
4949
### getPlugins
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'commandkit/config';
2-
import { workflowRollupPlugin } from 'workflow/rollup';
2+
import { workflow } from '@commandkit/workflow';
33

44
export default defineConfig({
5-
rolldownPlugins: [workflowRollupPlugin()],
5+
plugins: [workflow()],
66
});

examples/with-workflow/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"dependencies": {
1818
"commandkit": "^1.2.0-rc.12",
1919
"discord.js": "^14.24.0",
20-
"workflow": "^4.0.1-beta.11"
20+
"workflow": "^4.0.1-beta.12"
2121
}
2222
}

examples/with-workflow/src/workflows/greet/steps/greet.step.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { useClient } from 'commandkit/hooks';
1+
import { commandkit } from 'commandkit';
22

33
export async function greetUser(userId: string, again = false) {
44
'use step';
55

6-
const client = useClient<true>();
7-
const user = await client.users.fetch(userId);
6+
const user = await commandkit.client.users.fetch(userId);
87

98
const message = again ? 'Hello again!' : 'Hello!';
109

packages/commandkit/src/cli/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export async function buildApplication({
7474

7575
const pluginRuntime = new CompilerPluginRuntime(
7676
(plugins || []) as CompilerPlugin[],
77+
!!isDev,
7778
);
7879

7980
rolldownPlugins ??= [];

packages/commandkit/src/cli/init.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export async function bootstrapCommandkitCLI(
9696
const { plugins } = await loadConfigFile();
9797
const runtime = new CompilerPluginRuntime(
9898
plugins.filter((p) => isCompilerPlugin(p)) as CompilerPlugin[],
99+
true,
99100
);
100101

101102
try {

0 commit comments

Comments
 (0)