5 Commits

Author SHA1 Message Date
7686495283 0.0.12 2025-08-31 20:35:13 +02:00
265d5affc6 Fix ES module bundling issues by isolating pure types
- Create dedicated types-only module (src/types/index.ts) with pure type definitions
- Update main index.ts to export only pure types without runtime imports
- Removes need for serverExternalPackages in Next.js configuration
- Plugin now works "out of the box" without bundling workarounds

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 20:35:09 +02:00
06571a4aae Update workflow to detect 'Release v' prefixed version commits 2025-08-31 18:10:14 +02:00
c5b2e6f286 Release v0.0.11 - Fix ES module bundling issues
- Separated server-side and client-safe exports
- Main export now contains only types to prevent bundling server code
- Updated documentation with new import structure

🤖 Generated with [Claude Code](https://claude.ai/code)
2025-08-31 18:09:52 +02:00
7cf102e0b9 Fix GitHub workflow to properly detect version changes
The workflow now detects version changes by:
1. Looking for version bump commits (created by npm version)
2. Checking if package.json was modified and version actually changed

This works with the npm version workflow where:
1. Make changes and commit them
2. Run npm version patch (creates version commit)
3. Push both commits - workflow publishes on version commit
2025-08-31 18:08:15 +02:00
5 changed files with 94 additions and 17 deletions

View File

@@ -35,25 +35,34 @@ jobs:
- name: Build
run: pnpm build
- name: Check if version changed
- name: Check if should publish
id: version-check
run: |
# Get current version from package.json
CURRENT_VERSION=$(node -p "require('./package.json').version")
# Get previous commit's version
git show HEAD~1:package.json > prev-package.json 2>/dev/null || echo '{"version":"0.0.0"}' > prev-package.json
PREVIOUS_VERSION=$(node -p "require('./prev-package.json').version")
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "previous=$PREVIOUS_VERSION" >> $GITHUB_OUTPUT
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
# Check if this is a version bump commit (created by npm version)
COMMIT_MSG=$(git log -1 --pretty=%B)
if echo "$COMMIT_MSG" | grep -q "^Release v[0-9]\|^v[0-9]"; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
echo "Version bump commit detected: $COMMIT_MSG"
# Or check if package.json was modified in this commit
elif git diff --name-only HEAD~1 HEAD | grep -q "package.json"; then
# Check if the version actually changed
git show HEAD~1:package.json > prev-package.json 2>/dev/null || echo '{"version":"0.0.0"}' > prev-package.json
PREVIOUS_VERSION=$(node -p "require('./prev-package.json').version")
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "package.json modified but version unchanged: $CURRENT_VERSION"
fi
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "Version unchanged: $CURRENT_VERSION"
echo "No version change detected"
fi
- name: Publish to NPM

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@xtr-dev/payload-workflows",
"version": "0.0.10",
"version": "0.0.12",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@xtr-dev/payload-workflows",
"version": "0.0.10",
"version": "0.0.12",
"license": "MIT",
"dependencies": {
"jsonpath-plus": "^10.3.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@xtr-dev/payload-automation",
"version": "0.0.10",
"version": "0.0.12",
"description": "PayloadCMS Automation Plugin - Comprehensive workflow automation system with visual workflow building, execution tracking, and step types",
"license": "MIT",
"type": "module",

View File

@@ -1,10 +1,16 @@
// Main export contains only types and client-safe utilities
// Server-side functions are exported via '@xtr-dev/payload-automation/server'
// Types only - safe for client bundling
export type { CustomTriggerOptions, TriggerResult } from './core/trigger-custom-workflow.js'
export type { ExecutionContext, Workflow, WorkflowStep, WorkflowTrigger } from './core/workflow-executor.js'
export type { WorkflowsPluginConfig } from './plugin/config-types.js'
// Pure types only - completely safe for client bundling
export type {
CustomTriggerOptions,
TriggerResult,
ExecutionContext,
Workflow,
WorkflowStep,
WorkflowTrigger,
WorkflowsPluginConfig
} from './types/index.js'
// Server-side functions are NOT re-exported here to avoid bundling issues
// Import server-side functions from the /server export instead

62
src/types/index.ts Normal file
View File

@@ -0,0 +1,62 @@
// Pure type definitions for client-safe exports
// This file contains NO runtime code and can be safely bundled
export interface CustomTriggerOptions {
workflowId: string
triggerData?: any
req?: any // PayloadRequest type, but avoiding import to keep this client-safe
}
export interface TriggerResult {
success: boolean
runId?: string
error?: string
}
export interface ExecutionContext {
trigger: {
type: string
doc?: any
data?: any
}
steps: Record<string, {
output?: any
state: 'pending' | 'running' | 'succeeded' | 'failed'
}>
payload: any // Payload instance
req: any // PayloadRequest
}
export interface WorkflowStep {
id: string
type: string
input: Record<string, any>
dependencies?: string[]
}
export interface WorkflowTrigger {
type: 'collection' | 'global' | 'webhook' | 'cron' | 'manual'
collection?: string
global?: string
event?: 'create' | 'update' | 'delete' | 'read'
path?: string
cron?: string
}
export interface Workflow {
id: string
name: string
description?: string
active: boolean
triggers: WorkflowTrigger[]
steps: WorkflowStep[]
}
export interface WorkflowsPluginConfig {
collections?: string[]
globals?: string[]
logging?: {
level?: 'debug' | 'info' | 'warn' | 'error'
enabled?: boolean
}
}