diff --git a/bin/cli.js b/bin/cli.js index 4d937b8..68082fd 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -1,6 +1,10 @@ #!/usr/bin/env node "use strict"; -const fs = require("fs"); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs_1 = __importDefault(require("fs")); const port = getPortnumber(); const testsPort = port + 1; const objPorts = { 'port': port, 'testsPort': testsPort }; @@ -9,8 +13,8 @@ let wpEnvJsonData; /** * Check if ".wp-env.json" exist. */ -if (fs.existsSync(wpEnvJson)) { - wpEnvJsonData = JSON.parse(fs.readFileSync(wpEnvJson, 'utf8')); +if (fs_1.default.existsSync(wpEnvJson)) { + wpEnvJsonData = JSON.parse(fs_1.default.readFileSync(wpEnvJson, 'utf8')); // Add numbers for "port" and "testsPort". Object.keys(objPorts).forEach(key => { wpEnvJsonData[key] = objPorts[key]; @@ -23,7 +27,7 @@ else { /** * Write to .wp-env.json. */ -fs.writeFileSync(wpEnvJson, JSON.stringify(wpEnvJsonData, null, 2)); +fs_1.default.writeFileSync(wpEnvJson, JSON.stringify(wpEnvJsonData, null, 2)); /** * Generate port number from time stamp. * Function restarts if port number has unwanted values. diff --git a/bin/cli.js.map b/bin/cli.js.map index 2385dce..d714635 100644 --- a/bin/cli.js.map +++ b/bin/cli.js.map @@ -1 +1 @@ -{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;AAC7B,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC;AAC3B,MAAM,QAAQ,GAAgC,EAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAC,CAAA;AACpF,MAAM,SAAS,GAAG,cAAc,CAAC;AACjC,IAAI,aAA0C,CAAA;AAE9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AAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1D;IAED,0BAA0B;IAC1B,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;IAC3G,IAAI,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACrC,aAAa,EAAE,CAAA;KAClB;IAED,OAAO,UAAU,CAAA;AACrB,CAAC"} \ No newline at end of file diff --git a/src/cli.ts b/src/cli.ts index 94832ce..fe55e2e 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node -const fs = require("fs"); +import fs from 'fs'; const port = getPortnumber(); const testsPort = port + 1; const objPorts: { [index: string]: number } = {'port': port, 'testsPort': testsPort}