File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
core/use-cases/execute-script
desktop/modules/monaco/libs Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import type ExecuteScriptDTO from './execute-script.dto'
4
4
import type AppConfig from '../../config/app'
5
5
6
6
import moment from 'moment'
7
+
7
8
import EvaluationFacade from '../../facades/script'
8
9
export default class ExecuteScript {
9
10
constructor ( private readonly app : AppConfig ) { }
@@ -13,6 +14,10 @@ export default class ExecuteScript {
13
14
14
15
const drive = this . app . facades . drive . fromWorkspace ( workspace )
15
16
17
+ const createRepository = ( name : string ) => {
18
+ return this . app . facades . item . createRepositoryFromWorkspace ( workspace , name )
19
+ }
20
+
16
21
const sandbox : any = {
17
22
...scope ,
18
23
scope,
@@ -21,6 +26,7 @@ export default class ExecuteScript {
21
26
Facades : this . app . facades ,
22
27
Entry : DirectoryEntry ,
23
28
Moment : moment ,
29
+ createRepository,
24
30
}
25
31
26
32
const evaluation = new EvaluationFacade ( drive , this . app . services . evaluation , sandbox )
Original file line number Diff line number Diff line change 1
1
import { lib as core } from './core'
2
2
3
+ import momentTypes from 'moment/moment.d.ts?raw'
4
+
3
5
export function mount ( ) {
4
6
const uri = 'ts:runtime/script.d.ts'
5
7
6
8
const libs = core . mount ( )
7
9
10
+ libs . push ( {
11
+ uri : 'ts:moment.d.ts' ,
12
+ source : `
13
+ declare module 'moment' { ${ momentTypes } }
14
+ ` ,
15
+ } )
16
+
8
17
const source = `
9
18
declare const Workspace: import("core/entities/workspace").default
10
19
@@ -18,7 +27,7 @@ export function mount() {
18
27
19
28
declare const scope: Record<string, any>
20
29
21
- declare const Moment: any
30
+ declare const Moment: typeof import("moment")
22
31
23
32
declare function setResult(data: any): void
24
33
`
You can’t perform that action at this time.
0 commit comments