Skip to content

Commit

Permalink
Upgrade Commoners. Avoid publishing by connecting to generic JSON RES…
Browse files Browse the repository at this point in the history
…T API
  • Loading branch information
garrettmflynn committed Dec 1, 2024
1 parent cbecfd3 commit 627961a
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 89 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 0 additions & 3 deletions .env

This file was deleted.

17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# commoners-starter-kit
A cross-platform app built using [`commoners`](commoners.dev).
A cross-platform app for testing the [`commoners`](commoners.dev) build tool.

## Overview
This repository is configured to automatically build and distribute the application and its related services when new changes are pushed to `main`.

### Distribution Formats
When new changes are pushed to `main`, this application will automatically be built and distributed in the following formats:
- [x] Web — Progressive Web App (PWA)
- [x] Mac
- [x] Windows
- [x] Linux
- [ ] iOS
- [ ] Android

<!-- The TypeScript service is hosted using [Railway](https://railway.app/), where following considerations apply:
> **Note:** As of November 2023, choosing your [build providers](https://docs.railway.app/deploy/builds#build-providers) is a [Priority Boarding](https://docs.railway.app/reference/priority-boarding) feature, where you'll have to link your Discord account to support this.
1. When registering each service, set the `build` command to something useless (e.g. `node -v`) and run only a single service at a time (e.g. `npm run build -- --service service && npm run launch -- --service service`).
2. For each service, generate a domain in the Networking tab. Paste this into the `commoners.config.ts` file -->
If you'd like to host the services remotely (e.g. on [Railway](https://railway.app/)), please consider the following:
1. You will want to build services using the `commoners build --service tsNode` syntax
2. The build artifacts can be launched using `commoners launch --service tsNode`
3. Paste any generated URLs into the `commoners.config.ts` file in the services `publish.remote` field.
13 changes: 9 additions & 4 deletions commoners.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

// import { defineConfig } from '@commoners/solidarity/config';
const defineConfig = (o) => o

import { UserConfig } from '@commoners/solidarity';
const defineConfig = (o: UserConfig) => o

export default defineConfig({

Expand All @@ -11,10 +13,13 @@ export default defineConfig({
},

services: {
service: {
src:'./src/service/index.ts',
tsNode: {
src:'./src/services/tsNode.ts',
publish: {
remote: 'https://node-production-aa81.up.railway.app/'

// NOTE: Replace with hosted URL
remote: 'https://jsonplaceholder.typicode.com/todos/1'

}
}
}
Expand Down
68 changes: 17 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "commoners-starter-kit",
"version": "0.0.53",
"version": "0.0.54",
"description": "A template Commoners application.",
"private": true,
"license": "MIT",
Expand All @@ -9,21 +9,20 @@
"type": "git",
"url": "https://github.com/neuralinterfaces/commoners-starter-kit.git"
},
"workspaces": [
"src/service"
],
"scripts": {
"start": "commoners --target desktop",
"dev": "commoners",
"build": "commoners build",
"launch": "commoners launch"
"launch": "commoners launch",
"build:service": "commoners build --service tsNode",
"launch:service": "commoners launch --service tsNode"
},
"devDependencies": {
"@capacitor/android": "^5.5.0",
"@capacitor/assets": "^2.0.4",
"@capacitor/cli": "^5.3.0",
"@capacitor/core": "^5.3.0",
"@capacitor/ios": "^5.3.0",
"commoners": "0.0.53"
"commoners": "0.0.54"
}
}
4 changes: 1 addition & 3 deletions src/frontend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ const display = (message: string) => {
messages.scrollTop = messages.scrollHeight;
}

const serviceURL = new URL('connected', SERVICES.service.url)

const status: {
connected: boolean | null
} = {
connected: null
}

const poll = () => {
fetch(serviceURL).then((res) => {
fetch(SERVICES.tsNode.url).then((res) => {

if (res.ok) {
if (!status.connected) display('Application is connected to service')
Expand Down
11 changes: 0 additions & 11 deletions src/service/package.json

This file was deleted.

File renamed without changes.

0 comments on commit 627961a

Please sign in to comment.