This repository has been archived by the owner on Oct 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
reset_repo.sh
executable file
·61 lines (48 loc) · 1.86 KB
/
reset_repo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/bash
IFS=''
# Accepts the field name, the current value, and the replacement
substitutePackageFieldVal() {
sed -i -e "/\"$1\"/s/$2/$3/" package.json;
echo "Field \"$1\" set to $3";
}
echo "
------------------------------------------------------------------
Hi $USER. You have cloned a generic JS module boilerplate.
To make this repo yours, I will replace the generic parts
of package.json with project-specific info you provide here.
I will also remove the current .git folder and re-initialise.
------------------------------------------------------------------
"
# Prompt for and edit the "name" field:
name_prompt="
Can I take a name for your project? Note that I'm not going to
validate this: check https://docs.npmjs.com/files/package.json#name
if you're not sure of valid formatting.
> "
read -e -p $name_prompt name
substitutePackageFieldVal "name" "es6-module-starter" $name
# Possibly rename, but this is better at the `git clone` stage
# eg `git clone https://github.com/DanCouper/es6-module-starter.git my-awesome-project`
# mv ../es6-module-starter ../$name
# Prompt for and edit the "description" field:
description_prompt="
Can I take a description of your project? Again, I'm not validating,
so please escape any double quotes.
> "
read -e -p $description_prompt description
substitutePackageFieldVal "description" "Boilerplate starter kit for ES2015\+\/Babel modules\." $description
# Prompt for and edit the "author" field:
author_prompt="
Can I take the name you would use in the 'author' section? You can add
a contact email directly in the form: 'My Name <[email protected]>'
> "
read -e -p $author_prompt author
substitutePackageFieldVal "author" "Daniel Couper \<danielcouper81\@googlemail\.com\>" $author
# Remove keywords
sed -i -e '21,28d' package.json
echo "
I've removed the keywords; add your own in at your leisure.
"
rm -rf .git
git init
exit