motia 0.17.9-beta.192-537880 → 0.17.9-beta.192-311932
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { copyWithWSLCompat } from "./utils.mjs";
|
|
1
2
|
import fs from "fs";
|
|
2
3
|
import path from "path";
|
|
3
4
|
import { fileURLToPath } from "url";
|
|
@@ -11,13 +12,14 @@ const pullRules = async (args, context) => {
|
|
|
11
12
|
const targetFile = path.join(args.rootDir, file);
|
|
12
13
|
const isFolder = fs.statSync(path.join(cursorTemplateDir, file)).isDirectory();
|
|
13
14
|
const type = isFolder ? "Folder" : "File";
|
|
14
|
-
if (args.force || !fs.existsSync(targetFile)) {
|
|
15
|
-
|
|
16
|
-
recursive: isFolder,
|
|
17
|
-
force: true
|
|
18
|
-
});
|
|
15
|
+
if (args.force || !fs.existsSync(targetFile)) try {
|
|
16
|
+
copyWithWSLCompat(path.join(cursorTemplateDir, file), targetFile, isFolder);
|
|
19
17
|
context.log(`${file}-created`, (message) => message.tag("success").append(type).append(file, "cyan").append("has been created."));
|
|
20
|
-
}
|
|
18
|
+
} catch (error) {
|
|
19
|
+
context.log(`${file}-error`, (message) => message.tag("error").append("Failed to create").append(type, "yellow").append(file, "cyan").append(`: ${error.message}`));
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
else context.log(`${file}-skipped`, (message) => message.tag("warning").append(type).append(file, "cyan").append("already exists, skipping..."));
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull-rules.mjs","names":[],"sources":["../../src/create/pull-rules.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { fileURLToPath } from 'url'\nimport type { CliContext, Message } from '../cloud/config-utils'\n\ntype PullRulesArgs = {\n rootDir: string\n force?: boolean\n}\n\nexport const pullRules = async (args: PullRulesArgs, context: CliContext) => {\n const __dirname = path.dirname(fileURLToPath(import.meta.url))\n const cursorTemplateDir = path.join(__dirname, '..', 'cursor-rules', 'dot-files')\n const files = fs.readdirSync(cursorTemplateDir)\n\n for (const file of files) {\n const targetFile = path.join(args.rootDir, file)\n const isFolder = fs.statSync(path.join(cursorTemplateDir, file)).isDirectory()\n const type = isFolder ? 'Folder' : 'File'\n\n if (args.force || !fs.existsSync(targetFile)) {\n
|
|
1
|
+
{"version":3,"file":"pull-rules.mjs","names":["error: any"],"sources":["../../src/create/pull-rules.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { fileURLToPath } from 'url'\nimport type { CliContext, Message } from '../cloud/config-utils'\nimport { copyWithWSLCompat } from './utils'\n\ntype PullRulesArgs = {\n rootDir: string\n force?: boolean\n}\n\nexport const pullRules = async (args: PullRulesArgs, context: CliContext) => {\n const __dirname = path.dirname(fileURLToPath(import.meta.url))\n const cursorTemplateDir = path.join(__dirname, '..', 'cursor-rules', 'dot-files')\n const files = fs.readdirSync(cursorTemplateDir)\n\n for (const file of files) {\n const targetFile = path.join(args.rootDir, file)\n const isFolder = fs.statSync(path.join(cursorTemplateDir, file)).isDirectory()\n const type = isFolder ? 'Folder' : 'File'\n\n if (args.force || !fs.existsSync(targetFile)) {\n try {\n copyWithWSLCompat(path.join(cursorTemplateDir, file), targetFile, isFolder)\n context.log(`${file}-created`, (message: Message) =>\n message.tag('success').append(type).append(file, 'cyan').append('has been created.'),\n )\n } catch (error: any) {\n context.log(`${file}-error`, (message: Message) =>\n message\n .tag('error')\n .append('Failed to create')\n .append(type, 'yellow')\n .append(file, 'cyan')\n .append(`: ${error.message}`),\n )\n throw error\n }\n } else {\n context.log(`${file}-skipped`, (message: Message) =>\n message.tag('warning').append(type).append(file, 'cyan').append('already exists, skipping...'),\n )\n }\n }\n}\n"],"mappings":";;;;;;AAWA,MAAa,YAAY,OAAO,MAAqB,YAAwB;CAC3E,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;CAC9D,MAAM,oBAAoB,KAAK,KAAK,WAAW,MAAM,gBAAgB,YAAY;CACjF,MAAM,QAAQ,GAAG,YAAY,kBAAkB;AAE/C,MAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,aAAa,KAAK,KAAK,KAAK,SAAS,KAAK;EAChD,MAAM,WAAW,GAAG,SAAS,KAAK,KAAK,mBAAmB,KAAK,CAAC,CAAC,aAAa;EAC9E,MAAM,OAAO,WAAW,WAAW;AAEnC,MAAI,KAAK,SAAS,CAAC,GAAG,WAAW,WAAW,CAC1C,KAAI;AACF,qBAAkB,KAAK,KAAK,mBAAmB,KAAK,EAAE,YAAY,SAAS;AAC3E,WAAQ,IAAI,GAAG,KAAK,YAAY,YAC9B,QAAQ,IAAI,UAAU,CAAC,OAAO,KAAK,CAAC,OAAO,MAAM,OAAO,CAAC,OAAO,oBAAoB,CACrF;WACMA,OAAY;AACnB,WAAQ,IAAI,GAAG,KAAK,UAAU,YAC5B,QACG,IAAI,QAAQ,CACZ,OAAO,mBAAmB,CAC1B,OAAO,MAAM,SAAS,CACtB,OAAO,MAAM,OAAO,CACpB,OAAO,KAAK,MAAM,UAAU,CAChC;AACD,SAAM;;MAGR,SAAQ,IAAI,GAAG,KAAK,YAAY,YAC9B,QAAQ,IAAI,UAAU,CAAC,OAAO,KAAK,CAAC,OAAO,MAAM,OAAO,CAAC,OAAO,8BAA8B,CAC/F"}
|
package/dist/create/utils.mjs
CHANGED
|
@@ -12,7 +12,51 @@ const checkIfDirectoryExists = (dir) => {
|
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Recursively copies a directory using read/write operations.
|
|
17
|
+
* This is a fallback method for WSL/Windows compatibility.
|
|
18
|
+
*/
|
|
19
|
+
function copyDirectoryRecursive(src, dest) {
|
|
20
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
21
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const srcPath = path.join(src, entry.name);
|
|
24
|
+
const destPath = path.join(dest, entry.name);
|
|
25
|
+
if (entry.isDirectory()) copyDirectoryRecursive(srcPath, destPath);
|
|
26
|
+
else {
|
|
27
|
+
const content = fs.readFileSync(srcPath);
|
|
28
|
+
fs.writeFileSync(destPath, content);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Copies a file or directory with WSL/Windows compatibility.
|
|
34
|
+
* Attempts to use fs.cpSync first for better performance, but falls back
|
|
35
|
+
* to manual read/write operations if permission errors occur (common in WSL).
|
|
36
|
+
*
|
|
37
|
+
* @param src - Source file or directory path
|
|
38
|
+
* @param dest - Destination file or directory path
|
|
39
|
+
* @param isDirectory - Whether the source is a directory
|
|
40
|
+
* @throws Error if copy fails after all fallback attempts
|
|
41
|
+
*/
|
|
42
|
+
function copyWithWSLCompat(src, dest, isDirectory) {
|
|
43
|
+
const destDir = isDirectory ? dest : path.dirname(dest);
|
|
44
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
45
|
+
try {
|
|
46
|
+
fs.cpSync(src, dest, {
|
|
47
|
+
recursive: isDirectory,
|
|
48
|
+
force: true
|
|
49
|
+
});
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (error.code === "EPERM" || error.code === "EACCES") if (isDirectory) copyDirectoryRecursive(src, dest);
|
|
52
|
+
else {
|
|
53
|
+
const content = fs.readFileSync(src);
|
|
54
|
+
fs.writeFileSync(dest, content);
|
|
55
|
+
}
|
|
56
|
+
else throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
15
59
|
|
|
16
60
|
//#endregion
|
|
17
|
-
export { checkIfDirectoryExists, checkIfFileExists };
|
|
61
|
+
export { checkIfDirectoryExists, checkIfFileExists, copyWithWSLCompat };
|
|
18
62
|
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/create/utils.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\nexport const checkIfFileExists = (dir: string, fileName: string): boolean => {\n return fs.existsSync(path.join(dir, fileName))\n}\n\nexport const checkIfDirectoryExists = (dir: string): boolean => {\n try {\n return fs.statSync(dir).isDirectory()\n } catch {\n return false\n }\n}\n"],"mappings":";;;;AAGA,MAAa,qBAAqB,KAAa,aAA8B;AAC3E,QAAO,GAAG,WAAW,KAAK,KAAK,KAAK,SAAS,CAAC;;AAGhD,MAAa,0BAA0B,QAAyB;AAC9D,KAAI;AACF,SAAO,GAAG,SAAS,IAAI,CAAC,aAAa;SAC/B;AACN,SAAO"}
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":["error: any"],"sources":["../../src/create/utils.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\nexport const checkIfFileExists = (dir: string, fileName: string): boolean => {\n return fs.existsSync(path.join(dir, fileName))\n}\n\nexport const checkIfDirectoryExists = (dir: string): boolean => {\n try {\n return fs.statSync(dir).isDirectory()\n } catch {\n return false\n }\n}\n\n/**\n * Recursively copies a directory using read/write operations.\n * This is a fallback method for WSL/Windows compatibility.\n */\nfunction copyDirectoryRecursive(src: string, dest: string): void {\n fs.mkdirSync(dest, { recursive: true })\n const entries = fs.readdirSync(src, { withFileTypes: true })\n\n for (const entry of entries) {\n const srcPath = path.join(src, entry.name)\n const destPath = path.join(dest, entry.name)\n\n if (entry.isDirectory()) {\n copyDirectoryRecursive(srcPath, destPath)\n } else {\n // For files, read and write manually\n const content = fs.readFileSync(srcPath)\n fs.writeFileSync(destPath, content)\n }\n }\n}\n\n/**\n * Copies a file or directory with WSL/Windows compatibility.\n * Attempts to use fs.cpSync first for better performance, but falls back\n * to manual read/write operations if permission errors occur (common in WSL).\n *\n * @param src - Source file or directory path\n * @param dest - Destination file or directory path\n * @param isDirectory - Whether the source is a directory\n * @throws Error if copy fails after all fallback attempts\n */\nexport function copyWithWSLCompat(src: string, dest: string, isDirectory: boolean): void {\n // Ensure destination directory exists\n const destDir = isDirectory ? dest : path.dirname(dest)\n fs.mkdirSync(destDir, { recursive: true })\n\n try {\n // Try the standard cpSync first (faster and works in most cases)\n fs.cpSync(src, dest, {\n recursive: isDirectory,\n force: true,\n })\n } catch (error: any) {\n // If we get permission errors (common in WSL when writing to Windows paths),\n // fall back to manual copy using read/write operations\n if (error.code === 'EPERM' || error.code === 'EACCES') {\n if (isDirectory) {\n copyDirectoryRecursive(src, dest)\n } else {\n // For files, read and write manually\n const content = fs.readFileSync(src)\n fs.writeFileSync(dest, content)\n }\n } else {\n // Re-throw other errors\n throw error\n }\n }\n}"],"mappings":";;;;AAGA,MAAa,qBAAqB,KAAa,aAA8B;AAC3E,QAAO,GAAG,WAAW,KAAK,KAAK,KAAK,SAAS,CAAC;;AAGhD,MAAa,0BAA0B,QAAyB;AAC9D,KAAI;AACF,SAAO,GAAG,SAAS,IAAI,CAAC,aAAa;SAC/B;AACN,SAAO;;;;;;;AAQX,SAAS,uBAAuB,KAAa,MAAoB;AAC/D,IAAG,UAAU,MAAM,EAAE,WAAW,MAAM,CAAC;CACvC,MAAM,UAAU,GAAG,YAAY,KAAK,EAAE,eAAe,MAAM,CAAC;AAE5D,MAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,UAAU,KAAK,KAAK,KAAK,MAAM,KAAK;EAC1C,MAAM,WAAW,KAAK,KAAK,MAAM,MAAM,KAAK;AAE5C,MAAI,MAAM,aAAa,CACrB,wBAAuB,SAAS,SAAS;OACpC;GAEL,MAAM,UAAU,GAAG,aAAa,QAAQ;AACxC,MAAG,cAAc,UAAU,QAAQ;;;;;;;;;;;;;;AAezC,SAAgB,kBAAkB,KAAa,MAAc,aAA4B;CAEvF,MAAM,UAAU,cAAc,OAAO,KAAK,QAAQ,KAAK;AACvD,IAAG,UAAU,SAAS,EAAE,WAAW,MAAM,CAAC;AAE1C,KAAI;AAEF,KAAG,OAAO,KAAK,MAAM;GACnB,WAAW;GACX,OAAO;GACR,CAAC;UACKA,OAAY;AAGnB,MAAI,MAAM,SAAS,WAAW,MAAM,SAAS,SAC3C,KAAI,YACF,wBAAuB,KAAK,KAAK;OAC5B;GAEL,MAAM,UAAU,GAAG,aAAa,IAAI;AACpC,MAAG,cAAc,MAAM,QAAQ;;MAIjC,OAAM"}
|
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.17.9-beta.192-
|
|
4
|
+
"version": "0.17.9-beta.192-311932",
|
|
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.13",
|
|
49
|
-
"@motiadev/adapter-bullmq-events": "0.17.9-beta.192-
|
|
50
|
-
"@motiadev/adapter-redis-cron": "0.17.9-beta.192-
|
|
51
|
-
"@motiadev/adapter-redis-state": "0.17.9-beta.192-
|
|
52
|
-
"@motiadev/
|
|
53
|
-
"@motiadev/
|
|
54
|
-
"@motiadev/workbench": "0.17.9-beta.192-
|
|
55
|
-
"@motiadev/adapter-redis-streams": "0.17.9-beta.192-
|
|
49
|
+
"@motiadev/adapter-bullmq-events": "0.17.9-beta.192-311932",
|
|
50
|
+
"@motiadev/adapter-redis-cron": "0.17.9-beta.192-311932",
|
|
51
|
+
"@motiadev/adapter-redis-state": "0.17.9-beta.192-311932",
|
|
52
|
+
"@motiadev/stream-client-node": "0.17.9-beta.192-311932",
|
|
53
|
+
"@motiadev/core": "0.17.9-beta.192-311932",
|
|
54
|
+
"@motiadev/workbench": "0.17.9-beta.192-311932",
|
|
55
|
+
"@motiadev/adapter-redis-streams": "0.17.9-beta.192-311932"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@amplitude/analytics-types": "^2.9.2",
|