-
Notifications
You must be signed in to change notification settings - Fork 79
/
Taskfile
73 lines (61 loc) · 2.59 KB
/
Taskfile
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
#!/bin/bash
PATH="$PWD/node_modules/.bin":$PATH
set -e
build() {
set -x
rm -rf dist
mkdir dist
# https://esbuild.github.io/api/#target
cp -fv src/bin.js dist
cp -fv README.md LICENSE dist
npx pkgroll --target=es2020 --export-condition=node
cat package.json | jq '.main = "./index.cjs"' |
jq '.types = "./index.d.ts"' |
jq '.exports.".".require = "./index.cjs"' |
jq '.exports.".".types = "./index.d.ts"' |
jq '.typesVersions."*".generate = ["./generate.d.ts"]' |
jq '.exports."./generate".require = "./generate.cjs"' |
jq '.exports."./generate".types = "./generate.d.ts"' \
>dist/package.json
set +x
}
compatibilty_check() {
set -x
rm -rf ./@generated && npm run prisma:g && npm run tscheck
echo === Check noAtomicOperations ===
sed -i 's/noAtomicOperations *= false/noAtomicOperations = true/g' prisma/schema.prisma
rm -rf ./@generated && npm run prisma:g && npm run tscheck
sed -i 's/noAtomicOperations *= true/noAtomicOperations = false/g' prisma/schema.prisma
echo === Check combineScalarFilters ===
sed -i 's/combineScalarFilters *= false/combineScalarFilters = true/g' prisma/schema.prisma
rm -rf ./@generated && npm run prisma:g && npm run tscheck
sed -i 's/combineScalarFilters *= true/combineScalarFilters = false/g' prisma/schema.prisma
echo === Switching reExport ===
sed -i 's/reExport *= None/reExport = All/g' prisma/schema.prisma
rm -rf ./@generated && npm run prisma:g && npm run tscheck
sed -i 's/reExport *= All/reExport = None/g' prisma/schema.prisma
echo === Check emitSingle ===
sed -i 's/emitSingle *= false/emitSingle = true/g' prisma/schema.prisma
rm -rf ./@generated && npm run prisma:g
npx tsc --noEmit --skipLibCheck --experimentalDecorators ./@generated/index.ts
npx ts-node ./@generated/index.ts
echo === Check emitCompiled ===
sed -i 's/emitCompiled *= false/emitCompiled = true/g' prisma/schema.prisma
rm -rf ./@generated && npm run prisma:g
node ./@generated/index.js
sed -i 's/emitCompiled *= true/emitCompiled = false/g' prisma/schema.prisma
sed -i 's/emitSingle *= true/emitSingle = false/g' prisma/schema.prisma
echo === Check requireSingleFieldsInWhereUniqueInput ===
sed -i 's/requireSingleFieldsInWhereUniqueInput *= false/requireSingleFieldsInWhereUniqueInput = true/g' prisma/schema.prisma
rm -rf ./@generated && npm run prisma:g && npm run tscheck
sed -i 's/requireSingleFieldsInWhereUniqueInput *= true/requireSingleFieldsInWhereUniqueInput = false/g' prisma/schema.prisma
set +x
}
commit_lint() {
if git-branch-is -q -r "^(master)"; then
commitlint --edit
else
true
fi
}
"$@"