-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJustfile
161 lines (142 loc) · 4.63 KB
/
Justfile
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
set dotenv-load := true
build:
#!/usr/bin/env bash
set -euxo pipefail
cd cmd
go mod tidy
go build
mv cmd ../ortfodb
install:
just build
cp ortfodb ~/.local/bin/ortfodb
chmod +x ~/.local/bin/ortfodb
install-windows:
cd cmd; \
go mod tidy; \
go build; \
mv cmd.exe ~/go/bin/ortfodb.exe
docs:
mkdir -p docs/commands manpages
./ortfodb makedocs docs/commands manpages
cp CHANGELOG.md docs/changelog.md
render-demo-gif:
#!/usr/bin/env bash
set -euxo pipefail
cd ~/projects/portfolio
just db
jq 'delpaths([[".ortfo", ".centraverse", ".onset"]])' < database.json | sponge database.json
vhs ~/projects/ortfo/db/demo.tape -o ~/projects/ortfo/db/demo.gif
update-completions:
#!/usr/bin/env bash
set -euxo pipefail
just build
mkdir -p completions
for shell in fish bash zsh; do
./ortfodb completion $shell > completions/ortfodb.$shell
done
prepare-release $VERSION:
./tools/update_meta_go.py $VERSION
just update-completions
# only build & create archives, publishing & packaging is done later.
# i can't use goreleaser --prepare because i don't have like 15 fking dollars to spend each month on developer tooling lmao
goreleaser release --skip validate --clean \
--skip announce \
--skip aur \
--skip chocolatey \
--skip docker \
--skip homebrew \
--skip ko \
--skip nfpm \
--skip nix \
--skip publish \
--skip sbom \
--skip scoop \
--skip sign \
--skip snapcraft \
--skip winget
just build
just docs
./tools/generate_schemas.py
./tools/build_readme.py
just build-client-libraries $VERSION
release name='${version}':
release-it --github.releaseName={{quote(name)}}
publish version:
just publish-client-libraries
just package {{ version }}
publish-client-libraries:
cd packages/python; poetry publish
cd packages/typescript; npm publish
cd packages/rust; cargo publish
cd packages/ruby; gem push ortfodb-*.gem; rm ortfodb-*.gem
# TODO: PHP. Packagist wants the repo all to itself, so I have to create a new repo, copy the code in it; etc.
# TODO: crystal. Same problem as with Packagist.
package version flags='':
just build
goreleaser release --skip validate --clean {{flags}}
curl -F package=@dist/ortfodb_{{version}}_linux_amd64.deb https://[email protected]/ortfo/
curl -F package=@dist/ortfodb_{{version}}_linux_amd64.rpm https://[email protected]/ortfo/
build-client-libraries version:
just build-typescript {{version}}
just build-python {{version}}
just build-rust {{version}}
just build-ruby {{version}}
just build-php {{version}}
just build-crystal {{version}}
build-crystal version:
#!/usr/bin/env bash
set -euxo pipefail
for schema in schemas/*.schema.json; do
outfile=packages/crystal/src/$(basename $schema .schema.json).cr
quicktype --src-lang schema -l crystal $schema -o $outfile
sed -i 's/require "json"/require "json"\n\nmodule Ortfodb/g' $outfile
echo 'end' >> $outfile
done
build-php version:
#!/usr/bin/env bash
set -euxo pipefail
for schema in schemas/*.schema.json; do
pascal_case=$(basename $schema .schema.json | sed -re 's/(^|-)([a-z])/\U\2/g')
quicktype --src-lang schema -l php $schema -o packages/php/src/$pascal_case.php
sed -i 's/<?php/<?php\n\nnamespace Ortfo\\Db;/g' packages/php/src/$pascal_case.php
done
cd packages/php
composer install
build-ruby version:
#!/usr/bin/env bash
set -euxo pipefail
for schema in schemas/*.schema.json; do
quicktype --src-lang schema -l ruby $schema -o packages/ruby/lib/ortfodb/$(basename $schema .schema.json).rb --namespace Ortfodb
done
cd packages/ruby
printf 'module Ortfodb\n\tVERSION = "%s"\nend\n' {{ version }} > lib/ortfodb/version.rb
gem build ortfodb.gemspec
build-typescript version:
#!/usr/bin/env bash
set -euxo pipefail
for schema in schemas/*.schema.json; do
quicktype --src-lang schema -l typescript-zod $schema -o packages/typescript/src/$(basename $schema .schema.json).ts
done
cd packages/typescript
jq '.version = "{{ version }}"' < package.json | sponge package.json
rm -r dist
npm run build
build-python version:
#!/usr/bin/env bash
set -euxo pipefail
for schema in schemas/*.schema.json; do
quicktype --src-lang schema -l python $schema -o packages/python/ortfodb/$(basename $schema .schema.json).py
done
cd packages/python
poetry version {{ version }}
poetry build
build-rust version:
#!/usr/bin/env bash
set -euxo pipefail
for schema in schemas/*.schema.json; do
quicktype --src-lang schema -l rust --visibility public $schema -o packages/rust/src/$(basename $schema .schema.json).rs
sed -i 's/generated_module/ortfodb/g' packages/rust/src/$(basename $schema .schema.json).rs
done
cd packages/rust
tomlq -ti '.package.version = "{{ version }}"' Cargo.toml
cargo build