An easy-to-use platform for EEG experimentation in the classroom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added node pyodide install script

authored by

jdpigeon and committed by
Teon L Brooks
4e58b5c6 0bd343da

+66 -1
+65
internals/scripts/InstallPyodide.js
··· 1 + //mkdir app/utils/pyodide/src 2 + // && cd app/utils/pyodide/src 3 + // curl -LJO https://github.com/iodide-project/pyodide/releases/download/0.12.0/pyodide-build-0.12.0.tar.bz2 4 + // tar xjf pyodide-build-0.12.0.tar.bz2 5 + // rm pyodide-build-0.12.0.tar.bz2", 6 + 7 + import chalk from "chalk"; 8 + import os from "os"; 9 + import fs from "fs"; 10 + import https from "https"; 11 + import mkdirp from "mkdirp"; 12 + import tar from "tar-fs"; 13 + import url from "url"; 14 + import gunzip from "gunzip-maybe"; 15 + 16 + const PYODIDE_VERSION = "0.12.0"; 17 + const TAR_NAME = `pyodide-build-${PYODIDE_VERSION}.tar.bz2`; 18 + const PYODIDE_DIR = "app/utils/pyodide/src/"; 19 + 20 + const writeAndUnzipFile = response => { 21 + const filePath = `${PYODIDE_DIR}${TAR_NAME}`; 22 + const writeStream = fs.createWriteStream(filePath); 23 + response.pipe(writeStream); 24 + 25 + writeStream.on("finish", () => { 26 + console.log(`${chalk.green.bold(`Unzipping pyodide`)}`); 27 + 28 + const readStream = fs.createReadStream(filePath); 29 + readStream.pipe(gunzip()).pipe(tar.extract(PYODIDE_DIR)); 30 + 31 + readStream.on("end", () => { 32 + console.log(`${chalk.green.bold(`Unzip successful`)}`); 33 + }); 34 + }); 35 + }; 36 + 37 + (() => { 38 + console.log( 39 + `${chalk.green.bold(`Downloading pyodide ${PYODIDE_VERSION}...`)}` 40 + ); 41 + 42 + mkdirp.sync(`app/utils/pyodide/src`); 43 + 44 + https.get( 45 + `https://github.com/iodide-project/pyodide/releases/download/${PYODIDE_VERSION}/pyodide-build-${PYODIDE_VERSION}.tar.bz2`, 46 + response => { 47 + if ( 48 + response.statusCode > 300 && 49 + response.statusCode < 400 && 50 + response.headers.location 51 + ) { 52 + if (url.parse(response.headers.location).hostname) { 53 + https.get(response.headers.location, writeAndUnzipFile); 54 + } else { 55 + https.get( 56 + url.resolve(url.parse(TAR_URL).hostname, response.headers.location), 57 + writeToFile 58 + ); 59 + } 60 + } else { 61 + writeAndUnzipFile(response); 62 + } 63 + } 64 + ); 65 + })();
+1 -1
package.json
··· 21 21 "package-mac": "yarn build && electron-builder build --mac", 22 22 "package-linux": "yarn build && electron-builder build --linux", 23 23 "package-win": "yarn build && electron-builder build --win --x64", 24 - "postinstall": "node -r @babel/register internals/scripts/CheckNativeDep.js && electron-builder install-app-deps && yarn build-dll && opencollective-postinstall && mkdir app/utils/pyodide/src && cd app/utils/pyodide/src && curl -LJO https://github.com/iodide-project/pyodide/releases/download/0.12.0/pyodide-build-0.12.0.tar.bz2 && tar xjf pyodide-build-0.12.0.tar.bz2 && rm pyodide-build-0.12.0.tar.bz2", 24 + "postinstall": "node -r @babel/register internals/scripts/CheckNativeDep.js && electron-builder install-app-deps && yarn build-dll && opencollective-postinstall && node -r babel-register internals/scripts/InstallPyodide.js", 25 25 "postlint-fix": "prettier --ignore-path .eslintignore --single-quote --write '**/*.{js,jsx,json,html,css,less,scss,yml}'", 26 26 "postlint-styles-fix": "prettier --ignore-path .eslintignore --single-quote --write '**/*.{css,scss}'", 27 27 "preinstall": "node ./internals/scripts/CheckYarn.js",