@zuplo/cli 6.62.16 → 6.63.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/dist/__tests__/integration/deploy.integration.test.js +59 -2
- package/dist/__tests__/integration/deploy.integration.test.js.map +1 -1
- package/dist/__tests__/integration/jest-mocks-setup.js +3 -6
- package/dist/__tests__/integration/jest-mocks-setup.js.map +1 -1
- package/dist/__tests__/integration/link.integration.test.js +11 -51
- package/dist/__tests__/integration/link.integration.test.js.map +1 -1
- package/dist/cli.js +0 -2
- package/dist/cli.js.map +1 -1
- package/dist/cmds/compile.d.ts +1 -0
- package/dist/cmds/compile.d.ts.map +1 -1
- package/dist/cmds/compile.js +1 -0
- package/dist/cmds/compile.js.map +1 -1
- package/dist/cmds/delete.d.ts.map +1 -1
- package/dist/cmds/delete.js +14 -0
- package/dist/cmds/delete.js.map +1 -1
- package/dist/cmds/deploy.d.ts.map +1 -1
- package/dist/cmds/deploy.js +22 -0
- package/dist/cmds/deploy.js.map +1 -1
- package/dist/cmds/dev.d.ts.map +1 -1
- package/dist/cmds/dev.js +15 -0
- package/dist/cmds/dev.js.map +1 -1
- package/dist/cmds/link.d.ts.map +1 -1
- package/dist/cmds/link.js +19 -1
- package/dist/cmds/link.js.map +1 -1
- package/dist/cmds/list.d.ts.map +1 -1
- package/dist/cmds/list.js +15 -1
- package/dist/cmds/list.js.map +1 -1
- package/dist/cmds/test.d.ts.map +1 -1
- package/dist/cmds/test.js +18 -0
- package/dist/cmds/test.js.map +1 -1
- package/dist/common/middleware/user-configuration.js +3 -3
- package/dist/common/middleware/user-configuration.js.map +1 -1
- package/dist/common/populate.js +3 -3
- package/dist/common/populate.js.map +1 -1
- package/dist/deploy/archive.d.ts.map +1 -1
- package/dist/deploy/archive.js +11 -6
- package/dist/deploy/archive.js.map +1 -1
- package/dist/deploy/archive.test.d.ts +2 -0
- package/dist/deploy/archive.test.d.ts.map +1 -0
- package/dist/deploy/archive.test.js +245 -0
- package/dist/deploy/archive.test.js.map +1 -0
- package/dist/editor/handler.d.ts.map +1 -1
- package/dist/editor/handler.js +2 -1
- package/dist/editor/handler.js.map +1 -1
- package/dist/list/handler.js +2 -2
- package/dist/list/handler.js.map +1 -1
- package/dist/source/migrate/dev-portal/handler.js +1 -0
- package/dist/source/migrate/dev-portal/handler.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/__tests__/engine.test.d.ts +0 -2
- package/dist/__tests__/engine.test.d.ts.map +0 -1
- package/dist/__tests__/engine.test.js +0 -299
- package/dist/__tests__/engine.test.js.map +0 -1
- package/dist/cmds/convert.d.ts +0 -9
- package/dist/cmds/convert.d.ts.map +0 -1
- package/dist/cmds/convert.js +0 -24
- package/dist/cmds/convert.js.map +0 -1
- package/dist/convert/engine.d.ts +0 -14
- package/dist/convert/engine.d.ts.map +0 -1
- package/dist/convert/engine.js +0 -73
- package/dist/convert/engine.js.map +0 -1
- package/dist/convert/handler.d.ts +0 -5
- package/dist/convert/handler.d.ts.map +0 -1
- package/dist/convert/handler.js +0 -35
- package/dist/convert/handler.js.map +0 -1
- package/dist/convert/routes.legacy.d.ts +0 -88
- package/dist/convert/routes.legacy.d.ts.map +0 -1
- package/dist/convert/routes.legacy.js +0 -2
- package/dist/convert/routes.legacy.js.map +0 -1
package/dist/cmds/compile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/cmds/compile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAa,OAAO,EAAE,M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U,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;aACnC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACpB,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBAExB,OAAO,IAAI,CAAC;YACd,CAAC;iBAAM,CAAC;gBACN,OAAO,MAAM,IAAI,YAAY,CAC3B,IAAI,qBAAqB,EAAE,CAC5B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;QACrD,MAAM,OAAO,CAAC,IAAiB,CAAC,CAAC;IACnC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { ZuploProjectValidator } from \"../common/validators/file-system-validator.js\";\nimport { YargsChecker } from \"../common/validators/lib.js\";\nimport { Arguments, compile } from \"../compile/handler.js\";\n\nexport default {\n // For now, hide this command\n desc: false,\n hide: true,\n // desc: \"Compiles a self-contained Zuplo API binary\",\n command: \"compile\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"bundled-dir\", {\n type: \"string\",\n describe:\n \"The directory representing a built Zuplo API's sources. Use to skip build and bundling.\",\n hidden: true,\n })\n .option(\"port\", {\n type: \"number\",\n describe: \"The port to run the Zuplo API server on\",\n default: 9000,\n })\n .option(\"binary-name\", {\n type: \"string\",\n describe: \"The name of the binary\",\n default: \"compiled-zup\",\n })\n .option(\"build-id\", {\n type: \"string\",\n describe: \"The buildId to use for remote assets\",\n default: \"\",\n hidden: true,\n })\n .middleware([setBlocking, identify])\n .check(async (argv) => {\n if (argv[\"bundled-dir\"]) {\n // By pass the checks because the user already has a bundled-script\n return true;\n } else {\n return await new YargsChecker<typeof argv>(\n new ZuploProjectValidator()\n ).check(argv);\n }\n });\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo compile\" });\n await compile(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/cmds/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAaV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/cmds/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAaV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAoDf,OAAO;;AAvD/B,wBA2DE"}
|
package/dist/cmds/delete.js
CHANGED
|
@@ -38,6 +38,20 @@ export default {
|
|
|
38
38
|
})
|
|
39
39
|
.boolean("wait")
|
|
40
40
|
.demandOption(["url"])
|
|
41
|
+
.example([
|
|
42
|
+
[
|
|
43
|
+
"$0 delete --url https://my-api-dev-123abc.zuplo.app --api-key YOUR_API_KEY",
|
|
44
|
+
"Delete a deployed environment by its URL",
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"$0 delete --url https://my-api-dev-123abc.zuplo.app --api-key YOUR_API_KEY --wait",
|
|
48
|
+
"Delete an environment and wait until the deletion is complete",
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
"$0 delete --url https://my-api-dev-123abc.zuplo.app --api-key YOUR_API_KEY --project my-project --account my-account",
|
|
52
|
+
"Delete with explicit project and account specification",
|
|
53
|
+
],
|
|
54
|
+
])
|
|
41
55
|
.middleware([
|
|
42
56
|
setBlocking,
|
|
43
57
|
authenticate,
|
package/dist/cmds/delete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/cmds/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE,eAAe;IACb,IAAI,EAAE,kCAAkC;IACxC,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,oCAAoC;SAC/C,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACd,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,oDAAoD;SAC/D,CAAC;aACD,MAAM,CAAC,sBAAsB,EAAE;YAC9B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uDAAuD;SAClE,CAAC;aACD,OAAO,CAAC,MAAM,CAAC;aACf,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC;aACrB,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;QACpD,MAAM,SAAS,CAAC,IAAiB,CAAC,CAAC;IACrC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { authenticate } from \"../common/middleware/authentication.js\";\nimport { configure } from \"../common/middleware/user-configuration.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { Arguments, deleteZup } from \"../delete/handler.js\";\nimport { fetchAccount } from \"../common/middleware/get-account-param.js\";\nimport { fetchProject } from \"../common/middleware/get-project-param.js\";\n\nexport default {\n desc: \"Deletes the Zuplo API at the URL\",\n command: \"delete\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .option(\"url\", {\n type: \"string\",\n describe: \"The URL of the Zuplo API to delete\",\n })\n .option(\"project\", {\n type: \"string\",\n describe: \"The project name\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"wait\", {\n type: \"boolean\",\n describe: \"Should the CLI wait until the Zuplo API is deleted\",\n })\n .option(\"self-hosted-endpoint\", {\n type: \"string\",\n describe: \"The endpoint of your self-hosted service to deploy to\",\n })\n .boolean(\"wait\")\n .demandOption([\"url\"])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n fetchProject,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo delete\" });\n await deleteZup(argv as Arguments);\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/cmds/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE,eAAe;IACb,IAAI,EAAE,kCAAkC;IACxC,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,oCAAoC;SAC/C,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACd,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,oDAAoD;SAC/D,CAAC;aACD,MAAM,CAAC,sBAAsB,EAAE;YAC9B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uDAAuD;SAClE,CAAC;aACD,OAAO,CAAC,MAAM,CAAC;aACf,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC;aACrB,OAAO,CAAC;YACP;gBACE,4EAA4E;gBAC5E,0CAA0C;aAC3C;YACD;gBACE,mFAAmF;gBACnF,+DAA+D;aAChE;YACD;gBACE,sHAAsH;gBACtH,wDAAwD;aACzD;SACF,CAAC;aACD,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;QACpD,MAAM,SAAS,CAAC,IAAiB,CAAC,CAAC;IACrC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { authenticate } from \"../common/middleware/authentication.js\";\nimport { configure } from \"../common/middleware/user-configuration.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { Arguments, deleteZup } from \"../delete/handler.js\";\nimport { fetchAccount } from \"../common/middleware/get-account-param.js\";\nimport { fetchProject } from \"../common/middleware/get-project-param.js\";\n\nexport default {\n desc: \"Deletes the Zuplo API at the URL\",\n command: \"delete\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .option(\"url\", {\n type: \"string\",\n describe: \"The URL of the Zuplo API to delete\",\n })\n .option(\"project\", {\n type: \"string\",\n describe: \"The project name\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"wait\", {\n type: \"boolean\",\n describe: \"Should the CLI wait until the Zuplo API is deleted\",\n })\n .option(\"self-hosted-endpoint\", {\n type: \"string\",\n describe: \"The endpoint of your self-hosted service to deploy to\",\n })\n .boolean(\"wait\")\n .demandOption([\"url\"])\n .example([\n [\n \"$0 delete --url https://my-api-dev-123abc.zuplo.app --api-key YOUR_API_KEY\",\n \"Delete a deployed environment by its URL\",\n ],\n [\n \"$0 delete --url https://my-api-dev-123abc.zuplo.app --api-key YOUR_API_KEY --wait\",\n \"Delete an environment and wait until the deletion is complete\",\n ],\n [\n \"$0 delete --url https://my-api-dev-123abc.zuplo.app --api-key YOUR_API_KEY --project my-project --account my-account\",\n \"Delete with explicit project and account specification\",\n ],\n ])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n fetchProject,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo delete\" });\n await deleteZup(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAcV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAcV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAoFf,OAAO;;AAvF/B,wBA2FE"}
|
package/dist/cmds/deploy.js
CHANGED
|
@@ -59,6 +59,28 @@ export default {
|
|
|
59
59
|
default: false,
|
|
60
60
|
})
|
|
61
61
|
.boolean("verify-remote")
|
|
62
|
+
.example([
|
|
63
|
+
[
|
|
64
|
+
"$0 deploy --api-key YOUR_API_KEY",
|
|
65
|
+
"Deploy the current Git branch using the branch name as the environment name",
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
"$0 deploy --api-key YOUR_API_KEY --environment production",
|
|
69
|
+
"Deploy to a specific environment name instead of using the Git branch name",
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"$0 deploy --api-key YOUR_API_KEY --account my-account",
|
|
73
|
+
"Deploy to a project in a specific account",
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
"ZUPLO_API_KEY=YOUR_API_KEY $0 deploy",
|
|
77
|
+
"Use environment variable for API key",
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
"git checkout -b my-feature && $0 deploy",
|
|
81
|
+
"Create a new branch and deploy it as a new environment",
|
|
82
|
+
],
|
|
83
|
+
])
|
|
62
84
|
.middleware([
|
|
63
85
|
setBlocking,
|
|
64
86
|
authenticate,
|
package/dist/cmds/deploy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEjF,eAAe;IACb,IAAI,EAAE,qDAAqD;IAC3D,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;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AAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;QACpD,MAAM,MAAM,CAAC,IAAiB,CAAC,CAAC;IAClC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { authenticate } from \"../common/middleware/authentication.js\";\nimport { configure } from \"../common/middleware/user-configuration.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { Arguments, deploy } from \"../deploy/handler.js\";\nimport { fetchAccount } from \"../common/middleware/get-account-param.js\";\nimport { fetchProject } from \"../common/middleware/get-project-param.js\";\nimport { fetchEnvironment } from \"../common/middleware/get-environment-param.js\";\n\nexport default {\n desc: \"Deploys current Git branch of the current directory\",\n command: \"deploy\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .option(\"project\", {\n type: \"string\",\n hidden: true,\n describe: \"The project name\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"verify-remote\", {\n deprecated: true,\n type: \"boolean\",\n describe:\n \"Verify that this Git repository matches the one configured on Zuplo. Use --no-verify-remote to disable.\",\n default: false,\n })\n .option(\"environment\", {\n type: \"string\",\n describe:\n \"The value to use for environment name, instead of the current branch name\",\n })\n .option(\"self-hosted-endpoint\", {\n type: \"string\",\n describe: \"The endpoint of your self-hosted service to deploy to\",\n })\n .option(\"override-repo-url\", {\n type: \"string\",\n describe: \"Override the repo url reference\",\n default: undefined,\n hidden: true,\n })\n .option(\"fetch-environments\", {\n type: \"boolean\",\n describe:\n \"Fetch the environments for your project from Zuplo. If this is false, then the environment will automatically be detected from the git branch.\",\n default: false,\n })\n .boolean(\"verify-remote\")\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n fetchProject,\n fetchEnvironment,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo deploy\" });\n await deploy(argv as Arguments);\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEjF,eAAe;IACb,IAAI,EAAE,qDAAqD;IAC3D,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;YACnD,OAAO,EAAE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;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { authenticate } from \"../common/middleware/authentication.js\";\nimport { configure } from \"../common/middleware/user-configuration.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { Arguments, deploy } from \"../deploy/handler.js\";\nimport { fetchAccount } from \"../common/middleware/get-account-param.js\";\nimport { fetchProject } from \"../common/middleware/get-project-param.js\";\nimport { fetchEnvironment } from \"../common/middleware/get-environment-param.js\";\n\nexport default {\n desc: \"Deploys current Git branch of the current directory\",\n command: \"deploy\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .option(\"project\", {\n type: \"string\",\n hidden: true,\n describe: \"The project name\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"verify-remote\", {\n deprecated: true,\n type: \"boolean\",\n describe:\n \"Verify that this Git repository matches the one configured on Zuplo. Use --no-verify-remote to disable.\",\n default: false,\n })\n .option(\"environment\", {\n type: \"string\",\n describe:\n \"The value to use for environment name, instead of the current branch name\",\n })\n .option(\"self-hosted-endpoint\", {\n type: \"string\",\n describe: \"The endpoint of your self-hosted service to deploy to\",\n })\n .option(\"override-repo-url\", {\n type: \"string\",\n describe: \"Override the repo url reference\",\n default: undefined,\n hidden: true,\n })\n .option(\"fetch-environments\", {\n type: \"boolean\",\n describe:\n \"Fetch the environments for your project from Zuplo. If this is false, then the environment will automatically be detected from the git branch.\",\n default: false,\n })\n .boolean(\"verify-remote\")\n .example([\n [\n \"$0 deploy --api-key YOUR_API_KEY\",\n \"Deploy the current Git branch using the branch name as the environment name\",\n ],\n [\n \"$0 deploy --api-key YOUR_API_KEY --environment production\",\n \"Deploy to a specific environment name instead of using the Git branch name\",\n ],\n [\n \"$0 deploy --api-key YOUR_API_KEY --account my-account\",\n \"Deploy to a project in a specific account\",\n ],\n [\n \"ZUPLO_API_KEY=YOUR_API_KEY $0 deploy\",\n \"Use environment variable for API key\",\n ],\n [\n \"git checkout -b my-feature && $0 deploy\",\n \"Create a new branch and deploy it as a new environment\",\n ],\n ])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n fetchProject,\n fetchEnvironment,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo deploy\" });\n await deploy(argv as Arguments);\n },\n};\n"]}
|
package/dist/cmds/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cmds/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAWV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cmds/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAWV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAuDf,OAAO;;AA1D/B,wBAuEE"}
|
package/dist/cmds/dev.js
CHANGED
|
@@ -40,6 +40,21 @@ export default {
|
|
|
40
40
|
describe: "Unsafely ignore certificate errors",
|
|
41
41
|
default: false,
|
|
42
42
|
})
|
|
43
|
+
.example([
|
|
44
|
+
[
|
|
45
|
+
"$0 dev",
|
|
46
|
+
"Start the local development server with default settings (port 9000 for API, port 9100 for editor)",
|
|
47
|
+
],
|
|
48
|
+
["$0 dev --port 8080", "Start the local server on a custom port"],
|
|
49
|
+
[
|
|
50
|
+
"$0 dev --no-start-editor",
|
|
51
|
+
"Start only the API server without opening the editor",
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"$0 dev --debug-port 9229",
|
|
55
|
+
"Start with Chrome DevTools inspector enabled on port 9229",
|
|
56
|
+
],
|
|
57
|
+
])
|
|
43
58
|
.middleware([setBlocking, identify])
|
|
44
59
|
.check(async (argv) => {
|
|
45
60
|
return await new YargsChecker(new ZuploProjectValidator()).check(argv);
|
package/dist/cmds/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/cmds/dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAa,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAe;IACb,IAAI,EAAE,4BAA4B;IAClC,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;YACnD,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC;aACD,MAAM,CAAC,cAAc,EAAE;YACtB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,wCAAwC;YAClD,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,qCAAqC;YAC/C,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,aAAa,EAAE;YACrB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uCAAuC;YACjD,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,YAAY,EAAE;YACpB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;SACpD,CAAC;aACD,MAAM,CAAC,oCAAoC,EAAE;YAC5C,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,oCAAoC;YAC9C,OAAO,EAAE,KAAK;SACf,CAAC;aACD,UAAU,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;aACnC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACpB,OAAO,MAAM,IAAI,YAAY,CAC3B,IAAI,qBAAqB,EAAE,CAC5B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC;YACjB,IAAI;YACJ,UAAU,EAAE;gBACV,YAAY,EAAG,IAAkB,CAAC,WAAW,CAAC;gBAC9C,oCAAoC,EAAG,IAAkB,CACvD,iCAAiC,CAClC;aACF;YACD,KAAK,EAAE,WAAW;SACnB,CAAC,CAAC;QACH,MAAM,GAAG,CAAC,IAAiB,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { ZuploProjectValidator } from \"../common/validators/file-system-validator.js\";\nimport { YargsChecker } from \"../common/validators/lib.js\";\nimport { Arguments, dev } from \"../dev/handler.js\";\n\nexport default {\n desc: \"Runs the Zuplo API locally\",\n command: \"dev\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"start-editor\", {\n type: \"boolean\",\n describe: \"Start the editor with the local server\",\n default: true,\n })\n .option(\"port\", {\n type: \"number\",\n describe: \"The port to run the local server on\",\n default: 9000,\n })\n .option(\"editor-port\", {\n type: \"number\",\n describe: \"The port to run the route designer on\",\n default: 9100,\n })\n .option(\"debug-port\", {\n type: \"number\",\n describe: \"The port to run the Chrome inspector on\",\n })\n .option(\"unsafely-ignore-certificate-errors\", {\n type: \"boolean\",\n describe: \"Unsafely ignore certificate errors\",\n default: false,\n })\n .middleware([setBlocking, identify])\n .check(async (argv) => {\n return await new YargsChecker<typeof argv>(\n new ZuploProjectValidator()\n ).check(argv);\n });\n },\n handler: async (argv: unknown) => {\n await captureEvent({\n argv,\n properties: {\n \"debug-port\": (argv as Arguments)[\"debugPort\"],\n \"unsafely-ignore-certificate-errors\": (argv as Arguments)[\n \"unsafelyIgnoreCertificateErrors\"\n ],\n },\n event: \"zuplo dev\",\n });\n await dev(argv as Arguments);\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/cmds/dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAa,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAe;IACb,IAAI,EAAE,4BAA4B;IAClC,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;YACnD,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC;aACD,MAAM,CAAC,cAAc,E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iB,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { ZuploProjectValidator } from \"../common/validators/file-system-validator.js\";\nimport { YargsChecker } from \"../common/validators/lib.js\";\nimport { Arguments, dev } from \"../dev/handler.js\";\n\nexport default {\n desc: \"Runs the Zuplo API locally\",\n command: \"dev\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"start-editor\", {\n type: \"boolean\",\n describe: \"Start the editor with the local server\",\n default: true,\n })\n .option(\"port\", {\n type: \"number\",\n describe: \"The port to run the local server on\",\n default: 9000,\n })\n .option(\"editor-port\", {\n type: \"number\",\n describe: \"The port to run the route designer on\",\n default: 9100,\n })\n .option(\"debug-port\", {\n type: \"number\",\n describe: \"The port to run the Chrome inspector on\",\n })\n .option(\"unsafely-ignore-certificate-errors\", {\n type: \"boolean\",\n describe: \"Unsafely ignore certificate errors\",\n default: false,\n })\n .example([\n [\n \"$0 dev\",\n \"Start the local development server with default settings (port 9000 for API, port 9100 for editor)\",\n ],\n [\"$0 dev --port 8080\", \"Start the local server on a custom port\"],\n [\n \"$0 dev --no-start-editor\",\n \"Start only the API server without opening the editor\",\n ],\n [\n \"$0 dev --debug-port 9229\",\n \"Start with Chrome DevTools inspector enabled on port 9229\",\n ],\n ])\n .middleware([setBlocking, identify])\n .check(async (argv) => {\n return await new YargsChecker<typeof argv>(\n new ZuploProjectValidator()\n ).check(argv);\n });\n },\n handler: async (argv: unknown) => {\n await captureEvent({\n argv,\n properties: {\n \"debug-port\": (argv as Arguments)[\"debugPort\"],\n \"unsafely-ignore-certificate-errors\": (argv as Arguments)[\n \"unsafelyIgnoreCertificateErrors\"\n ],\n },\n event: \"zuplo dev\",\n });\n await dev(argv as Arguments);\n },\n};\n"]}
|
package/dist/cmds/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/cmds/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAcV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/cmds/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAcV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBA4Df,OAAO;;AA/D/B,wBAmEE"}
|
package/dist/cmds/link.js
CHANGED
|
@@ -8,7 +8,7 @@ import { fetchAccount } from "../common/middleware/get-account-param.js";
|
|
|
8
8
|
import { fetchProject } from "../common/middleware/get-project-param.js";
|
|
9
9
|
import { fetchEnvironment } from "../common/middleware/get-environment-param.js";
|
|
10
10
|
export default {
|
|
11
|
-
desc: "Links information from your Zuplo account to your local machine",
|
|
11
|
+
desc: "Links information from your Zuplo account to your local machine allowing",
|
|
12
12
|
command: "link",
|
|
13
13
|
builder: (yargs) => {
|
|
14
14
|
return yargs
|
|
@@ -41,6 +41,24 @@ export default {
|
|
|
41
41
|
describe: "Fetch the environments for your project from Zuplo. If this is false, then the environment will automatically be detected from the git branch.",
|
|
42
42
|
default: true,
|
|
43
43
|
})
|
|
44
|
+
.example([
|
|
45
|
+
[
|
|
46
|
+
"$0 link --api-key YOUR_API_KEY",
|
|
47
|
+
"Link your local project to your Zuplo account",
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"$0 link --api-key YOUR_API_KEY --project my-project --account my-account",
|
|
51
|
+
"Link to a specific project and account",
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"$0 link --api-key YOUR_API_KEY --environment production",
|
|
55
|
+
"Link to a specific environment",
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
"ZUPLO_API_KEY=YOUR_API_KEY $0 link",
|
|
59
|
+
"Use environment variable for API key",
|
|
60
|
+
],
|
|
61
|
+
])
|
|
44
62
|
.middleware([
|
|
45
63
|
setBlocking,
|
|
46
64
|
authenticate,
|
package/dist/cmds/link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/cmds/link.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEjF,eAAe;IACb,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/cmds/link.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,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AE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,IAAiB,CAAC,CAAC;IAChC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { authenticate } from \"../common/middleware/authentication.js\";\nimport { configure } from \"../common/middleware/user-configuration.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { Arguments, link } from \"../link/handler.js\";\nimport { fetchAccount } from \"../common/middleware/get-account-param.js\";\nimport { fetchProject } from \"../common/middleware/get-project-param.js\";\nimport { fetchEnvironment } from \"../common/middleware/get-environment-param.js\";\n\nexport default {\n desc: \"Links information from your Zuplo account to your local machine allowing\",\n command: \"link\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .option(\"project\", {\n type: \"string\",\n describe: \"The project name\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"environment\", {\n type: \"string\",\n describe: \"The environment name\",\n })\n .option(\"fetch-environments\", {\n type: \"boolean\",\n describe:\n \"Fetch the environments for your project from Zuplo. If this is false, then the environment will automatically be detected from the git branch.\",\n default: true,\n })\n .example([\n [\n \"$0 link --api-key YOUR_API_KEY\",\n \"Link your local project to your Zuplo account\",\n ],\n [\n \"$0 link --api-key YOUR_API_KEY --project my-project --account my-account\",\n \"Link to a specific project and account\",\n ],\n [\n \"$0 link --api-key YOUR_API_KEY --environment production\",\n \"Link to a specific environment\",\n ],\n [\n \"ZUPLO_API_KEY=YOUR_API_KEY $0 link\",\n \"Use environment variable for API key\",\n ],\n ])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n fetchProject,\n fetchEnvironment,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo link\" });\n await link(argv as Arguments);\n },\n};\n"]}
|
package/dist/cmds/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/cmds/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAaV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/cmds/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAaV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBA0Cf,OAAO;;AA7C/B,wBAiDE"}
|
package/dist/cmds/list.js
CHANGED
|
@@ -7,7 +7,7 @@ import { list } from "../list/handler.js";
|
|
|
7
7
|
import { fetchAccount } from "../common/middleware/get-account-param.js";
|
|
8
8
|
import { fetchProject } from "../common/middleware/get-project-param.js";
|
|
9
9
|
export default {
|
|
10
|
-
desc: "Lists all deployed
|
|
10
|
+
desc: "Lists all deployed Zuplo APIs",
|
|
11
11
|
command: "list",
|
|
12
12
|
builder: (yargs) => {
|
|
13
13
|
return yargs
|
|
@@ -28,6 +28,20 @@ export default {
|
|
|
28
28
|
type: "string",
|
|
29
29
|
describe: "The endpoint of your self-hosted service to deploy to",
|
|
30
30
|
})
|
|
31
|
+
.example([
|
|
32
|
+
[
|
|
33
|
+
"$0 list --api-key YOUR_API_KEY",
|
|
34
|
+
"List all deployed environments for your project",
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
"$0 list --api-key YOUR_API_KEY --project my-project --account my-account",
|
|
38
|
+
"List environments for a specific project and account",
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
"ZUPLO_API_KEY=YOUR_API_KEY $0 list",
|
|
42
|
+
"Use environment variable for API key",
|
|
43
|
+
],
|
|
44
|
+
])
|
|
31
45
|
.middleware([
|
|
32
46
|
setBlocking,
|
|
33
47
|
authenticate,
|
package/dist/cmds/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/cmds/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE,eAAe;IACb,IAAI,EAAE
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/cmds/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE,eAAe;IACb,IAAI,EAAE,+BAA+B;IACrC,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,sBAAsB,EAAE;YAC9B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uDAAuD;SAClE,CAAC;aACD,OAAO,CAAC;YACP;gBACE,gCAAgC;gBAChC,iDAAiD;aAClD;YACD;gBACE,0EAA0E;gBAC1E,sDAAsD;aACvD;YACD;gBACE,oCAAoC;gBACpC,sCAAsC;aACvC;SACF,CAAC;aACD,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,IAAiB,CAAC,CAAC;IAChC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { authenticate } from \"../common/middleware/authentication.js\";\nimport { configure } from \"../common/middleware/user-configuration.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { Arguments, list } from \"../list/handler.js\";\nimport { fetchAccount } from \"../common/middleware/get-account-param.js\";\nimport { fetchProject } from \"../common/middleware/get-project-param.js\";\n\nexport default {\n desc: \"Lists all deployed Zuplo APIs\",\n command: \"list\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .option(\"project\", {\n type: \"string\",\n describe: \"The project name\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"self-hosted-endpoint\", {\n type: \"string\",\n describe: \"The endpoint of your self-hosted service to deploy to\",\n })\n .example([\n [\n \"$0 list --api-key YOUR_API_KEY\",\n \"List all deployed environments for your project\",\n ],\n [\n \"$0 list --api-key YOUR_API_KEY --project my-project --account my-account\",\n \"List environments for a specific project and account\",\n ],\n [\n \"ZUPLO_API_KEY=YOUR_API_KEY $0 list\",\n \"Use environment variable for API key\",\n ],\n ])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n fetchProject,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo list\" });\n await list(argv as Arguments);\n },\n};\n"]}
|
package/dist/cmds/test.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/cmds/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAWV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/cmds/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAWV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBA2Cf,OAAO;;AA9C/B,wBAkDE"}
|
package/dist/cmds/test.js
CHANGED
|
@@ -24,6 +24,24 @@ export default {
|
|
|
24
24
|
normalize: true,
|
|
25
25
|
hidden: true,
|
|
26
26
|
})
|
|
27
|
+
.example([
|
|
28
|
+
[
|
|
29
|
+
"$0 test --endpoint https://your-api-123abc.zuplo.app",
|
|
30
|
+
"Run all tests against your deployed API",
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
"$0 test --endpoint https://your-api-123abc.zuplo.app --filter 'auth'",
|
|
34
|
+
"Run only tests matching 'auth' in their name",
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
"$0 test --endpoint https://your-api-123abc.zuplo.app --filter '/api\\/v1/'",
|
|
38
|
+
"Run tests matching a regex pattern",
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
"MY_VAR=example $0 test --endpoint https://your-api-123abc.zuplo.app",
|
|
42
|
+
"Run tests with environment variables",
|
|
43
|
+
],
|
|
44
|
+
])
|
|
27
45
|
.check(async (argv) => {
|
|
28
46
|
return await new YargsChecker(validTestDirectoryValidator).check(argv);
|
|
29
47
|
})
|
package/dist/cmds/test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/cmds/test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAa,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAe;IACb,IAAI,EAAE,iDAAiD;IACvD,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,UAAU,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,0CAA0C;SACrD,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,IAAI,EAAE,QAAQ;YACd,QAAQ,EACN,gGAAgG;SACnG,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;YACnD,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC;aACD,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACpB,OAAO,MAAM,IAAI,YAAY,CAC3B,2BAA2B,CAC5B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC;aACD,UAAU,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,IAAiB,CAAC,CAAC;IAChC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { validTestDirectoryValidator } from \"../common/validators/file-system-validator.js\";\nimport { YargsChecker } from \"../common/validators/lib.js\";\nimport { Arguments, test } from \"../test/handler.js\";\n\nexport default {\n desc: \"Runs the tests under /tests against an endpoint\",\n command: \"test\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"endpoint\", {\n type: \"string\",\n describe: \"The URL of the Zuplo API to test against\",\n })\n .option(\"filter\", {\n type: \"string\",\n describe:\n \"A filter to run a subset of tests (e.g., --filter 'test name' or --filter '/test-name-regex/')\",\n })\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .check(async (argv) => {\n return await new YargsChecker<typeof argv>(\n validTestDirectoryValidator\n ).check(argv);\n })\n .middleware([setBlocking, identify]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo test\" });\n await test(argv as Arguments);\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/cmds/test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAa,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAe;IACb,IAAI,EAAE,iDAAiD;IACvD,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,UAAU,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,0CAA0C;SACrD,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,IAAI,EAAE,QAAQ;YACd,QAAQ,EACN,gGAAgG;SACnG,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;YACnD,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC;aACD,OAAO,CAAC;YACP;gBACE,sDAAsD;gBACtD,yCAAyC;aAC1C;YACD;gBACE,sEAAsE;gBACtE,8CAA8C;aAC/C;YACD;gBACE,4EAA4E;gBAC5E,oCAAoC;aACrC;YACD;gBACE,qEAAqE;gBACrE,sCAAsC;aACvC;SACF,CAAC;aACD,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACpB,OAAO,MAAM,IAAI,YAAY,CAC3B,2BAA2B,CAC5B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC;aACD,UAAU,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,IAAiB,CAAC,CAAC;IAChC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { validTestDirectoryValidator } from \"../common/validators/file-system-validator.js\";\nimport { YargsChecker } from \"../common/validators/lib.js\";\nimport { Arguments, test } from \"../test/handler.js\";\n\nexport default {\n desc: \"Runs the tests under /tests against an endpoint\",\n command: \"test\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"endpoint\", {\n type: \"string\",\n describe: \"The URL of the Zuplo API to test against\",\n })\n .option(\"filter\", {\n type: \"string\",\n describe:\n \"A filter to run a subset of tests (e.g., --filter 'test name' or --filter '/test-name-regex/')\",\n })\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .example([\n [\n \"$0 test --endpoint https://your-api-123abc.zuplo.app\",\n \"Run all tests against your deployed API\",\n ],\n [\n \"$0 test --endpoint https://your-api-123abc.zuplo.app --filter 'auth'\",\n \"Run only tests matching 'auth' in their name\",\n ],\n [\n \"$0 test --endpoint https://your-api-123abc.zuplo.app --filter '/api\\\\/v1/'\",\n \"Run tests matching a regex pattern\",\n ],\n [\n \"MY_VAR=example $0 test --endpoint https://your-api-123abc.zuplo.app\",\n \"Run tests with environment variables\",\n ],\n ])\n .check(async (argv) => {\n return await new YargsChecker<typeof argv>(\n validTestDirectoryValidator\n ).check(argv);\n })\n .middleware([setBlocking, identify]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo test\" });\n await test(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
|
-
import { join,
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
4
|
import { parse } from "jsonc-parser";
|
|
5
5
|
import { ZUPLO_FALLBACK_JSON_FILE, ZUPLO_PREFERRED_JSON_FILE, } from "../constants.js";
|
|
6
6
|
import { logger } from "../logger.js";
|
|
@@ -29,8 +29,8 @@ export async function configure(argv) {
|
|
|
29
29
|
await printCriticalFailureToConsoleAndExit("Error: Failed to validate the API key. Check your API key.");
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
async function processZuploConfigurationFile(sourceDirectory) {
|
|
33
|
-
const normalizedDir =
|
|
32
|
+
async function processZuploConfigurationFile(sourceDirectory = ".") {
|
|
33
|
+
const normalizedDir = resolve(sourceDirectory);
|
|
34
34
|
const preferredPath = join(normalizedDir, ZUPLO_PREFERRED_JSON_FILE);
|
|
35
35
|
const fallbackPath = join(normalizedDir, ZUPLO_FALLBACK_JSON_FILE);
|
|
36
36
|
let fileContents = "{}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-configuration.js","sourceRoot":"","sources":["../../../src/common/middleware/user-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"user-configuration.js","sourceRoot":"","sources":["../../../src/common/middleware/user-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAA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AC,CAAC,KAAK,IAAI,CAAC;SAC9B,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { ParseError, parse } from \"jsonc-parser\";\nimport {\n ZUPLO_FALLBACK_JSON_FILE,\n ZUPLO_PREFERRED_JSON_FILE,\n} from \"../constants.js\";\nimport { logger } from \"../logger.js\";\nimport {\n printCriticalFailureToConsoleAndExit,\n printWarningToConsole,\n} from \"../output.js\";\nimport settings from \"../settings.js\";\n\n/**\n * This is the middleware to set the context for the CLI calls.\n *\n * It can be used to set sensible configurations such as account and project that are gotten from the API, zuplo.jsonc, --parameters\n *\n * The order of setting a configuration is\n * 1. API key\n * 2. zuplo.jsonc\n * 3. --parameters from the CLI invocation\n *\n * Note that --parameters objects can also come from .env file because of https://yargs.js.org/docs/#api-reference-envprefix\n *\n * @param argv - The yargs object\n */\nexport async function configure(argv: { [key: string]: unknown }) {\n // Clone the original value (for merging at the end)\n // The original is the most specific since it can only contain things from --parameters\n // It will always be applied last to override anything from zuplo.jsonc or the API key\n const cliParametersConfiguration = { ...argv };\n\n // Make a call to the API key\n const whoAmIResponse = await fetch(\n `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/who-am-i`,\n {\n method: \"GET\",\n headers: {\n // biome-ignore lint/style/useNamingConvention: External API property\n Authorization: `Bearer ${argv.authToken}`,\n },\n }\n );\n\n if (whoAmIResponse.ok) {\n // Note that the algorithms below are based on \"addition\"\n // You cannot unset/remove a value from the configuration by setting it to null/undefined\n // Do be mindful of parameters that might be the same value since things might be overridden\n\n // Merge any non-null values from the API key\n const apiKeyMetadata = await whoAmIResponse.json();\n\n // The API key metadata response contains the account.\n Object.assign(argv, omitNull(apiKeyMetadata));\n\n // Merge any non-null values from zuplo.jsonc\n // For now, only merge project since zuplo.jsonc could have many keys that might conflict\n const { project: zuploJsoncProject } = await processZuploConfigurationFile(\n argv.dir as string | undefined\n );\n if (zuploJsoncProject) {\n printWarningToConsole(\n \"The project name in zuplo.jsonc is deprecated. Please remove the project key from zuplo.jsonc and use the --project flag or ZUPLO_PROJECT environment variable instead.\"\n );\n argv.project = zuploJsoncProject;\n }\n\n // Merge any non-null values from --parameters\n Object.assign(argv, cliParametersConfiguration);\n } else {\n logger.trace(\n { status: whoAmIResponse.status, statusText: whoAmIResponse.statusText },\n \"Failed to determine who-am-i\"\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to validate the API key. Check your API key.\"\n );\n }\n}\n\nasync function processZuploConfigurationFile(sourceDirectory: string = \".\") {\n const normalizedDir = resolve(sourceDirectory);\n const preferredPath = join(normalizedDir, ZUPLO_PREFERRED_JSON_FILE);\n const fallbackPath = join(normalizedDir, ZUPLO_FALLBACK_JSON_FILE);\n let fileContents = \"{}\";\n if (existsSync(preferredPath)) {\n fileContents = await readFile(preferredPath, \"utf-8\");\n } else if (existsSync(fallbackPath)) {\n fileContents = await readFile(fallbackPath, \"utf-8\");\n } else {\n logger.trace(\"No zuplo.jsonc file found\");\n return {};\n }\n\n // If we get here, we have a zuplo.jsonc (or, zuplo.json) file\n // That means we should report any issues with it.\n const errors: ParseError[] = [];\n const data = parse(fileContents, errors, { allowTrailingComma: true });\n if (errors.length > 0) {\n logger.trace(errors[0], \"Failed to parse zuplo.jsonc\");\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to parse the values from zuplo.jsonc. Check your zuplo.jsonc file.\"\n );\n }\n return data;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Migrated from ESLint\nconst omitNull = (obj: any) => {\n Object.keys(obj)\n .filter((k) => obj[k] === null)\n .forEach((k) => delete obj[k]);\n return obj;\n};\n"]}
|
package/dist/common/populate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
|
2
|
-
import { join,
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import { ZUPLO_SYSTEM_ENV_VAR } from "./constants.js";
|
|
4
4
|
import { logger } from "./logger.js";
|
|
5
5
|
import { printCriticalFailureToConsoleAndExit } from "./output.js";
|
|
@@ -15,7 +15,7 @@ function wrapEnvValue(value) {
|
|
|
15
15
|
return `"${escapedValue}"`;
|
|
16
16
|
}
|
|
17
17
|
export async function pullSystemConfig(argv) {
|
|
18
|
-
const normalizedDir =
|
|
18
|
+
const normalizedDir = resolve(argv.dir);
|
|
19
19
|
const zuploPreferredConfigFile = join(normalizedDir, ZUPLO_SYSTEM_ENV_VAR);
|
|
20
20
|
const environmentResponseFromDeveloperAPI = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments/${argv.environment}/configurations`, {
|
|
21
21
|
headers: {
|
|
@@ -48,7 +48,7 @@ ZUPLO_SYSTEM_CONFIGURATIONS=${payload["systemConfigurations"]}
|
|
|
48
48
|
await writeFile(zuploPreferredConfigFile, content);
|
|
49
49
|
}
|
|
50
50
|
export async function pullLocalConfig(argv) {
|
|
51
|
-
const normalizedDir =
|
|
51
|
+
const normalizedDir = resolve(argv.dir);
|
|
52
52
|
const zuploPreferredConfigFile = join(normalizedDir, ZUPLO_SYSTEM_ENV_VAR);
|
|
53
53
|
const environmentResponseFromDeveloperAPI = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments/${argv.environment}/local-configurations`, {
|
|
54
54
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate.js","sourceRoot":"","sources":["../../src/common/populate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO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AAwB,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport { join, relative } from \"node:path\";\nimport { ZUPLO_SYSTEM_ENV_VAR } from \"./constants.js\";\nimport { logger } from \"./logger.js\";\nimport { printCriticalFailureToConsoleAndExit } from \"./output.js\";\nimport settings from \"./settings.js\";\nimport { Arguments } from \"../link/handler.js\";\n\nconst SYSTEM_KEYS = [\n \"accountName\",\n \"projectName\",\n \"environmentType\",\n \"systemConfigurations\",\n];\n\n/**\n * Wraps environment variable values in single quotes for dotenv compatibility.\n * Escapes any single quotes within the value by replacing them with \\'.\n * This ensures proper parsing while preserving special characters.\n *\n * @param value The environment variable value to wrap\n * @returns The value wrapped in single quotes with escaped single quotes\n */\nfunction wrapEnvValue(value: string): string {\n // Escape single quotes by replacing them with \\'\n const escapedValue = value.replace(/\"/g, '\\\\\"');\n // Always use single quotes\n return `\"${escapedValue}\"`;\n}\n\n/**\n * Pulls the system configuration from the API and writes it to the .env.zuplo file.\n * All the system environment variables are encoded in base58. Use this wherever\n * we need to *make sure* that the system environment variables are preserved correctly,\n * e.g in deployments.\n * @param argv\n */\nexport async function pullSystemConfig(\n argv: Pick<Arguments, \"dir\" | \"environment\" | \"authToken\">\n) {\n const normalizedDir = join(relative(process.cwd(), argv.dir));\n const zuploPreferredConfigFile = join(normalizedDir, ZUPLO_SYSTEM_ENV_VAR);\n\n const environmentResponseFromDeveloperAPI = await fetch(\n `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments/${argv.environment}/configurations`,\n {\n headers: {\n authorization: `Bearer ${argv.authToken}`,\n },\n }\n );\n\n if (!environmentResponseFromDeveloperAPI.ok) {\n if (\n environmentResponseFromDeveloperAPI.status === 404 ||\n environmentResponseFromDeveloperAPI.status === 401\n ) {\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to link data from the environment. The environment you specified doesn't exist or you don't have access to it.\"\n );\n } else {\n logger.error(\n {\n status: environmentResponseFromDeveloperAPI.status,\n statusText: environmentResponseFromDeveloperAPI.statusText,\n },\n `Failed to link data from ${argv.environment}`\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to link data from the environment. Please try again later.\"\n );\n }\n }\n\n const payload = await environmentResponseFromDeveloperAPI.json();\n\n const content = `\n# This file is auto-generated from zuplo link. Please do not edit it manually.\n# It will be auto-generated afresh the next time you run zuplo link.\n# If you wish to add your own environment variables, create a separate .env file.\nZUPLO_ACCOUNT_NAME=${payload.accountName}\nZUPLO_PROJECT_NAME=${payload.projectName}\nZUPLO_ENVIRONMENT_TYPE=${payload.environmentType}\nZUPLO_SYSTEM_CONFIGURATIONS=${payload[\"systemConfigurations\"]}\n`;\n\n await writeFile(zuploPreferredConfigFile, content);\n}\n\n/**\n * Pulls the local configuration from dev-api and writes it to the .env.zuplo file.\n * This method differs from pullSystemConfig in that it writes the user defined\n * environment variables, as well as the public variables explicitly to the\n * file instead of getting all variable in the base58 encoded ZUPLO_SYSTEM_CONFIGURATIONS\n * variable.\n * @param argv\n */\nexport async function pullLocalConfig(\n argv: Pick<Arguments, \"dir\" | \"environment\" | \"authToken\">\n) {\n const normalizedDir = join(relative(process.cwd(), argv.dir));\n const zuploPreferredConfigFile = join(normalizedDir, ZUPLO_SYSTEM_ENV_VAR);\n\n const environmentResponseFromDeveloperAPI = await fetch(\n `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments/${argv.environment}/local-configurations`,\n {\n headers: {\n authorization: `Bearer ${argv.authToken}`,\n },\n }\n );\n\n if (!environmentResponseFromDeveloperAPI.ok) {\n if (\n environmentResponseFromDeveloperAPI.status === 404 ||\n environmentResponseFromDeveloperAPI.status === 401\n ) {\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to link data from the environment. The environment you specified doesn't exist or you don't have access to it.\"\n );\n } else {\n logger.error(\n {\n status: environmentResponseFromDeveloperAPI.status,\n statusText: environmentResponseFromDeveloperAPI.statusText,\n },\n `Failed to link data from ${argv.environment}`\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to link data from the environment. Please try again later.\"\n );\n }\n }\n\n const payload = await environmentResponseFromDeveloperAPI.json();\n\n // We wrap the env vars in appropriate quotes to preserve special characters\n // and handle single quotes properly for dotenv parsing.\n const userEnvVars = Object.keys(payload)\n .filter((key) => {\n return !key.startsWith(\"ZUPLO_PUBLIC_\") && !SYSTEM_KEYS.includes(key);\n })\n .map((key) => {\n return `${key}=${wrapEnvValue(payload[key])}`;\n });\n\n const zuploPublicEnvVars = Object.keys(payload)\n .filter((key) => {\n // These start with ZUPLO_PUBLIC_ and are not system variables\n return key.startsWith(\"ZUPLO_PUBLIC_\");\n })\n .map((key) => {\n return `${key}=${wrapEnvValue(payload[key])}`;\n });\n\n let content = `# This file is auto-generated from zuplo link. Please do not edit it manually.\n# It will be auto-generated afresh the next time you run zuplo link.\n# If you wish to add your own environment variables, create a separate .env file.\n\nZUPLO_ACCOUNT_NAME=${payload.accountName}\nZUPLO_PROJECT_NAME=${payload.projectName}\nZUPLO_ENVIRONMENT_TYPE=${payload.environmentType}\nZUPLO_SYSTEM_CONFIGURATIONS=${payload[\"systemConfigurations\"]}`;\n\n // Only add public environment variables section if there are any\n if (zuploPublicEnvVars.length > 0) {\n content += `\n\n# Public Zuplo environment variables\n${zuploPublicEnvVars.join(\"\\n\")}`;\n }\n\n // Only add user environment variables section if there are any\n if (userEnvVars.length > 0) {\n content += `\n\n# Environment variables defined in the Zuplo UI for the environment\n# Note that \" characters are escaped with a backslash and escaped double quotes\n# will show up as \\\\\" in the value.\n${userEnvVars.join(\"\\n\")}`;\n }\n\n // Add final newline\n content += \"\\n\";\n\n await writeFile(zuploPreferredConfigFile, content);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"populate.js","sourceRoot":"","sources":["../../src/common/populate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MA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AC,CAAC;AACrD,CAAC","sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { ZUPLO_SYSTEM_ENV_VAR } from \"./constants.js\";\nimport { logger } from \"./logger.js\";\nimport { printCriticalFailureToConsoleAndExit } from \"./output.js\";\nimport settings from \"./settings.js\";\nimport { Arguments } from \"../link/handler.js\";\n\nconst SYSTEM_KEYS = [\n \"accountName\",\n \"projectName\",\n \"environmentType\",\n \"systemConfigurations\",\n];\n\n/**\n * Wraps environment variable values in single quotes for dotenv compatibility.\n * Escapes any single quotes within the value by replacing them with \\'.\n * This ensures proper parsing while preserving special characters.\n *\n * @param value The environment variable value to wrap\n * @returns The value wrapped in single quotes with escaped single quotes\n */\nfunction wrapEnvValue(value: string): string {\n // Escape single quotes by replacing them with \\'\n const escapedValue = value.replace(/\"/g, '\\\\\"');\n // Always use single quotes\n return `\"${escapedValue}\"`;\n}\n\n/**\n * Pulls the system configuration from the API and writes it to the .env.zuplo file.\n * All the system environment variables are encoded in base58. Use this wherever\n * we need to *make sure* that the system environment variables are preserved correctly,\n * e.g in deployments.\n * @param argv\n */\nexport async function pullSystemConfig(\n argv: Pick<Arguments, \"dir\" | \"environment\" | \"authToken\">\n) {\n const normalizedDir = resolve(argv.dir);\n const zuploPreferredConfigFile = join(normalizedDir, ZUPLO_SYSTEM_ENV_VAR);\n\n const environmentResponseFromDeveloperAPI = await fetch(\n `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments/${argv.environment}/configurations`,\n {\n headers: {\n authorization: `Bearer ${argv.authToken}`,\n },\n }\n );\n\n if (!environmentResponseFromDeveloperAPI.ok) {\n if (\n environmentResponseFromDeveloperAPI.status === 404 ||\n environmentResponseFromDeveloperAPI.status === 401\n ) {\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to link data from the environment. The environment you specified doesn't exist or you don't have access to it.\"\n );\n } else {\n logger.error(\n {\n status: environmentResponseFromDeveloperAPI.status,\n statusText: environmentResponseFromDeveloperAPI.statusText,\n },\n `Failed to link data from ${argv.environment}`\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to link data from the environment. Please try again later.\"\n );\n }\n }\n\n const payload = await environmentResponseFromDeveloperAPI.json();\n\n const content = `\n# This file is auto-generated from zuplo link. Please do not edit it manually.\n# It will be auto-generated afresh the next time you run zuplo link.\n# If you wish to add your own environment variables, create a separate .env file.\nZUPLO_ACCOUNT_NAME=${payload.accountName}\nZUPLO_PROJECT_NAME=${payload.projectName}\nZUPLO_ENVIRONMENT_TYPE=${payload.environmentType}\nZUPLO_SYSTEM_CONFIGURATIONS=${payload[\"systemConfigurations\"]}\n`;\n\n await writeFile(zuploPreferredConfigFile, content);\n}\n\n/**\n * Pulls the local configuration from dev-api and writes it to the .env.zuplo file.\n * This method differs from pullSystemConfig in that it writes the user defined\n * environment variables, as well as the public variables explicitly to the\n * file instead of getting all variable in the base58 encoded ZUPLO_SYSTEM_CONFIGURATIONS\n * variable.\n * @param argv\n */\nexport async function pullLocalConfig(\n argv: Pick<Arguments, \"dir\" | \"environment\" | \"authToken\">\n) {\n const normalizedDir = resolve(argv.dir);\n const zuploPreferredConfigFile = join(normalizedDir, ZUPLO_SYSTEM_ENV_VAR);\n\n const environmentResponseFromDeveloperAPI = await fetch(\n `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments/${argv.environment}/local-configurations`,\n {\n headers: {\n authorization: `Bearer ${argv.authToken}`,\n },\n }\n );\n\n if (!environmentResponseFromDeveloperAPI.ok) {\n if (\n environmentResponseFromDeveloperAPI.status === 404 ||\n environmentResponseFromDeveloperAPI.status === 401\n ) {\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to link data from the environment. The environment you specified doesn't exist or you don't have access to it.\"\n );\n } else {\n logger.error(\n {\n status: environmentResponseFromDeveloperAPI.status,\n statusText: environmentResponseFromDeveloperAPI.statusText,\n },\n `Failed to link data from ${argv.environment}`\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to link data from the environment. Please try again later.\"\n );\n }\n }\n\n const payload = await environmentResponseFromDeveloperAPI.json();\n\n // We wrap the env vars in appropriate quotes to preserve special characters\n // and handle single quotes properly for dotenv parsing.\n const userEnvVars = Object.keys(payload)\n .filter((key) => {\n return !key.startsWith(\"ZUPLO_PUBLIC_\") && !SYSTEM_KEYS.includes(key);\n })\n .map((key) => {\n return `${key}=${wrapEnvValue(payload[key])}`;\n });\n\n const zuploPublicEnvVars = Object.keys(payload)\n .filter((key) => {\n // These start with ZUPLO_PUBLIC_ and are not system variables\n return key.startsWith(\"ZUPLO_PUBLIC_\");\n })\n .map((key) => {\n return `${key}=${wrapEnvValue(payload[key])}`;\n });\n\n let content = `# This file is auto-generated from zuplo link. Please do not edit it manually.\n# It will be auto-generated afresh the next time you run zuplo link.\n# If you wish to add your own environment variables, create a separate .env file.\n\nZUPLO_ACCOUNT_NAME=${payload.accountName}\nZUPLO_PROJECT_NAME=${payload.projectName}\nZUPLO_ENVIRONMENT_TYPE=${payload.environmentType}\nZUPLO_SYSTEM_CONFIGURATIONS=${payload[\"systemConfigurations\"]}`;\n\n // Only add public environment variables section if there are any\n if (zuploPublicEnvVars.length > 0) {\n content += `\n\n# Public Zuplo environment variables\n${zuploPublicEnvVars.join(\"\\n\")}`;\n }\n\n // Only add user environment variables section if there are any\n if (userEnvVars.length > 0) {\n content += `\n\n# Environment variables defined in the Zuplo UI for the environment\n# Note that \" characters are escaped with a backslash and escaped double quotes\n# will show up as \\\\\" in the value.\n${userEnvVars.join(\"\\n\")}`;\n }\n\n // Add final newline\n content += \"\\n\";\n\n await writeFile(zuploPreferredConfigFile, content);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../src/deploy/archive.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAS3C,wBAAsB,OAAO,CAAC,IAAI,EAAE,SAAS;;;;;;;
|
|
1
|
+
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../src/deploy/archive.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAS3C,wBAAsB,OAAO,CAAC,IAAI,EAAE,SAAS;;;;;;;GAkE5C;AAID,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,OA2BzD;AAeD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,SAAS;;;;GAmErD"}
|
package/dist/deploy/archive.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
|
-
import { join,
|
|
4
|
+
import { join, resolve, sep } from "node:path";
|
|
5
5
|
import ignore from "ignore";
|
|
6
6
|
import { minimatch } from "minimatch";
|
|
7
7
|
import { simpleGit } from "simple-git";
|
|
@@ -16,18 +16,23 @@ function createTempFileWithSuffix(suffix = ARCHIVE_EXTENSION) {
|
|
|
16
16
|
return tempFilePath;
|
|
17
17
|
}
|
|
18
18
|
export async function archive(argv) {
|
|
19
|
-
const tarball = createTempFileWithSuffix();
|
|
20
|
-
const ignoreFn = createIgnoreFunction(argv.dir);
|
|
19
|
+
const tarball = createTempFileWithSuffix(".tar.gz");
|
|
21
20
|
const normalizedDir = resolve(argv.dir);
|
|
21
|
+
const ignoreFn = createIgnoreFunction(normalizedDir);
|
|
22
22
|
const metadata = await prepareDeployerMetadata(argv);
|
|
23
23
|
await tar.create({
|
|
24
24
|
gzip: true,
|
|
25
25
|
file: tarball,
|
|
26
|
+
cwd: normalizedDir,
|
|
26
27
|
filter: (path, stat) => {
|
|
27
28
|
const stats = stat;
|
|
29
|
+
const cleanPath = path.startsWith("./") ? path.slice(2) : path;
|
|
30
|
+
if (cleanPath === "." || cleanPath === "") {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
28
33
|
const normalizedPath = stats.isDirectory()
|
|
29
|
-
? join(
|
|
30
|
-
:
|
|
34
|
+
? join(cleanPath, sep)
|
|
35
|
+
: cleanPath;
|
|
31
36
|
if (minimatch(normalizedPath, "/", { windowsPathsNoEscape: true })) {
|
|
32
37
|
return true;
|
|
33
38
|
}
|
|
@@ -48,7 +53,7 @@ export async function archive(argv) {
|
|
|
48
53
|
logger.trace(`${normalizedPath} ignored: ${result}`);
|
|
49
54
|
return !result;
|
|
50
55
|
},
|
|
51
|
-
}, [
|
|
56
|
+
}, ["."]);
|
|
52
57
|
return {
|
|
53
58
|
tarball,
|
|
54
59
|
metadata,
|