Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: removing unneeded postinstall script

Ilian Sapundshieva446dda589a2
diff --git a/package.json b/package.json
index 6e1ad54ff..67fda19d1 100644
--- a/package.json
+++ b/package.json
@@ -97,16 +97,10 @@
"paste-android-linux": "adb shell input text '$(xclip -selection c -o)'",
"paste-android-macos": "adb shell input text \"'$(pbpaste)'\"",
"playwright-show-trace": "npx playwright show-trace \"test-results/folder.pw.e2e.js-TST01---Folder-management-TST0102---Reload-folder-web-minio-electron-/trace.zip\"",
- "postinstall-aws-check": "cross-env PD_PLATFORM=aws node scripts/postinstall.js",
- "postinstall-cordova-check": "cross-env PD_PLATFORM=cordova node scripts/postinstall.js",
- "postinstall-electron-check": "cross-env PD_PLATFORM=electron node scripts/postinstall.js",
- "postinstall-electron-debug": "cross-env PD_PLATFORM=electron npm install --foreground-scripts @tagspaces/[email protected]",
- "postinstall-node-check": "cross-env PD_PLATFORM=node node scripts/postinstall.js",
- "postinstall-web-check": "cross-env PD_PLATFORM=web node scripts/postinstall.js",
"prepare": "husky install",
- "prepare-cordova": "npm run install-ext-web-check && npm run postinstall-cordova-check && rimraf cordova/www/dist && rimraf cordova/www/node_modules && shx cp -rL release/app/node_modules cordova/www && shx cp LICENSE.txt cordova/www",
- "prepare-node": "npm run install-ext-node-check && npm run postinstall-electron-check",
- "copy-web": "npm run install-ext-web-check && npm run postinstall-aws-check && rimraf web/modules && shx mkdir -p web/modules/@tagspaces/extensions && shx cp -rL release/app/node_modules/@tagspaces/extensions/* web/modules/@tagspaces/extensions/",
+ "prepare-cordova": "npm run install-ext-web-check && rimraf cordova/www/dist && rimraf cordova/www/node_modules && shx cp -rL release/app/node_modules cordova/www && shx cp LICENSE.txt cordova/www",
+ "prepare-node": "npm run install-ext-node-check",
+ "copy-web": "npm run install-ext-web-check && rimraf web/modules && shx mkdir -p web/modules/@tagspaces/extensions && shx cp -rL release/app/node_modules/@tagspaces/extensions/* web/modules/@tagspaces/extensions/",
"prepare-web": "npm run copy-web && shx cp LICENSE.txt web && npm run build:web && node scripts/genswconf.js && npm run clean-maps",
"copy-web-pro": "npm run copy-web && npm run prepare-web-pro-ext && shx cp node_modules/@tagspacespro/tagspacespro/EULA.txt web",
"prepare-web-pro": "npm run copy-web-pro && npm run build:web && node scripts/genswconf.js && npm run clean-maps",
diff --git a/scripts/postinstall.js b/scripts/postinstall.js
deleted file mode 100644
index 434a90b29..000000000
--- a/scripts/postinstall.js
+++ /dev/null
@@ -1,128 +0,0 @@
-const fs = require('fs-extra');
-const pathLib = require('path');
-const shell = require('shelljs');
-// const packageJson = require('../package.json');
-
-/**
- * check only if index.js exist - TODO check installed version
- * TODO rethink to replace this from @tagspaces/dynamic-packages-loading
- * @param npmPackage
- * @returns {boolean}
- */
-/*function isInstalled(npmPackage) {
- try {
- const path = require.resolve('@tagspaces/tagspaces-platforms');
- if (
- !fs.existsSync(path) // || !fs.existsSync(pathLib.join(path, '..', 'node_modules'))
- ) {
- return false;
- }
- const data = fs.readFileSync(path, 'utf8');
- return data.indexOf(npmPackage) !== -1; // fs.existsSync(path)
- // process.moduleLoadList.indexOf("NativeModule " + npmPackage) >= 0 ||
- } catch (e) {
- return false;
- }
-}*/
-
-function isInstalled(npmPackage) {
- try {
- // const path = require.resolve(npmPackage);
- const pkg = pathLib.join(__dirname, '..', 'node_modules', npmPackage);
- return fs.existsSync(pkg);
- } catch (e) {
- return false;
- }
-}
-
-/*if (!process.env.PD_PLATFORM) {
- console.log('PD_PLATFORM environment variable is not set');
- shell.exit(1);
-}
-let install = false;
-if (process.env.PD_PLATFORM === 'electron') {
- if (
- !isInstalled('@tagspaces/tagspaces-common-aws') ||
- //!isInstalled('@tagspaces/tagspaces-common-webdav') ||
- isInstalled('@tagspaces/tagspaces-common-node') ||
- isInstalled('@tagspaces/tagspaces-common-cordova')
- ) {
- //!isInstalled('@tagspaces/tagspaces-common-electron')) {
- install = true;
- }
-} else if (process.env.PD_PLATFORM === 'node') {
- if (
- !isInstalled('@tagspaces/tagspaces-common-node') // || isInstalled('@tagspaces/tagspaces-common-electron')
- ) {
- install = true;
- }
-} else if (process.env.PD_PLATFORM === 'aws') {
- if (
- !isInstalled('@tagspaces/tagspaces-common-aws') ||
- isInstalled('@tagspaces/tagspaces-common-node') ||
- isInstalled('@tagspaces/tagspaces-common-web')
- ) {
- install = true;
- }
-} else if (process.env.PD_PLATFORM === 'web') {
- if (
- !isInstalled('@tagspaces/tagspaces-common-web') ||
- isInstalled('@tagspaces/tagspaces-common-node')
- ) {
- install = true;
- }
-} else if (process.env.PD_PLATFORM === 'webdav') {
- if (!isInstalled('@tagspaces/tagspaces-common-webdav')) {
- install = true;
- }
-} else if (process.env.PD_PLATFORM === 'cordova') {
- if (!isInstalled('@tagspaces/tagspaces-common-cordova')) {
- install = true;
- }
-}
-shell.exec('npm -v');*/
-
-/**
- * If the installed tagspaces-platforms changed (with deleted node_modules) npm install will not update it -> change version or delete the tagspaces-platforms folder
- * @type {string}
- */
-/*if (install) {
- const cmd =
- 'npm run-script --prefix ./node_modules/@tagspaces/tagspaces-platforms install';
- // 'npm install @tagspaces/tagspaces-platforms@' + // --force --foreground-scripts
- /!*stripFromStart(
- packageJson.dependencies['@tagspaces/tagspaces-platforms'],
- '^'
- );*!/
- if (!fs.existsSync('./node_modules/@tagspaces/tagspaces-platforms')) {
- shell.exec('npm install');
- }
- if (shell.exec(cmd).code !== 0) {
- shell.echo(
- 'Error: Install ' + process.env.PD_PLATFORM + ' platform failed',
- );
- shell.exit(1);
- }
- // fix: npm postinstall and install scripts not runs automatically after 'npm install' with npm v8
- // if (process.platform === 'win32') {
- const projectDir = pathLib.join(__dirname, '..');
- const platformDir = pathLib.join(
- projectDir,
- 'node_modules',
- '@tagspaces',
- 'tagspaces-platforms',
- );
- const cmd2 =
- 'npx @tagspaces/dynamic-packages-loading ' +
- platformDir +
- ' -p ' +
- process.env.PD_PLATFORM +
- ' --prefix=' +
- projectDir;
- //
- if (shell.exec(cmd2).code !== 0) {
- shell.echo('Error: PostInstall ' + process.env.PD_PLATFORM + ' platform');
- shell.exit(1);
- }
- // }
-}*/