Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 18 Upgrade #991

Merged
merged 16 commits into from
Jan 31, 2023
Merged
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17
18.12.1
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This is a monorepo with multiple packages leveraging [`lerna`](https://github.co
You'll need to have some tools installed locally to build and test action destinations.

- Yarn 1.x
- Node 14.17 (latest LTS, we recommand using [`nvm`](https://github.com/nvm-sh/nvm) for managing Node versions)
- Node 18.12 (latest LTS, we recommand using [`nvm`](https://github.com/nvm-sh/nvm) for managing Node versions)

If you are a Segment employee you can directly `git clone` the repository locally. Otherwise you'll want to fork this repository for your organization to submit Pull Requests against the main Segment repository. Once you've got a fork, you can `git clone` that locally.

Expand All @@ -62,7 +62,7 @@ cd action-destinations
npm login
yarn login

# Requires node 14.17, optionally: nvm use 14.17
# Requires node 18.12.1, optionally: nvm use 18.12.1
yarn --ignore-optional
yarn bootstrap
yarn build
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"types": "./bin/run generate:types",
"validate": "./bin/run validate",
"lint": "eslint '**/*.ts' --cache",
"subscriptions": "yarn workspace @segment/destination-subscriptions",
"subscriptions": "NODE_OPTIONS=--openssl-legacy-provider yarn workspace @segment/destination-subscriptions",
"test": "lerna run test --stream",
"test-partners": "lerna run test --stream --ignore @segment/actions-core --ignore @segment/actions-cli --ignore @segment/ajv-human-errors",
"test-browser": "lerna run build:karma --stream && karma start",
"test-browser": "lerna run build:karma --stream && NODE_OPTIONS=--openssl-legacy-provider karma start",
"typecheck": "lerna run typecheck --stream",
"alpha": "lerna publish --canary --preid $(git branch --show-current) --include-merged-tags",
"prepare": "husky install"
Expand Down
2 changes: 1 addition & 1 deletion packages/actions-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"package.json"
],
"engines": {
"node": "^14.16"
"node": "^18.12"
},
"engineStrict": true,
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/browser-destinations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build": "yarn clean && yarn build-ts && yarn build-cjs && yarn build-web",
"build-ts": "yarn tsc -b tsconfig.build.json",
"build-cjs": "yarn tsc -p ./tsconfig.build.json -m commonjs --outDir ./dist/cjs/",
"build-web": "NODE_ENV=production ASSET_ENV=production yarn webpack -c webpack.config.js",
"build-web-stage": "NODE_ENV=production ASSET_ENV=stage yarn webpack -c webpack.config.js",
"build-web": "NODE_ENV=production ASSET_ENV=production NODE_OPTIONS=--openssl-legacy-provider yarn webpack -c webpack.config.js",
"build-web-stage": "NODE_ENV=production ASSET_ENV=stage NODE_OPTIONS=--openssl-legacy-provider yarn webpack -c webpack.config.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious about what --openssl-legacy-provider does for action-destinations?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some webpack bug

webpack/webpack#14532

"deploy-prod": "yarn build-web && aws s3 sync ./dist/web/ s3://segment-ajs-next-destinations-production/next-integrations/actions --grants read=id=$npm_config_prod_cdn_oai,id=$npm_config_prod_custom_domain_oai",
"deploy-stage": "yarn build-web-stage && aws-okta exec plat-write -- aws s3 sync ./dist/web/ s3://segment-ajs-next-destinations-stage/next-integrations/actions --grants read=id=$npm_config_stage_cdn_oai,id=$npm_config_stage_custom_domain_oai",
"clean": "tsc -b tsconfig.build.json --clean",
Expand Down
3 changes: 2 additions & 1 deletion packages/cli-internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"directory": "packages/cli-internal"
},
"engines": {
"node": "^14.16"
"node": "^18.12"
},
"engineStrict": true,
"files": [
Expand Down Expand Up @@ -53,6 +53,7 @@
"@oclif/config": "^1",
"@oclif/errors": "^1",
"@oclif/plugin-help": "^3.3",
"@types/node": "^18.11.15",
"@segment/action-destinations": "^3.130.0",
"@segment/actions-core": "^3.50.0",
"chalk": "^4.1.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"directory": "packages/cli"
},
"engines": {
"node": "^14.16"
"node": "^18.12"
},
"engineStrict": true,
"bin": {
Expand Down Expand Up @@ -56,6 +56,7 @@
"@oclif/config": "^1",
"@oclif/errors": "^1",
"@oclif/plugin-help": "^3.3",
"@types/node": "^18.11.15",
"@segment/action-destinations": "^3.130.0",
"@segment/actions-core": "^3.50.0",
"chalk": "^4.1.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"package.json"
],
"engines": {
"node": "^14.16"
"node": "^18.12"
},
"engineStrict": true,
"license": "MIT",
Expand Down Expand Up @@ -55,6 +55,7 @@
},
"dependencies": {
"@lukeed/uuid": "^2.0.0",
"@types/node": "^18.11.15",
"@segment/ajv-human-errors": "^2.2.0",
"@segment/destination-subscriptions": "^3.14.0",
"abort-controller": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/__tests__/destination-kit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('destination kit', () => {
const testEvent: SegmentEvent = { type: 'track' }
const testSettings = { apiSecret: 'test_key', subscription: { subscribe: 'typo', partnerAction: 'customEvent' } }
const res = await destinationTest.onEvent(testEvent, testSettings)
expect(res).toEqual([{ output: "invalid subscription : Cannot read property 'type' of undefined" }])
expect(res).toEqual([{ output: "invalid subscription : Cannot read properties of undefined (reading 'type')" }])
})

test('should return `not subscribed` when providing an empty event', async () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/destination-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"package.json"
],
"engines": {
"node": "^14.16"
"node": "^18.12"
},
"engineStrict": true,
"license": "MIT",
Expand All @@ -39,6 +39,7 @@
"dependencies": {
"@amplitude/ua-parser-js": "^0.7.25",
"@segment/a1-notation": "^2.1.4",
"@types/node": "^18.11.15",
"@segment/actions-core": "^3.50.0",
"@segment/actions-shared": "^1.32.0",
"cheerio": "^1.0.0-rc.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ const testDestination = createTestIntegration(destination)
const actionSlug = 'createUpdateActivity'
const destinationSlug = 'Pipedrive'
const seedName = `${destinationSlug}#${actionSlug}`
const PIPEDRIVE_DOMAIN = 'companydomain'

describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
it('required fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)
settingsData.domain = PIPEDRIVE_DOMAIN

nock(/.*/).persist().get(/.*/).reply(200)
nock(/.*/).persist().post(/.*/).reply(200)
Expand Down Expand Up @@ -45,6 +47,7 @@ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination ac
it('all fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, false)
settingsData.domain = PIPEDRIVE_DOMAIN

nock(/.*/).persist().get(/.*/).reply(200)
nock(/.*/).persist().post(/.*/).reply(200)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ const testDestination = createTestIntegration(destination)
const actionSlug = 'createUpdateDeal'
const destinationSlug = 'Pipedrive'
const seedName = `${destinationSlug}#${actionSlug}`
const PIPEDRIVE_DOMAIN = 'companydomain'

describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
it('required fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)

settingsData.domain = PIPEDRIVE_DOMAIN
const basePath = `https://${settingsData.domain}.pipedrive.com`
nock(basePath)
.persist()
Expand Down Expand Up @@ -55,7 +56,7 @@ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination ac
it('all fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, false)

settingsData.domain = PIPEDRIVE_DOMAIN
const basePath = `https://${settingsData.domain}.pipedrive.com`
nock(basePath)
.persist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ const testDestination = createTestIntegration(destination)
const actionSlug = 'createUpdateLead'
const destinationSlug = 'Pipedrive'
const seedName = `${destinationSlug}#${actionSlug}`
const PIPEDRIVE_DOMAIN = 'companydomain'

describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
it('required fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)
settingsData.domain = PIPEDRIVE_DOMAIN
Object.keys(eventData)
.filter((f) => !action.fields[f].required)
.forEach((f) => {
Expand Down Expand Up @@ -60,7 +62,7 @@ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination ac
it('all fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, false)

settingsData.domain = PIPEDRIVE_DOMAIN
const basePath = `https://${settingsData.domain}.pipedrive.com`
nock(basePath)
.persist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ const testDestination = createTestIntegration(destination)
const actionSlug = 'createUpdateNote'
const destinationSlug = 'Pipedrive'
const seedName = `${destinationSlug}#${actionSlug}`
const PIPEDRIVE_DOMAIN = 'companydomain'

describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
it('required fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)

settingsData.domain = PIPEDRIVE_DOMAIN
Object.keys(eventData)
.filter((f) => !action.fields[f].required)
.forEach((f) => {
Expand Down Expand Up @@ -61,7 +62,7 @@ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination ac
it('all fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, false)

settingsData.domain = PIPEDRIVE_DOMAIN
const basePath = `https://${settingsData.domain}.pipedrive.com`
nock(basePath)
.persist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ const testDestination = createTestIntegration(destination)
const actionSlug = 'createUpdateOrganization'
const destinationSlug = 'Pipedrive'
const seedName = `${destinationSlug}#${actionSlug}`
const PIPEDRIVE_DOMAIN = 'companydomain'

describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
it('required fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)

settingsData.domain = PIPEDRIVE_DOMAIN
Object.keys(eventData)
.filter((f) => !action.fields[f].required)
.forEach((f) => {
Expand Down Expand Up @@ -51,7 +52,7 @@ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination ac
it('required fields, update', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)

settingsData.domain = PIPEDRIVE_DOMAIN
Object.keys(eventData)
.filter((f) => !action.fields[f].required)
.forEach((f) => {
Expand Down Expand Up @@ -99,7 +100,7 @@ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination ac
it('all fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, false)

settingsData.domain = PIPEDRIVE_DOMAIN
const basePath = `https://${settingsData.domain}.pipedrive.com`
nock(basePath)
.persist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ const actionSlug = 'createUpdatePerson'
const destinationSlug = 'Pipedrive'
const seedName = `${destinationSlug}#${actionSlug}`

const PIPEDRIVE_DOMAIN = 'companydomain'

describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
it('required fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)

// generateTestData / chance sometimes generates a string that can't be parsed by nock
settingsData.domain = PIPEDRIVE_DOMAIN
Object.keys(eventData)
.filter((f) => !action.fields[f].required)
.forEach((f) => {
Expand Down Expand Up @@ -51,7 +54,8 @@ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination ac
it('required fields, update', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)

// generateTestData / chance sometimes generates a string that can't be parsed by nock
settingsData.domain = PIPEDRIVE_DOMAIN
Object.keys(eventData)
.filter((f) => !action.fields[f].required)
.forEach((f) => {
Expand Down Expand Up @@ -99,7 +103,8 @@ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination ac
it('all fields', async () => {
const action = destination.actions[actionSlug]
const [eventData, settingsData] = generateTestData(seedName, destination, action, false)

// generateTestData / chance sometimes generates a string that can't be parsed by nock
settingsData.domain = PIPEDRIVE_DOMAIN
const basePath = `https://${settingsData.domain}.pipedrive.com`
nock(basePath)
.persist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const testFql = (fql: string, ast: any): void => {
expect(generateFql(ast)).toEqual(fql)
}

const expectedTypeError = new Error("Cannot read property 'type' of undefined")
const expectedTypeError = new Error("Cannot read properties of undefined (reading 'type')")
expectedTypeError.name = 'TypeError'

test('should handle invalid payloads', () => {
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3044,10 +3044,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.33.tgz#24927446e8b7669d10abacedd16077359678f436"
integrity sha512-5XmYX2GECSa+CxMYaFsr2mrql71Q4EvHjKS+ox/SiwSdaASMoBIWE6UmZqFO+VX1jIcsYLStI4FFoB6V7FeIYw==

"@types/node@^14.0.0":
version "14.17.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.9.tgz#b97c057e6138adb7b720df2bd0264b03c9f504fd"
integrity sha512-CMjgRNsks27IDwI785YMY0KLt3co/c0cQ5foxHYv/shC2w8oOnVwz5Ubq1QG5KzrcW+AXk6gzdnxIkDnTvzu3g==
"@types/node@^18.11.15":
version "18.11.15"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.15.tgz#de0e1fbd2b22b962d45971431e2ae696643d3f5d"
integrity sha512-VkhBbVo2+2oozlkdHXLrb3zjsRkpdnaU2bXmX8Wgle3PUi569eLRaHGlgETQHR7lLL1w7GiG3h9SnePhxNDecw==

"@types/normalize-package-data@^2.4.0":
version "2.4.1"
Expand Down Expand Up @@ -3615,7 +3615,7 @@ ansi-html-community@^0.0.8:

ansi-regex@5.0.1, ansi-regex@^2.0.0, ansi-regex@^2.1.1, ansi-regex@^3.0.0, ansi-regex@^5.0.0, ansi-regex@^5.0.1, ansi-regex@^6.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==

ansi-styles@^2.2.1:
Expand Down Expand Up @@ -5749,7 +5749,7 @@ domutils@^2.6.0:

dot-prop@^3.0.0, dot-prop@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4"
resolved "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4"
integrity sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==
dependencies:
is-obj "^1.0.0"
Expand Down Expand Up @@ -6901,7 +6901,7 @@ glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.2:

glob-parent@^6.0.1:
version "6.0.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3"
resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3"
integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==
dependencies:
is-glob "^4.0.3"
Expand Down