| @@ -0,0 +1,90 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| const fs = require('fs') | ||
| const lockfile = require('@yarnpkg/lockfile') | ||
| const { docopt } = require('docopt') | ||
| const deepEqual = require('deep-equal') | ||
| const R = require('ramda') | ||
|
|
||
| const fixPkgAddMissingSha1 = require('../lib/fixPkgAddMissingSha1') | ||
| const mapObjIndexedReturnArray = require('../lib/mapObjIndexedReturnArray') | ||
| const generateNix = require('../lib/generateNix') | ||
|
|
||
| const USAGE = ` | ||
| Usage: yarn2nix [options] | ||
| Options: | ||
| -h --help Shows this help. | ||
| --no-nix Hide the nix output | ||
| --no-patch Don't patch the lockfile if hashes are missing | ||
| --lockfile=FILE Specify path to the lockfile [default: ./yarn.lock]. | ||
| --builtin-fetchgit Use builtin fetchGit for git dependencies to support on-the-fly generation of yarn.nix without an internet connection | ||
| ` | ||
|
|
||
| const options = docopt(USAGE) | ||
|
|
||
| const data = fs.readFileSync(options['--lockfile'], 'utf8') | ||
|
|
||
| // json example: | ||
|
|
||
| // { | ||
| // type:'success', | ||
| // object:{ | ||
| // 'abbrev@1':{ | ||
| // version:'1.0.9', | ||
| // resolved:'https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135' | ||
| // }, | ||
| // 'shell-quote@git+https://github.com/srghma/node-shell-quote.git#without_unlicenced_jsonify':{ | ||
| // version:'1.6.0', | ||
| // resolved:'git+https://github.com/srghma/node-shell-quote.git#0aa381896e0cd7409ead15fd444f225807a61e0a' | ||
| // }, | ||
| // '@graphile/plugin-supporter@git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git':{ | ||
| // version:'1.6.0', | ||
| // resolved:'git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git#1234commit' | ||
| // }, | ||
| // } | ||
| // } | ||
|
|
||
| const json = lockfile.parse(data) | ||
|
|
||
| if (json.type !== 'success') { | ||
| throw new Error('yarn.lock parse error') | ||
| } | ||
|
|
||
| // Check for missing hashes in the yarn.lock and patch if necessary | ||
|
|
||
| const pkgs = R.pipe( | ||
| mapObjIndexedReturnArray((value, key) => ({ | ||
| ...value, | ||
| nameWithVersion: key, | ||
| })), | ||
| R.uniqBy(R.prop('resolved')), | ||
| )(json.object) | ||
|
|
||
| const fixedPkgsPromises = R.map(fixPkgAddMissingSha1, pkgs) | ||
|
|
||
| ;(async () => { | ||
| const fixedPkgs = await Promise.all(fixedPkgsPromises) | ||
|
|
||
| const origJson = lockfile.parse(data) | ||
|
|
||
| if (!deepEqual(origJson, json)) { | ||
| console.error('found changes in the lockfile', options['--lockfile']) | ||
|
|
||
| if (options['--no-patch']) { | ||
| console.error('...aborting') | ||
| process.exit(1) | ||
| } | ||
|
|
||
| fs.writeFileSync(options['--lockfile'], lockfile.stringify(json.object)) | ||
| } | ||
|
|
||
| if (!options['--no-nix']) { | ||
| // print to stdout | ||
| console.log(generateNix(fixedPkgs, options['--builtin-fetchgit'])) | ||
| } | ||
| })().catch(error => { | ||
| console.error(error) | ||
|
|
||
| process.exit(1) | ||
| }) |
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /* Usage: | ||
| * node fixup_bin.js <bin_dir> <modules_dir> [<bin_pkg_1>, <bin_pkg_2> ... ] | ||
| */ | ||
|
|
||
| const fs = require('fs') | ||
| const path = require('path') | ||
|
|
||
| const derivationBinPath = process.argv[2] | ||
| const nodeModules = process.argv[3] | ||
| const packagesToPublishBin = process.argv.slice(4) | ||
|
|
||
| function processPackage(name) { | ||
| console.log('fixup_bin: Processing ', name) | ||
|
|
||
| const packagePath = `${nodeModules}/${name}` | ||
| const packageJsonPath = `${packagePath}/package.json` | ||
| const packageJson = JSON.parse(fs.readFileSync(packageJsonPath)) | ||
|
|
||
| if (!packageJson.bin) { | ||
| console.log('fixup_bin: No binaries provided') | ||
| return | ||
| } | ||
|
|
||
| // There are two alternative syntaxes for `bin` | ||
| // a) just a plain string, in which case the name of the package is the name of the binary. | ||
| // b) an object, where key is the name of the eventual binary, and the value the path to that binary. | ||
| if (typeof packageJson.bin === 'string') { | ||
| const binName = packageJson.bin | ||
| packageJson.bin = {} | ||
| packageJson.bin[packageJson.name] = binName | ||
| } | ||
|
|
||
| // eslint-disable-next-line no-restricted-syntax, guard-for-in | ||
| for (const binName in packageJson.bin) { | ||
| const binPath = packageJson.bin[binName] | ||
| const normalizedBinName = binName.replace('@', '').replace('/', '-') | ||
|
|
||
| const targetPath = path.normalize(`${packagePath}/${binPath}`) | ||
| const createdPath = `${derivationBinPath}/${normalizedBinName}` | ||
|
|
||
| console.log( | ||
| `fixup_bin: creating link ${createdPath} that points to ${targetPath}`, | ||
| ) | ||
|
|
||
| fs.symlinkSync(targetPath, createdPath) | ||
| } | ||
| } | ||
|
|
||
| packagesToPublishBin.forEach(pkg => { | ||
| processPackage(pkg) | ||
| }) |
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /* Usage: | ||
| * node fixup_yarn_lock.js yarn.lock | ||
| */ | ||
|
|
||
| const fs = require('fs') | ||
| const readline = require('readline') | ||
|
|
||
| const urlToName = require('../lib/urlToName') | ||
|
|
||
| const yarnLockPath = process.argv[2] | ||
|
|
||
| const readFile = readline.createInterface({ | ||
| input: fs.createReadStream(yarnLockPath, { encoding: 'utf8' }), | ||
|
|
||
| // Note: we use the crlfDelay option to recognize all instances of CR LF | ||
| // ('\r\n') in input.txt as a single line break. | ||
| crlfDelay: Infinity, | ||
|
|
||
| terminal: false, // input and output should be treated like a TTY | ||
| }) | ||
|
|
||
| const result = [] | ||
|
|
||
| readFile | ||
| .on('line', line => { | ||
| const arr = line.match(/^ {2}resolved "([^#]+)#([^"]+)"$/) | ||
|
|
||
| if (arr !== null) { | ||
| const [_, url, shaOrRev] = arr | ||
|
|
||
| const fileName = urlToName(url) | ||
|
|
||
| result.push(` resolved "${fileName}#${shaOrRev}"`) | ||
| } else { | ||
| result.push(line) | ||
| } | ||
| }) | ||
| .on('close', () => { | ||
| fs.writeFile(yarnLockPath, result.join('\n'), 'utf8', err => { | ||
| if (err) { | ||
| console.error( | ||
| 'fixup_yarn_lock: fatal error when trying to write to yarn.lock', | ||
| err, | ||
| ) | ||
| } | ||
| }) | ||
| }) |
| @@ -0,0 +1,66 @@ | ||
| const https = require('https') | ||
| const crypto = require('crypto') | ||
|
|
||
| // TODO: | ||
| // make test case where getSha1 function is used, i.e. the case when resolved is without sha1? | ||
| // consider using https://github.com/request/request-promise-native | ||
|
|
||
| function getSha1(url) { | ||
| return new Promise((resolve, reject) => { | ||
| https.get(url, res => { | ||
| const { statusCode } = res | ||
| const hash = crypto.createHash('sha1') | ||
|
|
||
| if (statusCode !== 200) { | ||
| const err = new Error(`Request Failed.\nStatus Code: ${statusCode}`) | ||
|
|
||
| // consume response data to free up memory | ||
| res.resume() | ||
|
|
||
| reject(err) | ||
| } | ||
|
|
||
| res.on('data', chunk => { | ||
| hash.update(chunk) | ||
| }) | ||
|
|
||
| res.on('end', () => { | ||
| resolve(hash.digest('hex')) | ||
| }) | ||
|
|
||
| res.on('error', reject) | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| // Object -> Object | ||
| async function fixPkgAddMissingSha1(pkg) { | ||
| // local dependency | ||
|
|
||
| if (!pkg.resolved) { | ||
| console.error( | ||
| `yarn2nix: can't find "resolved" field for package ${ | ||
| pkg.nameWithVersion | ||
| }, you probably required it using "file:...", this feature is not supported, ignoring`, | ||
| ) | ||
| return pkg | ||
| } | ||
|
|
||
| const [url, sha1] = pkg.resolved.split('#', 2) | ||
|
|
||
| if (sha1) { | ||
| return pkg | ||
| } | ||
|
|
||
| // if there is no sha1 in resolved url | ||
| // (this could happen if yarn.lock was generated by older version of yarn) | ||
| // - request it from registry by https and add it to pkg | ||
| const newSha1 = await getSha1(url) | ||
|
|
||
| return { | ||
| ...pkg, | ||
| resolved: `${url}#${newSha1}`, | ||
| } | ||
| } | ||
|
|
||
| module.exports = fixPkgAddMissingSha1 |
| @@ -0,0 +1,124 @@ | ||
| const R = require('ramda') | ||
|
|
||
| const urlToName = require('./urlToName') | ||
| const { execFileSync } = require('child_process') | ||
|
|
||
| // fetchgit transforms | ||
| // | ||
| // "shell-quote@git+https://github.com/srghma/node-shell-quote.git#without_unlicenced_jsonify": | ||
| // version "1.6.0" | ||
| // resolved "git+https://github.com/srghma/node-shell-quote.git#1234commit" | ||
| // | ||
| // to | ||
| // | ||
| // builtins.fetchGit { | ||
| // url = "https://github.com/srghma/node-shell-quote.git"; | ||
| // ref = "without_unlicenced_jsonify"; | ||
| // rev = "1234commit"; | ||
| // } | ||
| // | ||
| // and transforms | ||
| // | ||
| // "@graphile/plugin-supporter@git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git": | ||
| // version "0.6.0" | ||
| // resolved "git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git#1234commit" | ||
| // | ||
| // to | ||
| // | ||
| // builtins.fetchGit { | ||
| // url = "https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git"; | ||
| // ref = "master"; | ||
| // rev = "1234commit"; | ||
| // } | ||
|
|
||
| function prefetchgit(url, rev) { | ||
| return JSON.parse( | ||
| execFileSync("nix-prefetch-git", ["--rev", rev, url], { | ||
| stdio: [ "ignore", "pipe", "ignore" ], | ||
| timeout: 60000, | ||
| }) | ||
| ).sha256 | ||
| } | ||
|
|
||
| function fetchgit(fileName, url, rev, branch, builtinFetchGit) { | ||
| return ` { | ||
| name = "${fileName}"; | ||
| path = | ||
| let${builtinFetchGit ? ` | ||
| repo = builtins.fetchGit { | ||
| url = "${url}"; | ||
| ref = "${branch}"; | ||
| rev = "${rev}"; | ||
| }; | ||
| ` : ` | ||
| repo = fetchgit { | ||
| url = "${url}"; | ||
| rev = "${rev}"; | ||
| sha256 = "${prefetchgit(url, rev)}"; | ||
| }; | ||
| `}in | ||
| runCommandNoCC "${fileName}" { buildInputs = [gnutar]; } '' | ||
| # Set u+w because tar-fs can't unpack archives with read-only dirs | ||
| # https://github.com/mafintosh/tar-fs/issues/79 | ||
| tar cf $out --mode u+w -C \${repo} . | ||
| ''; | ||
| }` | ||
| } | ||
|
|
||
| function fetchLockedDep(builtinFetchGit) { | ||
| return function (pkg) { | ||
| const { nameWithVersion, resolved } = pkg | ||
|
|
||
| if (!resolved) { | ||
| console.error( | ||
| `yarn2nix: can't find "resolved" field for package ${nameWithVersion}, you probably required it using "file:...", this feature is not supported, ignoring`, | ||
| ) | ||
| return '' | ||
| } | ||
|
|
||
| const [url, sha1OrRev] = resolved.split('#') | ||
|
|
||
| const fileName = urlToName(url) | ||
|
|
||
| if (url.startsWith('git+')) { | ||
| const rev = sha1OrRev | ||
|
|
||
| const [_, branch] = nameWithVersion.split('#') | ||
|
|
||
| const urlForGit = url.replace(/^git\+/, '') | ||
|
|
||
| return fetchgit(fileName, urlForGit, rev, branch || 'master', builtinFetchGit) | ||
| } | ||
|
|
||
| const sha = sha1OrRev | ||
|
|
||
| return ` { | ||
| name = "${fileName}"; | ||
| path = fetchurl { | ||
| name = "${fileName}"; | ||
| url = "${url}"; | ||
| sha1 = "${sha}"; | ||
| }; | ||
| }` | ||
| } | ||
| } | ||
|
|
||
| const HEAD = ` | ||
| { fetchurl, fetchgit, linkFarm, runCommandNoCC, gnutar }: rec { | ||
| offline_cache = linkFarm "offline" packages; | ||
| packages = [ | ||
| `.trim() | ||
|
|
||
| // Object -> String | ||
| function generateNix(pkgs, builtinFetchGit) { | ||
| const nameWithVersionAndPackageNix = R.map(fetchLockedDep(builtinFetchGit), pkgs) | ||
|
|
||
| const packagesDefinition = R.join( | ||
| '\n', | ||
| R.values(nameWithVersionAndPackageNix), | ||
| ) | ||
|
|
||
| return R.join('\n', [HEAD, packagesDefinition, ' ];', '}']) | ||
| } | ||
|
|
||
| module.exports = generateNix |
| @@ -0,0 +1,21 @@ | ||
| const _curry2 = require('ramda/src/internal/_curry2') | ||
| const _map = require('ramda/src/internal/_map') | ||
| const keys = require('ramda/src/keys') | ||
|
|
||
| // mapObjIndexed: ((v, k, {k: v}) → v') → {k: v} → {k: v'} | ||
| // mapObjIndexedReturnArray: ((v, k, {k: v}) → v') → {k: v} → [v'] | ||
|
|
||
| /* | ||
| * @example | ||
| * | ||
| * const xyz = { x: 1, y: 2, z: 3 }; | ||
| * const prependKeyAndDouble = (num, key, obj) => key + (num * 2); | ||
| * | ||
| * mapObjIndexedReturnArray(prependKeyAndDouble, xyz); //=> ['x2', 'y4', 'z6'] | ||
| */ | ||
|
|
||
| const mapObjIndexedReturnArray = _curry2((fn, obj) => | ||
| _map(key => fn(obj[key], key, obj), keys(obj)), | ||
| ) | ||
|
|
||
| module.exports = mapObjIndexedReturnArray |
| @@ -0,0 +1,21 @@ | ||
| const path = require('path') | ||
|
|
||
| // String -> String | ||
|
|
||
| // @url examples: | ||
| // - https://registry.yarnpkg.com/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz | ||
| // - https://registry.npmjs.org/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz | ||
| // - git+https://github.com/srghma/node-shell-quote.git | ||
| // - git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git | ||
|
|
||
| function urlToName(url) { | ||
| if (url.startsWith('git+')) { | ||
| return path.basename(url) | ||
| } | ||
|
|
||
| return url | ||
| .replace('https://registry.yarnpkg.com/', '') // prevents having long directory names | ||
| .replace(/[@/:-]/g, '_') // replace @ and : and - characters with underscore | ||
| } | ||
|
|
||
| module.exports = urlToName |
| @@ -0,0 +1,30 @@ | ||
| expectFilePresent () { | ||
| if [ -f "$1" ]; then | ||
| echo "Test passed: file is present - $1" | ||
| else | ||
| echo "Test failed: file is absent - $1" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| expectFileOrDirAbsent () { | ||
| if [ ! -e "$1" ]; | ||
| then | ||
| echo "Test passed: file or dir is absent - $1" | ||
| else | ||
| echo "Test failed: file or dir is present - $1" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| expectEqual () { | ||
| if [ "$1" == "$2" ]; | ||
| then | ||
| echo "Test passed: output is equal to expected_output" | ||
| else | ||
| echo "Test failed: output is not equal to expected_output:" | ||
| echo " output - $1" | ||
| echo " expected_output - $2" | ||
| exit 1 | ||
| fi | ||
| } |
| @@ -0,0 +1,47 @@ | ||
| { | ||
| "name": "yarn2nix", | ||
| "version": "1.0.0", | ||
| "description": "Convert packages.json and yarn.lock into a Nix expression that downloads all the dependencies", | ||
| "main": "index.js", | ||
| "repository": ".", | ||
| "author": "Maarten Hoogendoorn <maarten@moretea.nl>", | ||
| "license": "MIT", | ||
| "scripts": { | ||
| "yarn2nix": "bin/yarn2nix.js", | ||
| "format": "prettier-eslint --write './**/*.{js,jsx,json}'", | ||
| "lint": "eslint ." | ||
| }, | ||
| "bin": { | ||
| "yarn2nix": "bin/yarn2nix.js" | ||
| }, | ||
| "engines" : { | ||
| "node" : ">=8.0.0" | ||
| }, | ||
| "dependencies": { | ||
| "@yarnpkg/lockfile": "^1.1.0", | ||
| "deep-equal": "^1.0.1", | ||
| "docopt": "^0.6.2", | ||
| "ramda": "^0.26.1" | ||
| }, | ||
| "devDependencies": { | ||
| "babel-eslint": "^10.0.1", | ||
| "eslint": "^5.11.1", | ||
| "eslint-config-airbnb": "^17.1.0", | ||
| "eslint-config-prettier": "^3.3.0", | ||
| "eslint-config-standard": "^12.0.0", | ||
| "eslint-plugin-import": "^2.14.0", | ||
| "eslint-plugin-jsx-a11y": "^6.1.2", | ||
| "eslint-plugin-node": "^8.0.0", | ||
| "eslint-plugin-promise": "^4.0.1", | ||
| "eslint-plugin-react": "^7.12.2", | ||
| "eslint-plugin-standard": "^4.0.0", | ||
| "husky": "^1.3.1", | ||
| "lint-staged": "^8.1.0", | ||
| "prettier-eslint-cli": "^4.7.1" | ||
| }, | ||
| "husky": { | ||
| "hooks": { | ||
| "pre-commit": "lint-staged" | ||
| } | ||
| } | ||
| } |
| @@ -97,7 +97,7 @@ in stdenv.mkDerivation rec { | ||
|
|
||
| enableParallelBuilding = true; | ||
|
|
||
| preFixup = stdenv.lib.optionalString qtMode '' | ||
| wrapQtApp "$out/games/nethack" | ||
| ''; | ||
|
|
||
| @@ -8,8 +8,8 @@ in | ||
| mktplcRef = { | ||
| name = "vscode-wakatime"; | ||
| publisher = "WakaTime"; | ||
| version = "2.2.0"; | ||
| sha256 = "0mwn72cp8rd9zc527k9l08iyap1wyqzpvzbj8142fa7nsy64jd04"; | ||
| }; | ||
|
|
||
| postPatch = '' | ||
| @@ -1,34 +1,21 @@ | ||
| { substituteAll, lib | ||
| , coreutils, getopt | ||
| }: | ||
|
|
||
| substituteAll { | ||
| name = "lsb_release"; | ||
|
|
||
| src = ./lsb_release.sh; | ||
|
|
||
| dir = "bin"; | ||
| isExecutable = true; | ||
|
|
||
| inherit coreutils getopt; | ||
|
|
||
| meta = with lib; { | ||
| description = "Prints certain LSB (Linux Standard Base) and Distribution information"; | ||
| license = [ licenses.mit ]; | ||
| maintainers = with maintainers; [ primeos ]; | ||
| platforms = platforms.linux; | ||
| }; | ||
| } |
| @@ -0,0 +1,190 @@ | ||
| #! @shell@ | ||
|
|
||
| set -o errexit | ||
| set -o nounset | ||
|
|
||
| show_help() { | ||
| @coreutils@/bin/cat << EOF | ||
| Usage: lsb_release [options] | ||
| Options: | ||
| -h, --help show this help message and exit | ||
| -v, --version show LSB modules this system supports | ||
| -i, --id show distributor ID | ||
| -d, --description show description of this distribution | ||
| -r, --release show release number of this distribution | ||
| -c, --codename show code name of this distribution | ||
| -a, --all show all of the above information | ||
| -s, --short show requested information in short format | ||
| EOF | ||
| exit 0 | ||
| } | ||
|
|
||
| # Potential command-line options. | ||
| version=0 | ||
| id=0 | ||
| description=0 | ||
| release=0 | ||
| codename=0 | ||
| all=0 | ||
| short=0 | ||
|
|
||
| @getopt@/bin/getopt --test > /dev/null && rc=$? || rc=$? | ||
| if [[ $rc -ne 4 ]]; then | ||
| # This shouldn't happen. | ||
| echo "Warning: Enhanced getopt not supported, please open an issue." >&2 | ||
| else | ||
| # Define all short and long options. | ||
| SHORT=hvidrcas | ||
| LONG=help,version,id,description,release,codename,all,short | ||
|
|
||
| # Parse all options. | ||
| PARSED=`@getopt@/bin/getopt --options $SHORT --longoptions $LONG --name "$0" -- "$@"` | ||
|
|
||
| eval set -- "$PARSED" | ||
| fi | ||
|
|
||
|
|
||
| # Process each argument, and set the appropriate flag if we recognize it. | ||
| while [[ $# -ge 1 ]]; do | ||
| case "$1" in | ||
| -v|--version) | ||
| version=1 | ||
| ;; | ||
| -i|--id) | ||
| id=1 | ||
| ;; | ||
| -d|--description) | ||
| description=1 | ||
| ;; | ||
| -r|--release) | ||
| release=1 | ||
| ;; | ||
| -c|--codename) | ||
| codename=1 | ||
| ;; | ||
| -a|--all) | ||
| all=1 | ||
| ;; | ||
| -s|--short) | ||
| short=1 | ||
| ;; | ||
| -h|--help) | ||
| show_help | ||
| ;; | ||
| --) | ||
| shift | ||
| break | ||
| ;; | ||
| *) | ||
| echo "lsb_release: unrecognized option '$1'" | ||
| echo "Type 'lsb_release -h' for a list of available options." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| # Read our variables. | ||
| if [[ -e /etc/os-release ]]; then | ||
| . /etc/os-release | ||
| OS_RELEASE_FOUND=1 | ||
| else | ||
| # This is e.g. relevant for the Nix build sandbox and compatible with the | ||
| # original lsb_release binary: | ||
| OS_RELEASE_FOUND=0 | ||
| NAME="n/a" | ||
| PRETTY_NAME="(none)" | ||
| VERSION_ID="n/a" | ||
| VERSION_CODENAME="n/a" | ||
| fi | ||
|
|
||
| # Default output | ||
| if [[ "$version" = "0" ]] && [[ "$id" = "0" ]] && \ | ||
| [[ "$description" = "0" ]] && [[ "$release" = "0" ]] && \ | ||
| [[ "$codename" = "0" ]] && [[ "$all" = "0" ]]; then | ||
| if [[ "$OS_RELEASE_FOUND" = "1" ]]; then | ||
| echo "No LSB modules are available." >&2 | ||
| else | ||
| if [[ "$short" = "0" ]]; then | ||
| printf "LSB Version:\tn/a\n" | ||
| else | ||
| printf "n/a\n" | ||
| fi | ||
| fi | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Now output the data - The order of these was chosen to match | ||
| # what the original lsb_release used. | ||
|
|
||
| SHORT_OUTPUT="" | ||
| append_short_output() { | ||
| if [[ "$1" = "n/a" ]]; then | ||
| SHORT_OUTPUT+=" $1" | ||
| else | ||
| SHORT_OUTPUT+=" \"$1\"" | ||
| fi | ||
| } | ||
|
|
||
| if [[ "$all" = "1" ]] || [[ "$version" = "1" ]]; then | ||
| if [[ "$OS_RELEASE_FOUND" = "1" ]]; then | ||
| if [[ "$short" = "0" ]]; then | ||
| echo "No LSB modules are available." >&2 | ||
| else | ||
| append_short_output "n/a" | ||
| fi | ||
| else | ||
| if [[ "$short" = "0" ]]; then | ||
| printf "LSB Version:\tn/a\n" | ||
| else | ||
| append_short_output "n/a" | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| if [[ "$all" = "1" ]] || [[ "$id" = "1" ]]; then | ||
| if [[ "$short" = "0" ]]; then | ||
| printf "Distributor ID:\t$NAME\n" | ||
| else | ||
| append_short_output "$NAME" | ||
| fi | ||
| fi | ||
|
|
||
| if [[ "$all" = "1" ]] || [[ "$description" = "1" ]]; then | ||
| if [[ "$short" = "0" ]]; then | ||
| printf "Description:\t$PRETTY_NAME\n" | ||
| else | ||
| append_short_output "$PRETTY_NAME" | ||
| fi | ||
| fi | ||
|
|
||
| if [[ "$all" = "1" ]] || [[ "$release" = "1" ]]; then | ||
| if [[ "$short" = "0" ]]; then | ||
| printf "Release:\t$VERSION_ID\n" | ||
| else | ||
| append_short_output "$VERSION_ID" | ||
| fi | ||
| fi | ||
|
|
||
| if [[ "$all" = "1" ]] || [[ "$codename" = "1" ]]; then | ||
| if [[ "$short" = "0" ]]; then | ||
| printf "Codename:\t$VERSION_CODENAME\n" | ||
| else | ||
| append_short_output "$VERSION_CODENAME" | ||
| fi | ||
| fi | ||
|
|
||
| if [[ "$short" = "1" ]]; then | ||
| # Output in one line without the first space: | ||
| echo "${SHORT_OUTPUT:1}" | ||
| fi | ||
|
|
||
| # For compatibility with the original lsb_release: | ||
| if [[ "$OS_RELEASE_FOUND" = "0" ]]; then | ||
| if [[ "$all" = "1" ]] || [[ "$id" = "1" ]] || \ | ||
| [[ "$description" = "1" ]] || [[ "$release" = "1" ]] || \ | ||
| [[ "$codename" = "1" ]]; then | ||
| exit 3 | ||
| fi | ||
| fi |
| @@ -0,0 +1,211 @@ | ||
| { | ||
| "name": "CodiMD", | ||
| "version": "1.4.0", | ||
| "description": "Realtime collaborative markdown notes on all platforms.", | ||
| "main": "app.js", | ||
| "license": "AGPL-3.0", | ||
| "scripts": { | ||
| "test": "npm run-script eslint && npm run-script jsonlint && npm run-script mocha-suite", | ||
| "eslint": "node_modules/.bin/eslint lib public test app.js", | ||
| "jsonlint": "find . -not -path './node_modules/*' -type f -name '*.json' -o -type f -name '*.json.example' | while read json; do echo $json ; jq . $json; done", | ||
| "mocha-suite": "NODE_ENV=test CMD_DB_URL=\"sqlite::memory:\" mocha --exit", | ||
| "standard": "echo 'standard is no longer being used, use `npm run eslint` instead!' && exit 1", | ||
| "dev": "webpack --config webpack.dev.js --progress --colors --watch", | ||
| "heroku-prebuild": "bin/heroku", | ||
| "build": "webpack --config webpack.prod.js --progress --colors --bail", | ||
| "start": "sequelize db:migrate && node app.js" | ||
| }, | ||
| "dependencies": { | ||
| "@passport-next/passport-openid": "^1.0.0", | ||
| "Idle.Js": "git+https://github.com/shawnmclean/Idle.js", | ||
| "archiver": "^2.1.1", | ||
| "async": "^2.1.4", | ||
| "aws-sdk": "^2.345.0", | ||
| "azure-storage": "^2.7.0", | ||
| "base64url": "^3.0.0", | ||
| "body-parser": "^1.15.2", | ||
| "bootstrap": "^3.4.0", | ||
| "bootstrap-validator": "^0.11.8", | ||
| "chance": "^1.0.4", | ||
| "cheerio": "^0.22.0", | ||
| "codemirror": "git+https://github.com/hackmdio/CodeMirror.git", | ||
| "compression": "^1.6.2", | ||
| "connect-flash": "^0.1.1", | ||
| "connect-session-sequelize": "^4.1.0", | ||
| "cookie": "0.3.1", | ||
| "cookie-parser": "1.4.3", | ||
| "deep-freeze": "^0.0.1", | ||
| "diff-match-patch": "git+https://github.com/hackmdio/diff-match-patch.git", | ||
| "ejs": "^2.5.5", | ||
| "emojify.js": "~1.1.0", | ||
| "escape-html": "^1.0.3", | ||
| "express": ">=4.14", | ||
| "express-session": "^1.14.2", | ||
| "file-saver": "^1.3.3", | ||
| "flowchart.js": "^1.6.4", | ||
| "fork-awesome": "^1.1.3", | ||
| "formidable": "^1.0.17", | ||
| "gist-embed": "~2.6.0", | ||
| "graceful-fs": "^4.1.11", | ||
| "handlebars": "^4.1.2", | ||
| "helmet": "^3.13.0", | ||
| "highlight.js": "~9.12.0", | ||
| "i18n": "^0.8.3", | ||
| "imgur": "git+https://github.com/hackmdio/node-imgur.git", | ||
| "ionicons": "~2.0.1", | ||
| "jquery": "^3.4.1", | ||
| "jquery-mousewheel": "^3.1.13", | ||
| "jquery-ui": "^1.12.1", | ||
| "js-cookie": "^2.1.3", | ||
| "js-sequence-diagrams": "git+https://github.com/codimd/js-sequence-diagrams.git", | ||
| "js-yaml": "^3.13.1", | ||
| "jsdom-nogyp": "^0.8.3", | ||
| "keymaster": "^1.6.2", | ||
| "list.js": "^1.5.0", | ||
| "lodash": "^4.17.11", | ||
| "lutim": "^1.0.2", | ||
| "lz-string": "git+https://github.com/hackmdio/lz-string.git", | ||
| "markdown-it": "^8.2.2", | ||
| "markdown-it-abbr": "^1.0.4", | ||
| "markdown-it-container": "^2.0.0", | ||
| "markdown-it-deflist": "^2.0.1", | ||
| "markdown-it-emoji": "^1.3.0", | ||
| "markdown-it-footnote": "^3.0.1", | ||
| "markdown-it-imsize": "^2.0.1", | ||
| "markdown-it-ins": "^2.0.0", | ||
| "markdown-it-mark": "^2.0.0", | ||
| "markdown-it-mathjax": "^2.0.0", | ||
| "markdown-it-regexp": "^0.4.0", | ||
| "markdown-it-sub": "^1.0.0", | ||
| "markdown-it-sup": "^1.0.0", | ||
| "markdown-pdf": "^9.0.0", | ||
| "mathjax": "~2.7.0", | ||
| "mattermost": "^3.4.0", | ||
| "mermaid": "~7.1.0", | ||
| "meta-marked": "git+https://github.com/codimd/meta-marked#semver:^0.4.2", | ||
| "method-override": "^2.3.7", | ||
| "minimist": "^1.2.0", | ||
| "minio": "^6.0.0", | ||
| "moment": "^2.17.1", | ||
| "morgan": "^1.7.0", | ||
| "mysql": "^2.12.0", | ||
| "passport": "^0.4.0", | ||
| "passport-dropbox-oauth2": "^1.1.0", | ||
| "passport-facebook": "^2.1.1", | ||
| "passport-github": "^1.1.0", | ||
| "passport-gitlab2": "^4.0.0", | ||
| "passport-google-oauth20": "^1.0.0", | ||
| "passport-ldapauth": "^2.0.0", | ||
| "passport-local": "^1.0.0", | ||
| "passport-oauth2": "^1.4.0", | ||
| "passport-saml": "^1.0.0", | ||
| "passport-twitter": "^1.0.4", | ||
| "passport.socketio": "^3.7.0", | ||
| "pdfobject": "^2.0.201604172", | ||
| "pg": "^6.1.2", | ||
| "pg-hstore": "^2.3.2", | ||
| "prismjs": "^1.6.0", | ||
| "randomcolor": "^0.5.3", | ||
| "raphael": "git+https://github.com/dmitrybaranovskiy/raphael", | ||
| "readline-sync": "^1.4.7", | ||
| "request": "^2.88.0", | ||
| "reveal.js": "~3.7.0", | ||
| "scrypt-async": "^2.0.1", | ||
| "scrypt-kdf": "^2.0.1", | ||
| "select2": "^3.5.2-browserify", | ||
| "sequelize": "^3.28.0", | ||
| "sequelize-cli": "^2.5.1", | ||
| "shortid": "2.2.8", | ||
| "socket.io": "~2.1.1", | ||
| "socket.io-client": "~2.1.1", | ||
| "spin.js": "^2.3.2", | ||
| "sqlite3": "^4.0.7", | ||
| "store": "^2.0.12", | ||
| "string": "^3.3.3", | ||
| "tedious": "^1.14.0", | ||
| "toobusy-js": "^0.5.1", | ||
| "turndown": "^5.0.1", | ||
| "uuid": "^3.1.0", | ||
| "validator": "^10.4.0", | ||
| "velocity-animate": "^1.4.0", | ||
| "visibilityjs": "^1.2.4", | ||
| "viz.js": "^1.7.0", | ||
| "winston": "^3.1.0", | ||
| "ws": "^6.0.0", | ||
| "wurl": "^2.5.3", | ||
| "xss": "^1.0.3" | ||
| }, | ||
| "resolutions": { | ||
| "**/tough-cookie": "~2.4.0", | ||
| "**/minimatch": "^3.0.2", | ||
| "**/request": "^2.88.0" | ||
| }, | ||
| "engines": { | ||
| "node": ">=8.x" | ||
| }, | ||
| "bugs": "https://github.com/codimd/server/issues", | ||
| "keywords": [ | ||
| "Collaborative", | ||
| "Markdown", | ||
| "Notes" | ||
| ], | ||
| "homepage": "https://codimd.org", | ||
| "maintainers": [ | ||
| { | ||
| "name": "Claudius Coenen", | ||
| "url": "https://www.claudiuscoenen.de/" | ||
| }, | ||
| { | ||
| "name": "Christoph (Sheogorath) Kern", | ||
| "email": "codimd@sheogorath.shivering-isles.com", | ||
| "url": "https://shivering-isles.com" | ||
| } | ||
| ], | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/codimd/server.git" | ||
| }, | ||
| "devDependencies": { | ||
| "babel-cli": "^6.26.0", | ||
| "babel-core": "^6.26.3", | ||
| "babel-loader": "^7.1.4", | ||
| "babel-plugin-transform-runtime": "^6.23.0", | ||
| "babel-polyfill": "^6.26.0", | ||
| "babel-preset-env": "^1.7.0", | ||
| "babel-runtime": "^6.26.0", | ||
| "copy-webpack-plugin": "^4.5.2", | ||
| "css-loader": "^1.0.0", | ||
| "ejs-loader": "^0.3.1", | ||
| "eslint": "^5.9.0", | ||
| "eslint-config-standard": "^12.0.0", | ||
| "eslint-plugin-import": "^2.14.0", | ||
| "eslint-plugin-node": "^8.0.0", | ||
| "eslint-plugin-promise": "^4.0.1", | ||
| "eslint-plugin-standard": "^4.0.0", | ||
| "exports-loader": "^0.7.0", | ||
| "expose-loader": "^0.7.5", | ||
| "file-loader": "^2.0.0", | ||
| "html-webpack-plugin": "4.0.0-beta.2", | ||
| "imports-loader": "^0.8.0", | ||
| "jsonlint": "^1.6.2", | ||
| "less": "^2.7.1", | ||
| "less-loader": "^4.1.0", | ||
| "mini-css-extract-plugin": "^0.4.1", | ||
| "mocha": "^5.2.0", | ||
| "mock-require": "^3.0.3", | ||
| "optimize-css-assets-webpack-plugin": "^5.0.0", | ||
| "script-loader": "^0.7.2", | ||
| "string-loader": "^0.0.1", | ||
| "style-loader": "^0.21.0", | ||
| "uglifyjs-webpack-plugin": "^1.2.7", | ||
| "url-loader": "^1.0.1", | ||
| "webpack": "^4.14.0", | ||
| "webpack-cli": "^3.1.0", | ||
| "webpack-merge": "^4.1.4", | ||
| "webpack-parallel-uglify-plugin": "^1.1.0" | ||
| }, | ||
| "optionalDependencies": { | ||
| "bufferutil": "^4.0.0", | ||
| "utf-8-validate": "^5.0.1" | ||
| } | ||
| } |