motia 0.14.0-beta.165-917560 → 0.14.0-beta.165-958021
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/dist/create/index.mjs +1 -1
- package/dist/create/index.mjs.map +1 -1
- package/dist/create/interactive.mjs +2 -1
- package/dist/create/interactive.mjs.map +1 -1
- package/dist/create/templates/hello_mixed/requirements.txt +3 -0
- package/dist/create/templates/hello_multilang/README.md.txt +103 -0
- package/dist/create/templates/hello_multilang/motia-workbench.json +16 -0
- package/dist/create/templates/hello_multilang/motia.config.ts.txt +10 -0
- package/dist/create/templates/hello_multilang/requirements.txt +2 -0
- package/dist/create/templates/hello_multilang/steps/hello/hello-api.step.ts.txt +46 -0
- package/dist/create/templates/hello_multilang/steps/hello/process_greeting_step.py.txt +65 -0
- package/dist/create/templates/index.mjs +2 -1
- package/dist/create/templates/index.mjs.map +1 -1
- package/dist/create/templates/index.ts +1 -0
- package/dist/docker/setup.mjs +2 -8
- package/dist/docker/setup.mjs.map +1 -1
- package/package.json +9 -8
- package/dist/cursor-rules/dot-files/.aider.conf.yml +0 -32
package/dist/create/index.mjs
CHANGED
|
@@ -150,7 +150,7 @@ const create = async ({ projectName, template, cursorEnabled, context }) => {
|
|
|
150
150
|
let packageManager;
|
|
151
151
|
if (!isPluginTemplate) {
|
|
152
152
|
packageManager = await installNodeDependencies(rootDir, context);
|
|
153
|
-
if (template.includes("python")) await pythonInstall({ baseDir: rootDir });
|
|
153
|
+
if (template.includes("python") || template.includes("multilang")) await pythonInstall({ baseDir: rootDir });
|
|
154
154
|
await generateTypes(rootDir);
|
|
155
155
|
} else packageManager = await preparePackageManager(rootDir, context);
|
|
156
156
|
const projectDirName = path.basename(rootDir);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["packageManager: string"],"sources":["../../src/create/index.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport pc from 'picocolors'\nimport type { CliContext, Message } from '../cloud/config-utils'\nimport { generateTypes } from '../generate-types'\nimport { pythonInstall } from '../install'\nimport { pluginDependencies } from '../plugins/plugin-dependencies'\nimport { executeCommand } from '../utils/execute-command'\nimport { getPackageManager } from '../utils/get-package-manager'\nimport { version } from '../version'\nimport { pullRules } from './pull-rules'\nimport { setupTemplate } from './setup-template'\nimport { checkIfDirectoryExists, checkIfFileExists } from './utils'\n\nconst installRequiredDependencies = async (packageManager: string, rootDir: string, context: CliContext) => {\n context.log('installing-dependencies', (message: Message) => message.tag('info').append('Installing dependencies...'))\n\n const installCommand = {\n npm: 'npm install --save',\n yarn: 'yarn add',\n pnpm: 'pnpm add',\n }[packageManager]\n\n const dependencies = [\n `motia@${version}`,\n 'zod@4.1.12',\n `@motiadev/adapter-bullmq-events@${version}`,\n ...pluginDependencies.map((dep: string) => `${dep}@${version}`),\n ].join(' ')\n\n const devDependencies = ['ts-node@10.9.2', 'typescript@5.7.3', '@types/react@19.1.1'].join(' ')\n\n try {\n await executeCommand(`${installCommand} ${dependencies}`, rootDir)\n await executeCommand(`${installCommand} -D ${devDependencies}`, rootDir)\n\n context.log('dependencies-installed', (message: Message) => message.tag('success').append('Dependencies installed'))\n } catch (error) {\n console.error('❌ Failed to install dependencies:', error)\n }\n}\n\nconst preparePackageManager = async (rootDir: string, context: CliContext) => {\n let packageManager = 'npm'\n const detectedPackageManager = getPackageManager(rootDir)\n\n if (detectedPackageManager !== 'unknown') {\n context.log('package-manager-detected', (message: Message) =>\n message.tag('info').append('Detected package manager').append(detectedPackageManager, 'gray'),\n )\n packageManager = detectedPackageManager\n } else {\n context.log('package-manager-using-default', (message: Message) =>\n message.tag('info').append('Using default package manager').append(packageManager, 'gray'),\n )\n }\n\n return packageManager\n}\n\nconst installNodeDependencies = async (rootDir: string, context: CliContext) => {\n const packageManager = await preparePackageManager(rootDir, context)\n\n await installRequiredDependencies(packageManager, rootDir, context).catch((error: unknown) => {\n context.log('failed-to-install-dependencies', (message: Message) =>\n message.tag('failed').append('Failed to install dependencies'),\n )\n console.error(error)\n })\n\n return packageManager\n}\n\ntype Args = {\n projectName: string\n template: string\n cursorEnabled: boolean\n context: CliContext\n skipTutorialTemplates?: boolean\n}\n\nexport const create = async ({ projectName, template, cursorEnabled, context }: Args): Promise<void> => {\n console.log(\n '\\n\\n' +\n `\n _____ ______ ______ ______\n /'\\\\_/\\`\\\\/\\\\ __\\`\\\\/\\\\__ _\\\\/\\\\__ _\\\\ /\\\\ _ \\\\\n /\\\\ \\\\ \\\\ \\\\/\\\\ \\\\/_/\\\\ \\\\/\\\\/_/\\\\ \\\\/ \\\\ \\\\ \\\\L\\\\ \\\\\n \\\\ \\\\ \\\\__\\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ __ \\\\\n \\\\ \\\\ \\\\_/\\\\ \\\\ \\\\ \\\\_\\\\ \\\\ \\\\ \\\\ \\\\ \\\\_\\\\ \\\\__\\\\ \\\\ \\\\/\\\\ \\\\\n \\\\ \\\\_\\\\\\\\ \\\\_\\\\ \\\\_____\\\\ \\\\ \\\\_\\\\ /\\\\_____\\\\\\\\ \\\\_\\\\ \\\\_\\\\\n \\\\/_/ \\\\/_/\\\\/_____/ \\\\/_/ \\\\/_____/ \\\\/_/\\\\/_/\n ` +\n '\\n\\n',\n )\n\n const isCurrentDir = projectName === '.' || projectName === './' || projectName === '.\\\\'\n const rootDir = isCurrentDir ? process.cwd() : path.join(process.cwd(), projectName)\n const isPluginTemplate = template === 'plugin'\n\n if (!isCurrentDir && !checkIfDirectoryExists(rootDir)) {\n fs.mkdirSync(path.join(rootDir))\n context.log('directory-created', (message: Message) =>\n message.tag('success').append('Directory created ').append(projectName, 'gray'),\n )\n } else {\n context.log('directory-using', (message: Message) => message.tag('info').append('Using current directory'))\n }\n\n // Plugin template handles package.json differently (via template)\n if (!isPluginTemplate && !checkIfFileExists(rootDir, 'package.json')) {\n const finalProjectName =\n !projectName || projectName === '.' || projectName === './' || projectName === '.\\\\'\n ? path.basename(process.cwd())\n : projectName.trim()\n\n const packageJsonContent = {\n name: finalProjectName,\n description: '',\n type: 'module',\n scripts: {\n postinstall: 'motia install',\n dev: 'motia dev',\n start: 'motia start',\n 'generate-types': 'motia generate-types',\n build: 'motia build',\n clean: 'rm -rf dist node_modules python_modules .motia .mermaid',\n //'generate:config': 'motia get-config --output ./', TODO: doesnt work at the moment\n },\n keywords: ['motia'],\n }\n\n fs.writeFileSync(path.join(rootDir, 'package.json'), JSON.stringify(packageJsonContent, null, 2))\n\n context.log('package-json-created', (message: Message) =>\n message.tag('success').append('File').append('package.json', 'cyan').append('has been created.'),\n )\n } else if (!isPluginTemplate) {\n const packageJsonPath = path.join(rootDir, 'package.json')\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))\n\n if (!packageJson.scripts) {\n packageJson.scripts = {}\n }\n\n if (!packageJson.scripts.dev) {\n packageJson.scripts.dev = 'motia dev'\n } else {\n packageJson.scripts.olddev = packageJson.scripts.dev\n packageJson.scripts.dev = 'motia dev'\n context.log('dev-command-already-exists', (message: Message) =>\n message.tag('warning').append('dev command already exists in package.json'),\n )\n }\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n context.log('dev-command-updated', (message: Message) =>\n message\n .tag('success')\n .append('Updated')\n .append('dev', 'gray')\n .append('command to')\n .append('package.json', 'gray'),\n )\n }\n\n // Plugin template handles tsconfig.json via template\n if (!isPluginTemplate && !checkIfFileExists(rootDir, 'tsconfig.json')) {\n const tsconfigContent = {\n compilerOptions: {\n target: 'ES2020',\n module: 'ESNext',\n moduleResolution: 'bundler',\n allowImportingTsExtensions: true,\n noEmit: true,\n esModuleInterop: true,\n strict: true,\n skipLibCheck: true,\n forceConsistentCasingInFileNames: true,\n resolveJsonModule: true,\n allowJs: true,\n outDir: 'dist',\n rootDir: '.',\n baseUrl: '.',\n jsx: 'react-jsx',\n },\n include: ['**/*.ts', 'motia.config.ts', '**/*.tsx', 'types.d.ts', '**/*.jsx'],\n exclude: ['node_modules', 'dist', 'tests'],\n }\n\n fs.writeFileSync(path.join(rootDir, 'tsconfig.json'), JSON.stringify(tsconfigContent, null, 2))\n context.log('tsconfig-json-created', (message: Message) =>\n message.tag('success').append('File').append('tsconfig.json', 'cyan').append('has been created.'),\n )\n }\n\n // Plugin template handles .gitignore via template\n if (!isPluginTemplate && !checkIfFileExists(rootDir, '.gitignore')) {\n const gitignoreContent = [\n 'node_modules',\n 'python_modules',\n '.venv',\n 'venv',\n '.motia',\n '.mermaid',\n 'dist',\n '*.pyc',\n ].join('\\n')\n\n fs.writeFileSync(path.join(rootDir, '.gitignore'), gitignoreContent)\n context.log('gitignore-created', (message: Message) =>\n message.tag('success').append('File').append('.gitignore', 'cyan').append('has been created.'),\n )\n }\n\n // Skip cursor rules for plugin template\n if (!isPluginTemplate && cursorEnabled) {\n await pullRules({ force: true, rootDir }, context)\n }\n\n if (template) {\n await setupTemplate(template, rootDir, context)\n }\n\n let packageManager: string\n if (!isPluginTemplate) {\n packageManager = await installNodeDependencies(rootDir, context)\n\n if (template.includes('python')) {\n await pythonInstall({ baseDir: rootDir })\n }\n\n await generateTypes(rootDir)\n } else {\n // For plugin template, just detect the package manager\n packageManager = await preparePackageManager(rootDir, context)\n }\n\n const projectDirName = path.basename(rootDir)\n const devCommand = `${packageManager} run dev`\n const port = 3000\n const cdCommand = isCurrentDir ? '' : `${pc.cyan(`cd ${projectDirName}`)}\\n `\n\n context.log('success-blank', (message) => message.text(''))\n context.log('success-header', (message) =>\n message.text(`${pc.green('✨')} ${pc.bold('All set! Your project is ready to go.')}`),\n )\n context.log('success-blank-2', (message) => message.text(''))\n context.log('success-get-started', (message) => message.text('Get started:'))\n context.log('success-blank-3', (message) => message.text(''))\n context.log('success-commands', (message) => message.text(` ${cdCommand}${pc.cyan(devCommand)}`))\n context.log('success-blank-4', (message) => message.text(''))\n context.log('success-open', (message) => message.text(`Then open ${pc.cyan(`http://localhost:${port}`)}`))\n context.log('success-blank-5', (message: Message) => message.text(''))\n context.log('success-docs', (message) => message.text(`Docs: ${pc.cyan('https://www.motia.dev/docs')}`))\n context.log('success-blank-6', (message) => message.text(''))\n context.log('success-signoff', (message) => message.text('Happy coding! 🚀'))\n context.log('success-blank-7', (message) => message.text(''))\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,8BAA8B,OAAO,gBAAwB,SAAiB,YAAwB;AAC1G,SAAQ,IAAI,4BAA4B,YAAqB,QAAQ,IAAI,OAAO,CAAC,OAAO,6BAA6B,CAAC;CAEtH,MAAM,iBAAiB;EACrB,KAAK;EACL,MAAM;EACN,MAAM;EACP,CAAC;CAEF,MAAM,eAAe;EACnB,SAAS;EACT;EACA,mCAAmC;EACnC,GAAG,mBAAmB,KAAK,QAAgB,GAAG,IAAI,GAAG,UAAU;EAChE,CAAC,KAAK,IAAI;CAEX,MAAM,kBAAkB;EAAC;EAAkB;EAAoB;EAAsB,CAAC,KAAK,IAAI;AAE/F,KAAI;AACF,QAAM,eAAe,GAAG,eAAe,GAAG,gBAAgB,QAAQ;AAClE,QAAM,eAAe,GAAG,eAAe,MAAM,mBAAmB,QAAQ;AAExE,UAAQ,IAAI,2BAA2B,YAAqB,QAAQ,IAAI,UAAU,CAAC,OAAO,yBAAyB,CAAC;UAC7G,OAAO;AACd,UAAQ,MAAM,qCAAqC,MAAM;;;AAI7D,MAAM,wBAAwB,OAAO,SAAiB,YAAwB;CAC5E,IAAI,iBAAiB;CACrB,MAAM,yBAAyB,kBAAkB,QAAQ;AAEzD,KAAI,2BAA2B,WAAW;AACxC,UAAQ,IAAI,6BAA6B,YACvC,QAAQ,IAAI,OAAO,CAAC,OAAO,2BAA2B,CAAC,OAAO,wBAAwB,OAAO,CAC9F;AACD,mBAAiB;OAEjB,SAAQ,IAAI,kCAAkC,YAC5C,QAAQ,IAAI,OAAO,CAAC,OAAO,gCAAgC,CAAC,OAAO,gBAAgB,OAAO,CAC3F;AAGH,QAAO;;AAGT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QAAQ,KAAK,GAAG,CAAC;AAC7D,SAAQ,IAAI,qBAAqB,YAAY,QAAQ,KAAK,KAAK,YAAY,GAAG,KAAK,WAAW,GAAG,CAAC;AAClG,SAAQ,IAAI,oBAAoB,YAAY,QAAQ,KAAK,GAAG,CAAC;AAC7D,SAAQ,IAAI,iBAAiB,YAAY,QAAQ,KAAK,aAAa,GAAG,KAAK,oBAAoB,OAAO,GAAG,CAAC;AAC1G,SAAQ,IAAI,oBAAoB,YAAqB,QAAQ,KAAK,GAAG,CAAC;AACtE,SAAQ,IAAI,iBAAiB,YAAY,QAAQ,KAAK,SAAS,GAAG,KAAK,6BAA6B,GAAG,CAAC;AACxG,SAAQ,IAAI,oBAAoB,YAAY,QAAQ,KAAK,GAAG,CAAC;AAC7D,SAAQ,IAAI,oBAAoB,YAAY,QAAQ,KAAK,mBAAmB,CAAC;AAC7E,SAAQ,IAAI,oBAAoB,YAAY,QAAQ,KAAK,GAAG,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["packageManager: string"],"sources":["../../src/create/index.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport pc from 'picocolors'\nimport type { CliContext, Message } from '../cloud/config-utils'\nimport { generateTypes } from '../generate-types'\nimport { pythonInstall } from '../install'\nimport { pluginDependencies } from '../plugins/plugin-dependencies'\nimport { executeCommand } from '../utils/execute-command'\nimport { getPackageManager } from '../utils/get-package-manager'\nimport { version } from '../version'\nimport { pullRules } from './pull-rules'\nimport { setupTemplate } from './setup-template'\nimport { checkIfDirectoryExists, checkIfFileExists } from './utils'\n\nconst installRequiredDependencies = async (packageManager: string, rootDir: string, context: CliContext) => {\n context.log('installing-dependencies', (message: Message) => message.tag('info').append('Installing dependencies...'))\n\n const installCommand = {\n npm: 'npm install --save',\n yarn: 'yarn add',\n pnpm: 'pnpm add',\n }[packageManager]\n\n const dependencies = [\n `motia@${version}`,\n 'zod@4.1.12',\n `@motiadev/adapter-bullmq-events@${version}`,\n ...pluginDependencies.map((dep: string) => `${dep}@${version}`),\n ].join(' ')\n\n const devDependencies = ['ts-node@10.9.2', 'typescript@5.7.3', '@types/react@19.1.1'].join(' ')\n\n try {\n await executeCommand(`${installCommand} ${dependencies}`, rootDir)\n await executeCommand(`${installCommand} -D ${devDependencies}`, rootDir)\n\n context.log('dependencies-installed', (message: Message) => message.tag('success').append('Dependencies installed'))\n } catch (error) {\n console.error('❌ Failed to install dependencies:', error)\n }\n}\n\nconst preparePackageManager = async (rootDir: string, context: CliContext) => {\n let packageManager = 'npm'\n const detectedPackageManager = getPackageManager(rootDir)\n\n if (detectedPackageManager !== 'unknown') {\n context.log('package-manager-detected', (message: Message) =>\n message.tag('info').append('Detected package manager').append(detectedPackageManager, 'gray'),\n )\n packageManager = detectedPackageManager\n } else {\n context.log('package-manager-using-default', (message: Message) =>\n message.tag('info').append('Using default package manager').append(packageManager, 'gray'),\n )\n }\n\n return packageManager\n}\n\nconst installNodeDependencies = async (rootDir: string, context: CliContext) => {\n const packageManager = await preparePackageManager(rootDir, context)\n\n await installRequiredDependencies(packageManager, rootDir, context).catch((error: unknown) => {\n context.log('failed-to-install-dependencies', (message: Message) =>\n message.tag('failed').append('Failed to install dependencies'),\n )\n console.error(error)\n })\n\n return packageManager\n}\n\ntype Args = {\n projectName: string\n template: string\n cursorEnabled: boolean\n context: CliContext\n skipTutorialTemplates?: boolean\n}\n\nexport const create = async ({ projectName, template, cursorEnabled, context }: Args): Promise<void> => {\n console.log(\n '\\n\\n' +\n `\n _____ ______ ______ ______\n /'\\\\_/\\`\\\\/\\\\ __\\`\\\\/\\\\__ _\\\\/\\\\__ _\\\\ /\\\\ _ \\\\\n /\\\\ \\\\ \\\\ \\\\/\\\\ \\\\/_/\\\\ \\\\/\\\\/_/\\\\ \\\\/ \\\\ \\\\ \\\\L\\\\ \\\\\n \\\\ \\\\ \\\\__\\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ __ \\\\\n \\\\ \\\\ \\\\_/\\\\ \\\\ \\\\ \\\\_\\\\ \\\\ \\\\ \\\\ \\\\ \\\\_\\\\ \\\\__\\\\ \\\\ \\\\/\\\\ \\\\\n \\\\ \\\\_\\\\\\\\ \\\\_\\\\ \\\\_____\\\\ \\\\ \\\\_\\\\ /\\\\_____\\\\\\\\ \\\\_\\\\ \\\\_\\\\\n \\\\/_/ \\\\/_/\\\\/_____/ \\\\/_/ \\\\/_____/ \\\\/_/\\\\/_/\n ` +\n '\\n\\n',\n )\n\n const isCurrentDir = projectName === '.' || projectName === './' || projectName === '.\\\\'\n const rootDir = isCurrentDir ? process.cwd() : path.join(process.cwd(), projectName)\n const isPluginTemplate = template === 'plugin'\n\n if (!isCurrentDir && !checkIfDirectoryExists(rootDir)) {\n fs.mkdirSync(path.join(rootDir))\n context.log('directory-created', (message: Message) =>\n message.tag('success').append('Directory created ').append(projectName, 'gray'),\n )\n } else {\n context.log('directory-using', (message: Message) => message.tag('info').append('Using current directory'))\n }\n\n // Plugin template handles package.json differently (via template)\n if (!isPluginTemplate && !checkIfFileExists(rootDir, 'package.json')) {\n const finalProjectName =\n !projectName || projectName === '.' || projectName === './' || projectName === '.\\\\'\n ? path.basename(process.cwd())\n : projectName.trim()\n\n const packageJsonContent = {\n name: finalProjectName,\n description: '',\n type: 'module',\n scripts: {\n postinstall: 'motia install',\n dev: 'motia dev',\n start: 'motia start',\n 'generate-types': 'motia generate-types',\n build: 'motia build',\n clean: 'rm -rf dist node_modules python_modules .motia .mermaid',\n //'generate:config': 'motia get-config --output ./', TODO: doesnt work at the moment\n },\n keywords: ['motia'],\n }\n\n fs.writeFileSync(path.join(rootDir, 'package.json'), JSON.stringify(packageJsonContent, null, 2))\n\n context.log('package-json-created', (message: Message) =>\n message.tag('success').append('File').append('package.json', 'cyan').append('has been created.'),\n )\n } else if (!isPluginTemplate) {\n const packageJsonPath = path.join(rootDir, 'package.json')\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))\n\n if (!packageJson.scripts) {\n packageJson.scripts = {}\n }\n\n if (!packageJson.scripts.dev) {\n packageJson.scripts.dev = 'motia dev'\n } else {\n packageJson.scripts.olddev = packageJson.scripts.dev\n packageJson.scripts.dev = 'motia dev'\n context.log('dev-command-already-exists', (message: Message) =>\n message.tag('warning').append('dev command already exists in package.json'),\n )\n }\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n context.log('dev-command-updated', (message: Message) =>\n message\n .tag('success')\n .append('Updated')\n .append('dev', 'gray')\n .append('command to')\n .append('package.json', 'gray'),\n )\n }\n\n // Plugin template handles tsconfig.json via template\n if (!isPluginTemplate && !checkIfFileExists(rootDir, 'tsconfig.json')) {\n const tsconfigContent = {\n compilerOptions: {\n target: 'ES2020',\n module: 'ESNext',\n moduleResolution: 'bundler',\n allowImportingTsExtensions: true,\n noEmit: true,\n esModuleInterop: true,\n strict: true,\n skipLibCheck: true,\n forceConsistentCasingInFileNames: true,\n resolveJsonModule: true,\n allowJs: true,\n outDir: 'dist',\n rootDir: '.',\n baseUrl: '.',\n jsx: 'react-jsx',\n },\n include: ['**/*.ts', 'motia.config.ts', '**/*.tsx', 'types.d.ts', '**/*.jsx'],\n exclude: ['node_modules', 'dist', 'tests'],\n }\n\n fs.writeFileSync(path.join(rootDir, 'tsconfig.json'), JSON.stringify(tsconfigContent, null, 2))\n context.log('tsconfig-json-created', (message: Message) =>\n message.tag('success').append('File').append('tsconfig.json', 'cyan').append('has been created.'),\n )\n }\n\n // Plugin template handles .gitignore via template\n if (!isPluginTemplate && !checkIfFileExists(rootDir, '.gitignore')) {\n const gitignoreContent = [\n 'node_modules',\n 'python_modules',\n '.venv',\n 'venv',\n '.motia',\n '.mermaid',\n 'dist',\n '*.pyc',\n ].join('\\n')\n\n fs.writeFileSync(path.join(rootDir, '.gitignore'), gitignoreContent)\n context.log('gitignore-created', (message: Message) =>\n message.tag('success').append('File').append('.gitignore', 'cyan').append('has been created.'),\n )\n }\n\n // Skip cursor rules for plugin template\n if (!isPluginTemplate && cursorEnabled) {\n await pullRules({ force: true, rootDir }, context)\n }\n\n if (template) {\n await setupTemplate(template, rootDir, context)\n }\n\n let packageManager: string\n if (!isPluginTemplate) {\n packageManager = await installNodeDependencies(rootDir, context)\n\n if (template.includes('python') || template.includes('multilang')) {\n await pythonInstall({ baseDir: rootDir })\n }\n\n await generateTypes(rootDir)\n } else {\n // For plugin template, just detect the package manager\n packageManager = await preparePackageManager(rootDir, context)\n }\n\n const projectDirName = path.basename(rootDir)\n const devCommand = `${packageManager} run dev`\n const port = 3000\n const cdCommand = isCurrentDir ? '' : `${pc.cyan(`cd ${projectDirName}`)}\\n `\n\n context.log('success-blank', (message) => message.text(''))\n context.log('success-header', (message) =>\n message.text(`${pc.green('✨')} ${pc.bold('All set! Your project is ready to go.')}`),\n )\n context.log('success-blank-2', (message) => message.text(''))\n context.log('success-get-started', (message) => message.text('Get started:'))\n context.log('success-blank-3', (message) => message.text(''))\n context.log('success-commands', (message) => message.text(` ${cdCommand}${pc.cyan(devCommand)}`))\n context.log('success-blank-4', (message) => message.text(''))\n context.log('success-open', (message) => message.text(`Then open ${pc.cyan(`http://localhost:${port}`)}`))\n context.log('success-blank-5', (message: Message) => message.text(''))\n context.log('success-docs', (message) => message.text(`Docs: ${pc.cyan('https://www.motia.dev/docs')}`))\n context.log('success-blank-6', (message) => message.text(''))\n context.log('success-signoff', (message) => message.text('Happy coding! 🚀'))\n context.log('success-blank-7', (message) => message.text(''))\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,8BAA8B,OAAO,gBAAwB,SAAiB,YAAwB;AAC1G,SAAQ,IAAI,4BAA4B,YAAqB,QAAQ,IAAI,OAAO,CAAC,OAAO,6BAA6B,CAAC;CAEtH,MAAM,iBAAiB;EACrB,KAAK;EACL,MAAM;EACN,MAAM;EACP,CAAC;CAEF,MAAM,eAAe;EACnB,SAAS;EACT;EACA,mCAAmC;EACnC,GAAG,mBAAmB,KAAK,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CAAC;AAC7D,SAAQ,IAAI,oBAAoB,YAAY,QAAQ,KAAK,mBAAmB,CAAC;AAC7E,SAAQ,IAAI,oBAAoB,YAAY,QAAQ,KAAK,GAAG,CAAC"}
|
|
@@ -8,7 +8,8 @@ const choices = {
|
|
|
8
8
|
"motia-tutorial-python": "Tutorial (Python)",
|
|
9
9
|
"starter-typescript": "Starter (TypeScript)",
|
|
10
10
|
"starter-javascript": "Starter (JavaScript)",
|
|
11
|
-
"starter-python": "Starter (Python)"
|
|
11
|
+
"starter-python": "Starter (Python)",
|
|
12
|
+
"starter-multilang": "Starter (Multi-language: TypeScript + Python)"
|
|
12
13
|
};
|
|
13
14
|
const createInteractive = async (args, context) => {
|
|
14
15
|
context.log("welcome", (message) => message.append(`\n🚀 ${pc.bold(args.plugin ? "Welcome to Motia Plugin Creator!" : "Welcome to Motia Project Creator!")}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.mjs","names":["choices: Record<string, string>","questions: QuestionCollection<never>[]","answers: InteractiveAnswers"],"sources":["../../src/create/interactive.ts"],"sourcesContent":["import inquirer, { type QuestionCollection } from 'inquirer'\nimport pc from 'picocolors'\nimport type { CliContext, Message } from '../cloud/config-utils'\nimport { create } from './index'\n\ninterface InteractiveAnswers {\n template: string\n projectName: string\n}\n\nconst choices: Record<string, string> = {\n 'motia-tutorial-typescript': 'Tutorial (TypeScript)',\n 'motia-tutorial-python': 'Tutorial (Python)',\n 'starter-typescript': 'Starter (TypeScript)',\n 'starter-javascript': 'Starter (JavaScript)',\n 'starter-python': 'Starter (Python)',\n}\n\ninterface CreateInteractiveArgs {\n name?: string\n template?: string\n plugin?: boolean\n}\n\nexport const createInteractive = async (args: CreateInteractiveArgs, context: CliContext): Promise<void> => {\n context.log('welcome', (message: Message) =>\n message.append(\n `\\n🚀 ${pc.bold(args.plugin ? 'Welcome to Motia Plugin Creator!' : 'Welcome to Motia Project Creator!')}`,\n ),\n )\n\n const questions: QuestionCollection<never>[] = []\n\n let name = args.name\n let template = args.template\n\n if (args.plugin) {\n if (!args.name) {\n context.log('failed', (message: Message) =>\n message.tag('failed').append(`Project name is required: ${pc.bold('motia create --plugin [project-name]')}\\n`),\n )\n return\n }\n\n return create({\n projectName: args.name,\n template: 'plugin',\n cursorEnabled: false,\n context,\n })\n } else if (!args.template) {\n questions.push({\n type: 'list',\n name: 'template',\n message: 'What template do you want to use? (Use arrow keys)',\n choices: Object.keys(choices).map((key) => ({\n name: choices[key],\n value: key,\n })),\n })\n }\n\n if (!args.name) {\n questions.push({\n type: 'input',\n name: 'projectName',\n message: 'Project name (leave blank to use current folder):',\n validate: (input: string) => {\n if (input && input.trim().length > 0) {\n if (!/^[a-zA-Z0-9][a-zA-Z0-9-_]*$/.test(input.trim())) {\n return 'Project name must start with a letter or number and contain only letters, numbers, hyphens, and underscores'\n }\n }\n return true\n },\n filter: (input: string) => input.trim(),\n })\n }\n\n if (questions.length > 0) {\n const answers: InteractiveAnswers = await inquirer.prompt(questions)\n name = args.name || answers.projectName\n template = args.template || answers.template\n }\n\n context.log('creating', (message: Message) => message.append('\\n🔨 Creating your Motia project...\\n'))\n\n await create({\n projectName: name || '.',\n template: template || 'motia-tutorial-typescript',\n cursorEnabled: true, // Default to true for cursor rules\n context,\n })\n\n process.exit(0)\n}\n"],"mappings":";;;;;AAUA,MAAMA,UAAkC;CACtC,6BAA6B;CAC7B,yBAAyB;CACzB,sBAAsB;CACtB,sBAAsB;CACtB,kBAAkB;
|
|
1
|
+
{"version":3,"file":"interactive.mjs","names":["choices: Record<string, string>","questions: QuestionCollection<never>[]","answers: InteractiveAnswers"],"sources":["../../src/create/interactive.ts"],"sourcesContent":["import inquirer, { type QuestionCollection } from 'inquirer'\nimport pc from 'picocolors'\nimport type { CliContext, Message } from '../cloud/config-utils'\nimport { create } from './index'\n\ninterface InteractiveAnswers {\n template: string\n projectName: string\n}\n\nconst choices: Record<string, string> = {\n 'motia-tutorial-typescript': 'Tutorial (TypeScript)',\n 'motia-tutorial-python': 'Tutorial (Python)',\n 'starter-typescript': 'Starter (TypeScript)',\n 'starter-javascript': 'Starter (JavaScript)',\n 'starter-python': 'Starter (Python)',\n 'starter-multilang': 'Starter (Multi-language: TypeScript + Python)',\n}\n\ninterface CreateInteractiveArgs {\n name?: string\n template?: string\n plugin?: boolean\n}\n\nexport const createInteractive = async (args: CreateInteractiveArgs, context: CliContext): Promise<void> => {\n context.log('welcome', (message: Message) =>\n message.append(\n `\\n🚀 ${pc.bold(args.plugin ? 'Welcome to Motia Plugin Creator!' : 'Welcome to Motia Project Creator!')}`,\n ),\n )\n\n const questions: QuestionCollection<never>[] = []\n\n let name = args.name\n let template = args.template\n\n if (args.plugin) {\n if (!args.name) {\n context.log('failed', (message: Message) =>\n message.tag('failed').append(`Project name is required: ${pc.bold('motia create --plugin [project-name]')}\\n`),\n )\n return\n }\n\n return create({\n projectName: args.name,\n template: 'plugin',\n cursorEnabled: false,\n context,\n })\n } else if (!args.template) {\n questions.push({\n type: 'list',\n name: 'template',\n message: 'What template do you want to use? (Use arrow keys)',\n choices: Object.keys(choices).map((key) => ({\n name: choices[key],\n value: key,\n })),\n })\n }\n\n if (!args.name) {\n questions.push({\n type: 'input',\n name: 'projectName',\n message: 'Project name (leave blank to use current folder):',\n validate: (input: string) => {\n if (input && input.trim().length > 0) {\n if (!/^[a-zA-Z0-9][a-zA-Z0-9-_]*$/.test(input.trim())) {\n return 'Project name must start with a letter or number and contain only letters, numbers, hyphens, and underscores'\n }\n }\n return true\n },\n filter: (input: string) => input.trim(),\n })\n }\n\n if (questions.length > 0) {\n const answers: InteractiveAnswers = await inquirer.prompt(questions)\n name = args.name || answers.projectName\n template = args.template || answers.template\n }\n\n context.log('creating', (message: Message) => message.append('\\n🔨 Creating your Motia project...\\n'))\n\n await create({\n projectName: name || '.',\n template: template || 'motia-tutorial-typescript',\n cursorEnabled: true, // Default to true for cursor rules\n context,\n })\n\n process.exit(0)\n}\n"],"mappings":";;;;;AAUA,MAAMA,UAAk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AAU,YAAY;EACtB,eAAe;EACf;EACD,CAAC;AAEF,SAAQ,KAAK,EAAE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
A Motia project created with the **multi-language** starter template (TypeScript + Python).
|
|
4
|
+
|
|
5
|
+
## What is Motia?
|
|
6
|
+
|
|
7
|
+
Motia is an open-source, unified backend framework that eliminates runtime fragmentation by bringing **APIs, background jobs, queueing, streaming, state, workflows, AI agents, observability, scaling, and deployment** into one unified system using a single core primitive, the **Step**.
|
|
8
|
+
|
|
9
|
+
## Polyglot Architecture
|
|
10
|
+
|
|
11
|
+
This template demonstrates Motia's polyglot capabilities by combining:
|
|
12
|
+
|
|
13
|
+
- **TypeScript**: API endpoint (`hello-api.step.ts`) - handles HTTP requests
|
|
14
|
+
- **Python**: Event processor (`process_greeting_step.py`) - handles background work
|
|
15
|
+
|
|
16
|
+
This shows how you can use the best language for each task while keeping everything in a single unified system.
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Start the development server
|
|
22
|
+
npm run dev
|
|
23
|
+
# or
|
|
24
|
+
yarn dev
|
|
25
|
+
# or
|
|
26
|
+
pnpm dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This starts the Motia runtime and the **Workbench** - a powerful UI for developing and debugging your workflows. By default, it's available at [`http://localhost:3000`](http://localhost:3000).
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Test your first endpoint
|
|
33
|
+
curl http://localhost:3000/hello
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## How It Works
|
|
37
|
+
|
|
38
|
+
1. **TypeScript API Step** receives the HTTP request at `/hello`
|
|
39
|
+
2. It emits a `process-greeting` event with the request data
|
|
40
|
+
3. **Python Event Step** picks up the event and processes it in the background
|
|
41
|
+
4. The result is stored in state using Python
|
|
42
|
+
|
|
43
|
+
## Step Types
|
|
44
|
+
|
|
45
|
+
Every Step has a `type` that defines how it triggers:
|
|
46
|
+
|
|
47
|
+
| Type | When it runs | Use case |
|
|
48
|
+
|------|--------------|----------|
|
|
49
|
+
| **`api`** | HTTP request | REST APIs, webhooks |
|
|
50
|
+
| **`event`** | Event emitted | Background jobs, workflows |
|
|
51
|
+
| **`cron`** | Schedule | Cleanup, reports, reminders |
|
|
52
|
+
|
|
53
|
+
## Development Commands
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Start Workbench and development server
|
|
57
|
+
npm run dev
|
|
58
|
+
# or
|
|
59
|
+
yarn dev
|
|
60
|
+
# or
|
|
61
|
+
pnpm dev
|
|
62
|
+
|
|
63
|
+
# Start production server (without hot reload)
|
|
64
|
+
npm run start
|
|
65
|
+
# or
|
|
66
|
+
yarn start
|
|
67
|
+
# or
|
|
68
|
+
pnpm start
|
|
69
|
+
|
|
70
|
+
# Generate TypeScript types from Step configs
|
|
71
|
+
npm run generate-types
|
|
72
|
+
# or
|
|
73
|
+
yarn generate-types
|
|
74
|
+
# or
|
|
75
|
+
pnpm generate-types
|
|
76
|
+
|
|
77
|
+
# Build project for deployment
|
|
78
|
+
npm run build
|
|
79
|
+
# or
|
|
80
|
+
yarn build
|
|
81
|
+
# or
|
|
82
|
+
pnpm build
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Project Structure
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
steps/ # Your Step definitions
|
|
89
|
+
├── hello/
|
|
90
|
+
│ ├── hello-api.step.ts # TypeScript API endpoint
|
|
91
|
+
│ └── process_greeting_step.py # Python event processor
|
|
92
|
+
motia.config.ts # Motia configuration
|
|
93
|
+
requirements.txt # Python dependencies
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Steps are auto-discovered from your `steps/` or `src/` directories - no manual registration required.
|
|
97
|
+
|
|
98
|
+
## Learn More
|
|
99
|
+
|
|
100
|
+
- [Documentation](https://motia.dev/docs) - Complete guides and API reference
|
|
101
|
+
- [Quick Start Guide](https://motia.dev/docs/getting-started/quick-start) - Detailed getting started tutorial
|
|
102
|
+
- [Core Concepts](https://motia.dev/docs/concepts/overview) - Learn about Steps and Motia architecture
|
|
103
|
+
- [Discord Community](https://discord.gg/motia) - Get help and connect with other developers
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { config } from '@motiadev/core'
|
|
2
|
+
import endpointPlugin from '@motiadev/plugin-endpoint/plugin'
|
|
3
|
+
import logsPlugin from '@motiadev/plugin-logs/plugin'
|
|
4
|
+
import observabilityPlugin from '@motiadev/plugin-observability/plugin'
|
|
5
|
+
import statesPlugin from '@motiadev/plugin-states/plugin'
|
|
6
|
+
import bullmqPlugin from '@motiadev/plugin-bullmq/plugin'
|
|
7
|
+
|
|
8
|
+
export default config({
|
|
9
|
+
plugins: [observabilityPlugin, statesPlugin, endpointPlugin, logsPlugin, bullmqPlugin],
|
|
10
|
+
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ApiRouteConfig, Handlers } from 'motia';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export const config: ApiRouteConfig = {
|
|
5
|
+
name: 'HelloAPI',
|
|
6
|
+
type: 'api',
|
|
7
|
+
path: '/hello',
|
|
8
|
+
method: 'GET',
|
|
9
|
+
description: 'Receives hello request and emits event for Python processing',
|
|
10
|
+
emits: ['process-greeting'],
|
|
11
|
+
flows: ['hello-world-flow'],
|
|
12
|
+
responseSchema: {
|
|
13
|
+
200: z.object({
|
|
14
|
+
message: z.string(),
|
|
15
|
+
status: z.string(),
|
|
16
|
+
appName: z.string()
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const handler: Handlers['HelloAPI'] = async (_, { emit, logger }) => {
|
|
22
|
+
const appName = process.env.APP_NAME || 'Motia App';
|
|
23
|
+
const timestamp = new Date().toISOString();
|
|
24
|
+
|
|
25
|
+
logger.info('Hello API endpoint called (TypeScript)', { appName, timestamp });
|
|
26
|
+
|
|
27
|
+
// Emit event for background processing in Python
|
|
28
|
+
await emit({
|
|
29
|
+
topic: 'process-greeting',
|
|
30
|
+
data: {
|
|
31
|
+
timestamp,
|
|
32
|
+
appName,
|
|
33
|
+
greetingPrefix: process.env.GREETING_PREFIX || 'Hello',
|
|
34
|
+
requestId: Math.random().toString(36).substring(7)
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
status: 200,
|
|
40
|
+
body: {
|
|
41
|
+
message: 'Hello request received! Processing in Python...',
|
|
42
|
+
status: 'processing',
|
|
43
|
+
appName
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
# Optional: Using Pydantic for validation (remove if not using Pydantic)
|
|
4
|
+
try:
|
|
5
|
+
from pydantic import BaseModel
|
|
6
|
+
|
|
7
|
+
class GreetingInput(BaseModel):
|
|
8
|
+
timestamp: str
|
|
9
|
+
appName: str
|
|
10
|
+
greetingPrefix: str
|
|
11
|
+
requestId: str
|
|
12
|
+
|
|
13
|
+
# If using Pydantic, we can generate the JSON schema
|
|
14
|
+
input_schema = GreetingInput.model_json_schema()
|
|
15
|
+
except ImportError:
|
|
16
|
+
# Without Pydantic, define JSON schema manually
|
|
17
|
+
input_schema = {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"timestamp": {"type": "string"},
|
|
21
|
+
"appName": {"type": "string"},
|
|
22
|
+
"greetingPrefix": {"type": "string"},
|
|
23
|
+
"requestId": {"type": "string"}
|
|
24
|
+
},
|
|
25
|
+
"required": ["timestamp", "appName", "greetingPrefix", "requestId"]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
config = {
|
|
29
|
+
"name": "ProcessGreeting",
|
|
30
|
+
"type": "event",
|
|
31
|
+
"description": "Processes greeting in the background (Python)",
|
|
32
|
+
"subscribes": ["process-greeting"],
|
|
33
|
+
"emits": [],
|
|
34
|
+
"flows": ["hello-world-flow"],
|
|
35
|
+
"input": input_schema
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async def handler(input_data, context):
|
|
39
|
+
# Extract data from input
|
|
40
|
+
timestamp = input_data.get("timestamp")
|
|
41
|
+
app_name = input_data.get("appName")
|
|
42
|
+
greeting_prefix = input_data.get("greetingPrefix")
|
|
43
|
+
request_id = input_data.get("requestId")
|
|
44
|
+
|
|
45
|
+
context.logger.info("Processing greeting (Python)", {
|
|
46
|
+
"request_id": request_id,
|
|
47
|
+
"app_name": app_name
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
greeting = f"{greeting_prefix} {app_name}!"
|
|
51
|
+
|
|
52
|
+
# Store result in state (demonstrates state usage)
|
|
53
|
+
# Note: The state.set method takes (groupId, key, value)
|
|
54
|
+
await context.state.set("greetings", request_id, {
|
|
55
|
+
"greeting": greeting,
|
|
56
|
+
"processedAt": datetime.utcnow().isoformat(),
|
|
57
|
+
"originalTimestamp": timestamp,
|
|
58
|
+
"processedBy": "python"
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
context.logger.info("Greeting processed successfully (Python)", {
|
|
62
|
+
"request_id": request_id,
|
|
63
|
+
"greeting": greeting,
|
|
64
|
+
"stored_in_state": True
|
|
65
|
+
})
|
|
@@ -7,7 +7,8 @@ const templates = {
|
|
|
7
7
|
plugin: generatePluginTemplate("plugin"),
|
|
8
8
|
"starter-typescript": generateTemplateSteps("hello"),
|
|
9
9
|
"starter-javascript": generateTemplateSteps("hello_js"),
|
|
10
|
-
"starter-python": generateTemplateSteps("hello_python")
|
|
10
|
+
"starter-python": generateTemplateSteps("hello_python"),
|
|
11
|
+
"starter-multilang": generateTemplateSteps("hello_multilang")
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["templates: Record<string, Generator>"],"sources":["../../../src/create/templates/index.ts"],"sourcesContent":["import { type Generator, generatePluginTemplate, generateTemplateSteps } from './generate'\n\nexport const templates: Record<string, Generator> = {\n 'motia-tutorial-typescript': generateTemplateSteps('nodejs'),\n 'motia-tutorial-python': generateTemplateSteps('python'),\n plugin: generatePluginTemplate('plugin'),\n 'starter-typescript': generateTemplateSteps('hello'),\n 'starter-javascript': generateTemplateSteps('hello_js'),\n 'starter-python': generateTemplateSteps('hello_python'),\n}\n"],"mappings":";;;AAEA,MAAaA,YAAuC;CAClD,6BAA6B,sBAAsB,SAAS;CAC5D,yBAAyB,sBAAsB,SAAS;CACxD,QAAQ,uBAAuB,SAAS;CACxC,sBAAsB,sBAAsB,QAAQ;CACpD,sBAAsB,sBAAsB,WAAW;CACvD,kBAAkB,sBAAsB,eAAe;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["templates: Record<string, Generator>"],"sources":["../../../src/create/templates/index.ts"],"sourcesContent":["import { type Generator, generatePluginTemplate, generateTemplateSteps } from './generate'\n\nexport const templates: Record<string, Generator> = {\n 'motia-tutorial-typescript': generateTemplateSteps('nodejs'),\n 'motia-tutorial-python': generateTemplateSteps('python'),\n plugin: generatePluginTemplate('plugin'),\n 'starter-typescript': generateTemplateSteps('hello'),\n 'starter-javascript': generateTemplateSteps('hello_js'),\n 'starter-python': generateTemplateSteps('hello_python'),\n 'starter-multilang': generateTemplateSteps('hello_multilang'),\n}\n"],"mappings":";;;AAEA,MAAaA,YAAuC;CAClD,6BAA6B,sBAAsB,SAAS;CAC5D,yBAAyB,sBAAsB,SAAS;CACxD,QAAQ,uBAAuB,SAAS;CACxC,sBAAsB,sBAAsB,QAAQ;CACpD,sBAAsB,sBAAsB,WAAW;CACvD,kBAAkB,sBAAsB,eAAe;CACvD,qBAAqB,sBAAsB,kBAAkB;CAC9D"}
|
|
@@ -7,4 +7,5 @@ export const templates: Record<string, Generator> = {
|
|
|
7
7
|
'starter-typescript': generateTemplateSteps('hello'),
|
|
8
8
|
'starter-javascript': generateTemplateSteps('hello_js'),
|
|
9
9
|
'starter-python': generateTemplateSteps('hello_python'),
|
|
10
|
+
'starter-multilang': generateTemplateSteps('hello_multilang'),
|
|
10
11
|
}
|
package/dist/docker/setup.mjs
CHANGED
|
@@ -8,12 +8,6 @@ import * as readline$1 from "readline";
|
|
|
8
8
|
|
|
9
9
|
//#region src/docker/setup.ts
|
|
10
10
|
const __dirname = path$1.dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
const resolveTemplatesDir = () => {
|
|
12
|
-
const localTemplates = path$1.join(__dirname, "./templates");
|
|
13
|
-
if (fs$1.existsSync(localTemplates)) return localTemplates;
|
|
14
|
-
return path$1.join(__dirname, "../../../docker/templates");
|
|
15
|
-
};
|
|
16
|
-
const templatesDir = resolveTemplatesDir();
|
|
17
11
|
const updatePackageJson = () => {
|
|
18
12
|
const packageJsonPath = path$1.join(process.cwd(), "package.json");
|
|
19
13
|
if (fs$1.existsSync(packageJsonPath)) {
|
|
@@ -42,7 +36,7 @@ const createDockerfile = async () => {
|
|
|
42
36
|
return;
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
|
-
const dockerfileContent = fs$1.readFileSync(path$1.join(
|
|
39
|
+
const dockerfileContent = fs$1.readFileSync(path$1.join(__dirname, "./templates", "MotiaDockerSample"), "utf-8");
|
|
46
40
|
try {
|
|
47
41
|
fs$1.writeFileSync(dockerfilePath, dockerfileContent);
|
|
48
42
|
console.log("Dockerfile generated successfully!");
|
|
@@ -54,7 +48,7 @@ const createDockerfile = async () => {
|
|
|
54
48
|
const createDockerignore = async () => {
|
|
55
49
|
identifyUser();
|
|
56
50
|
trackEvent("docker_setup_command", { project_name: getProjectIdentifier(process.cwd()) });
|
|
57
|
-
const dockerignoreContent = fs$1.readFileSync(path$1.join(
|
|
51
|
+
const dockerignoreContent = fs$1.readFileSync(path$1.join(__dirname, "./templates", ".dockerignore.sample"), "utf-8");
|
|
58
52
|
const dockerignorePath = path$1.join(process.cwd(), ".dockerignore");
|
|
59
53
|
if (fs$1.existsSync(dockerignorePath)) {
|
|
60
54
|
console.log(".dockerignore already exists");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.mjs","names":["path","fs","readline"],"sources":["../../src/docker/setup.ts"],"sourcesContent":["import { getProjectIdentifier, trackEvent } from '@motiadev/core'\nimport * as fs from 'fs'\nimport * as path from 'path'\nimport * as readline from 'readline'\nimport { fileURLToPath } from 'url'\nimport { identifyUser } from '../utils/analytics'\nimport { printMotiaDockerIntro } from './utils/print-intro'\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\n\nconst
|
|
1
|
+
{"version":3,"file":"setup.mjs","names":["path","fs","readline"],"sources":["../../src/docker/setup.ts"],"sourcesContent":["import { getProjectIdentifier, trackEvent } from '@motiadev/core'\nimport * as fs from 'fs'\nimport * as path from 'path'\nimport * as readline from 'readline'\nimport { fileURLToPath } from 'url'\nimport { identifyUser } from '../utils/analytics'\nimport { printMotiaDockerIntro } from './utils/print-intro'\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\n\nconst updatePackageJson = (): void => {\n const packageJsonPath = path.join(process.cwd(), 'package.json')\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))\n if (!packageJson.scripts) {\n packageJson.scripts = {}\n }\n packageJson.scripts.start = 'motia start'\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n console.log('Updated package.json with start script')\n }\n}\n\nconst createDockerfile = async () => {\n const dockerfilePath = path.join(process.cwd(), 'Dockerfile')\n\n if (fs.existsSync(dockerfilePath)) {\n console.log('Dockerfile already exists')\n\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n })\n\n const shouldOverride = await new Promise<boolean>((resolve) => {\n rl.question('Do you want to override the existing Dockerfile? (y/N): ', (answer) => {\n rl.close()\n resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes')\n })\n })\n\n if (!shouldOverride) {\n console.log('Dockerfile generation cancelled')\n return\n }\n }\n\n const dockerfileContent = fs.readFileSync(path.join(__dirname, './templates', 'MotiaDockerSample'), 'utf-8')\n\n try {\n fs.writeFileSync(dockerfilePath, dockerfileContent)\n console.log('Dockerfile generated successfully!')\n } catch (error) {\n console.error('Error generating Dockerfile:', (error as Error).message)\n throw error\n }\n}\n\nconst createDockerignore = async () => {\n identifyUser()\n\n trackEvent('docker_setup_command', {\n project_name: getProjectIdentifier(process.cwd()),\n })\n\n const dockerignoreContent = fs.readFileSync(path.join(__dirname, './templates', '.dockerignore.sample'), 'utf-8')\n\n const dockerignorePath = path.join(process.cwd(), '.dockerignore')\n\n if (fs.existsSync(dockerignorePath)) {\n console.log('.dockerignore already exists')\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n })\n\n const shouldOverride = await new Promise<boolean>((resolve) => {\n rl.question('Do you want to override the existing .dockerignore? (y/N): ', (answer) => {\n rl.close()\n resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes')\n })\n })\n\n if (!shouldOverride) {\n console.log('.dockerignore generation cancelled')\n return\n }\n }\n\n try {\n fs.writeFileSync(dockerignorePath, dockerignoreContent)\n console.log('.dockerignore generated successfully!')\n } catch (error) {\n console.error('Error generating .dockerignore:', (error as Error).message)\n throw error\n }\n}\n\nexport const setup = async (): Promise<void> => {\n printMotiaDockerIntro()\n\n await createDockerfile()\n await createDockerignore()\n updatePackageJson()\n}\n"],"mappings":";;;;;;;;;AAQA,MAAM,YAAYA,OAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE9D,MAAM,0BAAgC;CACpC,MAAM,kBAAkBA,OAAK,KAAK,QAAQ,KAAK,EAAE,eAAe;AAChE,KAAIC,KAAG,WAAW,gBAAgB,EAAE;EAClC,MAAM,cAAc,KAAK,MAAMA,KAAG,aAAa,iBAAiB,QAAQ,CAAC;AACzE,MAAI,CAAC,YAAY,QACf,aAAY,UAAU,EAAE;AAE1B,cAAY,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AC7D,MAAG,SAAS,gEAAgE,WAAW;AACrF,OAAG,OAAO;AACV,YAAQ,OAAO,aAAa,KAAK,OAAO,OAAO,aAAa,KAAK,MAAM;KACvE;IACF,EAEmB;AACnB,WAAQ,IAAI,qCAAqC;AACjD;;;AAIJ,KAAI;AACF,OAAG,cAAc,kBAAkB,oBAAoB;AACvD,UAAQ,IAAI,wCAAwC;UAC7C,OAAO;AACd,UAAQ,MAAM,mCAAoC,MAAgB,QAAQ;AAC1E,QAAM;;;AAIV,MAAa,QAAQ,YAA2B;AAC9C,wBAAuB;AAEvB,OAAM,kBAAkB;AACxB,OAAM,oBAAoB;AAC1B,oBAAmB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motia",
|
|
3
3
|
"description": "Build production-grade backends with a single primitive. APIs, background jobs, Queues, Workflows, and AI agents - unified in one system with built-in State management, Streaming, and Observability.",
|
|
4
|
-
"version": "0.14.0-beta.165-
|
|
4
|
+
"version": "0.14.0-beta.165-958021",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"table": "^6.9.0",
|
|
47
47
|
"ts-node": "^10.9.2",
|
|
48
48
|
"zod": "^4.1.12",
|
|
49
|
-
"@motiadev/adapter-bullmq-events": "0.14.0-beta.165-
|
|
50
|
-
"@motiadev/adapter-redis-cron": "0.14.0-beta.165-
|
|
51
|
-
"@motiadev/adapter-redis-
|
|
52
|
-
"@motiadev/
|
|
53
|
-
"@motiadev/
|
|
54
|
-
"@motiadev/
|
|
55
|
-
"@motiadev/
|
|
49
|
+
"@motiadev/adapter-bullmq-events": "0.14.0-beta.165-958021",
|
|
50
|
+
"@motiadev/adapter-redis-cron": "0.14.0-beta.165-958021",
|
|
51
|
+
"@motiadev/adapter-redis-streams": "0.14.0-beta.165-958021",
|
|
52
|
+
"@motiadev/adapter-redis-state": "0.14.0-beta.165-958021",
|
|
53
|
+
"@motiadev/core": "0.14.0-beta.165-958021",
|
|
54
|
+
"@motiadev/stream-client-node": "0.14.0-beta.165-958021",
|
|
55
|
+
"@motiadev/workbench": "0.14.0-beta.165-958021"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@amplitude/analytics-types": "^2.9.2",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"move:python": "sh scripts/move-python.sh",
|
|
75
75
|
"move:dot-files": "sh scripts/move-dot-files.sh",
|
|
76
76
|
"build": "tsdown",
|
|
77
|
+
"postbuild": "sh scripts/post-build.sh",
|
|
77
78
|
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
78
79
|
"lint": "biome check .",
|
|
79
80
|
"lint:plugins": "eslint --config ../../eslint.config.js"
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Aider Configuration for Motia Projects
|
|
2
|
-
# https://aider.chat/docs/config.html
|
|
3
|
-
|
|
4
|
-
# Read AGENTS.md for project overview and guide references
|
|
5
|
-
read:
|
|
6
|
-
- AGENTS.md
|
|
7
|
-
# Uncomment specific guides as needed for more context:
|
|
8
|
-
# - .cursor/rules/motia/api-steps.mdc
|
|
9
|
-
# - .cursor/rules/motia/event-steps.mdc
|
|
10
|
-
# - .cursor/rules/motia/cron-steps.mdc
|
|
11
|
-
# - .cursor/rules/motia/state-management.mdc
|
|
12
|
-
# - .cursor/rules/motia/middlewares.mdc
|
|
13
|
-
# - .cursor/rules/motia/realtime-streaming.mdc
|
|
14
|
-
# - .cursor/rules/motia/virtual-steps.mdc
|
|
15
|
-
# - .cursor/rules/motia/ui-steps.mdc
|
|
16
|
-
# - .cursor/architecture/architecture.mdc
|
|
17
|
-
# - .cursor/architecture/error-handling.mdc
|
|
18
|
-
|
|
19
|
-
# Note: AGENTS.md references all detailed guides in .cursor/rules/
|
|
20
|
-
# The AI will read those guides when needed based on AGENTS.md instructions
|
|
21
|
-
|
|
22
|
-
# Auto-commit changes (optional, uncomment to enable)
|
|
23
|
-
# auto-commits: true
|
|
24
|
-
|
|
25
|
-
# Model selection (uncomment your preferred model)
|
|
26
|
-
# model: gpt-4
|
|
27
|
-
# model: claude-3-5-sonnet-20241022
|
|
28
|
-
|
|
29
|
-
# Additional context files (optional)
|
|
30
|
-
# read:
|
|
31
|
-
# - config.yml
|
|
32
|
-
# - package.json
|