File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ import * as fs from 'fs-extra';
2424import { DevfileContext } from './api/devfile-context' ;
2525import { DevContainerComponentFinder } from './devfile/dev-container-component-finder' ;
2626
27- type DevfileLike = V230Devfile & {
27+ export type DevfileLike = V230Devfile & {
2828 metadata : V230DevfileMetadata & {
2929 generateName ?: string ;
3030 } ;
@@ -72,13 +72,13 @@ export class Generate {
7272 injectDefaultComponent ?: string ,
7373 defaultComponentImage ?: string ,
7474 ) : Promise < DevfileContext > {
75- const devfile = jsYaml . load ( devfileContent ) ;
75+ const devfile = jsYaml . load ( devfileContent ) as DevfileLike ;
7676
7777 // sets the suffix to the devfile name
7878 const suffix = devfile . metadata . name || '' ;
7979
8080 // devfile of the editor
81- const editorDevfile = jsYaml . load ( editorContent ) ;
81+ const editorDevfile = jsYaml . load ( editorContent ) as DevfileLike ;
8282
8383 // transform it into a devWorkspace template
8484 const metadata = this . createDevWorkspaceMetadata ( editorDevfile ) ;
Original file line number Diff line number Diff line change 1010
1111import * as axios from 'axios' ;
1212import * as fs from 'fs-extra' ;
13- import { Generate , DEVWORKSPACE_METADATA_ANNOTATION } from './generate' ;
13+ import { Generate , DEVWORKSPACE_METADATA_ANNOTATION , DevfileLike } from './generate' ;
1414import { DevfileSchemaValidator } from './devfile-schema/devfile-schema-validator' ;
1515import * as jsYaml from 'js-yaml' ;
1616import { InversifyBinding } from './inversify/inversify-binding' ;
@@ -71,7 +71,7 @@ export class Main {
7171 devfileContent = await container . get ( UrlFetcher ) . fetchText ( url . getContentUrl ( 'devfile.yaml' ) ) ;
7272
7373 // load content
74- const devfileParsed = jsYaml . load ( devfileContent ) ;
74+ const devfileParsed = jsYaml . load ( devfileContent ) as DevfileLike ;
7575
7676 if ( ! devfileParsed . attributes ) {
7777 devfileParsed . attributes = { } ;
@@ -106,7 +106,7 @@ export class Main {
106106 devfileContent = params . devfileContent ;
107107 }
108108
109- const jsYamlDevfileContent = jsYaml . load ( devfileContent ) ;
109+ const jsYamlDevfileContent = jsYaml . load ( devfileContent ) as DevfileLike ;
110110 const schemaVersion = jsYamlDevfileContent . schemaVersion ;
111111 if ( ! schemaVersion ) {
112112 throw new Error ( `Devfile is not valid, schemaVersion is required` ) ;
You can’t perform that action at this time.
0 commit comments