scripting-cli 1.2.5 → 1.3.0
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/README.md +76 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +106 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +131 -0
- package/dist/const.d.ts +2 -0
- package/dist/controller.d.ts +60 -0
- package/dist/controller.js +14 -13
- package/dist/editors.d.ts +18 -0
- package/dist/editors.js +172 -0
- package/dist/http_router.d.ts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -110
- package/dist/prompt.d.ts +9 -0
- package/dist/prompt.js +52 -0
- package/dist/start_server.d.ts +7 -0
- package/dist/start_server.js +18 -8
- package/dist/types.d.ts +23 -0
- package/dist/types.js +2 -0
- package/dist/util.d.ts +9 -0
- package/dist/util.js +0 -33
- package/package.json +19 -6
- package/README_de.md +0 -106
- package/README_fr.md +0 -106
- package/README_it.md +0 -106
- package/README_ja.md +0 -106
- package/README_zh.md +0 -106
- package/src/const.ts +0 -2
- package/src/controller.ts +0 -393
- package/src/http_router.ts +0 -168
- package/src/index.ts +0 -80
- package/src/start_server.ts +0 -179
- package/src/util.ts +0 -191
- package/tsconfig.json +0 -19
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -1,112 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.parserConfiguration({
|
|
45
|
-
"boolean-negation": false
|
|
46
|
-
})
|
|
47
|
-
.command('start', 'Start the scripting-cli server', (yargs) => {
|
|
48
|
-
return yargs
|
|
49
|
-
.options({
|
|
50
|
-
port: {
|
|
51
|
-
alias: ["p"],
|
|
52
|
-
describe: "The port the server listens on",
|
|
53
|
-
type: "number",
|
|
54
|
-
default: 3000,
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
.usage("$0 start [--port=<port>]")
|
|
58
|
-
.example([
|
|
59
|
-
["$0 start -p=8000", "Start server and listen on 8000"]
|
|
60
|
-
])
|
|
61
|
-
.options({
|
|
62
|
-
"no-auto-open": {
|
|
63
|
-
type: "boolean",
|
|
64
|
-
describe: "Do not open the index.tsx/widget.tsx file automatically",
|
|
65
|
-
},
|
|
66
|
-
})
|
|
67
|
-
.usage("$0 start [--no-auto-open]")
|
|
68
|
-
.example([
|
|
69
|
-
["$0 start --no-auto-open", "Start server without opening the index.tsx/widget.tsx file"],
|
|
70
|
-
["$0 start --no-auto-open -p=8000", "Start server without opening the index.tsx/widget.tsx file and listen on 8000"],
|
|
71
|
-
])
|
|
72
|
-
.options({
|
|
73
|
-
"bonjour": {
|
|
74
|
-
type: "boolean",
|
|
75
|
-
describe: "Enable bonjour service",
|
|
76
|
-
},
|
|
77
|
-
})
|
|
78
|
-
.usage("$0 start [--bonjour]")
|
|
79
|
-
.example([
|
|
80
|
-
["$0 start --bonjour", "Start server with bonjour service"],
|
|
81
|
-
["$0 start --bonjour -p=8000", "Start server with bonjour service and listen on 8000"],
|
|
82
|
-
["$0 start --bonjour --no-auto-open", "Start server with bonjour service without opening the index.tsx/widget.tsx file"],
|
|
83
|
-
["$0 start --bonjour --no-auto-open -p=8000", "Start server with bonjour service without opening the index.tsx/widget.tsx file and listen on 8000"],
|
|
84
|
-
]);
|
|
85
|
-
}, (argv) => {
|
|
86
|
-
(0, start_server_1.startServer)({
|
|
87
|
-
port: argv.port,
|
|
88
|
-
noAutoOpen: argv['no-auto-open'],
|
|
89
|
-
startBonjourService: argv.bonjour,
|
|
90
|
-
});
|
|
91
|
-
})
|
|
92
|
-
.command('migrate', 'Migrate the scripts in the workspace root directory to the scripts directory.', (yargs) => {
|
|
93
|
-
return yargs
|
|
94
|
-
.usage("$0 migrate")
|
|
95
|
-
.example([
|
|
96
|
-
["$0 migrate", "Migrate the scripts in the workspace root directory to the scripts directory."]
|
|
97
|
-
]);
|
|
98
|
-
}, async () => {
|
|
99
|
-
const { migrateOldFiles } = await Promise.resolve().then(() => __importStar(require('./util')));
|
|
100
|
-
await migrateOldFiles();
|
|
101
|
-
process.exit(0);
|
|
102
|
-
})
|
|
103
|
-
.showHelpOnFail(true)
|
|
104
|
-
.option('help', {
|
|
105
|
-
alias: 'h',
|
|
106
|
-
describe: 'Show help',
|
|
107
|
-
})
|
|
108
|
-
.demandCommand()
|
|
109
|
-
.parse();
|
|
110
|
-
// if (require.main === module) {
|
|
111
|
-
// startServer();
|
|
112
|
-
// }
|
|
3
|
+
exports.defineConfig = defineConfig;
|
|
4
|
+
function defineConfig(config) {
|
|
5
|
+
return config;
|
|
6
|
+
}
|
package/dist/prompt.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EditorKey, ScriptingConfig } from './types';
|
|
2
|
+
export declare function isInteractive(): boolean;
|
|
3
|
+
interface EditorAnswers {
|
|
4
|
+
editor: EditorKey;
|
|
5
|
+
editorCommand?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function promptForEditor(): Promise<EditorAnswers | null>;
|
|
8
|
+
export type PromptedConfig = Partial<ScriptingConfig>;
|
|
9
|
+
export {};
|
package/dist/prompt.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isInteractive = isInteractive;
|
|
7
|
+
exports.promptForEditor = promptForEditor;
|
|
8
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const editors_1 = require("./editors");
|
|
11
|
+
function isInteractive() {
|
|
12
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
13
|
+
}
|
|
14
|
+
async function promptForEditor() {
|
|
15
|
+
if (!isInteractive()) {
|
|
16
|
+
console.log(chalk_1.default.yellow('[config] Non-interactive environment detected. Defaulting editor to "none". Edit scripting.config.json to change.'));
|
|
17
|
+
return { editor: 'none' };
|
|
18
|
+
}
|
|
19
|
+
const available = (0, editors_1.detectAvailableEditors)();
|
|
20
|
+
const choices = [...editors_1.EDITORS]
|
|
21
|
+
.sort((a, b) => {
|
|
22
|
+
const ax = available.has(a.key) ? 0 : 1;
|
|
23
|
+
const bx = available.has(b.key) ? 0 : 1;
|
|
24
|
+
return ax - bx;
|
|
25
|
+
})
|
|
26
|
+
.map(e => ({
|
|
27
|
+
title: `${available.has(e.key) ? chalk_1.default.green('✓') : ' '} ${e.displayName}`,
|
|
28
|
+
description: e.command ? `command: ${e.command}` : undefined,
|
|
29
|
+
value: e.key,
|
|
30
|
+
}));
|
|
31
|
+
const { editor } = await (0, prompts_1.default)({
|
|
32
|
+
type: 'select',
|
|
33
|
+
name: 'editor',
|
|
34
|
+
message: 'Which editor do you use?',
|
|
35
|
+
choices,
|
|
36
|
+
initial: 0,
|
|
37
|
+
}, { onCancel: () => process.exit(0) });
|
|
38
|
+
if (!editor)
|
|
39
|
+
return null;
|
|
40
|
+
if (editor === 'custom') {
|
|
41
|
+
const { editorCommand } = await (0, prompts_1.default)({
|
|
42
|
+
type: 'text',
|
|
43
|
+
name: 'editorCommand',
|
|
44
|
+
message: 'Enter the command to open files (e.g. "myeditor"):',
|
|
45
|
+
validate: v => v && v.trim().length > 0 ? true : 'command is required',
|
|
46
|
+
}, { onCancel: () => process.exit(0) });
|
|
47
|
+
if (!editorCommand)
|
|
48
|
+
return null;
|
|
49
|
+
return { editor, editorCommand: editorCommand.trim() };
|
|
50
|
+
}
|
|
51
|
+
return { editor };
|
|
52
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function startServer({ port, noAutoOpen, startBonjourService, editorOverride, reconfigure }: {
|
|
2
|
+
port: number | undefined;
|
|
3
|
+
noAutoOpen: boolean | undefined;
|
|
4
|
+
startBonjourService: boolean | undefined;
|
|
5
|
+
editorOverride?: string | undefined;
|
|
6
|
+
reconfigure?: boolean | undefined;
|
|
7
|
+
}): Promise<void>;
|
package/dist/start_server.js
CHANGED
|
@@ -15,6 +15,8 @@ const qrcode_terminal_1 = __importDefault(require("qrcode-terminal"));
|
|
|
15
15
|
const util_1 = require("./util");
|
|
16
16
|
const controller_1 = require("./controller");
|
|
17
17
|
const http_router_1 = require("./http_router");
|
|
18
|
+
const config_1 = require("./config");
|
|
19
|
+
const editors_1 = require("./editors");
|
|
18
20
|
const app = (0, express_1.default)();
|
|
19
21
|
const server = http_1.default.createServer(app);
|
|
20
22
|
const io = new socket_io_1.Server(server);
|
|
@@ -91,19 +93,27 @@ function getLocalNetworkIP() {
|
|
|
91
93
|
results.sort((a, b) => a.priority - b.priority);
|
|
92
94
|
return results.length > 0 ? results[0].address : null;
|
|
93
95
|
}
|
|
94
|
-
function startServer({ port, noAutoOpen, startBonjourService }) {
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
async function startServer({ port, noAutoOpen, startBonjourService, editorOverride, reconfigure }) {
|
|
97
|
+
const config = await (0, config_1.resolveConfig)({
|
|
98
|
+
port,
|
|
99
|
+
noAutoOpen,
|
|
100
|
+
editorOverride,
|
|
101
|
+
reconfigure,
|
|
102
|
+
});
|
|
103
|
+
const PORT = config.port;
|
|
104
|
+
const editor = (0, editors_1.getEditor)(config.editor);
|
|
105
|
+
console.log(chalk_1.default.gray(`Editor: ${editor?.displayName ?? config.editor}`));
|
|
97
106
|
(0, http_router_1.initHttpRouter)(app);
|
|
98
107
|
io.on('connection', (socket) => {
|
|
99
|
-
controller_1.Controller.create(socket,
|
|
108
|
+
controller_1.Controller.create(socket, config);
|
|
100
109
|
console.log(chalk_1.default.blue(`Client [${socket.id}] connected`));
|
|
101
110
|
});
|
|
102
111
|
server.listen(PORT, async () => {
|
|
103
|
-
(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
if (config.generateTsConfig) {
|
|
113
|
+
(0, util_1.createTsConfig)();
|
|
114
|
+
}
|
|
115
|
+
(0, editors_1.writeEditorSettings)(config);
|
|
116
|
+
(0, util_1.ensureScriptsDirectory)();
|
|
107
117
|
const ipAddress = getLocalNetworkIP() ?? ip_1.default.address();
|
|
108
118
|
const address = `http://${ipAddress}:${PORT}`;
|
|
109
119
|
if (startBonjourService) {
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type EditorKey = 'vscode' | 'vscode-insiders' | 'vscodium' | 'cursor' | 'windsurf' | 'trae' | 'zed' | 'webstorm' | 'idea' | 'fleet' | 'sublime' | 'nova' | 'vim' | 'nvim' | 'emacs' | 'custom' | 'none';
|
|
2
|
+
export type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug';
|
|
3
|
+
export interface ScriptingConfig {
|
|
4
|
+
editor?: EditorKey;
|
|
5
|
+
editorCommand?: string;
|
|
6
|
+
editorArgs?: string[];
|
|
7
|
+
port?: number;
|
|
8
|
+
autoOpen?: boolean;
|
|
9
|
+
generateTsConfig?: boolean;
|
|
10
|
+
logLevel?: LogLevel;
|
|
11
|
+
}
|
|
12
|
+
export type ResolvedConfig = Required<Omit<ScriptingConfig, 'editorCommand' | 'editorArgs'>> & {
|
|
13
|
+
editorCommand?: string;
|
|
14
|
+
editorArgs: string[];
|
|
15
|
+
};
|
|
16
|
+
export interface EditorDescriptor {
|
|
17
|
+
key: EditorKey;
|
|
18
|
+
displayName: string;
|
|
19
|
+
command: string | null;
|
|
20
|
+
macAppName?: string;
|
|
21
|
+
settingsTarget?: 'vscode' | 'zed' | 'idea' | null;
|
|
22
|
+
terminalApp?: boolean;
|
|
23
|
+
}
|
package/dist/types.js
ADDED
package/dist/util.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function md5(content: string): string;
|
|
2
|
+
export declare function getPath(filename: string): string;
|
|
3
|
+
export declare function getScriptPath(filename?: string): string;
|
|
4
|
+
export declare function createTsConfig(): void;
|
|
5
|
+
export declare function ensureScriptsDirectory(): void;
|
|
6
|
+
export declare function ensureDirectoryExistence(filePath: string): void;
|
|
7
|
+
export declare function writeDtsFiles(files: Record<string, string>): Promise<void>;
|
|
8
|
+
export declare function getRelativePath(from: string, to: string): string;
|
|
9
|
+
export declare function migrateOldFiles(): Promise<void>;
|
package/dist/util.js
CHANGED
|
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.md5 = md5;
|
|
7
7
|
exports.getPath = getPath;
|
|
8
8
|
exports.getScriptPath = getScriptPath;
|
|
9
|
-
exports.tryOpenFileInVSCode = tryOpenFileInVSCode;
|
|
10
9
|
exports.createTsConfig = createTsConfig;
|
|
11
|
-
exports.createVSCodeSettings = createVSCodeSettings;
|
|
12
10
|
exports.ensureScriptsDirectory = ensureScriptsDirectory;
|
|
13
11
|
exports.ensureDirectoryExistence = ensureDirectoryExistence;
|
|
14
12
|
exports.writeDtsFiles = writeDtsFiles;
|
|
@@ -16,8 +14,6 @@ exports.getRelativePath = getRelativePath;
|
|
|
16
14
|
exports.migrateOldFiles = migrateOldFiles;
|
|
17
15
|
const path_1 = __importDefault(require("path"));
|
|
18
16
|
const crypto_1 = __importDefault(require("crypto"));
|
|
19
|
-
const os_1 = __importDefault(require("os"));
|
|
20
|
-
const child_process_1 = __importDefault(require("child_process"));
|
|
21
17
|
const fs_1 = __importDefault(require("fs"));
|
|
22
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
23
19
|
const const_1 = require("./const");
|
|
@@ -36,20 +32,6 @@ function getScriptPath(filename) {
|
|
|
36
32
|
}
|
|
37
33
|
return path_1.default.join(process.cwd(), 'scripts');
|
|
38
34
|
}
|
|
39
|
-
function tryOpenFileInVSCode(filePath) {
|
|
40
|
-
let cmd = `code "${filePath}"`;
|
|
41
|
-
if (os_1.default.platform() === "win32") {
|
|
42
|
-
cmd = `cmd.exe /c ${cmd}`;
|
|
43
|
-
}
|
|
44
|
-
else if (os_1.default.platform() === "linux") {
|
|
45
|
-
const shell = process.env["SHELL"];
|
|
46
|
-
cmd = `${shell} -c ${cmd}`;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
cmd = `"/Applications/Visual Studio Code.app/Contents/MacOS/Electron" "${filePath}"`;
|
|
50
|
-
}
|
|
51
|
-
child_process_1.default.execSync(cmd);
|
|
52
|
-
}
|
|
53
35
|
// Function to create tsconfig.json
|
|
54
36
|
function createTsConfig() {
|
|
55
37
|
const tsconfigContent = `{
|
|
@@ -102,21 +84,6 @@ function createTsConfig() {
|
|
|
102
84
|
}
|
|
103
85
|
}
|
|
104
86
|
}
|
|
105
|
-
function createVSCodeSettings() {
|
|
106
|
-
const settingsContent = `{
|
|
107
|
-
"typescript.format.semicolons": "remove",
|
|
108
|
-
"typescript.preferences.jsxAttributeCompletionStyle": "braces",
|
|
109
|
-
}`;
|
|
110
|
-
const filePath = getPath('.vscode/settings.json');
|
|
111
|
-
ensureDirectoryExistence(filePath);
|
|
112
|
-
if (!fs_1.default.existsSync(filePath)) {
|
|
113
|
-
fs_1.default.writeFileSync(filePath, settingsContent);
|
|
114
|
-
console.log(chalk_1.default.green('.vscode/settings.json created.'));
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
console.log(chalk_1.default.gray('.vscode/settings.json already exists.'));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
87
|
function ensureScriptsDirectory() {
|
|
121
88
|
const scriptsDir = getScriptPath();
|
|
122
89
|
if (!fs_1.default.existsSync(scriptsDir)) {
|
package/package.json
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scripting-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "This plugin integrates the desktop editor synchronization feature of the Scripting app.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"bin": {
|
|
7
|
-
"scripting-cli": "dist/
|
|
8
|
+
"scripting-cli": "dist/cli.js"
|
|
8
9
|
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
9
19
|
"scripts": {
|
|
10
|
-
"build": "npx tsc",
|
|
11
|
-
"start": "node dist/
|
|
12
|
-
"dev": "ts-node src/
|
|
13
|
-
"help": "node dist/
|
|
20
|
+
"build": "npx tsc && chmod +x dist/cli.js",
|
|
21
|
+
"start": "node dist/cli.js",
|
|
22
|
+
"dev": "ts-node src/cli.ts",
|
|
23
|
+
"help": "node dist/cli.js --help",
|
|
14
24
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
15
25
|
},
|
|
16
26
|
"keywords": [
|
|
@@ -32,6 +42,8 @@
|
|
|
32
42
|
"chokidar": "^4.0.3",
|
|
33
43
|
"express": "^4.21.2",
|
|
34
44
|
"ip": "^2.0.1",
|
|
45
|
+
"jiti": "^2.7.0",
|
|
46
|
+
"prompts": "^2.4.2",
|
|
35
47
|
"qrcode-terminal": "^0.12.0",
|
|
36
48
|
"socket.io": "^4.8.1",
|
|
37
49
|
"typescript": "^5.7.3",
|
|
@@ -42,6 +54,7 @@
|
|
|
42
54
|
"@types/express": "^5.0.0",
|
|
43
55
|
"@types/ip": "^1.1.3",
|
|
44
56
|
"@types/node": "^22.13.4",
|
|
57
|
+
"@types/prompts": "^2.4.9",
|
|
45
58
|
"@types/qrcode-terminal": "^0.12.2",
|
|
46
59
|
"@types/socket.io": "^3.0.2",
|
|
47
60
|
"@types/yargs": "^17.0.33",
|
package/README_de.md
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Scripting-App-Befehlszeilentool
|
|
2
|
-
|
|
3
|
-
Willkommen beim `scripting-cli`, dem Befehlszeilentool für die Integration mit der Scripting-App. Dieses Tool ermöglicht es Ihnen, Ihre Skripte in Echtzeit zu synchronisieren und während der Entwicklung mit Ihrem bevorzugten Desktop-Editor, wie z. B. VSCode, anzuzeigen.
|
|
4
|
-
|
|
5
|
-
[English](./README.md) | [中文](./README_zh.md) | [日本語](./README_ja.md) | [Français](./README_fr.md) | [Italiano](./README_it.md)
|
|
6
|
-
|
|
7
|
-
## Voraussetzungen
|
|
8
|
-
|
|
9
|
-
Bevor Sie `scripting-cli` verwenden, stellen Sie sicher, dass die folgenden Anforderungen erfüllt sind:
|
|
10
|
-
|
|
11
|
-
1. **Node.js**: Stellen Sie sicher, dass eine aktuelle Version von Node.js installiert ist. Überprüfen Sie Ihre aktuelle Version mit:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
node -v
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. **Scripting-App**: Die Scripting-App muss installiert sein, um eine Verbindung mit dem lokalen Dienst herzustellen, der von `scripting-cli` gestartet wird.
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
Es ist keine globale Installation von `scripting-cli` erforderlich. Führen Sie es einfach mit `npx` aus:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx scripting-cli <command>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Verwendung
|
|
28
|
-
|
|
29
|
-
### 1. Arbeitsverzeichnis erstellen
|
|
30
|
-
|
|
31
|
-
Erstellen Sie ein Verzeichnis, in dem Ihre Scripting-App-Skripte gespeichert werden. Zum Beispiel:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
mkdir my-scripting-project
|
|
35
|
-
cd my-scripting-project
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 2. Lokalen Dienst starten
|
|
39
|
-
|
|
40
|
-
Führen Sie im Arbeitsverzeichnis den folgenden Befehl aus, um den lokalen Entwicklungsdienst zu starten:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npx scripting-cli start
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Standardmäßig wird der Dienst auf Port `3000` gestartet. Um einen anderen Port anzugeben, verwenden Sie die Option `--port`:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npx scripting-cli start --port=4000
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Um Bonjour-Unterstützung zu aktivieren, sodass die Scripting-App den lokalen Dienst automatisch erkennt, fügen Sie das Flag `--bonjour` hinzu:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npx scripting-cli start --bonjour
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 3. Scripting-App verbinden
|
|
59
|
-
|
|
60
|
-
Sobald der Dienst läuft, öffnen Sie die **Scripting-App** und verbinden Sie sich mit dem gerade gestarteten lokalen Dienst. Dadurch wird eine Verbindung zwischen der App und Ihrem Arbeitsverzeichnis hergestellt.
|
|
61
|
-
|
|
62
|
-
### 4. Code debuggen und synchronisieren
|
|
63
|
-
|
|
64
|
-
Nach der Verbindung wählen Sie das Skriptprojekt aus, das Sie debuggen möchten. Die Scripting-App synchronisiert den Code dieses Projekts automatisch mit Ihrem Arbeitsverzeichnis.
|
|
65
|
-
|
|
66
|
-
### 5. Echtzeit-Code-Synchronisierung
|
|
67
|
-
|
|
68
|
-
Wenn Sie Skripte in Ihrem Desktop-Editor (z. B. VSCode) schreiben und speichern, werden die Änderungen automatisch mit der Scripting-App synchronisiert und in Echtzeit ausgeführt, was die Entwicklung und das Debugging erheblich erleichtert.
|
|
69
|
-
|
|
70
|
-
## Beispiel-Workflow
|
|
71
|
-
|
|
72
|
-
1. Lokalen Dienst starten:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npx scripting-cli start
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
2. Öffnen Sie Ihren Editor und schreiben Sie Ihr Skript.
|
|
79
|
-
|
|
80
|
-
3. Speichern Sie die Skriptdatei.
|
|
81
|
-
|
|
82
|
-
4. Der aktualisierte Code wird automatisch mit der Scripting-App synchronisiert und ausgeführt.
|
|
83
|
-
|
|
84
|
-
## Zusätzliche Informationen
|
|
85
|
-
|
|
86
|
-
* Der Standardport ist `3000`. Wenn dieser bereits verwendet wird, geben Sie mit der Option `--port` einen anderen an.
|
|
87
|
-
* Verwenden Sie das Flag `--no-auto-open`, um zu verhindern, dass das Tool automatisch `index.tsx` oder `widget.tsx` öffnet:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npx scripting-cli start --no-auto-open
|
|
91
|
-
```
|
|
92
|
-
* Um den Bonjour-Dienst zu nutzen, stellen Sie sicher, dass Ihr System diese Funktion unterstützt. Unter Windows müssen Sie Bonjour möglicherweise manuell installieren. Verwenden Sie dann die Option `--bonjour`, um den Dienst zu aktivieren.
|
|
93
|
-
* Dieses Tool ist ideal für Benutzer, die Desktop-Editoren wie VSCode bevorzugen und eine nahtlose Code-Synchronisierung und Debugging mit der Scripting-App wünschen.
|
|
94
|
-
|
|
95
|
-
## Fehlerbehebung
|
|
96
|
-
|
|
97
|
-
Wenn Sie auf Probleme stoßen, stellen Sie sicher, dass:
|
|
98
|
-
|
|
99
|
-
* Sie Node.js Version 20 oder höher verwenden.
|
|
100
|
-
* Die Scripting-App korrekt mit dem lokalen Dienst verbunden ist.
|
|
101
|
-
* Der von Ihnen gewählte Port nicht von einem anderen Prozess verwendet wird.
|
|
102
|
-
* Sie das Tool immer mit `npx scripting-cli <command>` ausführen und sicherstellen, dass das Paket auf dem neuesten Stand ist.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
Viel Spaß beim Verwenden von `scripting-cli` in Ihrem Scripting-App-Entwicklungsworkflow! Viel Erfolg beim Codieren!
|
package/README_fr.md
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Outil en ligne de commande pour l'application Scripting
|
|
2
|
-
|
|
3
|
-
Bienvenue dans `scripting-cli`, l'outil en ligne de commande conçu pour l'intégration avec l'application Scripting. Cet outil vous permet de synchroniser et de prévisualiser vos scripts en temps réel pendant que vous les développez à l'aide de votre éditeur de bureau préféré, tel que VSCode.
|
|
4
|
-
|
|
5
|
-
[English](./README.md) | [中文](./README_zh.md) | [日本語](./README_ja.md) | [Deutsch](./README_de.md) | [Italiano](./README_it.md)
|
|
6
|
-
|
|
7
|
-
## Prérequis
|
|
8
|
-
|
|
9
|
-
Avant d'utiliser `scripting-cli`, assurez-vous que les conditions suivantes sont remplies :
|
|
10
|
-
|
|
11
|
-
1. **Node.js** : Assurez-vous qu'une version récente de Node.js est installée. Vérifiez votre version actuelle avec :
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
node -v
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. **Application Scripting** : L'application Scripting doit être installée pour se connecter au service local lancé par `scripting-cli`.
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
Il n'est pas nécessaire d'installer `scripting-cli` globalement. Exécutez-le simplement avec `npx` :
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx scripting-cli <command>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Utilisation
|
|
28
|
-
|
|
29
|
-
### 1. Créer un répertoire de travail
|
|
30
|
-
|
|
31
|
-
Créez un répertoire où vos scripts de l'application Scripting seront stockés. Par exemple :
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
mkdir my-scripting-project
|
|
35
|
-
cd my-scripting-project
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 2. Démarrer le service local
|
|
39
|
-
|
|
40
|
-
Dans votre répertoire de travail, exécutez la commande suivante pour démarrer le service de développement local :
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npx scripting-cli start
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Par défaut, ce service démarre sur le port `3000`. Pour spécifier un autre port, utilisez l'option `--port` :
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npx scripting-cli start --port=4000
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Pour activer la prise en charge de Bonjour, permettant à l'application Scripting de détecter automatiquement le service local, ajoutez le drapeau `--bonjour` :
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npx scripting-cli start --bonjour
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 3. Connecter l'application Scripting
|
|
59
|
-
|
|
60
|
-
Une fois le service en cours d'exécution, ouvrez l'**application Scripting** et connectez-vous au service local que vous venez de démarrer. Cela établira une connexion entre l'application et votre répertoire de travail.
|
|
61
|
-
|
|
62
|
-
### 4. Déboguer et synchroniser le code
|
|
63
|
-
|
|
64
|
-
Après la connexion, sélectionnez le projet de script que vous souhaitez déboguer. L'application Scripting synchronisera automatiquement le code de ce projet avec votre répertoire de travail.
|
|
65
|
-
|
|
66
|
-
### 5. Synchronisation du code en temps réel
|
|
67
|
-
|
|
68
|
-
Lorsque vous écrivez et enregistrez des scripts dans votre éditeur de bureau (par exemple, VSCode), les modifications seront automatiquement synchronisées avec l'application Scripting et exécutées en temps réel, rendant le développement et le débogage beaucoup plus fluides.
|
|
69
|
-
|
|
70
|
-
## Exemple de flux de travail
|
|
71
|
-
|
|
72
|
-
1. Démarrer le service local :
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npx scripting-cli start
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
2. Ouvrez votre éditeur et écrivez votre script.
|
|
79
|
-
|
|
80
|
-
3. Enregistrez le fichier de script.
|
|
81
|
-
|
|
82
|
-
4. Le code mis à jour est automatiquement synchronisé avec l'application Scripting et exécuté.
|
|
83
|
-
|
|
84
|
-
## Informations supplémentaires
|
|
85
|
-
|
|
86
|
-
* Le port par défaut est `3000`. S'il est déjà utilisé, spécifiez-en un autre avec l'option `--port`.
|
|
87
|
-
* Utilisez le drapeau `--no-auto-open` pour empêcher l'outil d'ouvrir automatiquement `index.tsx` ou `widget.tsx` :
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npx scripting-cli start --no-auto-open
|
|
91
|
-
```
|
|
92
|
-
* Pour utiliser le service Bonjour, assurez-vous que votre système le prend en charge. Sur Windows, vous devrez peut-être installer Bonjour manuellement. Ensuite, utilisez l'option `--bonjour` pour l'activer.
|
|
93
|
-
* Cet outil est idéal pour les utilisateurs qui préfèrent les éditeurs de bureau comme VSCode et souhaitent une synchronisation et un débogage du code sans faille avec l'application Scripting.
|
|
94
|
-
|
|
95
|
-
## Dépannage
|
|
96
|
-
|
|
97
|
-
Si vous rencontrez des problèmes, assurez-vous que :
|
|
98
|
-
|
|
99
|
-
* Vous utilisez Node.js version 20 ou supérieure.
|
|
100
|
-
* L'application Scripting est correctement connectée au service local.
|
|
101
|
-
* Aucun autre processus n'utilise le port que vous souhaitez utiliser.
|
|
102
|
-
* Vous exécutez toujours l'outil avec `npx scripting-cli <command>` et que le package est à jour.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
Profitez de l'utilisation de `scripting-cli` dans votre flux de travail de développement avec l'application Scripting ! Bon codage !
|