Skip to content

Commit

Permalink
snap: add initial snapcraft config creation script
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Jan 22, 2018
1 parent 690b267 commit cc2ceb8
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
9 changes: 9 additions & 0 deletions snap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Node.js Snap for https://snapcraft.io/

> Snaps are containerised software packages that are simple to create and install. They auto-update and are safe to run. And because they bundle their dependencies, they work on all major Linux systems without modification.
This is a work in progress, currently supporting Node.js Nightly versions, updated every 24 hours from the Node.js _master_ branch.

1. **Install snapd on your distribution:** https://docs.snapcraft.io/core/install
2. **Install Node.js Nightly**: `$ snap install node --edge`

51 changes: 51 additions & 0 deletions snap/snapcraft.yaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

set -xe

__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# release
#NODE_VERSION="9.4.0"
#NODE_DISTTYPE="release"
#NODE_TAG=""

# nightly
NODE_VERSION="$(curl -sL https://nodejs.org/download/nightly/index.tab | awk '/^v[1-9].*\Wsrc\W/ { print substr($1, 2); exit }')"
NODE_DISTTYPE="nightly"
NODE_TAG="v${NODE_VERSION}"

envsubst << EOF > ${__dirname}/snapcraft.yaml
name: node
version: 'v${NODE_VERSION:0:30}'
summary: Node.js
description: |
A JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. https://nodejs.org/
grade: stable
confinement: classic
apps:
node:
command: bin/node
npm:
command: bin/npm
yarn:
command: bin/yarn.js
parts:
node:
plugin: make
source-type: tar
source: https://nodejs.org/download/${NODE_DISTTYPE}/v${NODE_VERSION}/node-v${NODE_VERSION}.tar.gz
build-packages:
- g++
- make
- python2.7
- ccache
prepare: |
./configure --prefix=/ --release-urlbase=https://nodejs.org/download/${NODE_DISTTYPE}/ --tag=${NODE_TAG}
yarn:
source-type: tar
source: https://yarnpkg.com/latest.tar.gz
plugin: dump
EOF

0 comments on commit cc2ceb8

Please sign in to comment.