Skip to content

Commit f7d806c

Browse files
committed
chore: adds a new-version script
1 parent 3e70a61 commit f7d806c

File tree

7 files changed

+114
-6
lines changed

7 files changed

+114
-6
lines changed

app-config-cli/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"rootDir": "./src",
55
"outDir": "./dist"
66
},
7-
"include": ["src/**/*"],
7+
"include": ["src"],
88
"exclude": ["node_modules"],
99
"references": [
1010
{ "path": "../app-config" }

app-config-cypress/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"lib": ["dom"],
77
"types": ["node", "cypress"]
88
},
9-
"include": ["src/**/*", "types.d.ts"],
9+
"include": ["src", "types.d.ts"],
1010
"exclude": ["node_modules"],
1111
"references": [
1212
{ "path": "../app-config" }

app-config-inject/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"rootDir": "./src",
55
"outDir": "./dist"
66
},
7-
"include": ["src/**/*"],
7+
"include": ["src"],
88
"exclude": ["node_modules"],
99
"references": [
1010
{ "path": "../app-config" }

app-config-react-native-transformer/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"rootDir": "./src",
55
"outDir": "./dist"
66
},
7-
"include": ["src/**/*"],
7+
"include": ["src"],
88
"exclude": ["node_modules"],
99
"references": [
1010
{ "path": "../app-config" }

app-config-webpack-plugin/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"rootDir": "./src",
55
"outDir": "./dist"
66
},
7-
"include": ["src/**/*"],
7+
"include": ["src"],
88
"exclude": ["node_modules"],
99
"references": [
1010
{ "path": "../app-config" }

app-config/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"outDir": "./dist",
66
"lib": ["dom"]
77
},
8-
"include": ["src/**/*"],
8+
"include": ["src"],
99
"exclude": ["node_modules"]
1010
}

new-package.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
5+
if [ "$#" == "0" ]; then
6+
printf "No package name given\n"
7+
exit 1
8+
fi
9+
10+
echo -n "Description: "
11+
read description
12+
13+
NAME=$1
14+
PACKAGE_NAME=app-config-$NAME
15+
PACKAGE_VERSION=$(jq ".version" ./app-config/package.json)
16+
17+
PACKAGE_JSON='
18+
{
19+
"name": "@app-config/$NAME",
20+
"description": "$description",
21+
"version": "$version",
22+
"license": "MPL-2.0",
23+
"author": {
24+
"name": "Launchcode",
25+
"email": "[email protected]",
26+
"url": "https://lc.dev"
27+
},
28+
"repository": {
29+
"type": "git",
30+
"url": "https://github.com/launchcodedev/app-config.git"
31+
},
32+
"main": "dist/index.js",
33+
"module": "dist/es/index.js",
34+
"types": "dist/index.d.ts",
35+
"files": [
36+
"/dist",
37+
"!*.tsbuildinfo",
38+
"!*.test.*"
39+
],
40+
"scripts": {
41+
"build": "tsc -b",
42+
"build:es": "tsc -b tsconfig.es.json",
43+
"clean": "rm -rf dist *.tsbuildinfo",
44+
"lint": "eslint src",
45+
"fix": "eslint --fix src",
46+
"test": "jest",
47+
"prepublishOnly": "yarn clean && yarn build && yarn build:es"
48+
},
49+
"dependencies": {
50+
},
51+
"peerDependencies": {
52+
"@lcdev/app-config": "2"
53+
},
54+
"devDependencies": {
55+
"@lcdev/app-config": "2"
56+
},
57+
"prettier": "@lcdev/prettier",
58+
"jest": {
59+
"preset": "@lcdev/jest"
60+
}
61+
}
62+
'
63+
64+
TSCONFIG='
65+
{
66+
"extends": "@lcdev/tsconfig",
67+
"compilerOptions": {
68+
"rootDir": "./src",
69+
"outDir": "./dist"
70+
},
71+
"include": ["src"],
72+
"exclude": ["node_modules"],
73+
"references": [
74+
{ "path": "../app-config" }
75+
]
76+
}
77+
'
78+
79+
echo "-- Adding to workspace"
80+
WORKSPACE_PACKAGE_JSON=$(\
81+
jq ".workspaces.packages += [\"app-config-$NAME\"]" package.json
82+
)
83+
echo $WORKSPACE_PACKAGE_JSON > package.json
84+
npx prettier -w ./package.json
85+
86+
echo "-- Creating ./$PACKAGE_NAME"
87+
mkdir -p ./$PACKAGE_NAME
88+
89+
echo " -- Creating ./package.json"
90+
echo "$PACKAGE_JSON" | jq . > $PACKAGE_NAME/package.json
91+
92+
echo " -- Creating ./.eslintrc.js"
93+
cp ./app-config/.eslintrc.js ./$PACKAGE_NAME/.eslintrc.js
94+
95+
echo " -- Creating ./tsconfig.json"
96+
echo "$TSCONFIG" | jq . > $PACKAGE_NAME/tsconfig.json
97+
98+
echo " -- Creating ./tsconfig.es.json"
99+
cp ./app-config/tsconfig.es.json ./$PACKAGE_NAME/tsconfig.es.json
100+
101+
echo " -- Creating ./README.md"
102+
touch ./$PACKAGE_NAME/README.md
103+
104+
echo " -- Creating ./src/index.ts"
105+
mkdir ./$PACKAGE_NAME/src
106+
touch ./$PACKAGE_NAME/src/index.ts
107+
108+
yarn install

0 commit comments

Comments
 (0)