Files
studio-desktop/scripts/todesktop/beforeInstall.cjs
filteredandGitHub 88746f6234 Lint & refactor codebase (#539)
* Ignore shims script (hard forked)

* Format scripts

* Remove redundant code

* [Refactor] Remove ternary statement

* Add ESM top-level await

* Add TS types, clean up

* Ignore ESLint warnings in scripts

* Remove redundant code

* Lint tests

* Remove stylistic ESLint rule

!array.length is acceptable here.

* Ignore ESLint errors on yaml parsing

No easy solution here; this is already in the wild.
Needs proper reimplementation at some point.

* nit

* [Refactor] if-else => switch

* [Refactor] Remove redundant code

* Remove unnecessary use of static class

* Annotate remaining low-priority ESLint items

* Lint configs

* Lint playwright config

* nit
2024-12-19 13:30:19 -08:00

29 lines
1.0 KiB
JavaScript

const { spawnSync } = require('child_process');
const path = require('path');
const os = require('os');
module.exports = async ({ pkgJsonPath, pkgJson, appDir, hookName }) => {
/**
* pkgJsonPath - string - path to the package.json file
* pkgJson - object - the parsed package.json file
* appDir - string - the path to the app directory
* hookName - string - the name of the hook ("todesktop:beforeInstall" or "todesktop:afterPack")
*/
console.log('Before Yarn Install', os.platform());
if (os.platform() === 'win32') {
// ToDesktop currently does not have the min 3.12 python installed.
// Download the installer then install it
// Change stdio to get back the logs if there are issues.
spawnSync('curl', ['-s', 'https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe'], {
shell: true,
stdio: 'ignore',
});
spawnSync('python-3.12.7-amd64.exe', ['/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'Include_test=0'], {
shell: true,
stdio: 'ignore',
});
}
};