Skip to content

Commit

Permalink
node: headless works
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Mar 8, 2025
1 parent b37ef44 commit a0a04ed
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/node/headless.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Ownly Headless Utility.
*
* This synchronizes an Ownly project to the filesystem.
* Requires Node.js 23 or later.
*/

/// <reference types="node" />
/// <reference types="../services.d.ts" />

Expand Down Expand Up @@ -54,16 +61,27 @@ async function setupWorkspace(wkspName: string): Promise<Workspace> {
}

async function main() {
if (process.argv.length < 3) {
console.error('Usage: node dist/headless.js </workspace/name> <project-name>');
process.exit(1);
}

const wkspName = process.argv[2];
const projName = process.argv[3];

try {
await loadServices();
await loadGoEnvironment();
await ndn.setup();

// TODO: get name from CLI instead
const wksp = await setupWorkspace('/test/space1');
const proj = await wksp.proj.get('documents');
// Setup the workspace
const wksp = await setupWorkspace(wkspName);

// TODO: hook to wait for sync
await new Promise((resolve) => setTimeout(resolve, 2000));
const proj = await wksp.proj.get(projName);

// TODO: need a hook to wait for sync to complete instead of this
// TODO: hook to wait for sync
await new Promise((resolve) => setTimeout(resolve, 5000));

// Sychronize the filesystem
Expand Down

0 comments on commit a0a04ed

Please sign in to comment.