@dinoxx/dinox-cli 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.js +29 -0
- package/dist/config/resolve.js +1 -1
- package/dist/powersync/syncPass.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import { registerInfoCommand } from './commands/info/index.js';
|
|
|
6
6
|
import { registerNoteCommands } from './commands/notes/index.js';
|
|
7
7
|
import { registerPromptCommands } from './commands/prompt/index.js';
|
|
8
8
|
import { registerSyncCommand } from './commands/sync.js';
|
|
9
|
+
import { registerUpdateCommand } from './commands/update.js';
|
|
9
10
|
import { registerTagsCommand } from './commands/tags/index.js';
|
|
10
11
|
import { getPackageVersion } from './utils/version.js';
|
|
11
12
|
export function createCli() {
|
|
@@ -25,6 +26,7 @@ export function createCli() {
|
|
|
25
26
|
registerConfigCommands(program);
|
|
26
27
|
registerInfoCommand(program);
|
|
27
28
|
registerSyncCommand(program);
|
|
29
|
+
registerUpdateCommand(program);
|
|
28
30
|
registerPromptCommands(program);
|
|
29
31
|
registerTagsCommand(program);
|
|
30
32
|
registerNoteCommands(program);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { getPackageVersion } from '../utils/version.js';
|
|
3
|
+
const PACKAGE_NAME = '@dinoxx/dinox-cli';
|
|
4
|
+
function runNpmUpdate() {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
7
|
+
const child = spawn(npm, ['update', '-g', PACKAGE_NAME], { stdio: 'inherit' });
|
|
8
|
+
child.on('close', (code) => {
|
|
9
|
+
if (code === 0) {
|
|
10
|
+
resolve();
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
reject(new Error(`npm exited with code ${code}`));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
child.on('error', reject);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export function registerUpdateCommand(program) {
|
|
20
|
+
program
|
|
21
|
+
.command('update')
|
|
22
|
+
.description(`Update ${PACKAGE_NAME} to the latest version`)
|
|
23
|
+
.action(async () => {
|
|
24
|
+
console.log(`current version: ${getPackageVersion()}`);
|
|
25
|
+
console.log(`updating ${PACKAGE_NAME}...`);
|
|
26
|
+
await runNpmUpdate();
|
|
27
|
+
console.log('done');
|
|
28
|
+
});
|
|
29
|
+
}
|
package/dist/config/resolve.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { POWERSYNC_DEFAULT_ENDPOINT, POWERSYNC_DEFAULT_TOKEN_ENDPOINT, POWERSYNC_DEFAULT_UPLOAD_BASE_URL, } from './serviceEndpoints.js';
|
|
2
2
|
const DEFAULT_UPLOAD_V4_PATH = '/powersync/v4/uploadData';
|
|
3
3
|
const DEFAULT_UPLOAD_V2_PATH = '/powersync/v2/uploadData';
|
|
4
|
-
const DEFAULT_SYNC_TIMEOUT_MS =
|
|
4
|
+
const DEFAULT_SYNC_TIMEOUT_MS = 300_000;
|
|
5
5
|
function nonEmptyString(value) {
|
|
6
6
|
if (typeof value !== 'string') {
|
|
7
7
|
return undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { waitForIdleDataFlow } from './runtime.js';
|
|
2
2
|
import { syncNoteTokenIndex } from './tokenIndex.js';
|
|
3
3
|
export async function runSingleSyncPass(db, timeoutMs) {
|
|
4
|
-
const idle = await waitForIdleDataFlow(db, Math.min(timeoutMs,
|
|
4
|
+
const idle = await waitForIdleDataFlow(db, Math.min(timeoutMs, 60_000));
|
|
5
5
|
const tokenIndex = await syncNoteTokenIndex(db);
|
|
6
6
|
return {
|
|
7
7
|
idle,
|