Skip to content

Commit ddca030

Browse files
Replace packr with go:embed (#118)
1 parent 6f9384e commit ddca030

File tree

12 files changed

+532
-683
lines changed

12 files changed

+532
-683
lines changed

.dockerignore

-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
1313

14-
# Packr2 artifacts
15-
**/*-packr.go
16-
1714
####
1815
# Visual Studio Code
1916
####
@@ -59,7 +56,6 @@ stash-box
5956
dist
6057

6158
pkg/models/generated_*.go
62-
packrd
6359
# TODO - we'll add this in later
6460
vendor
6561
docker

.github/workflows/build.yml

-5
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ jobs:
9292
if: ${{ github.event_name != 'pull_request' || steps.cache-ui.outputs.cache-hit != 'true' }}
9393
run: make ui-only
9494

95-
- name: Bundle static assets
96-
run: |
97-
go get -u github.com/gobuffalo/packr/v2/[email protected]
98-
make packr
99-
10095
- name: Crosscompile binaries
10196
run: make cross-compile
10297

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
1313

14-
# Packr2 artifacts
15-
**/*-packr.go
16-
1714
####
1815
# Visual Studio Code
1916
####
@@ -61,6 +58,5 @@ dist
6158
stash-box-config.yml
6259

6360
pkg/models/generated_*.go
64-
packrd
6561
# TODO - we'll add this in later
6662
vendor

Makefile

+3-18
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,7 @@ endif
2323
build: pre-build
2424
go build $(OUTPUT) -v -ldflags "-X 'github.com/stashapp/stash-box/pkg/api.version=$(STASH_BOX_VERSION)' -X 'github.com/stashapp/stash-box/pkg/api.buildstamp=$(BUILD_DATE)' -X 'github.com/stashapp/stash-box/pkg/api.githash=$(GITHASH)'"
2525

26-
install:
27-
packr2 install
28-
29-
clean:
30-
packr2 clean
31-
32-
# Regenerates GraphQL files and packr files
26+
# Regenerates GraphQL files
3327
.PHONY: generate
3428
generate:
3529
go generate
@@ -90,19 +84,10 @@ lint: vet staticcheck errcheck
9084
pre-ui:
9185
cd frontend && yarn install --frozen-lockfile
9286

93-
.PHONY: ui ui-only
94-
ui-only:
87+
.PHONY: ui
88+
ui:
9589
cd frontend && yarn build
9690

97-
ui: ui-only
98-
packr2
99-
100-
# just repacks the packr files - use when updating migrations and packed files without
101-
# rebuilding the UI
102-
.PHONY: packr
103-
packr:
104-
packr2
105-
10691
# runs tests and checks on the UI and builds it
10792
.PHONY: ui-validate
10893
ui-validate:

README.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ Join the [Discord server](https://discord.gg/2TsNFKt).
116116

117117
* [Revive](https://github.com/mgechev/revive) - Configurable linter
118118
* Go Install: `go get github.com/mgechev/revive`
119-
* [Packr2](https://github.com/gobuffalo/packr/tree/v2.0.2/v2) - Static asset bundler
120-
* Go Install: `go get github.com/gobuffalo/packr/v2/[email protected]`
121-
* [Binary Download](https://github.com/gobuffalo/packr/releases)
122119
* [Yarn](https://yarnpkg.com/en/docs/install) - Yarn package manager
123120

124121
NOTE: You may need to run the `go get` commands outside the project directory to avoid modifying the projects module file.
@@ -141,8 +138,7 @@ TODO
141138
## Commands
142139

143140
* `make generate` - Generate Go GraphQL files. This should be run if the graphql schema has changed.
144-
* `make ui` - Builds the UI and regenerates the packr2 files.
145-
* `make packr` - Regenerates the packr2 files. Run this if schema migration files have changed and you don't want to rebuild the UI.
141+
* `make ui` - Builds the UI.
146142
* `make build` - Builds the binary
147143
* `make vet` - Run `go vet`
148144
* `make lint` - Run the linter

docker/build/x86_64/Dockerfile

-9
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,7 @@ RUN apt-get update && \
1313
apt-get install -y nodejs yarn xz-utils --no-install-recommends || exit 1; \
1414
rm -rf /var/lib/apt/lists/*;
1515

16-
ENV PACKR2_VERSION=2.0.2
17-
ENV PACKR2_SHA=f95ff4c96d7a28813220df030ad91700b8464fe292ab3e1dc9582305c2a338d2
18-
ENV PACKR2_DOWNLOAD_FILE=packr_${PACKR2_VERSION}_linux_amd64.tar.gz
19-
ENV PACKR2_DOWNLOAD_URL=https://github.com/gobuffalo/packr/releases/download/v${PACKR2_VERSION}/${PACKR2_DOWNLOAD_FILE}
20-
2116
WORKDIR /
22-
RUN wget ${PACKR2_DOWNLOAD_URL}; \
23-
echo "$PACKR2_SHA $PACKR2_DOWNLOAD_FILE" | sha256sum -c - || exit 1; \
24-
tar -xzf $PACKR2_DOWNLOAD_FILE -C /usr/bin/ packr2; \
25-
rm $PACKR2_DOWNLOAD_FILE;
2617

2718
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
2819

go.mod

+5-16
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,20 @@ require (
88
github.com/dgrijalva/jwt-go v3.2.0+incompatible
99
github.com/disintegration/imaging v1.6.2
1010
github.com/go-chi/chi v4.0.2+incompatible
11-
github.com/gobuffalo/envy v1.9.0 // indirect
12-
github.com/gobuffalo/genny v0.2.0 // indirect
13-
github.com/gobuffalo/gogen v0.2.0 // indirect
14-
github.com/gobuffalo/logger v1.0.3 // indirect
15-
github.com/gobuffalo/mapi v1.2.1 // indirect
16-
github.com/gobuffalo/packd v1.0.0 // indirect
17-
github.com/gobuffalo/packr/v2 v2.0.2
18-
github.com/gofrs/uuid v3.2.0+incompatible
19-
github.com/golang-migrate/migrate/v4 v4.9.1
11+
github.com/gofrs/uuid v4.0.0+incompatible
12+
github.com/golang-migrate/migrate/v4 v4.15.0-beta.1
2013
github.com/gorilla/sessions v1.1.3
2114
github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c
2215
github.com/hashicorp/golang-lru v0.5.4 // indirect
23-
github.com/jmoiron/sqlx v1.2.0
24-
github.com/karrick/godirwalk v1.16.1 // indirect
16+
github.com/jmoiron/sqlx v1.3.1
2517
github.com/kisielk/errcheck v1.6.0
26-
github.com/lib/pq v1.3.0
27-
github.com/markbates/oncer v1.0.0 // indirect
18+
github.com/lib/pq v1.10.0
2819
github.com/minio/minio-go/v7 v7.0.7
2920
github.com/mitchellh/mapstructure v1.4.1 // indirect
3021
github.com/pkg/errors v0.9.1
31-
github.com/rogpeppe/go-internal v1.8.0 // indirect
3222
github.com/rs/cors v1.6.0
3323
github.com/sirupsen/logrus v1.8.1
24+
github.com/spf13/afero v1.2.0 // indirect
3425
github.com/spf13/pflag v1.0.5
3526
github.com/spf13/viper v1.7.0
3627
github.com/stretchr/testify v1.7.0 // indirect
@@ -39,8 +30,6 @@ require (
3930
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
4031
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8
4132
golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 // indirect
42-
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect
4333
golang.org/x/tools v0.1.1 // indirect
44-
gopkg.in/yaml.v2 v2.4.0 // indirect
4534
honnef.co/go/tools v0.2.0
4635
)

0 commit comments

Comments
 (0)