-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
93 lines (79 loc) · 2.07 KB
/
bootstrap.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
set -e
yarn init --yes
## add files and scripts to the new package.json
JSONFILE='./package.json'
echo $( jq '.scripts += {
"analyze": "source-map-explorer dist/js/main.*",
"build": "yarn install && node scripts/build.js",
"test": "node scripts/test.js --passWithNoTests",
"new-version-patch": " yarn version --new-version patch",
"new-version": " yarn version"
}' $JSONFILE ) > $JSONFILE
echo $( jq '.files += ["dist/**/*","lib/**/*" ]' $JSONFILE ) > $JSONFILE
echo $( jq '.peerDependencies += {}' $JSONFILE ) > $JSONFILE
echo $( jq '.main += "lib/index.js"' $JSONFILE ) > $JSONFILE
# side effects allows webpack to trim unused deps
echo $( jq ".sideEffects += false" $JSONFILE ) > $JSONFILE
yarn add -D @babel/core \
@babel/plugin-proposal-class-properties \
@babel/plugin-proposal-decorators \
@babel/plugin-syntax-dynamic-import \
@babel/preset-env \
@babel/preset-react \
@babel/preset-typescript \
@types/jest \
@types/node \
@types/webpack \
babel \
babel-core \
babel-jest \
babel-loader \
babel-polyfill \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
eslint \
eslint-webpack-plugin \
eslint-plugin-react \
css-loader \
file-loader \
fs \
fs-extra \
jest \
jest-pnp-resolver \
jest-resolve \
jsdom \
mini-css-extract-plugin \
node-sass \
path \
postcss-flexbugs-fixes \
postcss-loader \
postcss-preset-env \
sass-loader \
terser-webpack-plugin \
ts-loader \
typescript \
webpack
# $confirmation = Read-Host "Add react libs? [y/n]"
# while($confirmation -ne "y" -and $confirmation -ne "n")
# {
# $confirmation = Read-Host "Add react libs? [y/n]"
# }
# if ($confirmation -eq 'y') {
# # add react based libs
# yarn add -D @types/react `
# @types/react-css-modules `
# @types/react-dom
# # add to deps
# yarn add react react-css-modules react-dom
# }
# add git remote
matches = git remote -v | grep -oP '(https|git)([^/]+)/(.+?)\.git'
upstream = "$matches/npm-package-template.git"
git remote add upstream $upstream
echo "Added remote $upstream"
git fetch upstream
# switch to initial branch
git checkout -b v1