@positronic/cli 0.0.3 → 0.0.5
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/src/commands/helpers.js +57 -27
- package/dist/types/commands/helpers.d.ts.map +1 -1
- package/package.json +5 -1
- package/dist/src/commands/brain.test.js +0 -2936
- package/dist/src/commands/helpers.test.js +0 -832
- package/dist/src/commands/project.test.js +0 -1201
- package/dist/src/commands/resources.test.js +0 -2511
- package/dist/src/commands/schedule.test.js +0 -1235
- package/dist/src/commands/secret.test.d.js +0 -1
- package/dist/src/commands/secret.test.js +0 -761
- package/dist/src/commands/server.test.js +0 -1237
- package/dist/src/commands/test-utils.js +0 -737
- package/dist/src/components/secret-sync.js +0 -303
- package/dist/src/test/mock-api-client.js +0 -371
- package/dist/src/test/test-dev-server.js +0 -1376
- package/dist/types/commands/test-utils.d.ts +0 -45
- package/dist/types/commands/test-utils.d.ts.map +0 -1
- package/dist/types/components/secret-sync.d.ts +0 -9
- package/dist/types/components/secret-sync.d.ts.map +0 -1
- package/dist/types/test/mock-api-client.d.ts +0 -25
- package/dist/types/test/mock-api-client.d.ts.map +0 -1
- package/dist/types/test/test-dev-server.d.ts +0 -129
- package/dist/types/test/test-dev-server.d.ts.map +0 -1
- package/src/cli.ts +0 -997
- package/src/commands/backend.ts +0 -63
- package/src/commands/brain.test.ts +0 -1004
- package/src/commands/brain.ts +0 -215
- package/src/commands/helpers.test.ts +0 -487
- package/src/commands/helpers.ts +0 -870
- package/src/commands/project-config-manager.ts +0 -152
- package/src/commands/project.test.ts +0 -502
- package/src/commands/project.ts +0 -109
- package/src/commands/resources.test.ts +0 -1052
- package/src/commands/resources.ts +0 -97
- package/src/commands/schedule.test.ts +0 -481
- package/src/commands/schedule.ts +0 -65
- package/src/commands/secret.test.ts +0 -210
- package/src/commands/secret.ts +0 -50
- package/src/commands/server.test.ts +0 -493
- package/src/commands/server.ts +0 -353
- package/src/commands/test-utils.ts +0 -324
- package/src/components/brain-history.tsx +0 -198
- package/src/components/brain-list.tsx +0 -105
- package/src/components/brain-rerun.tsx +0 -111
- package/src/components/brain-show.tsx +0 -92
- package/src/components/error.tsx +0 -24
- package/src/components/project-add.tsx +0 -59
- package/src/components/project-create.tsx +0 -83
- package/src/components/project-list.tsx +0 -83
- package/src/components/project-remove.tsx +0 -55
- package/src/components/project-select.tsx +0 -200
- package/src/components/project-show.tsx +0 -58
- package/src/components/resource-clear.tsx +0 -127
- package/src/components/resource-delete.tsx +0 -160
- package/src/components/resource-list.tsx +0 -177
- package/src/components/resource-sync.tsx +0 -170
- package/src/components/resource-types.tsx +0 -55
- package/src/components/resource-upload.tsx +0 -182
- package/src/components/schedule-create.tsx +0 -90
- package/src/components/schedule-delete.tsx +0 -116
- package/src/components/schedule-list.tsx +0 -186
- package/src/components/schedule-runs.tsx +0 -151
- package/src/components/secret-bulk.tsx +0 -79
- package/src/components/secret-create.tsx +0 -49
- package/src/components/secret-delete.tsx +0 -41
- package/src/components/secret-list.tsx +0 -41
- package/src/components/watch.tsx +0 -155
- package/src/hooks/useApi.ts +0 -183
- package/src/positronic.ts +0 -40
- package/src/test/data/resources/config.json +0 -1
- package/src/test/data/resources/data/config.json +0 -1
- package/src/test/data/resources/data/logo.png +0 -2
- package/src/test/data/resources/docs/api.md +0 -3
- package/src/test/data/resources/docs/readme.md +0 -3
- package/src/test/data/resources/example.md +0 -3
- package/src/test/data/resources/file with spaces.txt +0 -1
- package/src/test/data/resources/readme.md +0 -3
- package/src/test/data/resources/test.txt +0 -1
- package/src/test/mock-api-client.ts +0 -145
- package/src/test/test-dev-server.ts +0 -1003
- package/tsconfig.json +0 -11
package/src/commands/backend.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import type { PositronicDevServer } from '@positronic/spec';
|
|
4
|
-
|
|
5
|
-
interface BackendConfig {
|
|
6
|
-
type: string;
|
|
7
|
-
package: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface PositronicConfig {
|
|
11
|
-
backend?: BackendConfig;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Load the backend configuration from positronic.config.json
|
|
16
|
-
*/
|
|
17
|
-
function loadBackendConfig(projectRootPath: string): PositronicConfig {
|
|
18
|
-
const configPath = path.join(projectRootPath, 'positronic.config.json');
|
|
19
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
20
|
-
|
|
21
|
-
if (!config.backend) {
|
|
22
|
-
throw new Error('No backend configuration found in positronic.config.json');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return config;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Load the backend module based on the configuration
|
|
30
|
-
*/
|
|
31
|
-
async function loadBackendModule(projectRootPath: string) {
|
|
32
|
-
const config = loadBackendConfig(projectRootPath);
|
|
33
|
-
const backendPackage = config.backend!.package;
|
|
34
|
-
|
|
35
|
-
let backendModule: any;
|
|
36
|
-
|
|
37
|
-
if (backendPackage.startsWith('file:')) {
|
|
38
|
-
// Load from local file path
|
|
39
|
-
const packagePath = backendPackage.replace('file:', '');
|
|
40
|
-
const localModulePath = path.join(
|
|
41
|
-
packagePath,
|
|
42
|
-
'dist',
|
|
43
|
-
'src',
|
|
44
|
-
'node-index.js'
|
|
45
|
-
);
|
|
46
|
-
backendModule = await import(localModulePath);
|
|
47
|
-
} else {
|
|
48
|
-
// Load from npm package
|
|
49
|
-
backendModule = await import(backendPackage);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return backendModule;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Create a dev server instance from the backend configuration
|
|
57
|
-
*/
|
|
58
|
-
export async function createDevServer(
|
|
59
|
-
projectRootPath: string
|
|
60
|
-
): Promise<PositronicDevServer> {
|
|
61
|
-
const { DevServer } = await loadBackendModule(projectRootPath);
|
|
62
|
-
return new DevServer(projectRootPath);
|
|
63
|
-
}
|