shutro-erp 0.2.0 → 0.2.1
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/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/init.d.ts +5 -0
- package/dist/cli/init.js +23 -5
- package/package.json +1 -1
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Terminal } from './ui.js';
|
|
2
2
|
export { APPS_USAGE, type AppsIo, runApps } from './apps.js';
|
|
3
|
-
export { INIT_USAGE, type InitIo, runInit } from './init.js';
|
|
3
|
+
export { INIT_USAGE, type InitIo, releaseVersion, runInit } from './init.js';
|
|
4
4
|
export { migrateProject, moduleFiles, modulesOf, openProject, runMigrate, runModule, runSeed, runUser, type SeedContext, seed, seedWith, } from './project.js';
|
|
5
5
|
export { defaultsPrompter, InputEndedError, type Prompter, type PromptLook, type Question, terminalPrompter, } from './prompt.js';
|
|
6
6
|
export { type CardRow, createUi, detectTerminal, PLAIN_TERMINAL, type TaskHandle, type Terminal, type Ui, } from './ui.js';
|
package/dist/cli/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { runApps } from './apps.js';
|
|
|
12
12
|
import { runInit } from './init.js';
|
|
13
13
|
import { modulesOf, runMigrate, runModule, runSeed, runUser } from './project.js';
|
|
14
14
|
export { APPS_USAGE, runApps } from './apps.js';
|
|
15
|
-
export { INIT_USAGE, runInit } from './init.js';
|
|
15
|
+
export { INIT_USAGE, releaseVersion, runInit } from './init.js';
|
|
16
16
|
export { migrateProject, moduleFiles, modulesOf, openProject, runMigrate, runModule, runSeed, runUser, seed, seedWith, } from './project.js';
|
|
17
17
|
export { defaultsPrompter, InputEndedError, terminalPrompter, } from './prompt.js';
|
|
18
18
|
export { createUi, detectTerminal, PLAIN_TERMINAL, } from './ui.js';
|
package/dist/cli/init.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { type Prompter } from './prompt.js';
|
|
2
2
|
import { type Terminal } from './ui.js';
|
|
3
|
+
/**
|
|
4
|
+
* The version of the `shutro-erp` package this CLI runs from: new projects depend on it. In the workspace (no such
|
|
5
|
+
* package around the CLI) the framework version stands in.
|
|
6
|
+
*/
|
|
7
|
+
export declare function releaseVersion(from?: string): string;
|
|
3
8
|
export declare const INIT_USAGE: string;
|
|
4
9
|
export interface InitIo {
|
|
5
10
|
readonly write: (text: string) => void;
|
package/dist/cli/init.js
CHANGED
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { spawn, spawnSync } from 'node:child_process';
|
|
10
10
|
import { randomBytes } from 'node:crypto';
|
|
11
|
-
import { existsSync } from 'node:fs';
|
|
11
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
12
12
|
import { chmod, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
13
13
|
import { createServer as createNetServer } from 'node:net';
|
|
14
|
-
import { basename, join, resolve } from 'node:path';
|
|
14
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
15
16
|
import { parseArgs } from 'node:util';
|
|
16
17
|
import { base, createServer, DEMO_PASSWORD, FRAMEWORK_TABLES, installBase, installDemo, KOSH_VERSION, migrate, pg, recordInstalledApps, } from '../server/index.js';
|
|
17
18
|
import { seed } from './project.js';
|
|
@@ -19,6 +20,23 @@ import { defaultsPrompter, terminalPrompter } from './prompt.js';
|
|
|
19
20
|
import * as templates from './templates.js';
|
|
20
21
|
import { APPS, bridgesFor, SELECTABLE_APPS } from './templates.js';
|
|
21
22
|
import { createUi, PLAIN_TERMINAL } from './ui.js';
|
|
23
|
+
/**
|
|
24
|
+
* The version of the `shutro-erp` package this CLI runs from: new projects depend on it. In the workspace (no such
|
|
25
|
+
* package around the CLI) the framework version stands in.
|
|
26
|
+
*/
|
|
27
|
+
export function releaseVersion(from = dirname(fileURLToPath(import.meta.url))) {
|
|
28
|
+
for (let dir = from, i = 0; i < 6; i++, dir = dirname(dir)) {
|
|
29
|
+
try {
|
|
30
|
+
const manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'));
|
|
31
|
+
if (manifest.name === 'shutro-erp' && typeof manifest.version === 'string')
|
|
32
|
+
return manifest.version;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// no package.json here: look further up
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return KOSH_VERSION;
|
|
39
|
+
}
|
|
22
40
|
export const INIT_USAGE = `Usage: kosh init [folder] [options]
|
|
23
41
|
|
|
24
42
|
Sets up a Kosh installation: asks for the database, the first company, the administrator, the apps,
|
|
@@ -82,7 +100,7 @@ async function startDockerDb(dir, name, postgres, ui) {
|
|
|
82
100
|
name,
|
|
83
101
|
apps: [],
|
|
84
102
|
port: 3000,
|
|
85
|
-
koshVersion:
|
|
103
|
+
koshVersion: releaseVersion(),
|
|
86
104
|
dockerDb: postgres.db,
|
|
87
105
|
}));
|
|
88
106
|
return ui.task(`Starting PostgreSQL 18 in Docker (port ${postgres.port})`, async (task) => {
|
|
@@ -478,7 +496,7 @@ async function writeProject(a, ui) {
|
|
|
478
496
|
name: a.name,
|
|
479
497
|
apps: a.apps,
|
|
480
498
|
port: a.port,
|
|
481
|
-
koshVersion:
|
|
499
|
+
koshVersion: releaseVersion(),
|
|
482
500
|
dockerDb: a.postgres.db,
|
|
483
501
|
fileStorage: a.storage.kind === 'dir',
|
|
484
502
|
};
|
|
@@ -739,7 +757,7 @@ export async function runInit(argv, io) {
|
|
|
739
757
|
let server;
|
|
740
758
|
const started = Date.now();
|
|
741
759
|
try {
|
|
742
|
-
await ui.banner(`The ERP framework on Shutro · v${
|
|
760
|
+
await ui.banner(`The ERP framework on Shutro · v${releaseVersion()}`);
|
|
743
761
|
ui.write(` ${ui.style('gray', 'Kosh setup: press Enter to keep the value in [brackets].')}\n`);
|
|
744
762
|
const answers = await ask(prompter, values, io.cwd, positionals[0], ui);
|
|
745
763
|
ui.step('files', 'Project files', answers.dir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shutro-erp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Shutro ERP (Kosh): a modern ERP framework on TypeScript, PostgreSQL and the Shutro ORM — typed end to end, permissions enforced on the server, metadata-driven views, reporting, documents and a chatter on every record.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"erp",
|