feat(desktop,launcher): default to ~/.waggle-community (P1.3c)
The Tauri shell's bundled npm environment and its first-launch flag, the server installer's --data-dir default and the NSIS installer config fell back to ~/.waggle. Use ~/.waggle-community (ADR-0011). The Rust shell keeps the name in DEFAULT_DATA_DIR_NAME in lib.rs and the launcher, which uses only Node built-ins, in DATA_DIR_NAME. packages/shared/tests/data-dir.test.ts fails when either copy, or the marketplace's, differs from @waggle/shared.
This commit is contained in:
@@ -26,7 +26,8 @@ Run `waggle-server --help` for the full list.
|
||||
Supported systems: Windows x64, macOS (Apple silicon and Intel), Linux x64. You need Node.js
|
||||
20 or newer only for the first `npx` call.
|
||||
|
||||
Your data lives in `~/.waggle` (or `WAGGLE_DATA_DIR`). `uninstall` does not touch it.
|
||||
Your data lives in `~/.waggle-community` (or `WAGGLE_DATA_DIR`), apart from the commercial
|
||||
Waggle's `~/.waggle`. `uninstall` does not touch it.
|
||||
|
||||
The package and command names are temporary until the product name is decided, and until
|
||||
the release location is set, install from an archive with `--from`.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { COMMAND_NAME } from './platform.js';
|
||||
import { COMMAND_NAME, DATA_DIR_NAME } from './platform.js';
|
||||
|
||||
export type Command = 'install' | 'update' | 'run' | 'doctor' | 'uninstall' | 'help' | 'version';
|
||||
|
||||
@@ -97,7 +97,7 @@ export function formatHelp(version: string): string {
|
||||
--sha256 <hex> Expected SHA-256 of the archive
|
||||
--dir <path> Install directory
|
||||
--bin-dir <path> Where to put the ${COMMAND_NAME} command
|
||||
--data-dir <path> Data directory (default: $WAGGLE_DATA_DIR or ~/.waggle)
|
||||
--data-dir <path> Data directory (default: $WAGGLE_DATA_DIR or ~/${DATA_DIR_NAME})
|
||||
--port, -p <number> Server port (default: ${DEFAULT_PORT})
|
||||
--no-open Do not open the browser
|
||||
--force Reinstall even when this version is installed
|
||||
|
||||
@@ -9,6 +9,14 @@ import path from 'node:path';
|
||||
/** The command the installer puts on the PATH. A working name until the product name is decided. */
|
||||
export const COMMAND_NAME = 'waggle-server';
|
||||
|
||||
/**
|
||||
* The default data directory under the home directory, kept apart from the
|
||||
* commercial Waggle's `~/.waggle` (ADR-0011). A temporary name: the final one
|
||||
* follows the product-name decision (Q8). The launcher uses only Node's
|
||||
* built-in modules, so this copies `DEFAULT_DATA_DIR_NAME` from `@waggle/shared`.
|
||||
*/
|
||||
export const DATA_DIR_NAME = '.waggle-community';
|
||||
|
||||
export interface Host {
|
||||
platform: NodeJS.Platform;
|
||||
arch: string;
|
||||
@@ -63,9 +71,9 @@ export function defaultBinDir(host: Host, installDir: string): string {
|
||||
return host.platform === 'win32' ? p.join(installDir, 'bin') : p.join(host.homedir, '.local', 'bin');
|
||||
}
|
||||
|
||||
/** Same rule as the sidecar's resolveDataDir: WAGGLE_DATA_DIR, else ~/.waggle. */
|
||||
/** Same rule as the sidecar's resolveDataDir: WAGGLE_DATA_DIR, else ~/.waggle-community. */
|
||||
export function defaultDataDir(host: Host): string {
|
||||
return host.env.WAGGLE_DATA_DIR || pathApi(host.platform).join(host.homedir, '.waggle');
|
||||
return host.env.WAGGLE_DATA_DIR || pathApi(host.platform).join(host.homedir, DATA_DIR_NAME);
|
||||
}
|
||||
|
||||
export function isOnPath(host: Host, dir: string): boolean {
|
||||
|
||||
@@ -92,7 +92,8 @@ describe('platform paths', () => {
|
||||
});
|
||||
|
||||
it('follows the sidecar data directory rule', () => {
|
||||
expect(defaultDataDir(host('linux'))).toBe('/home/ana/.waggle');
|
||||
expect(defaultDataDir(host('linux'))).toBe('/home/ana/.waggle-community');
|
||||
expect(defaultDataDir(host('win32'))).toBe('C:\\Users\\ana\\.waggle-community');
|
||||
expect(defaultDataDir(host('linux', { WAGGLE_DATA_DIR: '/srv/waggle' }))).toBe('/srv/waggle');
|
||||
});
|
||||
|
||||
@@ -107,7 +108,7 @@ describe('payload helpers', () => {
|
||||
it('gives the server the environment the desktop shell gives it', () => {
|
||||
const env = serviceEnvironment({
|
||||
appDir: '/opt/w/app',
|
||||
dataDir: '/home/ana/.waggle',
|
||||
dataDir: '/home/ana/.waggle-community',
|
||||
port: 4000,
|
||||
platform: 'linux',
|
||||
baseEnv: { PATH: '/usr/bin', WAGGLE_DATA_DIR: '/stale' },
|
||||
@@ -119,8 +120,8 @@ describe('payload helpers', () => {
|
||||
WAGGLE_FRONTEND_DIR: '/opt/w/app/web',
|
||||
NODE_PATH: '/opt/w/app/node_modules:/opt/w/app/native',
|
||||
PATH: '/opt/w/app/node_modules/waggle-node-runtime/bin:/opt/w/app:/usr/bin',
|
||||
NPM_CONFIG_PREFIX: '/home/ana/.waggle/npm/prefix',
|
||||
NPM_CONFIG_CACHE: '/home/ana/.waggle/npm/cache',
|
||||
NPM_CONFIG_PREFIX: '/home/ana/.waggle-community/npm/prefix',
|
||||
NPM_CONFIG_CACHE: '/home/ana/.waggle-community/npm/cache',
|
||||
});
|
||||
expect(env.WAGGLE_DATA_DIR).toBeUndefined();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user