@gluhar/cli 2.5.1 → 2.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gluhar/cli",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "Gluhar cli commands and scripts",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
@@ -44,5 +44,5 @@
44
44
  "tsconfig-paths": "^4.2.0",
45
45
  "typescript": "^5.5.4"
46
46
  },
47
- "gitHead": "6aeb0ebe6cec454e140af6adacd4c77bb7d5913d"
47
+ "gitHead": "72175524c372e2ad4fb7802436290bdd73ab8fd7"
48
48
  }
@@ -9,7 +9,7 @@ const deploy = async (options) => {
9
9
  log_1.log.info("Deploying app...", options);
10
10
  // Deploy app to iOS
11
11
  if (options.ios) {
12
- (0, deployIos_1.deployIos)(options);
12
+ (0, deployIos_1.deployIos)();
13
13
  return;
14
14
  }
15
15
  // Handle ssr
@@ -1,3 +1,2 @@
1
- import { DeployOptions } from "./DeployOptions";
2
- export declare const deployIos: (options: DeployOptions) => Promise<void>;
1
+ export declare const deployIos: (url?: string) => Promise<void>;
3
2
  //# sourceMappingURL=deployIos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deployIos.d.ts","sourceRoot":"","sources":["../../../../src/commands/deploy/deployIos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,eAAO,MAAM,SAAS,YAAmB,aAAa,kBA2BrD,CAAC"}
1
+ {"version":3,"file":"deployIos.d.ts","sourceRoot":"","sources":["../../../../src/commands/deploy/deployIos.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,SAAgB,MAAM,kBAwC3C,CAAC"}
@@ -6,7 +6,7 @@ const log_1 = require("./log");
6
6
  const ts_morph_1 = require("ts-morph");
7
7
  const setSsr_1 = require("./setSsr");
8
8
  const project = new ts_morph_1.Project();
9
- const deployIos = async (options) => {
9
+ const deployIos = async (url) => {
10
10
  log_1.log.info("Deploying iOS app.");
11
11
  // Remove server dev url from capacitor config
12
12
  const capConfig = project.addSourceFileAtPathIfExists("./capacitor.config.ts");
@@ -17,7 +17,21 @@ const deployIos = async (options) => {
17
17
  ?.getInitializerIfKind(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
18
18
  if (!capConfigObject)
19
19
  return;
20
- capConfigObject.getProperty("server")?.remove();
20
+ const server = capConfigObject.getProperty("server");
21
+ if (!url) {
22
+ server?.remove();
23
+ }
24
+ else {
25
+ if (server) {
26
+ server.set({ initializer: `{ url: '${url}' }` });
27
+ }
28
+ else {
29
+ capConfigObject.addPropertyAssignment({
30
+ name: "server",
31
+ initializer: `{ url: '${url}' }`,
32
+ });
33
+ }
34
+ }
21
35
  capConfig.saveSync();
22
36
  // Disable ssr from nuxt.config
23
37
  (0, setSsr_1.setSsr)(false);
@@ -5,7 +5,7 @@ const deploy_1 = require("./deploy");
5
5
  exports.default = new commander_1.Command()
6
6
  .name("deploy")
7
7
  .description("Deploy a Nuxt app. Check out to deploy branch, merge with dev and check out back to dev.")
8
- .option("--from", "From what branch to deploy. Default is 'dev' so this is used in the event we are deploying from a different branch.", "dev")
8
+ .option("--from <branch>", "From what branch to deploy. Default is 'dev' so this is used in the event we are deploying from a different branch.", "dev")
9
9
  .option("--ios", "Deploy app to iOS device using Capacitor.")
10
10
  .option("--android", "Deploy app to Android device using Capacitor.")
11
11
  .option("--ssr", "Set SSR before deployment. Default is undefined for no change.")
@@ -0,0 +1,5 @@
1
+ export interface DevOptions {
2
+ host?: boolean;
3
+ ios?: boolean;
4
+ }
5
+ //# sourceMappingURL=DevOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/DevOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { DevOptions } from "./DevOptions";
2
+ export declare const dev: (options: DevOptions) => Promise<void>;
3
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,eAAO,MAAM,GAAG,YAAmB,UAAU,kBAS5C,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dev = void 0;
4
+ const cmd_1 = require("../../scripts/cmd");
5
+ const log_1 = require("./log");
6
+ const devIos_1 = require("./devIos");
7
+ const dev = async (options) => {
8
+ log_1.log.info("Running dev...", options);
9
+ if (options.ios) {
10
+ options.host = true;
11
+ await (0, devIos_1.devIos)(options);
12
+ }
13
+ // Run nuxt server
14
+ (0, cmd_1.executeCmd)("nuxt dev", options.host ? { host: "0.0.0.0" } : undefined);
15
+ };
16
+ exports.dev = dev;
@@ -0,0 +1,3 @@
1
+ import { DevOptions } from "./DevOptions";
2
+ export declare const devIos: (options: DevOptions) => Promise<void>;
3
+ //# sourceMappingURL=devIos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devIos.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/devIos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgB1C,eAAO,MAAM,MAAM,YAAmB,UAAU,kBAK/C,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.devIos = void 0;
7
+ const deployIos_1 = require("../deploy/deployIos");
8
+ const os_1 = __importDefault(require("os"));
9
+ const getLocalIP = () => {
10
+ const interfaces = os_1.default.networkInterfaces();
11
+ for (const iface of Object.values(interfaces)) {
12
+ if (!iface)
13
+ continue;
14
+ for (const config of iface) {
15
+ if (config.family === "IPv4" && !config.internal) {
16
+ return config.address;
17
+ }
18
+ }
19
+ }
20
+ };
21
+ const devIos = async (options) => {
22
+ const ip = getLocalIP();
23
+ const url = `http://${ip}:3000`; // TODO dynamic ssl and port ?
24
+ await (0, deployIos_1.deployIos)(url);
25
+ };
26
+ exports.devIos = devIos;
@@ -0,0 +1,4 @@
1
+ import { Command } from "commander";
2
+ declare const _default: Command;
3
+ export default _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;;AAGpC,wBAQe"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const commander_1 = require("commander");
4
+ const dev_1 = require("./dev");
5
+ exports.default = new commander_1.Command()
6
+ .name("dev")
7
+ .description("Description of command.")
8
+ .option("-h, --host", "Run nuxt dev server exposed to the local network.")
9
+ .option("--ios", "Run dev for ios. Runs nuxt dev host and deploys to ios device with server url.")
10
+ .action(dev_1.dev);
@@ -0,0 +1,2 @@
1
+ export declare const log: import("../../utils").Logger;
2
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/log.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,4BAAgB,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.log = void 0;
4
+ const utils_1 = require("../../utils");
5
+ exports.log = (0, utils_1.logger)("dev");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";AASA,wBASE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";AAUA,wBAUE"}
@@ -11,6 +11,7 @@ const reinstall_1 = __importDefault(require("./reinstall"));
11
11
  const release_1 = __importDefault(require("./release"));
12
12
  const version_1 = __importDefault(require("./version"));
13
13
  const upgrade_1 = __importDefault(require("./upgrade"));
14
+ const dev_1 = __importDefault(require("./dev"));
14
15
  exports.default = [
15
16
  deploy_1.default,
16
17
  version_1.default,
@@ -20,4 +21,5 @@ exports.default = [
20
21
  reinstall_1.default,
21
22
  generate_1.default,
22
23
  upgrade_1.default,
24
+ dev_1.default,
23
25
  ];