create-kosh-erp 0.1.1 → 0.1.2
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/index.js +8 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -18,15 +18,16 @@ import { createInterface } from 'node:readline/promises';
|
|
|
18
18
|
|
|
19
19
|
const own = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
|
|
20
20
|
/** What to install: kosh-erp of the same minor version (KOSH_ERP_SPEC overrides it, e.g. a local tarball). */
|
|
21
|
-
const
|
|
21
|
+
const [major, minor] = own.version.split('.');
|
|
22
|
+
const spec = process.env.KOSH_ERP_SPEC ?? `kosh-erp@^${major}.${minor}.0`;
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
24
|
+
// `npm create kosh-erp my-erp -- --yes …` reaches us without the `--` (npm consumes it); `npx create-kosh-erp`
|
|
25
|
+
// keeps it. Either way: an optional folder first, everything else is for kosh init.
|
|
26
|
+
const argv = process.argv.slice(2).filter((a, i, all) => !(a === '--' && all.indexOf('--') === i));
|
|
27
|
+
const positional = argv[0] !== undefined && !argv[0].startsWith('-') ? argv[0] : undefined;
|
|
28
|
+
const forInit = positional === undefined ? argv : argv.slice(1);
|
|
28
29
|
|
|
29
|
-
if (
|
|
30
|
+
if (forInit.length === argv.length && (argv[0] === '--help' || argv[0] === '-h')) {
|
|
30
31
|
process.stdout.write(`Usage: npm create kosh-erp@latest [folder] [-- kosh init options]
|
|
31
32
|
|
|
32
33
|
Creates a Kosh installation in [folder]: installs kosh-erp, then asks for the database, the company, the
|