Skip to content

Commit

Permalink
feat: 🔖 release 2.0.0 - local settings migration
Browse files Browse the repository at this point in the history
This version introduces the local settings migration - Users will now have to provide their own Mapbox API key.

This is a breaking change, please ensure users are provided with a Mapbox API key
  • Loading branch information
CRBroughton committed Nov 13, 2023
2 parents 9ac55a3 + 78ee7a0 commit bb537a9
Show file tree
Hide file tree
Showing 18 changed files with 1,149 additions and 96 deletions.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ db/pb_data
.env
**/*.exe
**/*.zip
db/forager
db/forager
build
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Forager

## 2.0.0

### Major Changes

- Move environment settings to user account
- Users will
now have to provide thier own Mapbox API keys on account creation (this is a breaking change).
- Users will now have to ensure the appropriate
Pocketbase server URL is set on first launch to
properly communicate with the server.

21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,22 @@ All pinned locations are stored via [Pocketbase](https://github.com/pocketbase/p

## Installation

Regardless of installation method, you will require the following to build Forager:
### Prebuilt Binary Installation

You can install Forager with the provided binaries available on the [releases](https://github.com/CRBroughton/Forager/releases) page.

This binary will provide both the back-end and front-end of the application.

For deployment of the application, see [Pocketbases Going to Production documentation](https://pocketbase.io/docs/going-to-production/).

## Manual Installation

Regardless of manual installation method, you will require the following to build Forager:

- npm
- pnpm
- go 1.20+ (this is version Forager is built against)
- [taskfile](https://taskfile.dev/) - Automates the build process

Forager can then be installed via the following methods:

Expand All @@ -76,11 +87,9 @@ To install Forager using this method, perform the following actions:

- Clone this repository
- `cd` into the repository and run `pnpm i`
- Provide your [Mapbox](https://www.mapbox.com/) key to the `.env` file
- Run `pnpm run go:build` to produce a linux arm64 binary

There are other commands available in the `package.json` to produce various binaries.

- Run `task linux64` to build the linux64 binary; Check out the
taskfile.yml file for various architectures, or to create all, simply
run `task build`.

### Separated installation

Expand Down
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ declare module 'vue' {
ReferenceImage: typeof import('./src/components/ReferenceImage.vue')['default']
ReferenceImages: typeof import('./src/components/ReferenceImages.vue')['default']
ServerHealth: typeof import('./src/components/ServerHealth.vue')['default']
ServerSelector: typeof import('./src/components/ServerSelector.vue')['default']
SettingsMenu: typeof import('./src/views/settings/settingsMenu.vue')['default']
SettingsWrapper: typeof import('./src/views/settings/SettingsWrapper.vue')['default']
SideMenu: typeof import('./src/components/SideMenu.vue')['default']
Expand Down
54 changes: 54 additions & 0 deletions db/migrations/1699719217_mapbox_api_key_users_table.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package migrations

import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
m "github.com/pocketbase/pocketbase/migrations"
"github.com/pocketbase/pocketbase/models/schema"
)

func init() {
m.Register(func(db dbx.Builder) error {
dao := daos.New(db)

collection, err := dao.FindCollectionByNameOrId("users")

if err != nil {
return err
}

collection.Schema.AddField(&schema.SchemaField{
Name: "mapboxAPIKey",
Type: schema.FieldTypeText,
System: false,
})

err = dao.SaveCollection(collection)

if err != nil {
return err
}

return nil
}, func(db dbx.Builder) error {
dao := daos.New(db)

collection, err := dao.FindCollectionByNameOrId("users")

if err != nil {
return err
}

mapboxAPIKeyField := collection.Schema.GetFieldByName("mapboxAPIKey")

collection.Schema.RemoveField(mapboxAPIKeyField.Id)

err = dao.SaveCollection(collection)

if err != nil {
return err
}

return nil
})
}
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "my-vite-template",
"version": "1.2.0",
"name": "forager",
"version": "2.0.0",
"scripts": {
"dev": "vite --host",
"build": "vue-tsc --noEmit && vite build",
"tailwind-config-viewer": "tailwind-config-viewer -o",
"go:build": "npm run build && rm -rf db/dist && mv dist db/ && cd db && go build",
"go:build:mac": "npm run build && rm -rf db/dist && mv dist db/ && cd db && GOOS=darwin GOARCH=amd64 go build -o forager.app",
"go:build:windows": "npm run build && rm -rf db/dist && mv dist db/ && cd db && GOOS=windows GOARCH=amd64 go build -o forager.exe",
"pnpm:check": "pnpm up -L -i",
"type:check": "vue-tsc --noEmit ",
"lint:check": "eslint \"src/*.{vue,ts,js}\"",
"lint:fix": "eslint \"src/*.{vue,ts,js}\" --fix",
"serve": "vite preview",
"pocketbase:serve": "./db/pocketbase serve",
"pocketbase:types": "npx pocketbase-typegen --db ./db/pb_data/data.db --out ./src/pocketbase-types.ts"
"pocketbase:types": "npx pocketbase-typegen --db ./db/pb_data/data.db --out ./src/pocketbase-types.ts",
"changeset": "npx changeset",
"changeset:status": "npx changeset status --verbose",
"changeset:version": "npx changeset version"
},
"dependencies": {
"@vueuse/core": "10.4.1",
Expand All @@ -26,6 +26,7 @@
},
"devDependencies": {
"@antfu/eslint-config": "0.43.0",
"@changesets/cli": "^2.26.2",
"@types/geojson": "^7946.0.10",
"@types/mapbox-gl": "^2.7.14",
"@types/node": "^20.6.2",
Expand Down
Loading

0 comments on commit bb537a9

Please sign in to comment.