--- install scripts ---
### postinstall
./assets/postinstall.sh
--- package/package.json (excerpt) ---
{
"name": "r2g",
"version": "0.2.15",
"description": "Semver-oriented TypeScript library skeleton.",
"main": "dist/index.js",
"bin": {
"r2g": "cli/r2g.sh",
"r2g_symlink": "cli/r2g_symlink.sh",
"r2g_get_project_root": "cli/r2g_get_project_root.js"
},
"types": "dist/index.d.ts",
"typings": "dist/index.d.ts",
"scripts": {
"postinstall": "./assets/postinstall.sh",
"test": "suman test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ORESoftware/r2g.git"
},
"keywords": [
"typescript",
"library",
"skeleton",
"scaffold"
],
"author": "TODO Yo.Mama",
"license": "SEE LICENSE IN LICENSE.md",
"bugs": {
"url": "https://github.com/ORESoftware/r2g/issues"
},
"homepage": "https://github.com/ORESoftware/r2g#readme",
"dependencies": {
"@oresoftware/deep.mixin": "0.0.107",
"@oresoftware/shell": "latest",
"async": "^2.6.1",
"chalk": "^2.4.1",
"clean-trace": "latest",
"dashdash": "^1.14.1",
"json-stdio": "latest",
"prepend-transform": "0.0.1016",
"residence": "latest",
"shortid": "^2.2.8"
},
"devDependencies": {
"@types/async": "^2.0.49",
"@types/node": "^9.6.2",
"@types/shortid": "0.0.29"
},
"r2g": {
"test": "node -e \"const assert = require('assert'); const matrix = require('./.r2g/fixtures/phase-matrix.json'); assert.deepStrictEqual(matrix.phases, ['phase-Z', 'phase-S', 'phase-T']); assert.strictEqual(matrix.phaseCommands.z, 'pa
--- package/cli/exp.js (excerpt) ---
const cp = require('child_process');
const k = cp.spawn('bash');
k.stdin.end(`
( cd . && find . -type f ) | xargs du --threshold=5KB
`);
k.stdout.pipe(process.stdout);
--- package/cli/r2g.sh (excerpt) ---
#!/usr/bin/env bash
if [[ "$r2g_is_running" == "yes" ]]; then
echo "Looks like r2g somehow launched an r2g child process. That is not allowed, exiting with 0.";
exit 0;
fi
export r2g_is_running="yes";
export r2g_gray='\033[1;30m'
export r2g_magenta='\033[1;35m'
export r2g_cyan='\033[1;36m'
export r2g_orange='\033[1;33m'
export r2g_yellow='\033[1;33m'
export r2g_green='\033[1;32m'
export r2g_no_color='\033[0m'
my_args=("$@");
cmd="$1";
shift 1;
project_root="";
if [[ "$(uname -s)" == "Darwin" ]]; then
project_root="$(dirname $(dirname $("$HOME/.oresoftware/bin/realpath" $0)))";
else
project_root="$(dirname $(dirname $(realpath $0)))";
fi
commands="$project_root/dist/commands"
r2g_match_arg(){
# checks to see if the first arg, is among the remaining args
# for example ql_match_arg --json --json # yes
first_item="$1"; shift;
for var in "$@"; do
if [[ "$var" == "$first_item" ]]; then
return 0;
fi
done
return 1;
}
export -f r2g_match_arg;
export FORCE_COLOR=1;
r2g_stdout() {
# REPLY is a build-in, see:
while read; do echo -e "${r2g_gray}r2g:${r2g_no_color} $REPLY"; done
}
r2g_stderr() {
while read; do echo -e "${r2g_magenta}r2g:${r2g_no_color} $REPLY"; done
}
export -f r2g_stdout;
export -f r2g_stderr;
if [[ "$cmd" == "run" ]] || [[ "$cmd" == "test" ]]; then
if [[ -z "$(which rsync)" ]]; then
echo >&2 "You need to install 'rsync' for r2g to work its magic.";
exit 1;
--- package/assets/completion.sh (excerpt) ---
#!/bin/bash
#
# Bash completion generated for 'r2g' at Fri Aug 03 2018 19:00:01 GMT-0700 (Pacific Daylight Time).
#
# The original template lives here:
# https://github.com/trentm/node-dashdash/blob/master/etc/dashdash.bash_completion.in
#
#
# Copyright 2016 Trent Mick
# Copyright 2016 Joyent, Inc.
#
#
# A generic Bash completion driver script.
#
# This is meant to provide a re-usable chunk of Bash to use for
# "etc/bash_completion.d/" files for individual tools. Only the "Configuration"
# section with tool-specific info need differ. Features:
#
# - support for short and long opts
# - support for knowing which options take arguments
# - support for subcommands (e.g. 'git log <TAB>' to show just options for the
# log subcommand)
# - does the right thing with "--" to stop options
# - custom optarg and arg types for custom completions
# - (TODO) support for shells other than Bash (tcsh, zsh, fish?, etc.)
#
#
# Examples/design:
#
# 1. Bash "default" completion. By default Bash's 'complete -o default' is
# enabled. That means when there are no completions (e.g. if no opts match
# the current word), then you'll get Bash's default completion. Most notably
# that means you get filename completion. E.g.:
# $ tool ./<TAB>
# $ tool READ<TAB>
#
# 2. all opts and subcmds:
# $ tool <TAB>
# $ tool -v <TAB> # assuming '-v' doesn't take an arg
# $ tool -<TAB> # matching opts
# $ git lo<TAB> # matching subcmds
#
# Long opt comp{
"name": "r2g",
"version": "0.2.15",
"description": "Semver-oriented TypeScript library skeleton.",
"main": "dist/index.js",
"bin": {
"r2g": "cli/r2g.sh",
"r2g_symlink": "cli/r2g_symlink.sh",
"r2g_get_project_root": "cli/r2g_get_project_root.js"
},
"types": "dist/index.d.ts",
"typings": "dist/index.d.ts",
"scripts": {
"postinstall": "./assets/postinstall.sh",
"test": "suman test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ORESoftware/r2g.git"
},
"keywords": [
"typescript",
"library",
"skeleton",
"scaffold"
],
"author": "TODO Yo.Mama",
"license": "SEE LICENSE IN LICENSE.md",
"bugs": {
"url": "https://github.com/ORESoftware/r2g/issues"
},
"homepage": "https://github.com/ORESoftware/r2g#readme",
"dependencies": {
"@oresoftware/deep.mixin": "0.0.107",
"@oresoftware/shell": "latest",
"async": "^2.6.1",
"chalk": "^2.4.1",
"clean-trace": "latest",
"dashdash": "^1.14.1",
"json-stdio": "latest",
"prepend-transform": "0.0.1016",
"residence": "latest",
"shortid": "^2.2.8"
},
"devDependencies": {
"@types/async": "^2.0.49",
"@types/node": "^9.6.2",
"@types/shortid": "0.0.29"
},
"r2g": {
"test": "node -e \"const assert = require('assert'); const matrix = require('./.r2g/fixtures/phase-matrix.json'); assert.deepStrictEqual(matrix.phases, ['phase-Z', 'phase-S', 'phase-T']); assert.strictEqual(matrix.phaseCommands.z, 'pa