11import { Manifest } from '../base/Executor'
2- import { Transport } from '../base/Transports'
32import * as path from 'path'
43import * as os from 'os'
54import * as fs from 'fs'
@@ -13,11 +12,6 @@ const log = getLogger('executa:serve')
1312const EXECUTORS_DIR_NAME = 'executors'
1413
1514export default async function discover ( ) : Promise < Manifest [ ] > {
16- // TODO: implement discovery of manifest files from ~/.stencila/executors/ (or similar)
17- // Should be able to mostly copy and paste from
18- // https://github.com/stencila/node/blob/24c30d1c89b5f6b6719a0beeda7a55d19401c294/lib/host/Host.js#L654-L666
19- // See https://github.com/stencila/executa/issues/2
20-
2115 let stencilaHome : string
2216
2317 switch ( os . platform ( ) ) {
@@ -69,52 +63,15 @@ export default async function discover(): Promise<Manifest[]> {
6963 }
7064
7165 try {
72- manifests . push ( JSON . parse ( json ) as Manifest )
66+ const manifest = JSON . parse ( json ) as Manifest
67+ log . info ( `Added manifest at ${ file } ` )
68+ manifests . push ( manifest )
7369 } catch ( error ) {
7470 log . warn ( `Warning: error parsing file "${ file } ": ${ error . message } ` )
7571 }
7672 }
7773 }
7874
7975 await discoverDir ( executorsDir )
80-
81- manifests . push ( js )
8276 return manifests
8377}
84-
85- // These are just stubs to be replaced by JSON read in from manifest.json files...
86-
87- const js : Manifest = {
88- capabilities : {
89- execute : {
90- type : 'object' ,
91- required : [ 'node' ] ,
92- properties : {
93- node : {
94- type : 'object' ,
95- required : [ 'type' , 'programmingLanguage' ] ,
96- properties : {
97- type : {
98- enum : [ 'CodeChunk' , 'CodeExpression' ]
99- } ,
100- programmingLanguage : {
101- enum : [ 'javascript' ]
102- }
103- }
104- }
105- }
106- }
107- } ,
108- addresses : {
109- stdio : {
110- type : Transport . stdio ,
111- command : 'npx' ,
112- args : [
113- 'ts-node' ,
114- '/Users/ben/Documents/stencila/schema/ts/interpreter' ,
115- 'listen'
116- ] ,
117- cwd : '/Users/ben/Documents/stencila/schema'
118- }
119- }
120- }
0 commit comments