create-zuplo-api 1.7.0 → 2.0.2

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.
Files changed (46) hide show
  1. package/create-zuplo-api.js +3 -1
  2. package/dist/index.js +31 -0
  3. package/dist/package.json +3 -0
  4. package/dist/src/cli.d.ts +2 -0
  5. package/dist/src/cli.d.ts.map +1 -0
  6. package/dist/src/common/analytics/lib.d.ts +18 -0
  7. package/dist/src/common/analytics/lib.d.ts.map +1 -0
  8. package/dist/src/common/constants.d.ts +5 -0
  9. package/dist/src/common/constants.d.ts.map +1 -0
  10. package/dist/src/common/machine-id/lib.d.ts +2 -0
  11. package/dist/src/common/machine-id/lib.d.ts.map +1 -0
  12. package/dist/src/common/output.d.ts +9 -0
  13. package/dist/src/common/output.d.ts.map +1 -0
  14. package/dist/src/create/create.d.ts +6 -0
  15. package/dist/src/create/create.d.ts.map +1 -0
  16. package/dist/src/create/handler.d.ts +2 -0
  17. package/dist/src/create/handler.d.ts.map +1 -0
  18. package/dist/src/create/package-json.d.ts +16 -0
  19. package/dist/src/create/package-json.d.ts.map +1 -0
  20. package/dist/src/index.d.ts +3 -0
  21. package/dist/src/index.d.ts.map +1 -0
  22. package/dist/src/utils.d.ts +2 -0
  23. package/dist/src/utils.d.ts.map +1 -0
  24. package/dist/templates/default/_README.md +1 -0
  25. package/dist/templates/default/config/dev-portal.json +5 -0
  26. package/dist/templates/default/config/policies.json +3 -0
  27. package/dist/templates/default/config/routes.oas.json +8 -0
  28. package/dist/templates/default/docs/markdown.md +43 -0
  29. package/dist/templates/default/docs/sidebar.json +13 -0
  30. package/dist/templates/default/docs/theme.css +29 -0
  31. package/dist/templates/default/env.example +2 -0
  32. package/dist/templates/default/eslintrc.js +11 -0
  33. package/dist/templates/default/gitignore +10 -0
  34. package/dist/templates/default/modules/hello-world.ts +21 -0
  35. package/dist/templates/default/tsconfig.json +19 -0
  36. package/dist/templates/default/vscode/launch.json +37 -0
  37. package/dist/templates/default/vscode/settings.json +24 -0
  38. package/dist/templates/default/zuplo.jsonc +4 -0
  39. package/package.json +17 -14
  40. package/dist/cli.js +0 -53
  41. package/dist/common/analytics/lib.js +0 -57
  42. package/dist/common/constants.js +0 -8
  43. package/dist/common/logger.js +0 -17
  44. package/dist/common/machine-id/lib.js +0 -68
  45. package/dist/common/output.js +0 -54
  46. package/dist/create/handler.js +0 -39
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,2 @@
1
+ export declare function exec(): Promise<void>;
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/cli.ts"],"names":[],"mappings":"AAYA,wBAAsB,IAAI,kBAoCzB"}
@@ -0,0 +1,18 @@
1
+ interface IdentifyMessageV1 {
2
+ distinctId: string;
3
+ properties?: Record<string | number, any>;
4
+ disableGeoip?: boolean;
5
+ }
6
+ interface EventMessageV1 extends IdentifyMessageV1 {
7
+ event: string;
8
+ groups?: Record<string, string | number>;
9
+ sendFeatureFlags?: boolean;
10
+ timestamp?: Date;
11
+ }
12
+ interface ZuploEventMessage extends Omit<EventMessageV1, "distinctId"> {
13
+ argv: any;
14
+ }
15
+ export declare function captureEvent({ argv, event, properties, groups, sendFeatureFlags, timestamp, disableGeoip, }: ZuploEventMessage): Promise<void>;
16
+ export declare function shutdownAnalytics(): Promise<void>;
17
+ export {};
18
+ //# sourceMappingURL=lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/common/analytics/lib.ts"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,cAAe,SAAQ,iBAAiB;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,UAAU,iBAAkB,SAAQ,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC;IAEpE,IAAI,EAAE,GAAG,CAAC;CACX;AA4BD,wBAAsB,YAAY,CAAC,EACjC,IAAI,EACJ,KAAK,EACL,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,YAAY,GACb,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+CnC;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEvD"}
@@ -0,0 +1,5 @@
1
+ export declare const ZUPLO_USER_ID_ARGV_KEY = "zuplo-user-id";
2
+ export declare const SENTRY_DSN = "https://e98d81e78b23b65fa607473823a9957a@o1036703.ingest.sentry.io/4505953760313344";
3
+ export declare const MAX_WAIT_PENDING_TIME_MS = 1000;
4
+ export declare const POST_HOG_CAPTURE_KEY = "phc_LDSwSTOvIjiDDZql2g54Q7xEXoQ0EN9RMYb3STbdz1V";
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/common/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAGtD,eAAO,MAAM,UAAU,wFACgE,CAAC;AACxF,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAG7C,eAAO,MAAM,oBAAoB,oDACkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function machineId(): string;
2
+ //# sourceMappingURL=lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/common/machine-id/lib.ts"],"names":[],"mappings":"AA4EA,wBAAgB,SAAS,IAAI,MAAM,CASlC"}
@@ -0,0 +1,9 @@
1
+ export declare function printDiagnosticsToConsole(message?: any): void;
2
+ export declare function printCriticalFailureToConsoleAndExit(message?: any): void;
3
+ export declare function printResultToConsole(message?: any): void;
4
+ export declare function printTableToConsole(table: any): void;
5
+ export declare function printResultToConsoleAndExitGracefully(message?: any): void;
6
+ export declare function printTableToConsoleAndExitGracefully(table: any): void;
7
+ export default function setBlocking(): void;
8
+ export declare function textOrJson(text: string): any;
9
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/common/output.ts"],"names":[],"mappings":"AAWA,wBAAgB,yBAAyB,CAAC,OAAO,CAAC,EAAE,GAAG,QAEtD;AAGD,wBAAgB,oCAAoC,CAAC,OAAO,CAAC,EAAE,GAAG,QAKjE;AAID,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,GAAG,QAEjD;AAID,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,QAE7C;AAED,wBAAgB,qCAAqC,CAAC,OAAO,CAAC,EAAE,GAAG,QAKlE;AAED,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,GAAG,QAK9D;AAaD,MAAM,CAAC,OAAO,UAAU,WAAW,SAalC;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,OAMtC"}
@@ -0,0 +1,6 @@
1
+ export declare function createApi({ rootDirectory, name, template, }: {
2
+ rootDirectory: string;
3
+ name: string;
4
+ template: string;
5
+ }): Promise<void>;
6
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/create/create.ts"],"names":[],"mappings":"AAQA,wBAAsB,SAAS,CAAC,EAC9B,aAAa,EACb,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAwCA"}
@@ -0,0 +1,2 @@
1
+ export declare function create(): Promise<void>;
2
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/create/handler.ts"],"names":[],"mappings":"AASA,wBAAsB,MAAM,kBAkC3B"}
@@ -0,0 +1,16 @@
1
+ export interface PackageJson {
2
+ name: string;
3
+ version: string;
4
+ author: string;
5
+ copyright: string;
6
+ scripts?: Record<string, string>;
7
+ dependencies: Record<string, string>;
8
+ devDependencies?: Record<string, string>;
9
+ packageManager?: string;
10
+ overrides?: Record<string, string>;
11
+ }
12
+ export declare function generateDefaultPackageJson(name: string): Promise<PackageJson>;
13
+ export declare function getPackageOverrides(): Record<string, string>;
14
+ export declare function getProjectPackageJson(sourceDirectory: string): Promise<PackageJson>;
15
+ export declare function updateProjectPackageJson(sourceDirectory: string, packageJson: PackageJson): Promise<void>;
16
+ //# sourceMappingURL=package-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/create/package-json.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,WAAW,CAAC,CA6BtB;AAMD,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ5D;AAED,wBAAsB,qBAAqB,CACzC,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAKtB;AAED,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,IAAI,CAAC,CAIf"}
@@ -0,0 +1,3 @@
1
+ export { exec } from "./cli.js";
2
+ export { createApi } from "./create/create.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getTemplateDir(template: string): string;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["file:///home/runner/work/create-zuplo-api/create-zuplo-api/src/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,UAK9C"}
@@ -0,0 +1 @@
1
+ # Zuplo API
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://cdn.zuplo.com/schemas/dev-portal.json",
3
+ "enabled": true,
4
+ "enableAuthentication": true
5
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "policies": []
3
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "version": "1.0.0",
5
+ "title": "My Zuplo API"
6
+ },
7
+ "paths": {}
8
+ }
@@ -0,0 +1,43 @@
1
+ # My API
2
+
3
+ You can write full markdown in these documents. Syntax highlighting and full
4
+ Github Flavored markdown are supported. To learn more about customizing the
5
+ documentation of this developer portal
6
+ [see the documentation](https://zuplo.com/docs/developer-portal/adding-pages).
7
+
8
+ ```ts
9
+ const response = await fetch("https://echo.zuplo.io", {
10
+ headers: {
11
+ "content-type": "application/json",
12
+ },
13
+ });
14
+
15
+ const data = await response.json();
16
+ console.log(data);
17
+ ```
18
+
19
+ ## Labore et Dolore
20
+
21
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
22
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
23
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
24
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
25
+ fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
26
+ culpa qui officia deserunt mollit anim id est laborum.
27
+
28
+ | Item | Description | Quanity |
29
+ | --------------- | -------------------------------------------- | ------- |
30
+ | ullamco laboris | reprehenderit in voluptate velit esse cillum | 21 |
31
+ | Excepteur sint | tempor incididunt ut labore | 1 |
32
+ | anim id est | irure dolor in reprehenderit in voluptate | 82 |
33
+ | non proiden | cupidatat non proident, sunt in | 53 |
34
+
35
+ ## Aliquip pariatur
36
+
37
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
38
+ deserunt mollit anim id est laborum.
39
+
40
+ - **Item 1** - ullamco laboris nisi ut aliquip ex ea commodo
41
+ - **Item 2** - ullamco laboris nisi ut aliquip ex ea commodo
42
+ - **Item 3** - ullamco laboris nisi ut aliquip ex ea commodo
43
+ - **Item 4** - ullamco laboris nisi ut aliquip ex ea commodo
@@ -0,0 +1,13 @@
1
+ {
2
+ "docs": [
3
+ {
4
+ "type": "doc",
5
+ "id": "index",
6
+ "label": "Index"
7
+ },
8
+ {
9
+ "type": "api-ref",
10
+ "label": "API Reference"
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,29 @@
1
+ /* Learn about theming here: https://zuplo.com/docs/developer-portal/theme */
2
+
3
+ :root {
4
+ --logo-url: url(https://cdn.zuplo.com/dev-portal/v2/made-with-zuplo.svg);
5
+ }
6
+
7
+ .light {
8
+ --background-primary: white;
9
+ --font-family-primary: "-apple-system", "BlinkMacSystemFont", "Segoe UI",
10
+ "Roboto", "Helvetica Neue", "Ubuntu", "sans-serif";
11
+ --text-color-h1: rgb(42 47 69);
12
+ --text-color-h2: rgb(42 47 69);
13
+ --text-color-primary: rgb(79 86 107);
14
+ }
15
+
16
+ .dark {
17
+ --background-primary: #1a1f36;
18
+ --font-family-primary: "-apple-system", "BlinkMacSystemFont", "Segoe UI",
19
+ "Roboto", "Helvetica Neue", "Ubuntu", "sans-serif";
20
+ --text-color-h1: #f7fafc;
21
+ --text-color-h2: #f7fafc;
22
+ --text-color-primary: rgb(193 201 210);
23
+ }
24
+
25
+ /* The logo image */
26
+ .theme-logo {
27
+ content: var(--logo-url);
28
+ margin: 20px;
29
+ }
@@ -0,0 +1,2 @@
1
+ EXAMPLE_SECRET=👀 What you looking at?
2
+ EXAMPLE_CONFIG=https://twitter.com/zuplo
@@ -0,0 +1,11 @@
1
+ /**@type {import('eslint').Linter.Config} */
2
+ // eslint-disable-next-line no-undef
3
+ module.exports = {
4
+ root: true,
5
+ parser: "@typescript-eslint/parser",
6
+ plugins: ["@typescript-eslint", "import"],
7
+ extends: ["prettier"],
8
+ rules: {
9
+ "no-console": "error",
10
+ },
11
+ };
@@ -0,0 +1,10 @@
1
+ .zuplo/
2
+ .cache/
3
+ dist/
4
+ node_modules/
5
+ .env
6
+ .env.zuplo
7
+ .husky/_
8
+
9
+ # OS Stuff
10
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ import { ZuploContext, ZuploRequest } from "@zuplo/runtime";
2
+
3
+ export default async function (request: ZuploRequest, context: ZuploContext) {
4
+ /**
5
+ * Use the log property on context to enjoy
6
+ * logging magic when testing your API.
7
+ */
8
+ context.log.info(`Hi, from inside your zup!`);
9
+
10
+ /**
11
+ * If you want to proxy an API, you can simply
12
+ * return the content of a fetch. Try it by
13
+ * uncommenting the line below.
14
+ */
15
+ // return fetch('http://www.example.com/');
16
+
17
+ /**
18
+ * In this example, we're just going to return some content.
19
+ */
20
+ return "What zup?";
21
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "include": ["modules/**/*", ".zuplo/**/*", "tests/**/*"],
3
+ "exclude": ["./node_modules", "./dist"],
4
+ "compilerOptions": {
5
+ "module": "ES2022",
6
+ "target": "ESNext",
7
+ "lib": ["ESNext", "WebWorker", "Webworker.Iterable"],
8
+ "preserveConstEnums": true,
9
+ "moduleResolution": "Bundler",
10
+ "useUnknownInCatchVariables": false,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "importHelpers": true,
13
+ "removeComments": true,
14
+ "esModuleInterop": true,
15
+ "noEmit": true,
16
+ "strictNullChecks": true,
17
+ "experimentalDecorators": true
18
+ }
19
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "node",
9
+ "request": "launch",
10
+ "name": "Launch Zuplo",
11
+ "runtimeExecutable": "npx",
12
+ "runtimeArgs": [
13
+ "@zuplo/cli",
14
+ "dev",
15
+ "--debug-port",
16
+ "9229",
17
+ "--port",
18
+ "9000",
19
+ ],
20
+ "console": "integratedTerminal",
21
+ "internalConsoleOptions": "neverOpen",
22
+ },
23
+ {
24
+ "name": "Zuplo Gateway",
25
+ "type": "node",
26
+ "request": "attach",
27
+ "restart": true,
28
+ "port": 9229,
29
+ },
30
+ ],
31
+ "compounds": [
32
+ {
33
+ "name": "Launch & Attach Zuplo",
34
+ "configurations": ["Launch Zuplo", "Zuplo Gateway"],
35
+ },
36
+ ],
37
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "json.schemas": [
3
+ {
4
+ "fileMatch": ["config/*.oas.json"],
5
+ "url": "https://cdn.zuplo.com/schemas/openapi-v3.1-zuplo.json"
6
+ },
7
+ {
8
+ "fileMatch": ["config/policies.json"],
9
+ "url": "https://cdn.zuplo.com/schemas/policies.json"
10
+ },
11
+ {
12
+ "fileMatch": ["config/dev-portal.json"],
13
+ "url": "https://cdn.zuplo.com/schemas/dev-portal.json"
14
+ },
15
+ {
16
+ "fileMatch": ["docs/sidebar.json"],
17
+ "url": "https://cdn.zuplo.com/schemas/sidebar.json"
18
+ },
19
+ {
20
+ "fileMatch": ["config/routes.json"],
21
+ "url": "https://cdn.zuplo.com/schemas/routes.json"
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": 1,
3
+ "compatibilityDate": "2024-03-14"
4
+ }
package/package.json CHANGED
@@ -1,19 +1,27 @@
1
1
  {
2
2
  "name": "create-zuplo-api",
3
- "version": "1.7.0",
3
+ "version": "2.0.2",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/zuplo/create-zuplo-api",
6
6
  "description": "The official way to create a new Zuplo API Gateway",
7
7
  "author": "Zuplo, Inc.",
8
8
  "license": "See LICENSE in LICENSE.txt",
9
+ "main": "dist/index.js",
10
+ "exports": {
11
+ ".": "./dist/index.js"
12
+ },
9
13
  "scripts": {
10
- "build": "tsc --build",
14
+ "dev": "ncc build ./src/index.ts -w -o dist/",
15
+ "build": "ncc build ./src/index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
11
16
  "clean": "git clean -Xfde !.env",
12
17
  "sentry:sourcemaps": "sentry-cli sourcemaps inject --org zuplo --project create-zuplo-api ./dist"
13
18
  },
14
19
  "engines": {
15
20
  "node": ">=18.0.0"
16
21
  },
22
+ "files": [
23
+ "dist"
24
+ ],
17
25
  "bin": {
18
26
  "create-zuplo-api": "create-zuplo-api.js"
19
27
  },
@@ -26,11 +34,16 @@
26
34
  ]
27
35
  },
28
36
  "devDependencies": {
37
+ "@inquirer/prompts": "^3.1.2",
29
38
  "@sentry/cli": "^2.21.1",
39
+ "@sentry/node": "^7.72.0",
30
40
  "@types/node": "^18.5.3",
31
41
  "@types/semver": "^7.5.3",
32
42
  "@typescript-eslint/eslint-plugin": "^6.7.3",
33
43
  "@typescript-eslint/parser": "^6.7.3",
44
+ "@vercel/ncc": "^0.38.1",
45
+ "chalk": "^5.3.0",
46
+ "dotenv": "^16.3.1",
34
47
  "eslint": "^8.50.0",
35
48
  "eslint-config-prettier": "^9.0.0",
36
49
  "eslint-plugin-import": "^2.28.1",
@@ -38,19 +51,9 @@
38
51
  "eslint-plugin-unicorn": "^48.0.1",
39
52
  "husky": "^8.0.3",
40
53
  "lint-staged": "^14.0.1",
54
+ "posthog-node": "^4.0.1",
41
55
  "prettier-plugin-organize-imports": "^3.2.3",
56
+ "semver": "^7.6.2",
42
57
  "typescript": "^5.2.2"
43
- },
44
- "dependencies": {
45
- "@inquirer/prompts": "^3.1.2",
46
- "@sentry/node": "^7.72.0",
47
- "@zuplo/core": "^5.1639.0",
48
- "@zuplo/pino-pretty-configurations": "^1.5.0",
49
- "chalk": "^5.3.0",
50
- "dotenv": "^16.3.1",
51
- "pino": "^8.15.1",
52
- "pino-pretty": "^10.2.0",
53
- "posthog-node": "^3.2.0",
54
- "semver": "^7.5.4"
55
58
  }
56
59
  }
package/dist/cli.js DELETED
@@ -1,53 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1edb5b86-ec24-5ea9-b706-204c1d36fe4a")}catch(e){}}();
3
- import * as dotenv from "dotenv";
4
- dotenv.config();
5
- import * as Sentry from "@sentry/node";
6
- import { logger } from "./common/logger.js";
7
- import { printCriticalFailureToConsoleAndExit, printDiagnosticsToConsole, } from "./common/output.js";
8
- import { gte } from "semver";
9
- import { readFileSync } from "node:fs";
10
- import { fileURLToPath } from "node:url";
11
- import { MAX_WAIT_PENDING_TIME_MS, SENTRY_DSN } from "./common/constants.js";
12
- import { shutdownAnalytics } from "./common/analytics/lib.js";
13
- import { create } from "./create/handler.js";
14
- const MIN_NODE_VERSION = "18.0.0";
15
- if (gte(process.versions.node, MIN_NODE_VERSION)) {
16
- let packageJson;
17
- try {
18
- packageJson = JSON.parse(readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf-8"));
19
- }
20
- catch (e) {
21
- logger.error(e);
22
- printCriticalFailureToConsoleAndExit(`Unable to load create-zuplo-api package. The package.json is missing or malformed.`);
23
- }
24
- Sentry.init({
25
- dsn: SENTRY_DSN,
26
- release: packageJson?.version,
27
- });
28
- try {
29
- printDiagnosticsToConsole("");
30
- printDiagnosticsToConsole("Zuplo: The Programmable API Gateway");
31
- printDiagnosticsToConsole("");
32
- await create();
33
- void Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
34
- process.exit(0);
35
- });
36
- }
37
- catch (err) {
38
- if (err instanceof Error) {
39
- Sentry.captureException(err);
40
- }
41
- printCriticalFailureToConsoleAndExit(err.message ?? err);
42
- }
43
- finally {
44
- await shutdownAnalytics();
45
- }
46
- }
47
- else {
48
- printCriticalFailureToConsoleAndExit(`The create-zuplo-api package requires at least node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of node.js.
49
-
50
- Consider using a Node.js version manager such as https://github.com/nvm-sh/nvm.`);
51
- }
52
- //# sourceMappingURL=cli.js.map
53
- //# debugId=1edb5b86-ec24-5ea9-b706-204c1d36fe4a
@@ -1,57 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e0b93e4a-c44e-509d-945b-f6c39a738828")}catch(e){}}();
3
- import { defaultIntegrations } from "@sentry/node";
4
- import { PostHog } from "posthog-node";
5
- import { POST_HOG_CAPTURE_KEY, ZUPLO_USER_ID_ARGV_KEY } from "../constants.js";
6
- import { machineId } from "../machine-id/lib.js";
7
- let _postHog;
8
- let _context;
9
- function init() {
10
- if (process.env.ZUPLO_DO_NOT_TRACK) {
11
- return undefined;
12
- }
13
- _postHog = new PostHog(POST_HOG_CAPTURE_KEY, {
14
- host: "https://app.posthog.com",
15
- flushAt: 1,
16
- flushInterval: 1,
17
- });
18
- _context = defaultIntegrations.filter((integration) => integration.name == "Context")[0];
19
- return _postHog;
20
- }
21
- export async function captureEvent({ argv, event, properties, groups, sendFeatureFlags, timestamp, disableGeoip, }) {
22
- if (_postHog === undefined) {
23
- init();
24
- }
25
- if (_postHog) {
26
- properties = properties ?? {};
27
- properties.$set_once = properties.$set_once ?? {};
28
- if (argv[ZUPLO_USER_ID_ARGV_KEY] &&
29
- typeof argv[ZUPLO_USER_ID_ARGV_KEY] === "string") {
30
- properties.$set_once["user-id"] = argv[ZUPLO_USER_ID_ARGV_KEY];
31
- }
32
- if (argv.account && typeof argv.account === "string") {
33
- properties.$set_once["account"] = argv["account"];
34
- }
35
- if (argv.project && typeof argv.project === "string") {
36
- properties.$set_once["project"] = argv["project"];
37
- }
38
- if (process.env.CI) {
39
- properties["ci"] = process.env.CI;
40
- }
41
- await _context?.addContext(properties);
42
- _postHog?.capture({
43
- distinctId: argv[ZUPLO_USER_ID_ARGV_KEY] || machineId(),
44
- event,
45
- properties,
46
- groups,
47
- sendFeatureFlags,
48
- timestamp,
49
- disableGeoip,
50
- });
51
- }
52
- }
53
- export async function shutdownAnalytics() {
54
- return _postHog?.shutdownAsync();
55
- }
56
- //# sourceMappingURL=lib.js.map
57
- //# debugId=e0b93e4a-c44e-509d-945b-f6c39a738828
@@ -1,8 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="58911fa6-e140-577b-abdc-d8fa357b4889")}catch(e){}}();
3
- export const ZUPLO_USER_ID_ARGV_KEY = "zuplo-user-id";
4
- export const SENTRY_DSN = "https://e98d81e78b23b65fa607473823a9957a@o1036703.ingest.sentry.io/4505953760313344";
5
- export const MAX_WAIT_PENDING_TIME_MS = 1000;
6
- export const POST_HOG_CAPTURE_KEY = "phc_LDSwSTOvIjiDDZql2g54Q7xEXoQ0EN9RMYb3STbdz1V";
7
- //# sourceMappingURL=constants.js.map
8
- //# debugId=58911fa6-e140-577b-abdc-d8fa357b4889
@@ -1,17 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="933da865-f680-55cc-a710-065ace7ed925")}catch(e){}}();
3
- import * as Pino from "pino";
4
- export const logger = Pino.pino({
5
- level: process.env.LOG_LEVEL || "info",
6
- transport: {
7
- targets: [
8
- {
9
- target: "@zuplo/pino-pretty-configurations",
10
- level: process.env.LOG_LEVEL || "info",
11
- options: {},
12
- },
13
- ],
14
- },
15
- });
16
- //# sourceMappingURL=logger.js.map
17
- //# debugId=933da865-f680-55cc-a710-065ace7ed925