Skip to content

Commit

Permalink
replace text-wrapper with wordwrap module
Browse files Browse the repository at this point in the history
    text-wrapper is convoluted and mess up with the process.env.DEBUG
    variable. The wordwrap module has no dependencies.
  • Loading branch information
erossignon committed May 16, 2021
1 parent 1e9053f commit 7104db1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"@types/rimraf": "^3.0.0",
"@types/sinon": "10.0.0",
"@types/underscore": "1.11.2",
"@types/wordwrap": "^1.0.0",
"@types/yargs": "16.0.1",
"@typescript-eslint/parser": "4.23.0",
"async": "^3.2.0",
Expand Down Expand Up @@ -158,6 +159,8 @@
"unirest": "^0.6.0",
"vorpal": "^1.12.0",
"vorpal-repl": "^1.1.8",
"wordwrap": "^1.0.0",
"wrap-text": "^1.0.9",
"xml-writer": "^1.7.0",
"yargs": "16.2.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"node-opcua-status-code": "2.41.1",
"node-opcua-types": "2.41.1",
"node-opcua-utils": "2.41.1",
"text-wrapper": "^2.0.2"
"wordwrap": "^1.0.0",
"@types/wordwrap": "^1.0.0"
},
"devDependencies": {
"node-opcua-leak-detector": "2.41.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { wrapper } from "text-wrapper";
import * as wrap from "wordwrap";
import {
AttributeIds,
LocalizedText,
Expand Down Expand Up @@ -40,6 +40,8 @@ import {
} from "./cache";
import assert from "node-opcua-assert";

const wrapText = wrap(0,50);

export async function convertDataTypeToTypescript(session: IBasicSession, dataTypeId: NodeId) {
const definition = await getDefinition(session, dataTypeId);
const browseName = await getBrowseName(session, dataTypeId);
Expand Down Expand Up @@ -690,7 +692,7 @@ function dumpUsedExport(currentType: string, namespaceIndex: number, cache: Cach
}

function toComment(prefix: string, description: string) {
var d = wrapper(description, { wrapOn: 78 });
var d = wrapText(description);
return d
.split("\n")
.map((x) => prefix + x)
Expand Down
14 changes: 14 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 7104db1

Please sign in to comment.