From a04fb01c7b09c6382cb2ed6178d0e65ed1b5b0e8 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Mon, 5 Apr 2021 09:03:57 -0400 Subject: [PATCH] Remove preinstall script and test https://github.com/prebuild/prebuild-install/pull/137 Signed-off-by: Timothy Johnson --- jenkins/bundleKeytar.sh | 2 +- package.json | 1 - scripts/preinstall.js | 43 ----------------------------------------- 3 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 scripts/preinstall.js diff --git a/jenkins/bundleKeytar.sh b/jenkins/bundleKeytar.sh index 1f8edbc..fc150da 100644 --- a/jenkins/bundleKeytar.sh +++ b/jenkins/bundleKeytar.sh @@ -15,7 +15,7 @@ chmod +x ./jq curl -fs https://$githubAuthHeader@api.github.com/repos/atom/node-keytar/releases/tags/v$keytarVersion | ./jq -c '.assets[] | select (.name | contains("node"))' | ./jq -cr 'select (.browser_download_url) | .browser_download_url' | - while read -r bdu; do curl -fsL -o `echo -n $(echo -n $bdu | md5sum | cut -c1-6)'-'$(basename $bdu)` $bdu; done + while read -r bdu; do curl -fsL $bdu; done rm ./jq cd .. diff --git a/package.json b/package.json index 8d6f0ce..aceefc0 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "watch": "tsc --pretty --watch", "watch:test": "jest --watch", "installPlugin": "npm install && npm run clean && npm run build && zowe plugins install .", - "preinstall": "node scripts/preinstall.js", "postinstall": "zowe config set CredentialManager @zowe/secure-credential-store-for-zowe-cli && echo \"The Secure Credential Store has been successfully installed. The CLI will now use the Node Keytar module to encrypt your local credentials. CLI Profiles that you have created will need to be updated because their credentials are stored in plain text and not accessible from the credential manager. Refer to the available options in the help text to update profiles 'zowe scs update -h'.\" 1>&2", "preuninstall": "zowe config reset CredentialManager", "postuninstall": "echo \"CLI Profiles that you have created will need to be recreated because their credentials are stored in the credential manager that has been uninstalled. Refer to the available options in the help text to create a new profile 'zowe profiles create zosmf-profile -h'.\" 1>&2" diff --git a/scripts/preinstall.js b/scripts/preinstall.js deleted file mode 100644 index 5969a7a..0000000 --- a/scripts/preinstall.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This program and the accompanying materials are made available under the terms of the - * Eclipse Public License v2.0 which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-v20.html - * - * SPDX-License-Identifier: EPL-2.0 - * - * Copyright Contributors to the Zowe Project. - */ - -const fs = require("fs"); -const join = require("path").join; - -// Function copied from prebuild-install -function npmCache() { - const env = process.env; - const home = require('os').homedir; - return env.npm_config_cache || - (env.APPDATA ? join(env.APPDATA, 'npm-cache') : join(home(), '.npm')); -} - -try { - // Skip preinstall script if local prebuilds folder doesn't exist - const localDir = join(__dirname, "..", "prebuilds"); - if (!fs.existsSync(localDir)) { - process.exit(0); - } - - // Ensure that prebuilds folder exists in NPM cache - const cacheDir = join(npmCache(), "_prebuilds"); - if (!fs.existsSync(cacheDir)) { - fs.mkdirSync(cacheDir); - } - - // Copy prebuilt Keytar binaries from local folder to NPM cache - fs.readdirSync(localDir).forEach((filename) => { - if (filename.match(/.*-keytar-.*-node-.*\.tar\.gz/)) { - fs.copyFileSync(join(localDir, filename), join(cacheDir, filename)); - } - }); -} catch (err) { - console.error(err); -}