-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
6,430 additions
and
7,855 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.vscode | ||
.DS_Store | ||
|
||
# Global Workspace | ||
.commoners | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,20 @@ | ||
# commoners-starter-kit | ||
A cross-platform app for testing the [`commoners`](commoners.dev) build tool. | ||
A cross-platform app built using [`commoners`](commoners.dev). | ||
|
||
When new changes are pushed to `main`, this application will automatically be built and distributed in the following formats: | ||
## 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 | ||
- [x] Web — Progressive Web App (PWA) | ||
- [x] Mac | ||
- [x] Windows | ||
- [x] Linux | ||
- [ ] iOS | ||
- [ ] Android | ||
|
||
Related services will be hosted using [Railway](https://railway.app/), where following considerations apply: | ||
<!-- 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 dev --service node`) | ||
2. For each service, generate a domain in the Networking tab. Paste this into your `commoners.config.ts` file | ||
|
||
## Running the Application | ||
To run the Python server, you'll need to create a `conda` environment from the `environment.yml` file. | ||
|
||
After this, activate the `commoners-starter-kit` environment (`conda activate commoners-starter-kit`). | ||
|
||
You can then run `npm run dev` to start the development server on your default browser—or `npm start` to begin developing for desktop! | ||
|
||
To populate the UI with an interactive UI for the `python` service (documented with the OpenAPI specification), run `npm run share` (**desktop** only). | ||
|
||
## Current Issues | ||
### Railway Service Deployment | ||
1. Cannot connect to Railway Node server because our WebSocket connection is not secure (http is fine...) | ||
2. Selecting [build providers](https://docs.railway.app/deploy/builds#build-providers) is an premium feature, and our app auto-registers as Node only. So the Railway Python server fails with `Error: spawn python ENOENT` because there is no Python installed. | ||
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 --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,21 @@ | ||
// ------------- PRODUCTION ------------- | ||
import * as bluetoothPlugin from '@commoners/bluetooth' | ||
import * as serialPlugin from '@commoners/serial' | ||
import localServicesPlugin from '@commoners/local-services' | ||
// import { defineConfig } from 'commoners' // NOTE: commoners dependencies are missing in local development... | ||
|
||
// // ------------- DEVELOPMENT ------------- | ||
// import * as bluetoothPlugin from '../commoners/packages/plugins/devices/ble/index.js' | ||
// import * as serialPlugin from '../commoners/packages/plugins/devices/serial/index.js' | ||
// import localServicesPlugin from '../commoners/packages/plugins/local-services/index.js' | ||
// import { defineConfig } from '../commoners/packages/core/index' // NOTE: commoners dependencies are missing in local development... | ||
|
||
// ------------- PACKAGE CHANGES ------------- | ||
// "commoners": "file:../commoners/packages/cli", | ||
|
||
|
||
const defineConfig = (o) => o | ||
// import { defineConfig } from '@commoners/solidarity/config'; | ||
const defineConfig = (o) => o | ||
|
||
export default defineConfig({ | ||
|
||
// icon: './icon.png', | ||
icon: './icon.png', | ||
|
||
electron: { | ||
splash: './splash.html', | ||
window: { | ||
width: 1000 // Adjust default width | ||
} | ||
}, | ||
|
||
|
||
plugins: { | ||
bluetooth: bluetoothPlugin, | ||
serial: serialPlugin, | ||
localServices: localServicesPlugin((ip, env) => { | ||
const isLocalIP = ip === 'localhost' | ||
const hasAuthString = process.env.SHARE_SECRET_KEY === env.SHARE_SECRET_KEY | ||
return hasAuthString || isLocalIP | ||
}), | ||
|
||
selectiveBuilds:{ | ||
isSupported: { | ||
desktop: { | ||
load: true | ||
}, | ||
mobile: { | ||
load: true | ||
}, | ||
web: { | ||
load: false | ||
} | ||
}, | ||
main: () => { | ||
console.log(`desktop build (main)`) | ||
}, | ||
preload: () => { | ||
console.log(commoners.target + ' build (preload)') | ||
}, | ||
render: () => console.log(commoners.target + ' build (render)'), | ||
|
||
} | ||
window: { width: 1000 } | ||
}, | ||
|
||
services: { | ||
|
||
// Packaged with pkg | ||
dynamicNode: { | ||
description: 'A simple Node.js server', | ||
src: './src/services/node/index.js', | ||
publish: 'https://node-production-aa81.up.railway.app/' | ||
}, | ||
|
||
devNode: { | ||
description: 'A development Node.js server', | ||
src: './src/services/node/index.js', | ||
publish: false // NOTE: Must try sending messages and checking | ||
}, | ||
|
||
localNode: { | ||
description: 'A local Node.js server', | ||
src: './src/services/node/index.js', | ||
publish: true | ||
|
||
// { | ||
// // local: true, | ||
// // local: './dist/services/node/index', // NOTE: This actually doesn't change the output location... | ||
// remote: false // Must include to remove auto-built service from remote | ||
// } | ||
}, | ||
|
||
// Packaged with pyinstaller | ||
python: { | ||
description: 'A simple Python server', | ||
src: './src/services/python/main.py', | ||
port: 1111, | ||
service: { | ||
src:'./src/service/index.ts', | ||
publish: { | ||
build: 'python -m PyInstaller --name flask --onedir --clean ./src/services/python/main.py --distpath ./build/python', | ||
remote: 'https://python-production-4f11.up.railway.app', | ||
local: { | ||
src: 'flask', | ||
base: './build/python/flask', // Will be copied | ||
} | ||
remote: 'https://node-production-aa81.up.railway.app/' | ||
} | ||
}, | ||
|
||
remote: 'https://jsonplaceholder.typicode.com', | ||
|
||
dynamic: { | ||
src: 'http://localhost:1111', // Call the python server in development | ||
publish: 'https://jsonplaceholder.typicode.com' | ||
} | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.