Skip to content

Commit

Permalink
Support UTF-16-encoded integration definitions (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorreece authored May 31, 2023
1 parent 9027550 commit bceaf32
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 35 deletions.
29 changes: 21 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 27 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prismatic-io/prism",
"version": "4.6.4",
"version": "4.6.5",
"description": "Build, deploy, and support integrations in Prismatic from the comfort of your command line",
"keywords": [
"prismatic",
Expand Down Expand Up @@ -40,62 +40,63 @@
"lib"
],
"dependencies": {
"dayjs": "1.11.0",
"oclif": "3.0.1",
"@msgpack/msgpack": "2.3.0",
"@oclif/core": "1.7.0",
"@oclif/plugin-help": "5.1.12",
"@oclif/plugin-warn-if-update-available": "2.0.4",
"@prismatic-io/spectral": "7.4.0",
"@prismatic-io/generator-spectral": "2.1.3",
"graphql-request": "4.2.0",
"graphql": "16.3.0",
"@prismatic-io/spectral": "7.4.0",
"archiver": "3.1.1",
"axios": "0.21.4",
"camelcase": "6.2.0",
"chardet": "1.5.1",
"dayjs": "1.11.0",
"dotenv": "16.0.0",
"fs-extra": "9.0.0",
"glob": "7.1.6",
"glob-promise": "4.2.2",
"graphql": "16.3.0",
"graphql-request": "4.2.0",
"http-status-codes": "2.1.2",
"lodash": "4.17.21",
"inquirer": "8.2.2",
"js-yaml": "3.14.0",
"jwt-decode": "2.2.0",
"lodash": "4.17.21",
"mime-types": "2.1.27",
"oclif": "3.0.1",
"prettier": "2.6.2",
"striptags": "3.2.0",
"tempy": "0.5.0",
"wsdl-tsclient": "1.4.0",
"ts-morph": "14.0.0",
"camelcase": "6.2.0",
"@msgpack/msgpack": "2.3.0",
"striptags": "3.2.0",
"glob": "7.1.6",
"glob-promise": "4.2.2",
"prettier": "2.6.2",
"yeoman-environment": "3.9.1",
"inquirer": "8.2.2",
"dotenv": "16.0.0"
"wsdl-tsclient": "1.4.0",
"yeoman-environment": "3.9.1"
},
"devDependencies": {
"@oclif/test": "2.1.0",
"@types/yeoman-environment": "2.10.7",
"@types/prettier": "2.0.2",
"@types/glob": "7.1.4",
"@types/fs-extra": "9.0.1",
"@types/jwt-decode": "2.2.1",
"@types/archiver": "3.1.0",
"@types/fs-extra": "9.0.1",
"@types/glob": "7.1.4",
"@types/inquirer": "8.2.1",
"@types/jest": "29.5.0",
"@types/js-yaml": "3.12.4",
"@types/jwt-decode": "2.2.1",
"@types/lodash": "4.14.155",
"@types/mime-types": "2.1.0",
"@types/node": "14.14.35",
"@types/inquirer": "8.2.1",
"@types/prettier": "2.0.2",
"@types/yeoman-environment": "2.10.7",
"@typescript-eslint/eslint-plugin": "5.18.0",
"@typescript-eslint/parser": "5.18.0",
"chalk": "3.0.0",
"eslint": "8.12.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-jest": "26.1.3",
"eslint-plugin-prettier": "3.1.3",
"jest": "29.5.0",
"jest-config": "29.5.0",
"ts-jest": "29.0.5",
"ts-node": "9.0.0",
"typescript": "4.6.3",
"eslint": "8.12.0",
"jest-config": "29.5.0"
"typescript": "4.6.3"
},
"oclif": {
"commands": "./lib/commands",
Expand Down
8 changes: 7 additions & 1 deletion src/commands/integrations/import.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import chardet from "chardet";
import { Command, Flags } from "@oclif/core";
import { fs, exists } from "../../fs";
import { gql, gqlRequest } from "../../graphql";
Expand Down Expand Up @@ -39,7 +40,12 @@ export default class ImportCommand extends Command {
});
}

const definition = await fs.readFile(path, "utf-8");
const encoding = await chardet.detectFile(path);
const definition = await fs.readFile(
path,
encoding === "UTF-16LE" ? "utf16le" : "utf-8"
);

const { integrationId: integrationImportId } = await importDefinition(
definition,
integrationId
Expand Down

0 comments on commit bceaf32

Please sign in to comment.