@zuplo/cli 1.44.0 → 1.48.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/LICENSE.txt ADDED
File without changes
package/README.md CHANGED
@@ -4,13 +4,14 @@
4
4
  zup <command>
5
5
 
6
6
  Commands:
7
- zup convert Converts routes.json to routes.oas.json
8
- zup delete Deletes the zup at the URL
9
- zup deploy Deploys current Git branch of the current directory
10
- zup list Lists all deployed zups
11
- zup test Runs the tests under /tests against an endpoint
12
- zup tunnel Tunnel commands
13
- zup variable Environment Variable commands
7
+ zup convert Converts routes.json to routes.oas.json
8
+ zup delete Deletes the zup at the URL
9
+ zup deploy Deploys current Git branch of the current directory
10
+ zup dev Runs the zup locally
11
+ zup list Lists all deployed zups
12
+ zup test Runs the tests under /tests against an endpoint
13
+ zup tunnel Tunnel commands
14
+ zup variable Variable commands
14
15
 
15
16
  zup tunnel
16
17
 
package/dist/cli.js CHANGED
@@ -6,6 +6,7 @@ import yargs from "yargs/yargs";
6
6
  import convert from "./cmds/convert.js";
7
7
  import deleteZup from "./cmds/delete.js";
8
8
  import deploy from "./cmds/deploy.js";
9
+ import dev from "./cmds/dev.js";
9
10
  import list from "./cmds/list.js";
10
11
  import test from "./cmds/test.js";
11
12
  import tunnel from "./cmds/tunnel/index.js";
@@ -18,6 +19,7 @@ if (gte(process.versions.node, MIN_NODE_VERSION)) {
18
19
  .command(convert)
19
20
  .command(deleteZup)
20
21
  .command(deploy)
22
+ .command(dev)
21
23
  .command(list)
22
24
  .command(test)
23
25
  .command(tunnel)
@@ -0,0 +1,31 @@
1
+ import setBlocking from "../common/output.js";
2
+ import { ZuploProjectValidator } from "../common/validators/file-system-validator.js";
3
+ import { YargsChecker } from "../common/validators/lib.js";
4
+ import { dev } from "../dev/handler.js";
5
+ export default {
6
+ desc: "Runs the zup locally",
7
+ command: "dev",
8
+ builder: (yargs) => {
9
+ return yargs
10
+ .option("dir", {
11
+ type: "string",
12
+ describe: "The directory containing your zup",
13
+ default: ".",
14
+ normalize: true,
15
+ hidden: true,
16
+ })
17
+ .option("port", {
18
+ type: "number",
19
+ describe: "The port to run the zup on",
20
+ default: 9000,
21
+ })
22
+ .middleware([setBlocking])
23
+ .check(async (argv) => {
24
+ return await new YargsChecker(new ZuploProjectValidator()).check(argv);
25
+ });
26
+ },
27
+ handler: async (argv) => {
28
+ await dev(argv);
29
+ },
30
+ };
31
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1,26 @@
1
+ import { existsSync } from "node:fs";
2
+ import { dirname, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { logger } from "../logger.js";
5
+ export class MissingDenoExecutableError extends Error {
6
+ constructor() {
7
+ super("Missing executable: Cannot locate deno executable");
8
+ Object.setPrototypeOf(this, MissingDenoExecutableError.prototype);
9
+ }
10
+ }
11
+ export async function locateDenoExecutable() {
12
+ return locateDeno(dirname(fileURLToPath(import.meta.url)));
13
+ }
14
+ export async function locateDeno(dir) {
15
+ const DENO_EXECUTABLE = process.platform === "win32" ? "deno.exe" : "deno";
16
+ if (dir === ".") {
17
+ return undefined;
18
+ }
19
+ const pathToDeno = resolve(dir, "node_modules", "deno-bin", "bin", DENO_EXECUTABLE);
20
+ if (await existsSync(pathToDeno)) {
21
+ logger.debug(`Path to deno: ${pathToDeno}`);
22
+ return pathToDeno;
23
+ }
24
+ return locateDeno(dirname(dir));
25
+ }
26
+ //# sourceMappingURL=locator.js.map
@@ -0,0 +1,27 @@
1
+ import { cpSync, existsSync } from "node:fs";
2
+ import { join, relative, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { locateDenoExecutable } from "../common/deno-utils/locator.js";
5
+ export async function dev(argv) {
6
+ const sourceDirectory = resolve(join(relative(process.cwd(), argv.dir)));
7
+ const zuploRuntimePath = new URL("../../node_modules/@zuplo/runtime", import.meta.url);
8
+ if (existsSync(zuploRuntimePath)) {
9
+ cpSync(zuploRuntimePath, join(sourceDirectory, "node_modules/@zuplo/runtime"), {
10
+ recursive: true,
11
+ });
12
+ }
13
+ process.env.GLOBAL_MODULE_LOCATION = fileURLToPath(new URL("../../node_modules", import.meta.url));
14
+ process.env.DENO_EXECUTABLE = await locateDenoExecutable();
15
+ const core = await import("@zuplo/core");
16
+ const port = argv.port ?? 9000;
17
+ await core.default.startDevServer({
18
+ sourceDirectory,
19
+ port,
20
+ generateSourceMaps: true,
21
+ flags: {
22
+ remoteModules: false,
23
+ disableIntegratedDevPortalBuild: false,
24
+ },
25
+ });
26
+ }
27
+ //# sourceMappingURL=handler.js.map
@@ -1,30 +1,7 @@
1
1
  import { execa } from "execa";
2
- import { existsSync } from "node:fs";
3
- import { dirname, resolve } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
2
  import { TEST_OUT_FOLDER } from "../common/constants.js";
3
+ import { locateDenoExecutable, MissingDenoExecutableError, } from "../common/deno-utils/locator.js";
6
4
  import { logger } from "../common/logger.js";
7
- export class MissingDenoExecutableError extends Error {
8
- constructor() {
9
- super("Missing executable: Cannot locate deno executable");
10
- Object.setPrototypeOf(this, MissingDenoExecutableError.prototype);
11
- }
12
- }
13
- async function locateDenoExecutable() {
14
- return locateDeno(dirname(fileURLToPath(import.meta.url)));
15
- }
16
- async function locateDeno(dir) {
17
- const DENO_EXECUTABLE = process.platform === "win32" ? "deno.exe" : "deno";
18
- if (dir === ".") {
19
- return undefined;
20
- }
21
- const pathToDeno = resolve(dir, "node_modules", "deno-bin", "bin", DENO_EXECUTABLE);
22
- if (await existsSync(pathToDeno)) {
23
- logger.debug(`Path to deno: ${pathToDeno}`);
24
- return pathToDeno;
25
- }
26
- return locateDeno(dirname(dir));
27
- }
28
5
  export async function runTests(argv) {
29
6
  const denoExecutable = await locateDenoExecutable();
30
7
  if (denoExecutable) {
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "1.44.0",
3
+ "version": "1.48.0",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/zuplo/cli",
6
6
  "author": "Zuplo, Inc.",
7
- "license": "Copyright 2022",
7
+ "license": "See LICENSE in LICENSE.txt",
8
8
  "scripts": {
9
9
  "build": "tsc --build",
10
10
  "test": "mocha",
11
- "test:debug": "mocha --timeout 0"
11
+ "test:debug": "mocha --timeout 0",
12
+ "prepack": "scripts/prepack.mjs"
12
13
  },
13
14
  "engines": {
14
15
  "node": ">=18.0.0"
@@ -49,19 +50,24 @@
49
50
  "typescript": "5.0.3"
50
51
  },
51
52
  "dependencies": {
53
+ "@swc/core": "1.3.78",
54
+ "@zuplo/core": "5.1206.0",
55
+ "@zuplo/runtime": "5.1206.0",
52
56
  "chalk": "^5.1.2",
53
57
  "deno-bin": "1.31.1",
54
58
  "dotenv": "^16.0.3",
55
- "esbuild": "^0.15.18",
59
+ "esbuild": "0.18.6",
56
60
  "execa": "^6.1.0",
57
61
  "fast-glob": "^3.2.12",
58
62
  "ignore": "^5.2.4",
59
63
  "jsonc-parser": "^3.2.0",
64
+ "jose": "^4.14.4",
60
65
  "pino": "^8.11.0",
61
66
  "pino-pretty": "^9.4.0",
62
67
  "prettier": "^2.8.7",
63
68
  "rimraf": "^3.0.2",
64
- "semver": "^7.3.8",
69
+ "rollup-plugin-node-polyfills": "^0.2.1",
70
+ "semver": "^7.5.2",
65
71
  "simple-git": "^3.17.0",
66
72
  "tar": "^6.1.13",
67
73
  "temp": "^0.9.4",
package/.mocharc.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extension": ["js"],
3
- "spec": "dist/**/*.spec.js",
4
- "enable-source-maps": true,
5
- "timeout": 5000
6
- }