scripting-cli 1.2.5 → 1.4.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 +104 -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 +134 -0
- package/dist/const.d.ts +2 -0
- package/dist/controller.d.ts +68 -0
- package/dist/controller.js +64 -21
- package/dist/editors.d.ts +18 -0
- package/dist/editors.js +172 -0
- package/dist/http_router.d.ts +2 -0
- package/dist/http_router.js +39 -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 +25 -0
- package/dist/types.js +2 -0
- package/dist/util.d.ts +11 -0
- package/dist/util.js +101 -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/util.js
CHANGED
|
@@ -4,20 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.md5 = md5;
|
|
7
|
+
exports.isBinaryFile = isBinaryFile;
|
|
7
8
|
exports.getPath = getPath;
|
|
8
9
|
exports.getScriptPath = getScriptPath;
|
|
9
|
-
exports.tryOpenFileInVSCode = tryOpenFileInVSCode;
|
|
10
10
|
exports.createTsConfig = createTsConfig;
|
|
11
|
-
exports.createVSCodeSettings = createVSCodeSettings;
|
|
12
11
|
exports.ensureScriptsDirectory = ensureScriptsDirectory;
|
|
13
12
|
exports.ensureDirectoryExistence = ensureDirectoryExistence;
|
|
14
13
|
exports.writeDtsFiles = writeDtsFiles;
|
|
15
14
|
exports.getRelativePath = getRelativePath;
|
|
15
|
+
exports.isIgnoredPath = isIgnoredPath;
|
|
16
16
|
exports.migrateOldFiles = migrateOldFiles;
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
18
|
const crypto_1 = __importDefault(require("crypto"));
|
|
19
|
-
const os_1 = __importDefault(require("os"));
|
|
20
|
-
const child_process_1 = __importDefault(require("child_process"));
|
|
21
19
|
const fs_1 = __importDefault(require("fs"));
|
|
22
20
|
const chalk_1 = __importDefault(require("chalk"));
|
|
23
21
|
const const_1 = require("./const");
|
|
@@ -27,6 +25,68 @@ function md5(content) {
|
|
|
27
25
|
.update(content)
|
|
28
26
|
.digest('hex');
|
|
29
27
|
}
|
|
28
|
+
// Drop an incomplete trailing UTF-8 multibyte sequence so a text file whose
|
|
29
|
+
// character happens to straddle the read boundary isn't misjudged as binary.
|
|
30
|
+
function trimIncompleteUtf8Tail(chunk) {
|
|
31
|
+
let i = chunk.length - 1;
|
|
32
|
+
let cont = 0;
|
|
33
|
+
// Walk back over continuation bytes (10xxxxxx).
|
|
34
|
+
while (i >= 0 && (chunk[i] & 0xc0) === 0x80) {
|
|
35
|
+
cont++;
|
|
36
|
+
i--;
|
|
37
|
+
}
|
|
38
|
+
if (i < 0)
|
|
39
|
+
return chunk;
|
|
40
|
+
const lead = chunk[i];
|
|
41
|
+
let seqLen;
|
|
42
|
+
if ((lead & 0x80) === 0x00)
|
|
43
|
+
seqLen = 1; // ASCII
|
|
44
|
+
else if ((lead & 0xe0) === 0xc0)
|
|
45
|
+
seqLen = 2;
|
|
46
|
+
else if ((lead & 0xf0) === 0xe0)
|
|
47
|
+
seqLen = 3;
|
|
48
|
+
else if ((lead & 0xf8) === 0xf0)
|
|
49
|
+
seqLen = 4;
|
|
50
|
+
else
|
|
51
|
+
return chunk; // invalid lead — let the decoder flag it
|
|
52
|
+
// Fewer bytes than the sequence needs → it's cut off; trim it.
|
|
53
|
+
if (cont + 1 < seqLen) {
|
|
54
|
+
return chunk.subarray(0, i);
|
|
55
|
+
}
|
|
56
|
+
return chunk;
|
|
57
|
+
}
|
|
58
|
+
// Detect whether a file is binary by content instead of extension.
|
|
59
|
+
// Reads the first 1024 bytes: a NUL byte or non-UTF-8 content means binary.
|
|
60
|
+
// Conceptually mirrors FileManagerService.isBinaryFileSync on the iOS side.
|
|
61
|
+
function isBinaryFile(filePath) {
|
|
62
|
+
let fd = null;
|
|
63
|
+
try {
|
|
64
|
+
fd = fs_1.default.openSync(filePath, 'r');
|
|
65
|
+
const buffer = Buffer.alloc(1024);
|
|
66
|
+
const bytesRead = fs_1.default.readSync(fd, buffer, 0, 1024, 0);
|
|
67
|
+
const chunk = buffer.subarray(0, bytesRead);
|
|
68
|
+
if (chunk.includes(0)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
new TextDecoder('utf-8', { fatal: true }).decode(trimIncompleteUtf8Tail(chunk));
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
console.log(chalk_1.default.red(`Failed to inspect file: ${filePath}, ${err}`));
|
|
81
|
+
// On failure, fall back to treating it as text (previous default behavior).
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
if (fd != null) {
|
|
86
|
+
fs_1.default.closeSync(fd);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
30
90
|
function getPath(filename) {
|
|
31
91
|
return path_1.default.join(process.cwd(), filename);
|
|
32
92
|
}
|
|
@@ -36,20 +96,6 @@ function getScriptPath(filename) {
|
|
|
36
96
|
}
|
|
37
97
|
return path_1.default.join(process.cwd(), 'scripts');
|
|
38
98
|
}
|
|
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
99
|
// Function to create tsconfig.json
|
|
54
100
|
function createTsConfig() {
|
|
55
101
|
const tsconfigContent = `{
|
|
@@ -102,21 +148,6 @@ function createTsConfig() {
|
|
|
102
148
|
}
|
|
103
149
|
}
|
|
104
150
|
}
|
|
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
151
|
function ensureScriptsDirectory() {
|
|
121
152
|
const scriptsDir = getScriptPath();
|
|
122
153
|
if (!fs_1.default.existsSync(scriptsDir)) {
|
|
@@ -149,6 +180,43 @@ function getRelativePath(from, to) {
|
|
|
149
180
|
const relativePath = path_1.default.relative(from, to);
|
|
150
181
|
return relativePath.replaceAll("\\", "/");
|
|
151
182
|
}
|
|
183
|
+
// Whether a script-relative path should be excluded from syncing.
|
|
184
|
+
// Always ignores dotfiles/dot-directories and node_modules; `patterns` adds
|
|
185
|
+
// user-configured excludes. Kept in sync with the iOS default ignore logic.
|
|
186
|
+
function isIgnoredPath(relativePath, patterns = []) {
|
|
187
|
+
const normalized = relativePath.replaceAll("\\", "/");
|
|
188
|
+
const segments = normalized.split("/").filter(Boolean);
|
|
189
|
+
// Default ignores.
|
|
190
|
+
for (const seg of segments) {
|
|
191
|
+
if (seg.startsWith(".") || seg === "node_modules") {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// User-configured patterns.
|
|
196
|
+
const basename = segments[segments.length - 1] ?? "";
|
|
197
|
+
for (const raw of patterns) {
|
|
198
|
+
const pattern = raw.trim();
|
|
199
|
+
if (!pattern)
|
|
200
|
+
continue;
|
|
201
|
+
if (pattern.startsWith("*.")) {
|
|
202
|
+
// Extension match, e.g. "*.log".
|
|
203
|
+
if (basename.endsWith(pattern.slice(1)))
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
else if (pattern.includes("/")) {
|
|
207
|
+
// Path match (relative), prefix or exact.
|
|
208
|
+
const p = pattern.replace(/^\/+|\/+$/g, "");
|
|
209
|
+
if (normalized === p || normalized.startsWith(p + "/"))
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
// Directory or file name match on any segment.
|
|
214
|
+
if (segments.includes(pattern))
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
152
220
|
async function migrateOldFiles() {
|
|
153
221
|
try {
|
|
154
222
|
const list = await fs_1.default.promises.readdir(process.cwd());
|
package/package.json
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scripting-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.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 !
|
package/README_it.md
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Strumento da linea di comando per l'app Scripting
|
|
2
|
-
|
|
3
|
-
Benvenuto in `scripting-cli`, lo strumento da linea di comando progettato per l'integrazione con l'app Scripting. Questo strumento ti consente di sincronizzare e visualizzare in anteprima i tuoi script in tempo reale mentre li sviluppi utilizzando il tuo editor desktop preferito, come VSCode.
|
|
4
|
-
|
|
5
|
-
[English](./README.md) | [中文](./README_zh.md) | [日本語](./README_ja.md) | [Deutsch](./README_de.md) | [Français](./README_fr.md)
|
|
6
|
-
|
|
7
|
-
## Prerequisiti
|
|
8
|
-
|
|
9
|
-
Prima di utilizzare `scripting-cli`, assicurati di avere quanto segue:
|
|
10
|
-
|
|
11
|
-
1. **Node.js**: Verifica di avere una versione recente di Node.js installata. Puoi controllare la tua versione eseguendo:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
node -v
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. **App Scripting**: L'app Scripting deve essere installata per potersi connettere al servizio locale avviato da `scripting-cli`.
|
|
18
|
-
|
|
19
|
-
## Installazione
|
|
20
|
-
|
|
21
|
-
Non è necessario installare `scripting-cli` globalmente. Puoi utilizzarlo direttamente con `npx`:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx scripting-cli <command>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Utilizzo
|
|
28
|
-
|
|
29
|
-
### 1. Creare una directory di lavoro
|
|
30
|
-
|
|
31
|
-
Crea una directory nel tuo computer dove archiviare gli script dell'app Scripting. Ad esempio:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
mkdir my-scripting-project
|
|
35
|
-
cd my-scripting-project
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 2. Avviare il servizio locale
|
|
39
|
-
|
|
40
|
-
All'interno della directory di lavoro, esegui il comando seguente per avviare il servizio locale:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npx scripting-cli start
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Per impostazione predefinita, il servizio verrà eseguito sulla porta `3000`. Se desideri utilizzare una porta diversa, puoi specificarla con l'opzione `--port`:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npx scripting-cli start --port=4000
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Per attivare il servizio Bonjour (che consente all'app Scripting di rilevare automaticamente il servizio locale), utilizza l'opzione `--bonjour`:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npx scripting-cli start --bonjour
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 3. Collegare l'app Scripting
|
|
59
|
-
|
|
60
|
-
Una volta che il servizio è in esecuzione, apri l'**app Scripting** e collegati al servizio locale appena avviato. Questo stabilirà la connessione tra l'app e la tua directory di lavoro.
|
|
61
|
-
|
|
62
|
-
### 4. Debug e sincronizzazione del codice
|
|
63
|
-
|
|
64
|
-
Dopo la connessione, seleziona il progetto di script che desideri eseguire il debug. L'app Scripting sincronizzerà automaticamente il codice del progetto con la tua directory locale.
|
|
65
|
-
|
|
66
|
-
### 5. Sincronizzazione del codice in tempo reale
|
|
67
|
-
|
|
68
|
-
Mentre scrivi e salvi gli script nel tuo editor desktop (ad esempio, VSCode), il codice aggiornato verrà automaticamente sincronizzato con l'app Scripting ed eseguito in tempo reale. Questo rende lo sviluppo e il debug molto più efficienti.
|
|
69
|
-
|
|
70
|
-
## Esempio di flusso di lavoro
|
|
71
|
-
|
|
72
|
-
1. Avvia il servizio locale:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npx scripting-cli start
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
2. Apri il tuo editor e scrivi lo script.
|
|
79
|
-
|
|
80
|
-
3. Salva il file dello script.
|
|
81
|
-
|
|
82
|
-
4. Il codice aggiornato viene sincronizzato automaticamente con l'app Scripting e viene eseguito.
|
|
83
|
-
|
|
84
|
-
## Informazioni aggiuntive
|
|
85
|
-
|
|
86
|
-
* La porta predefinita del servizio è `3000`. Se è già in uso, specificane un'altra con l'opzione `--port`.
|
|
87
|
-
* Utilizza l'opzione `--no-auto-open` per avviare il server di sviluppo senza aprire automaticamente `index.tsx` o `widget.tsx` nell'editor:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npx scripting-cli start --no-auto-open
|
|
91
|
-
```
|
|
92
|
-
* Se desideri utilizzare il servizio Bonjour, assicurati che il tuo computer lo supporti. Su Windows, potrebbe essere necessario installarlo manualmente. Poi utilizza l'opzione `--bonjour` per abilitarlo.
|
|
93
|
-
* Questo strumento è pensato per gli utenti che preferiscono editor desktop come VSCode e desiderano un'integrazione fluida con l'app Scripting per la sincronizzazione e il debug del codice.
|
|
94
|
-
|
|
95
|
-
## Risoluzione dei problemi
|
|
96
|
-
|
|
97
|
-
Se riscontri problemi, verifica che:
|
|
98
|
-
|
|
99
|
-
* Hai installato Node.js versione 20 o superiore.
|
|
100
|
-
* L'app Scripting è correttamente collegata al servizio locale.
|
|
101
|
-
* Nessun altro processo stia utilizzando la porta desiderata.
|
|
102
|
-
* Utilizzi sempre `npx scripting-cli <command>` per avviare il servizio e che il pacchetto sia aggiornato.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
Buon divertimento con `scripting-cli` nel tuo flusso di lavoro di sviluppo per l'app Scripting! Buona programmazione!
|
package/README_ja.md
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Scripting アプリ コマンドラインツール
|
|
2
|
-
|
|
3
|
-
Scripting アプリとの統合用に設計された `scripting-cli` コマンドラインツールへようこそ。このツールを使用すると、お気に入りのデスクトップエディター(例:VSCode)でスクリプトを開発しながら、リアルタイムで同期およびプレビューできます。
|
|
4
|
-
|
|
5
|
-
[English](./README.md) | [中文](./README_zh.md) | [Deutsch](./README_de.md) | [Français](./README_fr.md) | [Italiano](./README_it.md)
|
|
6
|
-
|
|
7
|
-
## 前提条件
|
|
8
|
-
|
|
9
|
-
`scripting-cli` を使用する前に、以下の要件を満たしていることを確認してください:
|
|
10
|
-
|
|
11
|
-
1. **Node.js**:最新バージョンの Node.js がインストールされていることを確認してください。現在のバージョンを確認するには、次のコマンドを実行します:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
node -v
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. **Scripting アプリ**:`scripting-cli` が起動するローカルサービスに接続するために、Scripting アプリをインストールする必要があります。
|
|
18
|
-
|
|
19
|
-
## インストール
|
|
20
|
-
|
|
21
|
-
`scripting-cli` をグローバルにインストールする必要はありません。`npx` を使用して実行するだけです:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx scripting-cli <command>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## 使用方法
|
|
28
|
-
|
|
29
|
-
### 1. 作業ディレクトリの作成
|
|
30
|
-
|
|
31
|
-
まず、Scripting アプリのスクリプトを保存するディレクトリを作成します。例:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
mkdir my-scripting-project
|
|
35
|
-
cd my-scripting-project
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 2. ローカルサービスの起動
|
|
39
|
-
|
|
40
|
-
作業ディレクトリで、次のコマンドを実行してローカル開発サービスを起動します:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npx scripting-cli start
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
デフォルトでは、サービスはポート `3000` で起動します。別のポートを指定するには、`--port` オプションを使用します:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npx scripting-cli start --port=4000
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Bonjour サポートを有効にして、Scripting アプリがローカルサービスを自動的に検出できるようにするには、`--bonjour` フラグを追加します:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npx scripting-cli start --bonjour
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 3. Scripting アプリの接続
|
|
59
|
-
|
|
60
|
-
サービスが起動したら、**Scripting アプリ** を開き、先ほど起動したローカルサービスに接続します。これにより、アプリと作業ディレクトリ間の接続が確立されます。
|
|
61
|
-
|
|
62
|
-
### 4. コードのデバッグと同期
|
|
63
|
-
|
|
64
|
-
接続後、デバッグしたいスクリプトプロジェクトを選択します。Scripting アプリは、プロジェクトのコードを自動的に作業ディレクトリと同期します。
|
|
65
|
-
|
|
66
|
-
### 5. リアルタイムコード同期
|
|
67
|
-
|
|
68
|
-
デスクトップエディター(例:VSCode)でスクリプトを作成して保存すると、変更内容が自動的に Scripting アプリと同期され、リアルタイムで実行されます。これにより、開発とデバッグがスムーズになります。
|
|
69
|
-
|
|
70
|
-
## 例:ワークフロー
|
|
71
|
-
|
|
72
|
-
1. ローカルサービスを起動します:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npx scripting-cli start
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
2. エディターを開いてスクリプトを作成します。
|
|
79
|
-
|
|
80
|
-
3. スクリプトファイルを保存します。
|
|
81
|
-
|
|
82
|
-
4. 更新されたコードが自動的に Scripting アプリと同期され、実行されます。
|
|
83
|
-
|
|
84
|
-
## 追加情報
|
|
85
|
-
|
|
86
|
-
* デフォルトのポートは `3000` です。既に使用されている場合は、`--port` オプションで別のポートを指定してください。
|
|
87
|
-
* `--no-auto-open` フラグを使用すると、`index.tsx` または `widget.tsx` ファイルが自動的に開かれるのを防げます:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npx scripting-cli start --no-auto-open
|
|
91
|
-
```
|
|
92
|
-
* Bonjour サービスを使用するには、システムがその機能をサポートしていることを確認してください。Windows では、Bonjour を手動でインストールする必要がある場合があります。その後、`--bonjour` オプションを使用してサービスを有効にします。
|
|
93
|
-
* このツールは、VSCode などのデスクトップエディターを好み、Scripting アプリとのシームレスなコード同期とデバッグを望むユーザーに最適です。
|
|
94
|
-
|
|
95
|
-
## トラブルシューティング
|
|
96
|
-
|
|
97
|
-
問題が発生した場合は、以下を確認してください:
|
|
98
|
-
|
|
99
|
-
* Node.js バージョン 20 以上を使用していること。
|
|
100
|
-
* Scripting アプリがローカルサービスに正しく接続されていること。
|
|
101
|
-
* 選択したポートが他のプロセスによって使用されていないこと。
|
|
102
|
-
* 常に `npx scripting-cli <command>` を使用してツールを実行し、パッケージが最新であることを確認してください。
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
Scripting アプリの開発ワークフローで `scripting-cli` をご活用ください。楽しいコーディングを!
|