Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
"homepage": "https://github.com/eclipse-che/che-devfile-registry#readme",
"dependencies": {
"@devfile/api": "2.3.0-1747843475",
"axios": "^1.8.3",
"fs-extra": "^11.2.0",
"inversify": "^7.1.0",
"lodash": "^4.17.21",
"js-yaml": "^4.0.0",
"jsonc-parser": "^3.0.0",
"jsonschema": "^1.4.1",
"lodash": "^4.17.21",
"reflect-metadata": "^0.2.2"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"axios": "^1.8.3",
"eslint": "^9.5.0",
"if-env": "^1.0.4",
"jest": "^29.7.0",
Expand All @@ -61,6 +61,9 @@
"ts-jest": "^29.2.6",
"typescript": "^5.6.2"
},
"peerDependencies": {
"axios": "^1.8.3"
},
"prettier": {
"printWidth": 120,
"singleQuote": true,
Expand Down
6 changes: 3 additions & 3 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as fs from 'fs-extra';
import { DevfileContext } from './api/devfile-context';
import { DevContainerComponentFinder } from './devfile/dev-container-component-finder';

type DevfileLike = V230Devfile & {
export type DevfileLike = V230Devfile & {
metadata: V230DevfileMetadata & {
generateName?: string;
};
Expand Down Expand Up @@ -72,13 +72,13 @@ export class Generate {
injectDefaultComponent?: string,
defaultComponentImage?: string,
): Promise<DevfileContext> {
const devfile = jsYaml.load(devfileContent);
const devfile = jsYaml.load(devfileContent) as DevfileLike;

// sets the suffix to the devfile name
const suffix = devfile.metadata.name || '';

// devfile of the editor
const editorDevfile = jsYaml.load(editorContent);
const editorDevfile = jsYaml.load(editorContent) as DevfileLike;

// transform it into a devWorkspace template
const metadata = this.createDevWorkspaceMetadata(editorDevfile);
Expand Down
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import * as axios from 'axios';
import * as fs from 'fs-extra';
import { Generate, DEVWORKSPACE_METADATA_ANNOTATION } from './generate';
import { Generate, DEVWORKSPACE_METADATA_ANNOTATION, DevfileLike } from './generate';
import { DevfileSchemaValidator } from './devfile-schema/devfile-schema-validator';
import * as jsYaml from 'js-yaml';
import { InversifyBinding } from './inversify/inversify-binding';
Expand Down Expand Up @@ -71,7 +71,7 @@ export class Main {
devfileContent = await container.get(UrlFetcher).fetchText(url.getContentUrl('devfile.yaml'));

// load content
const devfileParsed = jsYaml.load(devfileContent);
const devfileParsed = jsYaml.load(devfileContent) as DevfileLike;

if (!devfileParsed.attributes) {
devfileParsed.attributes = {};
Expand Down Expand Up @@ -106,7 +106,7 @@ export class Main {
devfileContent = params.devfileContent;
}

const jsYamlDevfileContent = jsYaml.load(devfileContent);
const jsYamlDevfileContent = jsYaml.load(devfileContent) as DevfileLike;
const schemaVersion = jsYamlDevfileContent.schemaVersion;
if (!schemaVersion) {
throw new Error(`Devfile is not valid, schemaVersion is required`);
Expand Down
31 changes: 3 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3125,16 +3125,7 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand All @@ -3152,14 +3143,7 @@ string-width@^5.0.1, string-width@^5.1.2:
emoji-regex "^9.2.2"
strip-ansi "^7.0.1"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -3381,16 +3365,7 @@ word-wrap@^1.2.5:
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down