Skip to content

Commit

Permalink
build: update make-module script
Browse files Browse the repository at this point in the history
- generate package name initials, use for readme & tests
  • Loading branch information
postspectacular committed Sep 9, 2018
1 parent 890eb97 commit 146868d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/make-module
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ readonly MODULE="packages/$1"
readonly AUTHOR="Karsten Schmidt"
readonly EMAIL="k+npm@thi.ng"

echo "generating module: $MODULE"
IFS='-' read -r -a parts <<< "$1"

for i in "${parts[@]}"; do
INITIAL="$INITIAL${i:0:1}"
done

echo "generating module: $MODULE ($INITIAL)"
mkdir -p $MODULE

echo "creating /src & /test folders..."
Expand All @@ -16,7 +22,7 @@ cp packages/api/LICENSE $MODULE/
echo "writing test skeleton..."
cat << EOF > $MODULE/test/index.ts
// import * as assert from "assert";
// import * as $1 from "../src/index";
// import * as $INITIAL from "../src/index";
describe("$1", () => {
it("tests pending");
Expand Down Expand Up @@ -113,6 +119,7 @@ cat << EOF > $MODULE/README.md
# @thi.ng/$1
[![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/$1.svg)](https://www.npmjs.com/package/@thi.ng/$1)
![npm downloads](https://img.shields.io/npm/dm/@thi.ng/$1.svg)
This project is part of the
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
Expand All @@ -131,10 +138,14 @@ TODO...
yarn add @thi.ng/$1
\`\`\`
## Dependencies
- TODO...
## Usage examples
\`\`\`ts
import * as $1 from "@thi.ng/$1";
import * as $INITIAL from "@thi.ng/$1";
\`\`\`
## Authors
Expand Down

0 comments on commit 146868d

Please sign in to comment.