@gluhar/cli 2.5.2 → 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 +2 -2
- package/src/commands/deploy/deploy.js +1 -1
- package/src/commands/deploy/deployIos.d.ts +1 -2
- package/src/commands/deploy/deployIos.d.ts.map +1 -1
- package/src/commands/deploy/deployIos.js +16 -2
- package/src/commands/dev/DevOptions.d.ts +5 -0
- package/src/commands/dev/DevOptions.d.ts.map +1 -0
- package/src/commands/dev/DevOptions.js +2 -0
- package/src/commands/dev/dev.d.ts +3 -0
- package/src/commands/dev/dev.d.ts.map +1 -0
- package/src/commands/dev/dev.js +16 -0
- package/src/commands/dev/devIos.d.ts +3 -0
- package/src/commands/dev/devIos.d.ts.map +1 -0
- package/src/commands/dev/devIos.js +26 -0
- package/src/commands/dev/index.d.ts +4 -0
- package/src/commands/dev/index.d.ts.map +1 -0
- package/src/commands/dev/index.js +10 -0
- package/src/commands/dev/log.d.ts +2 -0
- package/src/commands/dev/log.d.ts.map +1 -0
- package/src/commands/dev/log.js +5 -0
- package/src/commands/index.d.ts.map +1 -1
- package/src/commands/index.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gluhar/cli",
|
|
3
|
-
"version": "2.
|
|
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": "
|
|
47
|
+
"gitHead": "72175524c372e2ad4fb7802436290bdd73ab8fd7"
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployIos.d.ts","sourceRoot":"","sources":["../../../../src/commands/deploy/deployIos.ts"],"names":[],"mappings":"
|
|
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 (
|
|
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")
|
|
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);
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/log.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,4BAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";AAUA,wBAUE"}
|
package/src/commands/index.js
CHANGED
|
@@ -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
|
];
|