@t0.labs/daxta 1.1.7 → 1.1.8
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/build/build-spec.js +9 -8
- package/package.json +1 -1
- package/assets/readme/demo.html +0 -1896
- package/dist/cli/start.d.ts +0 -13
- package/dist/cli/start.js +0 -103
package/dist/cli/start.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run the app (or any command) with `@t0.labs/daxta/register` preloaded —
|
|
3
|
-
* Nest `/docs` mounts without editing start scripts.
|
|
4
|
-
*
|
|
5
|
-
* daxta start → pm run start:dev (or start)
|
|
6
|
-
* daxta start -- start:prod
|
|
7
|
-
* daxta start -- nest start
|
|
8
|
-
* daxta start -- node dist/main.js
|
|
9
|
-
*/
|
|
10
|
-
export declare function runDaxtaStart(options?: {
|
|
11
|
-
cwd?: string;
|
|
12
|
-
argv?: string[];
|
|
13
|
-
}): void;
|
package/dist/cli/start.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.runDaxtaStart = runDaxtaStart;
|
|
37
|
-
const fs_1 = require("fs");
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const child_process_1 = require("child_process");
|
|
40
|
-
function readPkg(cwd) {
|
|
41
|
-
return JSON.parse((0, fs_1.readFileSync)(path.join(cwd, 'package.json'), 'utf8'));
|
|
42
|
-
}
|
|
43
|
-
function detectPackageManager(cwd, pkg) {
|
|
44
|
-
if ((0, fs_1.existsSync)(path.join(cwd, 'pnpm-lock.yaml')) || pkg.packageManager?.startsWith('pnpm'))
|
|
45
|
-
return 'pnpm';
|
|
46
|
-
if ((0, fs_1.existsSync)(path.join(cwd, 'yarn.lock')))
|
|
47
|
-
return 'yarn';
|
|
48
|
-
return 'npm';
|
|
49
|
-
}
|
|
50
|
-
function withRequire(env, moduleId) {
|
|
51
|
-
const flag = `--require ${moduleId}`;
|
|
52
|
-
const current = env.NODE_OPTIONS ?? '';
|
|
53
|
-
if (current.includes(moduleId))
|
|
54
|
-
return { ...env };
|
|
55
|
-
return {
|
|
56
|
-
...env,
|
|
57
|
-
NODE_OPTIONS: current ? `${current} ${flag}`.trim() : flag,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Run the app (or any command) with `@t0.labs/daxta/register` preloaded —
|
|
62
|
-
* Nest `/docs` mounts without editing start scripts.
|
|
63
|
-
*
|
|
64
|
-
* daxta start → pm run start:dev (or start)
|
|
65
|
-
* daxta start -- start:prod
|
|
66
|
-
* daxta start -- nest start
|
|
67
|
-
* daxta start -- node dist/main.js
|
|
68
|
-
*/
|
|
69
|
-
function runDaxtaStart(options = {}) {
|
|
70
|
-
const cwd = options.cwd ?? process.cwd();
|
|
71
|
-
const argv = options.argv ?? [];
|
|
72
|
-
const pkg = readPkg(cwd);
|
|
73
|
-
const pm = detectPackageManager(cwd, pkg);
|
|
74
|
-
const env = withRequire(process.env, '@t0.labs/daxta/register');
|
|
75
|
-
let command;
|
|
76
|
-
let args;
|
|
77
|
-
if (argv.length === 0) {
|
|
78
|
-
const script = pkg.scripts?.['start:dev'] ? 'start:dev' : pkg.scripts?.start ? 'start' : null;
|
|
79
|
-
if (!script)
|
|
80
|
-
throw new Error('No start:dev/start script in package.json; pass a command: daxta start -- <cmd>');
|
|
81
|
-
command = pm;
|
|
82
|
-
args = pm === 'npm' ? ['run', script] : ['run', script];
|
|
83
|
-
}
|
|
84
|
-
else if (argv.length === 1 && pkg.scripts?.[argv[0]]) {
|
|
85
|
-
command = pm;
|
|
86
|
-
args = pm === 'npm' ? ['run', argv[0]] : ['run', argv[0]];
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
command = argv[0];
|
|
90
|
-
args = argv.slice(1);
|
|
91
|
-
}
|
|
92
|
-
console.log(`DAxTA start (register): ${command} ${args.join(' ')}`);
|
|
93
|
-
const result = (0, child_process_1.spawnSync)(command, args, {
|
|
94
|
-
cwd,
|
|
95
|
-
stdio: 'inherit',
|
|
96
|
-
shell: process.platform === 'win32',
|
|
97
|
-
env,
|
|
98
|
-
});
|
|
99
|
-
if (result.status && result.status !== 0)
|
|
100
|
-
process.exit(result.status);
|
|
101
|
-
if (result.error)
|
|
102
|
-
throw result.error;
|
|
103
|
-
}
|