Skip to content

Commit

Permalink
Merge pull request #13 from neuralinterfaces/v0.0.53
Browse files Browse the repository at this point in the history
0.0.53 Release
  • Loading branch information
garrettmflynn authored Nov 30, 2024
2 parents f48442b + e64a99e commit 46c31b5
Show file tree
Hide file tree
Showing 80 changed files with 1,738 additions and 1,201 deletions.
26 changes: 0 additions & 26 deletions .github/auto-assign.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/auto-assign.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Back-end Tests
name: Comprehensive Test Suite
on:
schedule:
- cron: "0 16 * * *" # Daily at noon EST
Expand All @@ -20,7 +20,7 @@ permissions:

jobs:
testing:
name: Back-end tests on ${{ matrix.os }}
name: Run test suite on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
Expand All @@ -30,7 +30,7 @@ jobs:
fail-fast: false
matrix:
os: [
# ubuntu-latest, # NOTE: Ignoring because I can't test locally
ubuntu-latest,
macos-latest,
windows-latest
]
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/vitepress-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ jobs:
run: pnpm install

- name: Build with Vitepress
run: npm run docs:build -- --outDir ./_site
run: pnpm docs:build --outDir ./_site

- name: Build Demo
run: pnpm demo:build --target pwa --outDir ./_site/demo

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ Install all packages by running the following command:
pnpm install
```

Finally, build all packages by running:
```bash
pnpm build
```

### Testing
#### Initial Setup
```bash
Expand All @@ -57,10 +62,19 @@ Always run tests with the `commoners-test-app` environment activated.
conda activate commoners-test-app
```

You must also ensure that `g++` is available to build the C++ server.

Then, simply run the following command:
```bash
pnpm test
```

##### Linux
When running tests on Linux, you'll need to install FUSE for AppImage support:
```
sudo apt-get update && sudo apt-get install -y fuse
```


## Acknowledgements
This project is part of [Neural Interfaces](https://github.com/neuralinterfaces).
43 changes: 31 additions & 12 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,49 @@ export default defineConfig({
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Guide', link: '/guide/getting-started' },
{ text: 'Config', link: '/config/index' },
{ text: 'Plugins', link: '/plugins/index' },
{ text: 'Roadmap', link: '/roadmap/features' },
{ text: 'Guide', link: '/getting-started' },
{ text: 'Plugins', link: '/packages/plugins' }
],

footer: {
message: `Released under the MIT License.`,
copyright: 'Copyright © 2024 Garrett Flynn & Commoners Contributors',
},

sidebar: {
'/guide/': [
sidebar: [
{ text: 'Getting Started', link: '/getting-started' },
{ text: 'Why Commoners', link: '/why/' },
{
text: 'Guide',
items: [
{ text: 'Why Commoners', link: '/guide/why' },
{ text: 'Getting Started', link: '/guide/getting-started' },
{ text: 'Features', link: '/guide/features' },
{ text: 'CLI', link: '/guide/cli' },
{ text: 'Configuration', link: '/guide/config' },
{
text: 'Targets',
items: [
{ text: 'Web', link: '/guide/targets/web' },
{ text: 'Desktop', link: '/guide/targets/desktop' },
{ text: 'Mobile', link: '/guide/targets/mobile' }
]
},
{ text: 'Services', link: '/guide/services' },
{ text: 'Plugins', link: '/guide/plugins' },
{ text: 'Testing', link: '/guide/testing' },
{ text: 'Release', link: '/guide/release' }
]
},
{
text: "Packages",
items: [
{ text: "Plugins", link: "/packages/plugins" },
]
},
{
text: "Reference",
items: [
{ text: 'CLI', link: '/reference/cli' },
]
}
]
},
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/neuralinterfaces/commoners' }
Expand Down
5 changes: 0 additions & 5 deletions docs/config/index.md

This file was deleted.

111 changes: 17 additions & 94 deletions docs/guide/getting-started.md → docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Follow the prompts to select your favorite framework and features.
After running `npm install`, add Commoners as a dependency:

```bash
npm install commoners
npm install -D commoners@0.0.53
```

## Configuring the `package.json` File
Expand All @@ -24,16 +24,15 @@ Then, modify `scripts` in your `package.json` to include the following:
"scripts": {
"start": "commoners --target desktop",
"dev": "commoners",
"build": "commoners build",
"build:desktop": "commoners build --target desktop"
"build": "commoners build"
}
}
```

Now you can run `npm start` to start your application as an Electron desktop application, `npm run dev` to start your application as a web application, and the `npm run build` commands to create different distributions of your application.
Now you have simple commands to start your application as an Electron desktop application (`npm start`), start as a web application (`npm run dev`), and build different distributions of your application (`npm run build`).


## Getting Started
## Creating a Configuration File
`commoners` allows you to customize your application by adding a `commoners.config.js` file to the root of your project. This file can be used to configure your application's services, plugins, and more.

For example, you can add the following to your `commoners.config.js` file to customize your application's name and icon:
Expand All @@ -45,7 +44,7 @@ export default {
}
```

All of the available configuration options are documented in the [Configuration](../config/index.md) documentation.
All of the available configuration options are documented in the [Configuration](./guide/config.md) documentation.

In your built application, you can access Commoners configuration values using the `commoners` object:

Expand Down Expand Up @@ -216,10 +215,11 @@ export default {
// Advanced configuration
tsNode: {
src: './src/services/node.ts',
// url: undefined, // Removed on remote builds (web, mobile)
// url: 'https://ts-node.example.com', // Remote for all builds (web, mobile, desktop)
// url: { remote: 'https://ts-node.example.com' }, // Remote for remote builds (web, mobile). Local for local builds (desktop)
url: { local: 'https://ts-node.example.com' }, // Remote for local builds (desktop). Removed on remote builds (web, mobile)
// publish: false, // Removed on all builds
// publish: 'https://ts-node.example.com', // Remote for all builds
publish: { local: 'https://ts-node.example.com' }, // Remote for local builds (desktop). Removed on remote builds (web, mobile)
// publish: { remote: 'https://ts-node.example.com' }, // Remote for remote builds (web, mobile). Local for local builds (desktop)
// publish: { url: 'https://ts-node.example.com', local: false }, // Remote for remote builds (web, mobile). Removed on local builds (desktop)
}
}
}
Expand All @@ -235,97 +235,20 @@ export default {

python: {
src: './src/services/python.py',
url: { remote: 'https://python.example.com' },
publish: { remote: 'https://python.example.com' },

// The build command
build: 'python -m PyInstaller --name python-service --onedir --clean ./src/services/python.py --distpath ./build/python',

// What to include from the build
publish: {
base: './build/python/python-service', // The base directory to copy
src: 'python-service', // The relative source location in the base directory
remote: 'https://python.example.com',
local: {
base: './build/python/python-service', // The base directory to copy
src: 'python-service', // The relative source location in the base directory
}
}
}
}
}
```

## Testing
Using the `@commoners/testing` package, you can easily write end-to-end tests for your application.

```bash
npm install @commoners/testing
```

Then, add the following to your `package.json`:

```json
{
"scripts": {
"test": "commoners test"
}
}
```

We use `vitest` to run tests—but you can use any testing framework you like.

Here's an example test for a Web + Desktop application:

```js

import { expect, test, describe, beforeAll, afterAll } from 'vitest'
import { open, build } from '../../testing/index'

const ROOT = '../my/app'
const OUTDIR = 'dist'

const registerTests = (prod = false) => {

const OUTPUTS = {}
const opts = { build: { outDir: OUTDIR } }

beforeAll(async () => {
if (prod) OUTPUTS.build = await build(ROOT, opts)
OUTPUTS.app = await open(ROOT, opts, prod)
})

afterAll(async () => Object.values(OUTPUTS).forEach(o => o.cleanup()))

test('should load the app', async () => {
expect(await OUTPUTS.app.page.title()).toBe('Test App')
})

test('should have global variable', async () => {
expect(await OUTPUTS.app.page.evaluate(() => commoners.NAME)).toBe('Test App')
})

}

describe('App runs in development mode', () => registerTests(false))

describe('App runs in production mode', () => registerTests(true))

```

## Release Management
Using GitHub Actions, you can automate the release of your application to GitHub Pages, GitHub Releases, and mobile app stores.

*Demo coming soon...*


## Monorepo Development
Commoners supports monorepo development using [PNPM](https://pnpm.io). To get started, run the following commands:

```bash
corepack enable pnpm && pnpm install
```

This will install all dependencies for the monorepo.

Each application can be managed with the following command syntax:

```bash
commoners ./apps/my-app # Run the application in the specified directory
```

This allows you to manage multiple applications in a single repository, such as separate desktop and mobile applications that share a common core (e.g. services, plugins, frontend components, etc.).
```
5 changes: 5 additions & 0 deletions docs/guide/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Config
Coming soon...

> **Note:** A `commoners.config.[ts|js]` file is required for proper resolution of [Plugins](../guide/plugins), which cannot be used purely with the `@commoners/solidarity` API.
Loading

0 comments on commit 46c31b5

Please sign in to comment.