@@ -149,6 +149,12 @@ Simple compiler to convert text to event.
149
149
150
150
詳細は[ wikiの該当ページ] ( https://github.com/yktsr/Text2Frame-MV/wiki/%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3 ) を参照してください。
151
151
152
+ ## 逆変換プラグイン Frame2Text
153
+ RPGツクールMV/MZのイベントコマンドを、Text2Frameの記法に則ったテキストにエクスポートするプラグインである、Frame2Textも公開しています。
154
+
155
+ Frame2Textのダウンロードは[ ここ] ( https://raw.githubusercontent.com/yktsr/Text2Frame-MV/master/Frame2Text.js ) からお願いします。
156
+
157
+ また、詳細な使い方は[ Frame2Textの紹介ページ] ( https://github.com/yktsr/Text2Frame-MV/wiki/%E9%80%86%E5%A4%89%E6%8F%9B%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3Frame2Text ) かプラグイン本体のヘルプドキュメントを参照してください。
152
158
153
159
## Author/連絡先
154
160
* [ @kryptos_nv] ( https://twitter.com/kryptos_nv )
@@ -168,19 +174,29 @@ $ npm run build --if-present
168
174
169
175
### Show help
170
176
```
171
- $ npm run debug
172
- ===== Manual =====
177
+ Usage: Text2Frame [options]
178
+
179
+ Options:
180
+ -V, --version output the version number
181
+ -m, --mode <map|common|compile|test> output mode
182
+ -t, --text_path <name> text file path
183
+ -o, --output_path <name> output file path
184
+ -e, --event_id <name> event file id
185
+ -p, --page_id <name> page id
186
+ -c, --common_event_id <name> common event id
187
+ -w, --overwrite <true/false> overwrite mode (default: "false")
188
+ -v, --verbose debug mode (default: false)
189
+ -h, --help display help for command
173
190
191
+ ===== Manual =====
174
192
NAME
175
193
Text2Frame - Simple compiler to convert text to event command.
176
194
SYNOPSIS
177
- node Text2Frame.js
178
195
node Text2Frame.js --verbose --mode map --text_path <text file path> --output_path <output file path> --event_id <event id> --page_id <page id> --overwrite <true|false>
179
196
node Text2Frame.js --verbose --mode common --text_path <text file path> --common_event_id <common event id> --overwrite <true|false>
197
+ node Text2Frame.js --mode compile
180
198
node Text2Frame.js --verbose --mode test
181
199
DESCRIPTION
182
- node Text2Frame.js
183
- テストモードです。test/basic.txtを読み込み、data/Map001.jsonに出力します。
184
200
node Text2Frame.js --verbose --mode map --text_path <text file path> --output_path <output file path> --event_id <event id> --page_id <page id> --overwrite <true|false>
185
201
マップへのイベント出力モードです。
186
202
読み込むファイル、出力マップ、上書きの有無を引数で指定します。
@@ -196,6 +212,17 @@ $ npm run debug
196
212
197
213
例1:$ node Text2Frame.js --mode common --text_path test/basic.txt --output_path data/CommonEvents.json --common_event_id 1 --overwrite true
198
214
例2:$ node Text2Frame.js -m common -t test/basic.txt -o data/CommonEvents.json -c 1 -w true
215
+
216
+ node Text2Frame.js --mode compile
217
+ コンパイルモードです。
218
+ 変換したいテキストファイルをパイプで与えると、対応したイベントに変換されたJSONを、標準出力に出力します。
219
+ このモードでは、Map.json / CommonEvent.jsonの形式へフォーマットされず、イベントに変換したJSONのみが出力されるため、
220
+ Map.json/CommonEvent.json への組み込みは各自で行う必要があります。
221
+
222
+ 例1: $ cat test/basic.txt | node Text2Frame.js --mode compile
223
+
224
+ node Text2Frame.js --mode test
225
+ テストモードです。test/basic.txtを読み込み、data/Map001.jsonに出力します。
199
226
```
200
227
201
228
### Run Text2frame.js with command line
@@ -209,6 +236,44 @@ Please restart RPG Maker MV(Editor) WITHOUT save.
209
236
**セーブせずに**プロジェクトファイルを開き直してください
210
237
```
211
238
239
+ ### How to use the Text2Frame module as an ES Module and as a CommonJS module:
240
+ ### npm install
241
+ ```
242
+ $ npm install 'yktsr/Text2Frame-MV'
243
+ ```
244
+
245
+ ### Using as an ES Module
246
+ ```
247
+ $ cat examples/commonjs.js
248
+ const TF = require("Text2Frame-MV/Text2Frame.cjs.js")
249
+
250
+ const date = new Date().toLocaleString()
251
+ const text = `<comment>
252
+ for common js module:
253
+ 出力日時: ${date}
254
+ </comment>`
255
+
256
+ console.log(TF.compile(text))
257
+
258
+ $ node examples/commonjs.js
259
+ ```
260
+
261
+ ### Using as an ES Module
262
+ ```
263
+ $ cat examples/esmodules.mjs
264
+ import TF from "Text2Frame-MV/Text2Frame.es.mjs"
265
+
266
+ const date = new Date().toLocaleString()
267
+ const text = `<comment>
268
+ for ES Module:
269
+ 出力日時: ${date}
270
+ </comment>`
271
+
272
+ console.log(TF.compile(text))
273
+
274
+ $ node examples/esmodules.mjs
275
+ ```
276
+
212
277
### Lint check
213
278
```
214
279
$ npm run lint
0 commit comments