- Upgrade eslint and fix a massive number (~2500!) of linting errors from new rules.
- Upgrade babel core frontend dev dependency.
- Upgrade UI lib and other frontend deps.
- Refactor the Vue admin app to use `vite` instead of `webpack`.
- This was an extremely tedious and painstaking, trial-and-error
alchemy job. My disdain for the Javascript "ecosystem" grows.
- Re-add custom admin appearance endpoints to the refactored Vue page.
- Remove obsolete vue-cli config.
- Re-auto-format all .vue files again to work with new linters.
When building on a system with enough cores, there is a race condition where
make runs pack-bin before build-frontend is complete.
Running: /usr/bin/gmake -j 60 dist
go install github.com/knadh/stuffbin/...
CGO_ENABLED=0 go build -o listmonk -ldflags="-s -w -X 'main.buildString=v2.0.0 (#05585b7 2021-09-29T08:59:00+0000)' -X 'main.versionString=v2.0.0'" cmd/*.go
cd frontend && /data/omnios-build/omniosorg/r151038/_extra/listmonk-2.0.0/listmonk-2.0.0/listmonk/_deps/node_modules/yarn/bin/yarn install
yarn install v1.22.11
[1/4] Resolving packages...
[2/4] Fetching packages...
/data/omnios-build/omniosorg/r151038/_extra/listmonk-2.0.0/listmonk-2.0.0/listmonk/_deps/bin/stuffbin -a stuff -in listmonk -out listmonk config.toml.sample schema.sql queries.sql static/public:/public static/email-templates frontend/dist:/admin i18n:/i18n
stuffing failed: stat frontend/dist: no such file or directory
gmake: *** [Makefile:76: pack-bin] Error 1
gmake: *** Waiting for unfinished jobs....
non-GNU systems like FreeBSD and illumos do not understand the long
"--no-create" flag to touch. POSIX defines that conforming implementations
must understand "-c" for this, so use the flag that is widely understood
(including by GNU touch).
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html
- Namespace all admin UI URLs behind `/admin/*`.
This breaks the current admin UI URLs.
- Make Vue output build assets to `frontend/dist/*` instead of
`frontend/dist/frontend`.
- Namespace Vue static assets to `/admin/static/*`.
This commit reduces the cofusing and convoluted Vue+WebPack build URI
and static path schemes. In addition, it removes ambiguity in URLs
where non-UI URLs like `/public`, `/api`, `/webhooks` etc. were in the
same name space as UI URLs like `/campaigns`, `/lists` etc. Now all UI
URLs are behind `/admin/`, also simplifying security rules for proxies.
Ref: https://github.com/knadh/listmonk/issues/409
- Introduce `main.appDir` and `main.fronendDir` Go compile-time flags
to hardcode custom paths for loading frontend assets
(frontend/dist/frontend in the repo after build) and app assets
(queries.sql, schema.sql, config.toml.sample) in environments where
embedding files in the binary is not feasible.
These default to CWD unless explicitly set during compilation.
- Fix the Vue favicon path oddity by copying the icon into the built
frontend dir in the `make-frontend` step.
make allows us to run build targets based on dependencies and will only
execute targets if the dependencies have changed. This drastically
speeds up rebuilds if some targets have already been executed and
are still up to date.
The earlier goreleaser implementation was incorrect where every
build would trigger `make pack-release` with the list of all
cross-platform releases. Fix that to atomically run the packing
once per goreleaser build. In addition, add `make release-dry`
and `make release` for goreleaser.
Git tag version injected via Makefile is incorrect since `git describe`
doesn't consider annotated tags but all the recent releases are lightweight tags.
So instead use `git describe --tags` command which also considers recent lightweight tag.
- A check for new versions on the GitHub releases pages happens
once every 24 hours. When a new version is available, a notice
is displayed on the admin UI.
This is a major breaking change that moves away from having the
entire app configuration in external TOML files to settings being
in the database with a UI to update them dynamically.
The app loads all config into memory (app settings, SMTP conf)
on boot. "Hot" replacing them is complex and it's a fair tradeoff
to instead just restart the application as it is practically
instant.
A new `settings` table stores arbitrary string keys with a JSONB
value field which happens to support arbitrary types. After every
settings update, the app gracefully releases all resources
(HTTP server, DB pool, SMTP pool etc.) and restarts itself,
occupying the same PID. If there are any running campaigns, the
auto-restart doesn't happen and the user is prompted to invoke
it manually with a one-click button once all running campaigns
have been paused.
- antd+react was resulting in extremely clunky and unreadable
spaghetti frontend code (primarily due to how antd is).
- Buefy is lighter by an order of magnitude, has excellent
responsive views (especially tables) and usability.
- Vue's templating produces far more readable template code.
- Fix version injection in build
- Refactor Makefile
- Add --new-config flag to generate sample config
- Add license
- Remove autogenerated frontend README
- Refactor make dist to do end-to-end build
- Refactor build and add goreleaser conf
This is a big commit that involves drastic changes to how static assets
(.sql and template files, the whole frontend bundle) are handled.
listmonk distribution should be a self-contained single binary
distribution, hence all static assets should be bundled. After
evaluating several solutions, srtkkou/zgok seemed like the best bet but
it lacked several fundamental features, namely the ability to fall back
to the local filesystem in the absence of embedded assets (for instance,
in the dev mode). Moreover, there was a lot of room for cleanup.
After a PR went unanswered, github.com/knadh/stuffbin was created. Just
like zgok, this enables arbitrary files and assets to be embedded into a
compiled Go binary that can be read during runtime. These changes
followed:
- Compress and embed all static files into the binary during
the build (Makefile) to make it standalone and distributable
- Refactor static paths (/public/* for public facing assets,
/frontend/* for the frontend app's assets)
- Add 'logo_url' to config
- Remove 'assets_path' from config
- Tweak yarn build to not produce symbol maps and override
the default /static (%PUBLIC_URL%) path to /frontend