Skip to content

Commit

Permalink
Removes memory-stream which cause circular dep (#272)
Browse files Browse the repository at this point in the history
* Removes memory-stream which cause circular dep

Signed-off-by: Noé Samaille <noe.samaille@ibm.com>

* Increment package.json

Signed-off-by: Noé Samaille <noe.samaille@ibm.com>

Signed-off-by: Noé Samaille <noe.samaille@ibm.com>
  • Loading branch information
NoeSamaille authored and seansund committed Dec 9, 2022
1 parent 8b057e2 commit 9b5e2c6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 65 deletions.
39 changes: 0 additions & 39 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cloudnativetoolkit/iascable",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "",
"keywords": [],
"main": "dist/iascable.umd.js",
Expand Down Expand Up @@ -170,7 +170,6 @@
"lodash.uniq": "^4.5.0",
"lodash.uniqby": "^4.7.0",
"lodash.uniqwith": "^4.5.0",
"memory-stream": "^1.0.0",
"rxjs": "^7.5.7",
"simple-git": "^3.14.1",
"superagent": "^6.1.0",
Expand Down
25 changes: 1 addition & 24 deletions src/util/file-util.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import {chmodSync, lstatSync, promises} from 'fs';
import {join} from 'path';
import superagent from 'superagent';
// @ts-ignore
import MemoryStream from 'memory-stream';

import {isDefined} from './object-util';

export async function chmodRecursive(root: string, mode: number) {
chmodSync(root, mode)
Expand All @@ -18,26 +14,7 @@ export async function chmodRecursive(root: string, mode: number) {

export async function loadFile(path: string): Promise<string> {
if (/^http.*/.test(path)) {
return new Promise((resolve, reject) => {
const ws = new MemoryStream()

try {
ws.on('finish', () => {
resolve(ws.toString())
})

superagent
.get(path)
.pipe(ws)
.on('error', (e: Error) => {
reject(e)
})
} finally {
try { ws.close() } catch (err) {
// ignore
}
}
})
return superagent.get(path).then(resp => resp.text)
}

return promises.readFile(path.replace(/^file:/, ''))
Expand Down

0 comments on commit 9b5e2c6

Please sign in to comment.