motia 0.13.0 → 0.13.1-beta.162
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/LICENSE +93 -21
- package/README.md +1 -1
- package/dist/cjs/cloud/cli-output-manager.d.ts.map +1 -1
- package/dist/cjs/cloud/cli-output-manager.js +38 -9
- package/dist/cjs/cloud/new-deployment/build.d.ts.map +1 -1
- package/dist/cjs/cloud/new-deployment/build.js +2 -1
- package/dist/cjs/create/index.d.ts.map +1 -1
- package/dist/cjs/create/index.js +22 -15
- package/dist/cjs/create/interactive.js +3 -3
- package/dist/cjs/create/templates/generate.d.ts.map +1 -1
- package/dist/cjs/create/templates/generate.js +4 -0
- package/dist/cjs/create/templates/generate.ts +3 -0
- package/dist/cjs/create/templates/hello/README.md.txt +77 -0
- package/dist/cjs/create/templates/hello_js/README.md.txt +77 -0
- package/dist/cjs/create/templates/hello_python/README.md.txt +78 -0
- package/dist/cjs/create/templates/index.js +2 -2
- package/dist/cjs/create/templates/index.ts +2 -2
- package/dist/cjs/create/templates/nodejs/README.md.txt +86 -0
- package/dist/cjs/create/templates/python/README.md.txt +87 -0
- package/dist/cjs/cursor-rules/dot-files/.cursor/rules/motia/api-steps.mdc +22 -6
- package/dist/cjs/cursor-rules/dot-files/.cursor/rules/motia/event-steps.mdc +19 -3
- package/dist/cjs/cursor-rules/dot-files/.cursor/rules/motia/motia-config.mdc +359 -0
- package/dist/cjs/cursor-rules/dot-files/.cursor/rules/motia/realtime-streaming.mdc +37 -16
- package/dist/cjs/generate-locked-data.d.ts.map +1 -1
- package/dist/cjs/generate-locked-data.js +1 -1
- package/dist/cjs/install.d.ts.map +1 -1
- package/dist/cjs/install.js +2 -1
- package/dist/esm/cloud/cli-output-manager.d.ts.map +1 -1
- package/dist/esm/cloud/cli-output-manager.js +38 -9
- package/dist/esm/cloud/new-deployment/build.d.ts.map +1 -1
- package/dist/esm/cloud/new-deployment/build.js +3 -2
- package/dist/esm/create/index.d.ts.map +1 -1
- package/dist/esm/create/index.js +22 -15
- package/dist/esm/create/interactive.js +3 -3
- package/dist/esm/create/templates/generate.d.ts.map +1 -1
- package/dist/esm/create/templates/generate.js +4 -0
- package/dist/esm/create/templates/generate.ts +3 -0
- package/dist/esm/create/templates/hello/README.md.txt +77 -0
- package/dist/esm/create/templates/hello_js/README.md.txt +77 -0
- package/dist/esm/create/templates/hello_python/README.md.txt +78 -0
- package/dist/esm/create/templates/index.js +2 -2
- package/dist/esm/create/templates/index.ts +2 -2
- package/dist/esm/create/templates/nodejs/README.md.txt +86 -0
- package/dist/esm/create/templates/python/README.md.txt +87 -0
- package/dist/esm/cursor-rules/dot-files/.cursor/rules/motia/api-steps.mdc +22 -6
- package/dist/esm/cursor-rules/dot-files/.cursor/rules/motia/event-steps.mdc +19 -3
- package/dist/esm/cursor-rules/dot-files/.cursor/rules/motia/motia-config.mdc +359 -0
- package/dist/esm/cursor-rules/dot-files/.cursor/rules/motia/realtime-streaming.mdc +37 -16
- package/dist/esm/generate-locked-data.d.ts.map +1 -1
- package/dist/esm/generate-locked-data.js +1 -1
- package/dist/esm/install.d.ts.map +1 -1
- package/dist/esm/install.js +3 -2
- package/dist/types/cloud/cli-output-manager.d.ts.map +1 -1
- package/dist/types/cloud/new-deployment/build.d.ts.map +1 -1
- package/dist/types/create/index.d.ts.map +1 -1
- package/dist/types/create/templates/generate.d.ts.map +1 -1
- package/dist/types/generate-locked-data.d.ts.map +1 -1
- package/dist/types/install.d.ts.map +1 -1
- package/package.json +7 -7
package/LICENSE
CHANGED
|
@@ -1,21 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject
|
|
14
|
+
to the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
27
|
+
of the licensor in the software. Any use of the licensor's trademarks is subject
|
|
28
|
+
to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
+
also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that organization.
|
|
84
|
+
**control** means ownership of substantially all the assets of an entity, or the
|
|
85
|
+
power to direct its management and policies by vote, contract, or otherwise.
|
|
86
|
+
Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[](https://motia.dev/)
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/motia)
|
|
4
|
-
[](https://github.com/MotiaDev/motia/blob/main/LICENSE)
|
|
5
5
|
[](https://github.com/MotiaDev/motia)
|
|
6
6
|
[](https://twitter.com/motiadev)
|
|
7
7
|
[](https://discord.gg/motia)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-output-manager.d.ts","sourceRoot":"","sources":["../../../src/cloud/cli-output-manager.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAU3B,QAAA,MAAM,IAAI;;;;;;CAMA,CAAA;AAEV,QAAA,MAAM,SAAS;;;;;;;;;;CAUL,CAAA;AAEV,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAU;;IAMxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAK9B,GAAG,CAAC,GAAG,EAAE,MAAM,OAAO,IAAI,GAAG,OAAO;IAKpC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,OAAO,SAAS,GAAG,OAAO;IAShE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,GAAE,MAAM,OAAO,SAAkB,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"cli-output-manager.d.ts","sourceRoot":"","sources":["../../../src/cloud/cli-output-manager.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAU3B,QAAA,MAAM,IAAI;;;;;;CAMA,CAAA;AAEV,QAAA,MAAM,SAAS;;;;;;;;;;CAUL,CAAA;AAEV,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAU;;IAMxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAK9B,GAAG,CAAC,GAAG,EAAE,MAAM,OAAO,IAAI,GAAG,OAAO;IAKpC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,OAAO,SAAS,GAAG,OAAO;IAShE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,GAAE,MAAM,OAAO,SAAkB,GAAG,OAAO;IA0CxE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO;IAiC/D,QAAQ,IAAI,MAAM;CAGnB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,SAAS,CAAI;IAErB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI;IAsBpD,aAAa,IAAI,OAAO;CAGzB"}
|
|
@@ -55,17 +55,46 @@ class Message {
|
|
|
55
55
|
return this;
|
|
56
56
|
}
|
|
57
57
|
box(messages, color = 'blue') {
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const border = '─'.repeat(
|
|
58
|
+
const ansiEscape = String.fromCharCode(0x1b);
|
|
59
|
+
const stripAnsi = (str) => str.replace(new RegExp(`${ansiEscape}\\[[0-9;]*m`, 'g'), '');
|
|
60
|
+
const contentWidth = 40;
|
|
61
|
+
const border = '─'.repeat(contentWidth + 2);
|
|
62
62
|
const borderColor = colorTags[color];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
63
|
+
const processedLines = [];
|
|
64
|
+
messages.forEach((msg) => {
|
|
65
|
+
const trimmed = msg.trim();
|
|
66
|
+
if (trimmed.length === 0)
|
|
67
|
+
return;
|
|
68
|
+
const visibleLength = stripAnsi(trimmed).length;
|
|
69
|
+
if (visibleLength <= contentWidth) {
|
|
70
|
+
processedLines.push(trimmed);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const words = trimmed.split(/\s+/);
|
|
74
|
+
let currentLine = '';
|
|
75
|
+
words.forEach((word) => {
|
|
76
|
+
const wordLength = stripAnsi(word).length;
|
|
77
|
+
const currentLength = stripAnsi(currentLine).length;
|
|
78
|
+
if (currentLength + wordLength + 1 <= contentWidth) {
|
|
79
|
+
currentLine = currentLine ? `${currentLine} ${word}` : word;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if (currentLine)
|
|
83
|
+
processedLines.push(currentLine);
|
|
84
|
+
currentLine = word;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
if (currentLine)
|
|
88
|
+
processedLines.push(currentLine);
|
|
89
|
+
}
|
|
67
90
|
});
|
|
68
|
-
this.output.push(borderColor(
|
|
91
|
+
this.output.push(borderColor(`\n ┌${border}┐\n`));
|
|
92
|
+
processedLines.forEach((line) => {
|
|
93
|
+
const lineLength = stripAnsi(line).length;
|
|
94
|
+
const padding = ' '.repeat(contentWidth - lineLength);
|
|
95
|
+
this.output.push(`${borderColor(' │')} ${line}${padding} ${borderColor('│\n')}`);
|
|
96
|
+
});
|
|
97
|
+
this.output.push(borderColor(` └${border}┘`));
|
|
69
98
|
return this;
|
|
70
99
|
}
|
|
71
100
|
table(headers, rows) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cloud/new-deployment/build.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAwB,MAAM,kBAAkB,CAAA;AAIhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAM/D,eAAO,MAAM,KAAK,GAAU,UAAU,aAAa,KAAG,OAAO,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cloud/new-deployment/build.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAwB,MAAM,kBAAkB,CAAA;AAIhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAM/D,eAAO,MAAM,KAAK,GAAU,UAAU,aAAa,KAAG,OAAO,CAAC,OAAO,CAuDpE,CAAA"}
|
|
@@ -20,6 +20,7 @@ const hasPythonSteps = (stepFiles) => {
|
|
|
20
20
|
const build = async (listener) => {
|
|
21
21
|
const builder = new builder_1.Builder(constants_1.projectDir, listener);
|
|
22
22
|
const stepFiles = (0, generate_locked_data_1.getStepFiles)(constants_1.projectDir);
|
|
23
|
+
const streamFiles = (0, generate_locked_data_1.getStreamFiles)(constants_1.projectDir);
|
|
23
24
|
if (stepFiles.length === 0) {
|
|
24
25
|
throw new Error('Project contains no steps, please add some steps before building');
|
|
25
26
|
}
|
|
@@ -29,7 +30,7 @@ const build = async (listener) => {
|
|
|
29
30
|
fs_1.default.mkdirSync(constants_1.distDir, { recursive: true });
|
|
30
31
|
const redisClient = await (0, redis_memory_manager_1.instanceRedisMemoryServer)(constants_1.projectDir, false);
|
|
31
32
|
const lockedData = new core_1.LockedData(constants_1.projectDir, new core_1.MemoryStreamAdapterManager(), new printer_1.NoPrinter(), redisClient);
|
|
32
|
-
if (hasPythonSteps(stepFiles)) {
|
|
33
|
+
if (hasPythonSteps([...stepFiles, ...streamFiles])) {
|
|
33
34
|
builder.registerBuilder('python', new python_1.PythonBuilder(builder, listener));
|
|
34
35
|
}
|
|
35
36
|
const invalidSteps = await (0, generate_locked_data_1.collectFlows)(constants_1.projectDir, lockedData).catch((err) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/create/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/create/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAwEvD,KAAK,IAAI,GAAG;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,OAAO,EAAE,UAAU,CAAA;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,MAAM,GAAU,mDAAmD,IAAI,KAAG,OAAO,CAAC,IAAI,CAmLlG,CAAA"}
|
package/dist/cjs/create/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.create = void 0;
|
|
7
|
+
const colors_1 = __importDefault(require("colors"));
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const generate_types_1 = require("../generate-types");
|
|
@@ -60,14 +61,14 @@ const installNodeDependencies = async (rootDir, context) => {
|
|
|
60
61
|
const create = async ({ projectName, template, cursorEnabled, context }) => {
|
|
61
62
|
console.log('\n\n' +
|
|
62
63
|
`
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/\\ \\ \\ \\/\\ \\/_/\\ \\/\\/_/\\ \\/ \\ \\ \\L\\ \\
|
|
66
|
-
\\ \\ \\__\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ __ \\
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
_____ ______ ______ ______
|
|
65
|
+
/'\\_/\`\\/\\ __\`\\/\\__ _\\/\\__ _\\ /\\ _ \\
|
|
66
|
+
/\\ \\ \\ \\/\\ \\/_/\\ \\/\\/_/\\ \\/ \\ \\ \\L\\ \\
|
|
67
|
+
\\ \\ \\__\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ __ \\
|
|
68
|
+
\\ \\ \\_/\\ \\ \\ \\_\\ \\ \\ \\ \\ \\_\\ \\__\\ \\ \\/\\ \\
|
|
69
|
+
\\ \\_\\\\ \\_\\ \\_____\\ \\ \\_\\ /\\_____\\\\ \\_\\ \\_\\
|
|
70
|
+
\\/_/ \\/_/\\/_____/ \\/_/ \\/_____/ \\/_/\\/_/
|
|
71
|
+
` +
|
|
71
72
|
'\n\n');
|
|
72
73
|
const isCurrentDir = projectName === '.' || projectName === './' || projectName === '.\\';
|
|
73
74
|
const rootDir = isCurrentDir ? process.cwd() : path_1.default.join(process.cwd(), projectName);
|
|
@@ -186,12 +187,18 @@ const create = async ({ projectName, template, cursorEnabled, context }) => {
|
|
|
186
187
|
.append('Created at')
|
|
187
188
|
.append(`./${path_1.default.basename(rootDir)}`, 'cyan')
|
|
188
189
|
.append('- happy coding!'));
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
.
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
const projectDirName = path_1.default.basename(rootDir);
|
|
191
|
+
const devCommand = `${packageManager} run dev`;
|
|
192
|
+
const nextSteps = [];
|
|
193
|
+
if (isCurrentDir) {
|
|
194
|
+
nextSteps.push(`Run ${colors_1.default.cyan(devCommand)}`);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
nextSteps.push(`cd ${colors_1.default.cyan(projectDirName)}`, `then run ${colors_1.default.cyan(devCommand)}`);
|
|
198
|
+
}
|
|
199
|
+
context.log('starting-development-server-command', (message) => {
|
|
200
|
+
message.tag('info').append('Next steps:');
|
|
201
|
+
message.box([...nextSteps, 'to start the development server.'], 'cyan');
|
|
202
|
+
});
|
|
196
203
|
};
|
|
197
204
|
exports.create = create;
|
|
@@ -8,8 +8,8 @@ const colors_1 = __importDefault(require("colors"));
|
|
|
8
8
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
9
9
|
const index_1 = require("./index");
|
|
10
10
|
const choices = {
|
|
11
|
-
|
|
12
|
-
python: 'Tutorial (Python)',
|
|
11
|
+
'motia-tutorial-typescript': 'Tutorial (TypeScript)',
|
|
12
|
+
'motia-tutorial-python': 'Tutorial (Python)',
|
|
13
13
|
'starter-typescript': 'Starter (TypeScript)',
|
|
14
14
|
'starter-javascript': 'Starter (JavaScript)',
|
|
15
15
|
'starter-python': 'Starter (Python)',
|
|
@@ -68,7 +68,7 @@ const createInteractive = async (args, context) => {
|
|
|
68
68
|
context.log('creating', (message) => message.append('\n🔨 Creating your Motia project...\n'));
|
|
69
69
|
await (0, index_1.create)({
|
|
70
70
|
projectName: name || '.',
|
|
71
|
-
template: template || '
|
|
71
|
+
template: template || 'motia-tutorial-typescript',
|
|
72
72
|
cursorEnabled: true, // Default to true for cursor rules
|
|
73
73
|
context,
|
|
74
74
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/create/templates/generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAuB/E,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/create/templates/generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAuB/E,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,KAAG,SAkE9D,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,MAAM,KAAG,SA0C/D,CAAA"}
|
|
@@ -59,6 +59,7 @@ const generateTemplateSteps = (templateFolder) => {
|
|
|
59
59
|
return async (rootDir, context) => {
|
|
60
60
|
const templatePath = path.join(__dirname, templateFolder);
|
|
61
61
|
const files = (0, glob_1.globSync)('**/*', { absolute: false, cwd: templatePath, dot: true });
|
|
62
|
+
const projectName = path.basename(rootDir);
|
|
62
63
|
try {
|
|
63
64
|
for (const fileName of files) {
|
|
64
65
|
const filePath = path.join(templatePath, fileName);
|
|
@@ -95,6 +96,9 @@ const generateTemplateSteps = (templateFolder) => {
|
|
|
95
96
|
void 0;
|
|
96
97
|
}
|
|
97
98
|
}
|
|
99
|
+
else {
|
|
100
|
+
content = replaceTemplateVariables(content, projectName);
|
|
101
|
+
}
|
|
98
102
|
// Use file descriptor for atomic write operation
|
|
99
103
|
let fd = null;
|
|
100
104
|
try {
|
|
@@ -30,6 +30,7 @@ export const generateTemplateSteps = (templateFolder: string): Generator => {
|
|
|
30
30
|
return async (rootDir: string, context: CliContext): Promise<void> => {
|
|
31
31
|
const templatePath = path.join(__dirname, templateFolder)
|
|
32
32
|
const files = globSync('**/*', { absolute: false, cwd: templatePath, dot: true })
|
|
33
|
+
const projectName = path.basename(rootDir)
|
|
33
34
|
|
|
34
35
|
try {
|
|
35
36
|
for (const fileName of files) {
|
|
@@ -71,6 +72,8 @@ export const generateTemplateSteps = (templateFolder: string): Generator => {
|
|
|
71
72
|
} catch {
|
|
72
73
|
void 0
|
|
73
74
|
}
|
|
75
|
+
} else {
|
|
76
|
+
content = replaceTemplateVariables(content, projectName)
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
// Use file descriptor for atomic write operation
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
A Motia project created with the starter template.
|
|
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
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Start the development server
|
|
13
|
+
npm run dev
|
|
14
|
+
# or
|
|
15
|
+
yarn dev
|
|
16
|
+
# or
|
|
17
|
+
pnpm dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
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).
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Test your first endpoint
|
|
24
|
+
curl http://localhost:3000/hello
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Step Types
|
|
28
|
+
|
|
29
|
+
Every Step has a `type` that defines how it triggers:
|
|
30
|
+
|
|
31
|
+
| Type | When it runs | Use case |
|
|
32
|
+
|------|--------------|----------|
|
|
33
|
+
| **`api`** | HTTP request | REST APIs, webhooks |
|
|
34
|
+
| **`event`** | Event emitted | Background jobs, workflows |
|
|
35
|
+
| **`cron`** | Schedule | Cleanup, reports, reminders |
|
|
36
|
+
|
|
37
|
+
## Development Commands
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Start Workbench and development server
|
|
41
|
+
npm run dev
|
|
42
|
+
# or
|
|
43
|
+
yarn dev
|
|
44
|
+
# or
|
|
45
|
+
pnpm dev
|
|
46
|
+
|
|
47
|
+
# Generate TypeScript types from Step configs
|
|
48
|
+
npm run generate-types
|
|
49
|
+
# or
|
|
50
|
+
yarn generate-types
|
|
51
|
+
# or
|
|
52
|
+
pnpm generate-types
|
|
53
|
+
|
|
54
|
+
# Build project for deployment
|
|
55
|
+
npm run build
|
|
56
|
+
# or
|
|
57
|
+
yarn build
|
|
58
|
+
# or
|
|
59
|
+
pnpm build
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Project Structure
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
steps/ # Your Step definitions (or use src/)
|
|
66
|
+
motia.config.ts # Motia configuration
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Steps are auto-discovered from your `steps/` or `src/` directories - no manual registration required.
|
|
70
|
+
|
|
71
|
+
## Learn More
|
|
72
|
+
|
|
73
|
+
- [Documentation](https://motia.dev/docs) - Complete guides and API reference
|
|
74
|
+
- [Quick Start Guide](https://motia.dev/docs/getting-started/quick-start) - Detailed getting started tutorial
|
|
75
|
+
- [Core Concepts](https://motia.dev/docs/concepts/overview) - Learn about Steps and Motia architecture
|
|
76
|
+
- [Discord Community](https://discord.gg/motia) - Get help and connect with other developers
|
|
77
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
A Motia project created with the starter template.
|
|
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
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Start the development server
|
|
13
|
+
npm run dev
|
|
14
|
+
# or
|
|
15
|
+
yarn dev
|
|
16
|
+
# or
|
|
17
|
+
pnpm dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
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).
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Test your first endpoint
|
|
24
|
+
curl http://localhost:3000/hello
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Step Types
|
|
28
|
+
|
|
29
|
+
Every Step has a `type` that defines how it triggers:
|
|
30
|
+
|
|
31
|
+
| Type | When it runs | Use case |
|
|
32
|
+
|------|--------------|----------|
|
|
33
|
+
| **`api`** | HTTP request | REST APIs, webhooks |
|
|
34
|
+
| **`event`** | Event emitted | Background jobs, workflows |
|
|
35
|
+
| **`cron`** | Schedule | Cleanup, reports, reminders |
|
|
36
|
+
|
|
37
|
+
## Development Commands
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Start Workbench and development server
|
|
41
|
+
npm run dev
|
|
42
|
+
# or
|
|
43
|
+
yarn dev
|
|
44
|
+
# or
|
|
45
|
+
pnpm dev
|
|
46
|
+
|
|
47
|
+
# Generate TypeScript types from Step configs
|
|
48
|
+
npm run generate-types
|
|
49
|
+
# or
|
|
50
|
+
yarn generate-types
|
|
51
|
+
# or
|
|
52
|
+
pnpm generate-types
|
|
53
|
+
|
|
54
|
+
# Build project for deployment
|
|
55
|
+
npm run build
|
|
56
|
+
# or
|
|
57
|
+
yarn build
|
|
58
|
+
# or
|
|
59
|
+
pnpm build
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Project Structure
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
steps/ # Your Step definitions (or use src/)
|
|
66
|
+
motia.config.ts # Motia configuration
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Steps are auto-discovered from your `steps/` or `src/` directories - no manual registration required.
|
|
70
|
+
|
|
71
|
+
## Learn More
|
|
72
|
+
|
|
73
|
+
- [Documentation](https://motia.dev/docs) - Complete guides and API reference
|
|
74
|
+
- [Quick Start Guide](https://motia.dev/docs/getting-started/quick-start) - Detailed getting started tutorial
|
|
75
|
+
- [Core Concepts](https://motia.dev/docs/concepts/overview) - Learn about Steps and Motia architecture
|
|
76
|
+
- [Discord Community](https://discord.gg/motia) - Get help and connect with other developers
|
|
77
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
A Motia project created with the starter template.
|
|
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
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Start the development server
|
|
13
|
+
npm run dev
|
|
14
|
+
# or
|
|
15
|
+
yarn dev
|
|
16
|
+
# or
|
|
17
|
+
pnpm dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
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).
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Test your first endpoint
|
|
24
|
+
curl http://localhost:3000/hello
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Step Types
|
|
28
|
+
|
|
29
|
+
Every Step has a `type` that defines how it triggers:
|
|
30
|
+
|
|
31
|
+
| Type | When it runs | Use case |
|
|
32
|
+
|------|--------------|----------|
|
|
33
|
+
| **`api`** | HTTP request | REST APIs, webhooks |
|
|
34
|
+
| **`event`** | Event emitted | Background jobs, workflows |
|
|
35
|
+
| **`cron`** | Schedule | Cleanup, reports, reminders |
|
|
36
|
+
|
|
37
|
+
## Development Commands
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Start Workbench and development server
|
|
41
|
+
npm run dev
|
|
42
|
+
# or
|
|
43
|
+
yarn dev
|
|
44
|
+
# or
|
|
45
|
+
pnpm dev
|
|
46
|
+
|
|
47
|
+
# Generate TypeScript types from Step configs
|
|
48
|
+
npm run generate-types
|
|
49
|
+
# or
|
|
50
|
+
yarn generate-types
|
|
51
|
+
# or
|
|
52
|
+
pnpm generate-types
|
|
53
|
+
|
|
54
|
+
# Build project for deployment
|
|
55
|
+
npm run build
|
|
56
|
+
# or
|
|
57
|
+
yarn build
|
|
58
|
+
# or
|
|
59
|
+
pnpm build
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Project Structure
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
steps/ # Your Step definitions (or use src/)
|
|
66
|
+
motia.config.ts # Motia configuration
|
|
67
|
+
requirements.txt # Python dependencies
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Steps are auto-discovered from your `steps/` or `src/` directories - no manual registration required. You can write Steps in Python, TypeScript, or JavaScript, all in the same project.
|
|
71
|
+
|
|
72
|
+
## Learn More
|
|
73
|
+
|
|
74
|
+
- [Documentation](https://motia.dev/docs) - Complete guides and API reference
|
|
75
|
+
- [Quick Start Guide](https://motia.dev/docs/getting-started/quick-start) - Detailed getting started tutorial
|
|
76
|
+
- [Core Concepts](https://motia.dev/docs/concepts/overview) - Learn about Steps and Motia architecture
|
|
77
|
+
- [Discord Community](https://discord.gg/motia) - Get help and connect with other developers
|
|
78
|
+
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.templates = void 0;
|
|
4
4
|
const generate_1 = require("./generate");
|
|
5
5
|
exports.templates = {
|
|
6
|
-
|
|
7
|
-
python: (0, generate_1.generateTemplateSteps)('python'),
|
|
6
|
+
'motia-tutorial-typescript': (0, generate_1.generateTemplateSteps)('nodejs'),
|
|
7
|
+
'motia-tutorial-python': (0, generate_1.generateTemplateSteps)('python'),
|
|
8
8
|
plugin: (0, generate_1.generatePluginTemplate)('plugin'),
|
|
9
9
|
'starter-typescript': (0, generate_1.generateTemplateSteps)('hello'),
|
|
10
10
|
'starter-javascript': (0, generate_1.generateTemplateSteps)('hello_js'),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Generator, generatePluginTemplate, generateTemplateSteps } from './generate'
|
|
2
2
|
|
|
3
3
|
export const templates: Record<string, Generator> = {
|
|
4
|
-
|
|
5
|
-
python: generateTemplateSteps('python'),
|
|
4
|
+
'motia-tutorial-typescript': generateTemplateSteps('nodejs'),
|
|
5
|
+
'motia-tutorial-python': generateTemplateSteps('python'),
|
|
6
6
|
plugin: generatePluginTemplate('plugin'),
|
|
7
7
|
'starter-typescript': generateTemplateSteps('hello'),
|
|
8
8
|
'starter-javascript': generateTemplateSteps('hello_js'),
|