From 1036c98db851f089cf549c6d0e2758cf669ff3cd Mon Sep 17 00:00:00 2001 From: Rhys Bartels-Waller Date: Tue, 7 Apr 2020 16:19:10 +1000 Subject: [PATCH] Hotfixes TypeScript package postinstall script (#136) * Correct npm scripts based on TypeScript transpilation * Update Jenkins credentials to align with package requirements * Add now explicit build action to Jenkins --- Jenkinsfile | 10 +++--- cli/package.json | 4 ++- cli/yarn.lock | 39 ++++++++++++++++++++-- generated_packages/TypeScript/package.json | 1 - 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 424e5b89..fb206a2e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,8 +16,8 @@ pipeline { stages { stage('Install') { steps { - sh 'yarn' - sh 'yarn --cwd ./cli' + sh 'yarn && yarn build' + sh 'yarn --cwd ./cli && yarn --cwd ./cli build' } } stage('Validate Code Style') { @@ -58,14 +58,14 @@ pipeline { environment { NPM_REGISTRY_AUTH = credentials('npm-registry-auth') NPM_REGISTRY_URI = credentials('npm-registry-uri') - NPM_REGISTRY_USER = credentials('npm-registry-user') + NPM_REGISTRY_EMAIL = credentials('npm-registry-email') } steps { sh "docker tag inputoutput/cardano-graphql:${env.GIT_COMMIT} inputoutput/cardano-graphql:${env.TAG_NAME}" sh "docker push inputoutput/cardano-graphql:${env.TAG_NAME}" - sh "npx npm-cli-login -u $NPM_REGISTRY_USER -e $NPM_REGISTRY_AUTH_USR -p $NPM_REGISTRY_AUTH_PSW -r $NPM_REGISTRY_URI" + sh "npx npm-cli-login -u $NPM_REGISTRY_AUTH_USR -e $NPM_REGISTRY_EMAIL -p $NPM_REGISTRY_AUTH_PSW -r $NPM_REGISTRY_URI" sh "npm publish --cwd ./cli" - sh "npm publish publish --cwd ./generated_packages/TypeScript" + sh "npm publish --cwd ./generated_packages/TypeScript" } post { always { diff --git a/cli/package.json b/cli/package.json index a78ef092..54d9eec4 100644 --- a/cli/package.json +++ b/cli/package.json @@ -11,7 +11,8 @@ "build": "tsc -p .", "dev": "ts-node-dev --no-notify --respawn --transpileOnly src/index.ts", "lint": "eslint -c ../.eslintrc.json \"src/**/*.ts\"", - "prepare": "yarn build", + "prepack": "yarn build", + "postpack": "shx rm -rf dist", "test": "jest" }, "repository": { @@ -61,6 +62,7 @@ "eslint-plugin-standard": "^4.0.1", "eslint-watch": "^6.0.1", "jest": "^25.1.0", + "shx": "^0.3.2", "ts-node-dev": "^1.0.0-pre.40", "typescript": "3.5.3" }, diff --git a/cli/yarn.lock b/cli/yarn.lock index 694149dd..80976910 100644 --- a/cli/yarn.lock +++ b/cli/yarn.lock @@ -1370,6 +1370,11 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +es6-object-assign@^1.0.3: + version "1.1.0" + resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c" + integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw= + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1925,7 +1930,7 @@ glob-parent@^5.0.0, glob-parent@~5.1.0: dependencies: is-glob "^4.0.1" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -2133,6 +2138,11 @@ inquirer@^7.0.0, inquirer@^7.1.0: strip-ansi "^6.0.0" through "^2.3.6" +interpret@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" + integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== + ip-regex@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" @@ -3649,6 +3659,13 @@ realpath-native@^1.1.0: dependencies: util.promisify "^1.0.0" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= + dependencies: + resolve "^1.1.6" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -3776,7 +3793,7 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.0.0, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.3.2: +resolve@^1.0.0, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.3.2: version "1.15.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== @@ -3934,11 +3951,29 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shelljs@^0.8.1: + version "0.8.3" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097" + integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A== + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== +shx@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/shx/-/shx-0.3.2.tgz#40501ce14eb5e0cbcac7ddbd4b325563aad8c123" + integrity sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA== + dependencies: + es6-object-assign "^1.0.3" + minimist "^1.2.0" + shelljs "^0.8.1" + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" diff --git a/generated_packages/TypeScript/package.json b/generated_packages/TypeScript/package.json index a030f3c1..da7836ca 100644 --- a/generated_packages/TypeScript/package.json +++ b/generated_packages/TypeScript/package.json @@ -11,7 +11,6 @@ "scripts": { "build": "tsc -p .", "prepack": "yarn build && shx cp ../../src/schema.graphql .", - "preinstall": "yarn build && shx cp ../../src/schema.graphql .", "postpack": "shx rm schema.graphql && shx rm -rf dist" }, "keywords": [