-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.deco.js
86 lines (82 loc) · 2.59 KB
/
configure.deco.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
'use strict'
var child_process = require('child_process')
var path = require('path')
// You must use require for deco-tool, import/export is not supported
var Deco = require('deco-tool')
// These are settings from the local projects .deco/.settings JSON file
const iosTarget = Deco.setting.iosTarget
const iosProject = Deco.setting.iosProject
const iosBuildScheme = Deco.setting.iosBuildScheme
const androidManifest = Deco.setting.androidManifest
const packagerPort = Deco.setting.packagerPort
/**
*
* HOW TO USE THIS FILE (https://github.com/decosoftware/deco-ide/blob/master/desktop/CONFIGURE.MD)
*
* Runs a registered function in an isolated NodeJS environment when that function's corresponding
* command is triggered from within the Deco application or when run from shell as a 'deco-tool' command
*
* Available commands:
* run-packager (!)
* description: Run packager for project
* return:
* resolve({child: ChildProcess})
*
* list-ios-sim
* description: Find list of available iOS simulators
* return:
* resolve({payload: [{name:String}]})
* reject({payload: [String]})
*
* sim-ios
* description: Launch an iOS simulator and load the .app binary
*
* reload-ios-app
* description: Hard reload the current iOS application in the simulator
*
* build-ios (!)
* description: Build the iOS application
* return:
* resolve({child: ChildProcess})
*
* list-android-sim
* description: Find list of available Android emulators
* return:
* resolve({payload: [{name:String}]})
* reject({payload: [String]})
*
* reload-android-app
* description: Hard reload the current Android application in the emulator
*
* sim-android (!)
* description: Build app and launch the Android emulator from available list
* return:
* resolve({child: ChildProcess})
*
* (!) Be careful to return any async children processes spawned
*
*
* HOW TO REGISTER A COMMAND
* Deco.on(command: String, do: (args: Object) => Promise)
*
* eg.
* Deco.on(list-android-sim, function(args) {
* // this will print out the args into the Deco output window
* // or into your shell terminal if using 'deco-tool' module
* console.log(args)
*
* // the function should return a Promise
* return Promise.reject({
* payload: ['Error Message']
* })
* })
*
* If you create an asynchronous child process, you should handle it properly
* by returning an object of form { child: {ChildProcess} } in the "resolve" call
* from within your promise.
*
* eg.
* ...
* const spawnPackager = child_process.spawn(...)
* return Promise.resolve({child: spawnPackager})
**/