From 4b89636035c4d9ca1edebaa24b60ca621ce2babf Mon Sep 17 00:00:00 2001 From: Sam Harrison Date: Thu, 27 Oct 2022 10:59:56 -0500 Subject: [PATCH 1/4] fix: include babel-config and global install twilio for internal testing --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f838293293..ad8217a5ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,6 @@ ENV NODE_PATH /usr/local/lib/node_modules COPY lib ./lib COPY spec ./spec COPY examples ./examples -COPY index.js . -COPY package* ./ +COPY index.js package.json babel.config.js ./ -RUN npm install . --include=dev +RUN npm install . -g && npm install . --include=dev From 0d48a72130919321e9fe377e5712b764321c5198 Mon Sep 17 00:00:00 2001 From: Sam Harrison Date: Thu, 27 Oct 2022 13:42:52 -0500 Subject: [PATCH 2/4] more tsc fixes --- Dockerfile | 6 ++++-- lib/base/Domain.js | 2 +- lib/base/Version.js | 4 ++-- lib/rest/Twilio.ts | 2 +- package.json | 1 + tsconfig.json | 5 ++++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad8217a5ae..5abf5c03cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,8 @@ ENV NODE_PATH /usr/local/lib/node_modules COPY lib ./lib COPY spec ./spec COPY examples ./examples -COPY index.js package.json babel.config.js ./ +COPY index.js package.json babel.config.js tsconfig.json ./ -RUN npm install . -g && npm install . --include=dev +RUN npm run build; npm pack +RUN npm install -g twilio-*.tgz +RUN npm install . --include=dev diff --git a/lib/base/Domain.js b/lib/base/Domain.js index 0bedead74c..ba8b4bdde6 100644 --- a/lib/base/Domain.js +++ b/lib/base/Domain.js @@ -1,5 +1,5 @@ 'use strict'; -import { trim } from './utility'; +const { trim } = require('./utility'); /** * Base domain object diff --git a/lib/base/Version.js b/lib/base/Version.js index 8885f0a4aa..887434041b 100644 --- a/lib/base/Version.js +++ b/lib/base/Version.js @@ -1,6 +1,6 @@ 'use strict'; -var RestException = require('./RestException'); -import { trim } from './utility'; +const RestException = require('./RestException'); +const { trim } = require('./utility'); /** * @constructor diff --git a/lib/rest/Twilio.ts b/lib/rest/Twilio.ts index 5fc2d3b298..75b6a7835f 100644 --- a/lib/rest/Twilio.ts +++ b/lib/rest/Twilio.ts @@ -456,4 +456,4 @@ class Twilio extends BaseTwilio { } } -module.exports = Twilio; +export = Twilio; diff --git a/package.json b/package.json index fca871b149..73d6736ee8 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "test:typescript": "tsc -t es2020 examples/typescript/example.ts --noEmit --strict", "jshint": "jshint lib/rest/** lib/base/** lib/http/**", "jscs": "eslint lib/base/**/**.js lib/http/**/**.js --fix", + "build": "tsc", "check": "npm run jshint && npm run jscs", "ci": "npm run test && npm run nsp", "jsdoc": "jsdoc -r lib -d docs", diff --git a/tsconfig.json b/tsconfig.json index 2b1fe44f02..bce3a751f1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,9 @@ { "compilerOptions": { "target": "es2020", - "esModuleInterop": true + "module": "commonjs", + "declaration": true, + "esModuleInterop": true, + "moduleResolution": "node", } } From c99a24c4a5399ac56adf43374ac82e1630e118c7 Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Thu, 27 Oct 2022 15:19:31 -0500 Subject: [PATCH 3/4] install before building --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5abf5c03cc..d233136ae0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ COPY spec ./spec COPY examples ./examples COPY index.js package.json babel.config.js tsconfig.json ./ +RUN npm install . --include=dev + RUN npm run build; npm pack RUN npm install -g twilio-*.tgz -RUN npm install . --include=dev From 22abf7eaf849894f83ff02c293df3f54d6dc841d Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Fri, 28 Oct 2022 09:47:56 -0500 Subject: [PATCH 4/4] no need to pack after building --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d233136ae0..c90ce45724 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,5 +12,5 @@ COPY index.js package.json babel.config.js tsconfig.json ./ RUN npm install . --include=dev -RUN npm run build; npm pack -RUN npm install -g twilio-*.tgz +RUN npm run build || true # tsc completes but with errors that need to be addressed. +RUN npm install -g .