Skip to content

Commit bcb94aa

Browse files
Merge pull request #23 from neuralinterfaces/v0.0.65
0.0.65 Release
2 parents f22b758 + 926ca3c commit bcb94aa

File tree

15 files changed

+56
-80
lines changed

15 files changed

+56
-80
lines changed

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Then, navigate to your new project directory and run `npm install` to install th
1818
After running `npm install`, add Commoners as a dependency.
1919

2020
```bash
21-
npm install -D commoners@0.0.64
21+
npm install -D commoners@0.0.65
2222
```
2323

2424
### Scripts

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
"@commoners/bluetooth": "0.0.62",
2121
"@commoners/local-services": "0.0.62",
2222
"@commoners/serial": "0.0.62",
23-
"@commoners/solidarity": "0.0.64",
23+
"@commoners/solidarity": "0.0.65",
2424
"@commoners/splash-screen": "0.0.62",
25-
"@commoners/testing": "0.0.62",
25+
"@commoners/testing": "0.0.65",
2626
"@commoners/windows": "0.0.64",
2727
"@vitest/coverage-v8": "^2.0.3",
2828
"search-insights": "^2.15.0",
29-
"commoners": "0.0.64",
29+
"commoners": "0.0.65",
3030
"vite": "^5.3.4",
3131
"vitepress": "^1.3.1",
3232
"vitest": "^2.0.3"

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "commoners",
33
"description": "Cross-Platform Development for the Rest of Us",
4-
"version": "0.0.64",
4+
"version": "0.0.65",
55
"type": "module",
66
"license": "MIT",
77
"engines": {
@@ -18,7 +18,7 @@
1818
"watch": "vite build --watch"
1919
},
2020
"dependencies": {
21-
"@commoners/solidarity": "0.0.64",
21+
"@commoners/solidarity": "0.0.65",
2222
"cac": "^6.7.14"
2323
},
2424
"devDependencies": {

packages/core/assets/electron/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const ogConsoleMethods: any = {};
120120
const isProduction = !utils.is.dev
121121
const ASSET_ROOT_DIR = __dirname
122122
const DEV_SERVER_URL = process.env.VITE_DEV_SERVER_URL
123-
const PROJECT_ROOT_DIR = isProduction ? ASSET_ROOT_DIR : process.env.__COMMONERS_PROJECT_ROOT
123+
const PROJECT_ROOT_DIR = isProduction ? ASSET_ROOT_DIR : process.cwd() // CWD is the project root in development
124124
const viteAssetsPath = join(ASSET_ROOT_DIR, 'assets')
125125

126126
globalThis.COMMONERS_QUIT = (message?: string) => {

packages/core/cleanup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export const exit = async (code) => {
1515
if (!globalThis.process.env.__COMMONERS_TESTING) process.exit(code === 'SIGINT' ? 0 : code) // Do not force exit if testing
1616
}
1717

18-
const exitEvents = ['beforeExit', 'exit', 'SIGINT']
18+
const exitEvents = ['beforeExit', 'exit', 'SIGINT', 'SIGTERM']
1919
exitEvents.forEach(event => process.on(event, exit))

packages/core/launch.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const launchServices = async (
7777

7878
}
7979

80-
export const launchApp = async ( config: LaunchConfig ) => {
80+
export const launchApp = async ( config: LaunchConfig, args = []) => {
8181

8282
const _chalk = await chalk
8383

@@ -130,22 +130,19 @@ export const launchApp = async ( config: LaunchConfig ) => {
130130

131131
let runExecutableCommand = "open" // Default to macOS command
132132

133-
const args = [
134-
`"${fullPath}"`, // The executable or path to open
135-
];
133+
const resolvedArgs = [ `"${fullPath}"` ]; // The path to the executable file
134+
const userArgs = new Set([ ...args ]) // User-provided arguments
136135

137136
// Set the appropriate command based on the platform
138-
if (PLATFORM === 'windows'|| PLATFORM === 'linux') runExecutableCommand = args.shift() // Run executable directly on Linux
139-
else if (PLATFORM === 'mac') args.splice(1, 0, "--args") // macOS-specific flag to pass additional arguments
137+
if (PLATFORM === 'windows'|| PLATFORM === 'linux') runExecutableCommand = resolvedArgs.shift() // Run executable directly
138+
if (PLATFORM === 'linux') userArgs.add('--no-sandbox') // Ensure No Sandbox
139+
if (PLATFORM === 'mac' && userArgs.size) resolvedArgs.push("--args") // macOS-specific flag to pass additional arguments
140+
resolvedArgs.push(...userArgs) // Add any additional arguments
140141

142+
printSubtle([runExecutableCommand, ...resolvedArgs].join(' '))
141143

142-
// Ensure No Sandbox
143-
if (PLATFORM === 'linux') args.push('--no-sandbox')
144-
145-
146-
printSubtle([runExecutableCommand, ...args].join(' '))
147-
148-
await spawnProcess(runExecutableCommand, args, { env: process.env }); // Share the same environment variables
144+
await spawnProcess(runExecutableCommand, resolvedArgs, { env: process.env }); // Share the same environment variables
145+
149146
}
150147

151148
else {

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@commoners/solidarity",
33
"description": "Build solidarity across platform",
4-
"version": "0.0.64",
4+
"version": "0.0.65",
55
"type": "module",
66
"license": "MIT",
77
"exports": {

packages/core/start.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,7 @@ export const app = async function (
168168
close: () => void
169169
}
170170

171-
onCleanup(() => {
172-
// console.log('CLEANUP')
173-
startManager.close()
174-
})
171+
onCleanup(() => startManager.close())
175172

176173
// ------------------------------- Mobile -------------------------------
177174
if (isMobile(target)) {
@@ -187,8 +184,6 @@ export const app = async function (
187184
const electronDevOptions = electron?.dev || {}
188185
const { load = 'url' } = electronDevOptions // Default to loading from URL
189186

190-
process.env.__COMMONERS_PROJECT_ROOT = root // Set the output directory for the desktop build
191-
192187
// Load Files in Dev Mode
193188
if (load === 'file') {
194189
const outDir = await build( scopedConfig, { services, dev: true } )

packages/core/utils/assets.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ async function buildService(
195195

196196
// Auto Build Configuration
197197
else return await packageFile(buildInfo)
198-
199198
}
200199

201200
// Derive assets to be transferred to the Commoners folder

packages/core/vite/plugins/electron/electron.ts

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ const cleanupElectronApp = async () => {
2626

2727
export const electronGlobalStates: { app?: ChildProcess } = {}
2828

29+
let cleanupPromise = null
30+
const onExit = async () => cleanupPromise || (cleanupPromise = cleanupElectronApp()) // Ensure cleanup is only done once
31+
2932
export async function startup( root ) {
3033

3134
const argv = ['.', '--no-sandbox']
@@ -45,30 +48,9 @@ export async function startup( root ) {
4548
stdio: [ 'ignore', 'pipe', 'pipe' ]
4649
})
4750

48-
// Kill the process after Electron.app exits
49-
app.once('exit', cleanup.exit) // Calls cleanup and exits the process
50-
51-
// Print out any messages from Electron.app
52-
app.stdout.on('data', data => log(data))
53-
54-
// Print out any errors from Electron.app
55-
app.stderr.on('data', data => log(data, 'error'))
56-
57-
if (!startup.hookedProcessExit) {
58-
startup.hookedProcessExit = true
59-
process.once('exit', startup.exit) // Ensure we clean up when the Node.js process exits
60-
}
61-
51+
app.stdout.on('data', data => log(data)) // Print out any messages from Electron.app
52+
app.stderr.on('data', data => log(data, 'error')) // Print out any errors from Electron.app
53+
cleanup.onCleanup(onExit) // Kill the process after the process exits
54+
6255
return app
6356
}
64-
65-
startup.hookedProcessExit = false
66-
67-
68-
// Exit the Electron process and remove all listeners
69-
let cleanupPromise = null
70-
startup.exit = async () => cleanupPromise || (cleanupPromise = cleanupElectronApp()) // Ensure cleanup is only done once
71-
72-
// Properly close Electron process on Windows.
73-
const signals = ['SIGTERM', 'SIGINT']
74-
signals.forEach(signal => process.on(signal, startup.exit))

0 commit comments

Comments
 (0)