@ldsg/cli 0.1.0-alpha.9 → 0.3.18

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.
@@ -0,0 +1,7 @@
1
+ export interface StartOptions {
2
+ targetDir: string;
3
+ verbose?: boolean;
4
+ }
5
+ export declare function validateTargetDir(targetDir: string): Promise<void>;
6
+ export declare function start(options: StartOptions): Promise<void>;
7
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBxE;AAED,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBhE"}
package/dist/start.js ADDED
@@ -0,0 +1,76 @@
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.validateTargetDir = validateTargetDir;
37
+ exports.start = start;
38
+ const child_process_1 = require("child_process");
39
+ const fs = __importStar(require("fs-extra"));
40
+ const path = __importStar(require("path"));
41
+ async function validateTargetDir(targetDir) {
42
+ const exists = await fs.pathExists(targetDir);
43
+ if (!exists) {
44
+ throw new Error(`Target directory does not exist: ${targetDir}`);
45
+ }
46
+ const packageJsonPath = path.join(targetDir, 'package.json');
47
+ const packageJsonExists = await fs.pathExists(packageJsonPath);
48
+ if (!packageJsonExists) {
49
+ throw new Error(`package.json not found in target directory. Is this a valid application?`);
50
+ }
51
+ const packageJson = await fs.readJson(packageJsonPath);
52
+ if (!packageJson.scripts || !packageJson.scripts.start) {
53
+ throw new Error(`No "start" script found in package.json`);
54
+ }
55
+ }
56
+ async function start(options) {
57
+ const { targetDir, verbose = false } = options;
58
+ if (verbose) {
59
+ console.log('Starting application...');
60
+ console.log(`Target directory: ${targetDir}`);
61
+ }
62
+ try {
63
+ await validateTargetDir(targetDir);
64
+ if (verbose) {
65
+ console.log('Running npm start...');
66
+ }
67
+ (0, child_process_1.execSync)('npm start', {
68
+ cwd: targetDir,
69
+ stdio: 'inherit'
70
+ });
71
+ }
72
+ catch (error) {
73
+ console.error('Start failed:', error);
74
+ process.exit(1);
75
+ }
76
+ }
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
2
  "name": "@ldsg/cli",
3
- "version": "0.1.0-alpha.9",
3
+ "version": "0.3.18",
4
+ "description": "CLI tool for generating and starting ldsg applications",
5
+ "license": "MIT",
6
+ "author": "wanxger",
4
7
  "main": "dist/index.js",
5
- "files": [
6
- "dist/"
7
- ],
8
8
  "types": "dist",
9
9
  "bin": {
10
10
  "ldsg": "dist/index.js"
11
11
  },
12
- "author": "wanxger",
13
- "license": "MIT",
14
- "publishConfig": {
15
- "access": "public"
16
- },
17
- "description": "",
12
+ "files": [
13
+ "dist/"
14
+ ],
18
15
  "dependencies": {
19
16
  "commander": "^12.1.0",
20
- "@ldsg/utils": "0.1.0-alpha.9"
17
+ "fs-extra": "^11.2.0",
18
+ "@ldsg/app-builder": "0.3.18",
19
+ "@ldsg/constants": "0.3.25"
21
20
  },
22
21
  "devDependencies": {
22
+ "@types/fs-extra": "^11.0.4",
23
+ "@types/jest": "^29.5.0",
23
24
  "@types/node": "^20.13.0",
24
- "@types/supertest": "^6.0.0",
25
- "supertest": "^6.3.4",
26
- "ts-loader": "^9.5.1",
27
- "ts-node": "^10.9.2",
28
- "tslib": "^2.6.2",
29
- "typescript": "^5.5.2",
30
- "webpack": "^5.97.1",
31
- "webpack-cli": "^5.1.4"
25
+ "jest": "^29.5.0",
26
+ "ts-jest": "^29.1.0",
27
+ "typescript": "^5.3.3"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
32
31
  },
33
32
  "scripts": {
34
- "build": "rm -rf dist && webpack",
35
- "debug": "ts-node src/index.ts"
33
+ "build": "tsc --project tsconfig.build.json",
34
+ "clean": "rm -rf dist",
35
+ "test": "jest --passWithNoTests"
36
36
  }
37
37
  }
package/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2014-present Sebastian McKenzie and other contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,24 +0,0 @@
1
- /*!
2
- * mime-db
3
- * Copyright(c) 2014 Jonathan Ong
4
- * Copyright(c) 2015-2022 Douglas Christopher Wilson
5
- * MIT Licensed
6
- */
7
-
8
- /*!
9
- * mime-types
10
- * Copyright(c) 2014 Jonathan Ong
11
- * Copyright(c) 2015 Douglas Christopher Wilson
12
- * MIT Licensed
13
- */
14
-
15
- /**
16
- * @license
17
- * Lodash <https://lodash.com/>
18
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
19
- * Released under MIT license <https://lodash.com/license>
20
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
21
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
22
- */
23
-
24
- /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */