Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d23614

Browse files
ygj6haoqunjiang
andauthored
playground: support running playground on windows (#16)
Co-authored-by: Haoqun Jiang <haoqunjiang@gmail.com>
1 parent4c44920 commit7d23614

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎playground/api/router.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
importRouterfrom'@koa/router'
22
importpathfrom'path'
33
importfsfrom'fs-extra'
4+
importosfrom'os'
45
import{ROOT_DIR}from'./constants'
56
import{spawnSync}from'child_process'
67
import{getMeta}from'./controllers'
78

89
constrouter=newRouter()
10+
constcmdSuffix=os.platform()==='win32' ?'.cmd' :''
911

1012
router.get('/',(ctx)=>{
1113
ctx.body='Hello'
@@ -36,7 +38,7 @@ router.post('/run/:trans', async (ctx) => {
3638
constinput=ctx.request.body
3739
constscript=path.resolve(__dirname,'transfrom.ts')
3840

39-
constresult=spawnSync('ts-node',['-T',script,name],{
41+
constresult=spawnSync(`ts-node${cmdSuffix}`,['-T',script,name],{
4042
input,
4143
encoding:'utf-8',
4244
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp