From 157058b96aff1796c2bca2686c50a8b5f48a4cae Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Mon, 16 Oct 2023 15:55:15 +0200 Subject: [PATCH] chore(core/strapi): remove postinstall --- packages/core/strapi/package.json | 2 -- packages/core/strapi/scripts/postinstall.js | 7 ----- packages/core/strapi/src/utils/postinstall.ts | 29 ------------------- 3 files changed, 38 deletions(-) delete mode 100644 packages/core/strapi/scripts/postinstall.js delete mode 100644 packages/core/strapi/src/utils/postinstall.ts diff --git a/packages/core/strapi/package.json b/packages/core/strapi/package.json index b01dcb650c..33f3dc46a1 100644 --- a/packages/core/strapi/package.json +++ b/packages/core/strapi/package.json @@ -70,7 +70,6 @@ "files": [ "./dist", "./bin", - "./scripts", "./resources", "index.js" ], @@ -79,7 +78,6 @@ "build:ts": "run build", "clean": "run -T rimraf ./dist", "copy-files": "copyfiles -u 1 -a 'src/**/*.html' 'src/**/*.png' dist", - "postinstall": "node ./scripts/postinstall.js", "lint": "run -T eslint .", "prepublishOnly": "yarn clean && yarn build", "test:unit": "run -T jest", diff --git a/packages/core/strapi/scripts/postinstall.js b/packages/core/strapi/scripts/postinstall.js deleted file mode 100644 index f19f1cf366..0000000000 --- a/packages/core/strapi/scripts/postinstall.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -try { - require('./dist/utils/postinstall'); -} catch (e) { - // ignore -} diff --git a/packages/core/strapi/src/utils/postinstall.ts b/packages/core/strapi/src/utils/postinstall.ts deleted file mode 100644 index 8251ccdc78..0000000000 --- a/packages/core/strapi/src/utils/postinstall.ts +++ /dev/null @@ -1,29 +0,0 @@ -import fetch from 'node-fetch'; -import machineID from './machine-id'; - -/* - * No need to worry about this file, we only retrieve anonymous data here. - * It allows us to know on how many times the package has been installed globally. - */ - -try { - if ( - process.env.npm_config_global === 'true' || - JSON.parse(process.env.npm_config_argv as any).original.includes('global') - ) { - const event = 'didInstallStrapi'; - fetch('https://analytics.strapi.io/api/v2/track', { - method: 'POST', - body: JSON.stringify({ - event, - deviceId: machineID(), - }), - headers: { - 'Content-Type': 'application/json', - 'X-Strapi-Event': event, - }, - }).catch(() => {}); - } -} catch (e) { - // ... -}