diff --git a/package.json b/package.json index c279d42167..f902001d67 100644 --- a/package.json +++ b/package.json @@ -123,6 +123,7 @@ "@types/jest": "27.0.2", "@types/js-yaml": "4.0.4", "@types/memoizee": "0.4.6", + "@types/mime": "2.0.3", "@types/node": "16.6.1", "@types/node-fetch": "2.5.12", "@types/nodemailer": "6.4.4", diff --git a/src/lib/services/state-util.ts b/src/lib/services/state-util.ts index 3ec2a7278f..730521c2a2 100644 --- a/src/lib/services/state-util.ts +++ b/src/lib/services/state-util.ts @@ -12,7 +12,7 @@ export const readFile: (file: string) => Promise = (file) => export const parseFile: (file: string, data: string) => any = ( file: string, data: string, -) => (mime.lookup(file) === 'text/yaml' ? YAML.load(data) : JSON.parse(data)); +) => (mime.getType(file) === 'text/yaml' ? YAML.load(data) : JSON.parse(data)); export const filterExisting: ( keepExisting: boolean, diff --git a/yarn.lock b/yarn.lock index 806bf1af5c..29d6dc37d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -807,6 +807,11 @@ resolved "https://registry.yarnpkg.com/@types/memoizee/-/memoizee-0.4.6.tgz#a4ba7a3ea61fa45be916f148763bec2ca38c34cf" integrity sha512-qJezGqoi3pW9Pset2w1Gfv8jATvmHHHnpO9Dq8x8pJGyYIpiUZJqRU0NM7xenmN0AcXEe7vqshI8H98KeFLYcg== +"@types/mime@2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.3.tgz#c893b73721db73699943bfc3653b1deb7faa4a3a" + integrity sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q== + "@types/mime@^1": version "1.3.2" resolved "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz"