Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
75 lines
2.1 KiB
JavaScript
Executable File
75 lines
2.1 KiB
JavaScript
Executable File
'use strict';
|
|
const path = require('path');
|
|
const os = require('os');
|
|
|
|
const homedir = os.homedir();
|
|
const tmpdir = os.tmpdir();
|
|
const {env} = process;
|
|
|
|
const macos = name => {
|
|
const library = path.join(homedir, 'Library');
|
|
|
|
return {
|
|
data: path.join(library, 'Application Support', name),
|
|
config: path.join(library, 'Preferences', name),
|
|
cache: path.join(library, 'Caches', name),
|
|
log: path.join(library, 'Logs', name),
|
|
temp: path.join(tmpdir, name)
|
|
};
|
|
};
|
|
|
|
const windows = name => {
|
|
const appData = env.APPDATA || path.join(homedir, 'AppData', 'Roaming');
|
|
const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local');
|
|
|
|
return {
|
|
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
data: path.join(localAppData, name, 'Data'),
|
|
config: path.join(appData, name, 'Config'),
|
|
cache: path.join(localAppData, name, 'Cache'),
|
|
log: path.join(localAppData, name, 'Log'),
|
|
temp: path.join(tmpdir, name)
|
|
};
|
|
};
|
|
|
|
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
const linux = name => {
|
|
const username = path.basename(homedir);
|
|
|
|
return {
|
|
data: path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name),
|
|
config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, '.config'), name),
|
|
cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, '.cache'), name),
|
|
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
log: path.join(env.XDG_STATE_HOME || path.join(homedir, '.local', 'state'), name),
|
|
temp: path.join(tmpdir, username, name)
|
|
};
|
|
};
|
|
|
|
const envPaths = (name, options) => {
|
|
if (typeof name !== 'string') {
|
|
throw new TypeError(`Expected string, got ${typeof name}`);
|
|
}
|
|
|
|
options = Object.assign({suffix: 'nodejs'}, options);
|
|
|
|
if (options.suffix) {
|
|
// Add suffix to prevent possible conflict with native apps
|
|
name += `-${options.suffix}`;
|
|
}
|
|
|
|
if (process.platform === 'darwin') {
|
|
return macos(name);
|
|
}
|
|
|
|
if (process.platform === 'win32') {
|
|
return windows(name);
|
|
}
|
|
|
|
return linux(name);
|
|
};
|
|
|
|
module.exports = envPaths;
|
|
// TODO: Remove this for the next major release
|
|
module.exports.default = envPaths;
|