Permalink
Browse files

npm5, bundle cache

Electron install not working!

npm5 can also be ensured by adding the following to the manifest,
instead of bumping nodejs to v8:

        {
            "name": "npm",
            "buildsystem": "simple",
            "sources": [
                {
                    "type": "archive",
                    "url": "https://registry.npmjs.org/npm/-/npm-5.0.0.tgz",
                    "sha256": "816fb9d30335c8e6e6584f2cdb74da7a484f35906b5989e9cc29b7293a471ae2"
                }
            ],
            "build-commands": [
                "make install",
                "rm /app/lib/node_modules/npm",
                "mkdir -p /app/lib/node_modules/npm",
                "cp --reflink=auto -r ./* /app/lib/node_modules/npm"
            ]
        },
  • Loading branch information...
manuq committed Jun 1, 2017
1 parent 091dfc0 commit 1136ce0353f95c3a35c8331541c5313238b14b80
Showing with 51 additions and 4 deletions.
  1. +3 −1 Makefile
  2. +37 −0 electron/bundle-npm-deps.sh
  3. +1 −0 electron/npm5-sha256sum
  4. +10 −3 org.sugarizer.Sugarizer.json
View
@@ -1,5 +1,7 @@
all:
cd electron && npm install
mkdir -p `npm config get cache`
tar -zxf npm-cache.tgz -C `npm config get cache`
cd electron && npm install --offline
cd electron && npm run pack
install:
@@ -0,0 +1,37 @@
#! /bin/bash
download_npm=false
if hash npm 2>/dev/null; then
npm_version=$(npm --version)
if [[ ! "$npm_version" == 5* ]]; then
download_npm=true
fi
else
download_npm=true
fi
if ! $download_npm; then
echo "Using system installed npm"
npm5=npm
else
echo "Downloading npm..."
wget https://registry.npmjs.org/npm/-/npm-5.0.0.tgz
if ! sha256sum --quiet -c npm5-sha256sum < npm-5.0.0.tgz; then
echo "Error downloading npm"
exit 1
fi
tar -zxf npm-5.0.0.tgz
mv package npm5
npm5=npm5/bin/npm-cli.js
fi
echo "Bundling npm cache..."
rm -rf node_modules cache package-lock.json npm-cache.tgz
mkdir cache
ORIG_CACHE=`$npm5 config get cache`
$npm5 config set cache ./cache
$npm5 install
pushd cache
tar -zcf ../npm-cache.tgz *
popd
$npm5 config set cache ${ORIG_CACHE}
View
@@ -0,0 +1 @@
816fb9d30335c8e6e6584f2cdb74da7a484f35906b5989e9cc29b7293a471ae2 npm-5.0.0.tgz
@@ -12,9 +12,8 @@
"sources": [
{
"type": "archive",
"url": "https://nodejs.org/dist/v5.12.0/node-v5.12.0.tar.xz",
"path": "node-v5.12.0.tar.xz",
"sha256": "4f926373f11f2a25156eee1804ec012eb912c42e5d34fc2909889da22efdadfe"
"url": "https://nodejs.org/dist/v8.0.0/node-v8.0.0.tar.xz",
"sha256": "258d3aa3632bbbf2a447c5d524bd7074e23aa26e2b698774ff452954f6174f1c"
}
]
},
@@ -36,6 +35,10 @@
"type": "file",
"path": "electron/package.json"
},
{
"type": "file",
"path": "electron/package-lock.json"
},
{
"type": "file",
"path": "electron/config.json"
@@ -59,6 +62,10 @@
{
"type": "file",
"path": "resources/org.sugarizer.Sugarizer.desktop"
},
{
"type": "file",
"path": "electron/npm-cache.tgz"
}
]
}

0 comments on commit 1136ce0

Please sign in to comment.