@cyklang/cli 0.7.4 → 0.7.5
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/build/Cmd.js +2 -2
- package/build/OpenCommand.d.ts +1 -1
- package/build/OpenCommand.js +11 -5
- package/build/index.js +1 -1
- package/package.json +1 -1
- package/src/Cmd.ts +2 -2
- package/src/OpenCommand.ts +11 -5
- package/src/index.ts +1 -1
package/build/Cmd.js
CHANGED
|
@@ -154,7 +154,7 @@ exports.runShellCommand = runShellCommand;
|
|
|
154
154
|
function spawnCommand(command, args) {
|
|
155
155
|
console.log();
|
|
156
156
|
console.log([command, ...args, '...'].join(' '));
|
|
157
|
-
const child_process = (0, child_process_1.spawn)(command, args, { stdio: 'inherit' });
|
|
157
|
+
const child_process = (0, child_process_1.spawn)(command, args, { stdio: 'inherit', shell: process.platform === 'win32' });
|
|
158
158
|
return new Promise((resolve, reject) => {
|
|
159
159
|
child_process.on('close', (code) => {
|
|
160
160
|
if (code === 0) {
|
|
@@ -176,7 +176,7 @@ exports.spawnCommand = spawnCommand;
|
|
|
176
176
|
*/
|
|
177
177
|
function spawnCommandData(command, args) {
|
|
178
178
|
let result = '';
|
|
179
|
-
const child_process = (0, child_process_1.spawn)(command, args);
|
|
179
|
+
const child_process = (0, child_process_1.spawn)(command, args, { shell: process.platform === 'win32' });
|
|
180
180
|
return new Promise((resolve, reject) => {
|
|
181
181
|
child_process.stdout.on('data', (data) => {
|
|
182
182
|
result += String(data);
|
package/build/OpenCommand.d.ts
CHANGED
package/build/OpenCommand.js
CHANGED
|
@@ -12,17 +12,23 @@ class OpenCommand extends Cmd_1.Cmd {
|
|
|
12
12
|
constructor(name) {
|
|
13
13
|
super(name);
|
|
14
14
|
this.description('open browser').version('0.1')
|
|
15
|
-
.argument('<
|
|
16
|
-
.action(async (
|
|
17
|
-
await this.openBrowser(
|
|
15
|
+
.argument('<module_path>', 'module to execute or pathname')
|
|
16
|
+
.action(async (module_path, options) => {
|
|
17
|
+
await this.openBrowser(module_path, options);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
async openBrowser(
|
|
20
|
+
async openBrowser(module_path, options) {
|
|
21
21
|
try {
|
|
22
22
|
await this.prologue(options);
|
|
23
23
|
if (process.env.DBREMOTE_URL === undefined)
|
|
24
24
|
throw 'DBREMOTE_URL undefined';
|
|
25
|
-
|
|
25
|
+
let url = process.env.DBREMOTE_URL;
|
|
26
|
+
if (module_path.startsWith('/')) {
|
|
27
|
+
url += module_path;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
url += '/cyk/#/run/' + module_path;
|
|
31
|
+
}
|
|
26
32
|
const open = await import('open');
|
|
27
33
|
open.default(url);
|
|
28
34
|
}
|
package/build/index.js
CHANGED
|
@@ -181,7 +181,7 @@ class StopCommand extends commander_1.Command {
|
|
|
181
181
|
*/
|
|
182
182
|
const program = new commander_1.Command();
|
|
183
183
|
program.name('cyk').description('cyklang CLI')
|
|
184
|
-
.version('0.7.
|
|
184
|
+
.version('0.7.5');
|
|
185
185
|
program.addCommand(new StartCommand('start'));
|
|
186
186
|
program.addCommand(new StopCommand('stop'));
|
|
187
187
|
program.addCommand(new InstallCommand_1.InstallCommand('install'));
|
package/package.json
CHANGED
package/src/Cmd.ts
CHANGED
|
@@ -145,7 +145,7 @@ export async function runShellCommand(command: string, args: string[]) {
|
|
|
145
145
|
export function spawnCommand(command: string, args: string[]): Promise<void> {
|
|
146
146
|
console.log()
|
|
147
147
|
console.log([command, ...args, '...'].join(' '))
|
|
148
|
-
const child_process = spawn(command, args, { stdio: 'inherit' })
|
|
148
|
+
const child_process = spawn(command, args, { stdio: 'inherit', shell: process.platform === 'win32' })
|
|
149
149
|
return new Promise((resolve, reject) => {
|
|
150
150
|
child_process.on('close', (code) => {
|
|
151
151
|
if (code === 0) {
|
|
@@ -167,7 +167,7 @@ export function spawnCommand(command: string, args: string[]): Promise<void> {
|
|
|
167
167
|
*/
|
|
168
168
|
export function spawnCommandData(command: string, args: string[]): Promise<string> {
|
|
169
169
|
let result = ''
|
|
170
|
-
const child_process = spawn(command, args)
|
|
170
|
+
const child_process = spawn(command, args, { shell: process.platform === 'win32' })
|
|
171
171
|
return new Promise((resolve, reject) => {
|
|
172
172
|
child_process.stdout.on('data', (data) => {
|
|
173
173
|
result += String(data)
|
package/src/OpenCommand.ts
CHANGED
|
@@ -8,18 +8,24 @@ export class OpenCommand extends Cmd {
|
|
|
8
8
|
constructor(name: string) {
|
|
9
9
|
super(name)
|
|
10
10
|
this.description('open browser').version('0.1')
|
|
11
|
-
.argument('<
|
|
12
|
-
.action(async (
|
|
13
|
-
await this.openBrowser(
|
|
11
|
+
.argument('<module_path>', 'module to execute or pathname')
|
|
12
|
+
.action(async (module_path: any, options: any) => {
|
|
13
|
+
await this.openBrowser(module_path, options)
|
|
14
14
|
})
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async openBrowser(
|
|
17
|
+
async openBrowser(module_path: string, options: any) {
|
|
18
18
|
try {
|
|
19
19
|
await this.prologue(options)
|
|
20
20
|
|
|
21
21
|
if (process.env.DBREMOTE_URL === undefined) throw 'DBREMOTE_URL undefined'
|
|
22
|
-
|
|
22
|
+
let url = process.env.DBREMOTE_URL
|
|
23
|
+
if (module_path.startsWith('/')) {
|
|
24
|
+
url += module_path
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
url += '/cyk/#/run/' + module_path
|
|
28
|
+
}
|
|
23
29
|
const open = await import('open');
|
|
24
30
|
open.default(url)
|
|
25
31
|
}
|
package/src/index.ts
CHANGED
|
@@ -175,7 +175,7 @@ class StopCommand extends Command {
|
|
|
175
175
|
*/
|
|
176
176
|
const program = new Command()
|
|
177
177
|
program.name('cyk').description('cyklang CLI')
|
|
178
|
-
.version('0.7.
|
|
178
|
+
.version('0.7.5')
|
|
179
179
|
program.addCommand(new StartCommand('start'))
|
|
180
180
|
program.addCommand(new StopCommand('stop'))
|
|
181
181
|
program.addCommand(new InstallCommand('install'))
|