Skip to content

Commit

Permalink
Try to only pass in NODE_OPTIONS for node18+ (#1032)
Browse files Browse the repository at this point in the history
* Try using conditional for scripts

* Remove NODE_OPTIONS from else

* Echo the nodeversion

* Try setting the node major version and testing that

* Use correct variable in condition

* Try a different approach

* Use bash instead

* Try to fix script

* Add other remaining scripts
  • Loading branch information
SyedWasiHaider authored Feb 8, 2023
1 parent 908178e commit 736f3fd
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 5 deletions.
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": "NODE_OPTIONS=--openssl-legacy-provider yarn workspace @segment/destination-subscriptions",
"subscriptions": "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 && NODE_OPTIONS=--openssl-legacy-provider karma start",
"test-browser": "bash scripts/test-browser.sh",
"typecheck": "lerna run typecheck --stream",
"alpha": "lerna publish --canary --preid $(git branch --show-current) --include-merged-tags",
"prepare": "husky install",
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 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",
"build-web": "bash scripts/build-web.sh",
"build-web-stage": "bash scripts/build-web-stage.sh",
"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
11 changes: 11 additions & 0 deletions packages/browser-destinations/scripts/build-web-stage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
NODE_VERSION="$(node --version)";
NODE_VERSION_MAJOR="${NODE_VERSION:1}"; # strip the "v" prefix
NODE_VERSION_MAJOR="${NODE_VERSION_MAJOR%%.*}"; #get everything before the first dot
if [ "$NODE_VERSION_MAJOR" -ge "18" ]; then
NODE_ENV=production ASSET_ENV=stage NODE_OPTIONS=--openssl-legacy-provider yarn webpack -c webpack.config.js
else NODE_ENV=production ASSET_ENV=stage yarn webpack -c webpack.config.js
fi



8 changes: 8 additions & 0 deletions packages/browser-destinations/scripts/build-web.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
NODE_VERSION="$(node --version)";
NODE_VERSION_MAJOR="${NODE_VERSION:1}"; # strip the "v" prefix
NODE_VERSION_MAJOR="${NODE_VERSION_MAJOR%%.*}"; #get everything before the first dot
if [ "$NODE_VERSION_MAJOR" -ge "18" ]; then
NODE_ENV=production ASSET_ENV=production NODE_OPTIONS=--openssl-legacy-provider yarn webpack -c webpack.config.js
else NODE_ENV=production ASSET_ENV=production yarn webpack -c webpack.config.js
fi
2 changes: 1 addition & 1 deletion packages/destination-subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test": "jest",
"typecheck": "tsc -p tsconfig.build.json --noEmit",
"prepare": "yarn build",
"size": "size-limit"
"size": "bash scripts/size.sh"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
8 changes: 8 additions & 0 deletions packages/destination-subscriptions/scripts/size.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
NODE_VERSION="$(node --version)";
NODE_VERSION_MAJOR="${NODE_VERSION:1}"; # strip the "v" prefix
NODE_VERSION_MAJOR="${NODE_VERSION_MAJOR%%.*}"; #get everything before the first dot
if [ "$NODE_VERSION_MAJOR" -ge "18" ]; then
NODE_OPTIONS=--openssl-legacy-provider size-limit
else size-limit
fi
8 changes: 8 additions & 0 deletions scripts/test-browser.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
NODE_VERSION="$(node --version)";
NODE_VERSION_MAJOR="${NODE_VERSION:1}"; # strip the "v" prefix
NODE_VERSION_MAJOR="${NODE_VERSION_MAJOR%%.*}"; #get everything before the first dot
if [ "$NODE_VERSION_MAJOR" -ge "18" ]; then
lerna run build:karma --stream && NODE_OPTIONS=--openssl-legacy-provider karma start;
else lerna run build:karma --stream && karma start;
fi

0 comments on commit 736f3fd

Please sign in to comment.