@posthog/wizard 0.2.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 (72) hide show
  1. package/LICENSE +47 -0
  2. package/README.md +34 -0
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +28 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/src/lib/constants.d.ts +20 -0
  7. package/dist/src/lib/constants.js +34 -0
  8. package/dist/src/lib/constants.js.map +1 -0
  9. package/dist/src/nextjs/docs.d.ts +8 -0
  10. package/dist/src/nextjs/docs.js +235 -0
  11. package/dist/src/nextjs/docs.js.map +1 -0
  12. package/dist/src/nextjs/nextjs-wizard.d.ts +9 -0
  13. package/dist/src/nextjs/nextjs-wizard.js +331 -0
  14. package/dist/src/nextjs/nextjs-wizard.js.map +1 -0
  15. package/dist/src/nextjs/prompts.d.ts +12 -0
  16. package/dist/src/nextjs/prompts.js +64 -0
  17. package/dist/src/nextjs/prompts.js.map +1 -0
  18. package/dist/src/nextjs/utils.d.ts +9 -0
  19. package/dist/src/nextjs/utils.js +80 -0
  20. package/dist/src/nextjs/utils.js.map +1 -0
  21. package/dist/src/run.d.ts +8 -0
  22. package/dist/src/run.js +69 -0
  23. package/dist/src/run.js.map +1 -0
  24. package/dist/src/telemetry.d.ts +2 -0
  25. package/dist/src/telemetry.js +13 -0
  26. package/dist/src/telemetry.js.map +1 -0
  27. package/dist/src/utils/analytics.d.ts +4 -0
  28. package/dist/src/utils/analytics.js +10 -0
  29. package/dist/src/utils/analytics.js.map +1 -0
  30. package/dist/src/utils/bash.d.ts +2 -0
  31. package/dist/src/utils/bash.js +54 -0
  32. package/dist/src/utils/bash.js.map +1 -0
  33. package/dist/src/utils/clack-utils.d.ts +177 -0
  34. package/dist/src/utils/clack-utils.js +628 -0
  35. package/dist/src/utils/clack-utils.js.map +1 -0
  36. package/dist/src/utils/clack.d.ts +2 -0
  37. package/dist/src/utils/clack.js +9 -0
  38. package/dist/src/utils/clack.js.map +1 -0
  39. package/dist/src/utils/debug.d.ts +2 -0
  40. package/dist/src/utils/debug.js +22 -0
  41. package/dist/src/utils/debug.js.map +1 -0
  42. package/dist/src/utils/environment.d.ts +1 -0
  43. package/dist/src/utils/environment.js +12 -0
  44. package/dist/src/utils/environment.js.map +1 -0
  45. package/dist/src/utils/file-utils.d.ts +2 -0
  46. package/dist/src/utils/file-utils.js +38 -0
  47. package/dist/src/utils/file-utils.js.map +1 -0
  48. package/dist/src/utils/logging.d.ts +9 -0
  49. package/dist/src/utils/logging.js +50 -0
  50. package/dist/src/utils/logging.js.map +1 -0
  51. package/dist/src/utils/package-json.d.ts +25 -0
  52. package/dist/src/utils/package-json.js +27 -0
  53. package/dist/src/utils/package-json.js.map +1 -0
  54. package/dist/src/utils/package-manager.d.ts +19 -0
  55. package/dist/src/utils/package-manager.js +188 -0
  56. package/dist/src/utils/package-manager.js.map +1 -0
  57. package/dist/src/utils/query.d.ts +6 -0
  58. package/dist/src/utils/query.js +27 -0
  59. package/dist/src/utils/query.js.map +1 -0
  60. package/dist/src/utils/semver.d.ts +5 -0
  61. package/dist/src/utils/semver.js +25 -0
  62. package/dist/src/utils/semver.js.map +1 -0
  63. package/dist/src/utils/string.d.ts +1 -0
  64. package/dist/src/utils/string.js +9 -0
  65. package/dist/src/utils/string.js.map +1 -0
  66. package/dist/src/utils/types.d.ts +30 -0
  67. package/dist/src/utils/types.js +3 -0
  68. package/dist/src/utils/types.js.map +1 -0
  69. package/dist/src/utils/vendor/is-unicorn-supported.d.ts +1 -0
  70. package/dist/src/utils/vendor/is-unicorn-supported.js +24 -0
  71. package/dist/src/utils/vendor/is-unicorn-supported.js.map +1 -0
  72. package/package.json +135 -0
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fulfillsVersionRange = fulfillsVersionRange;
4
+ const semver_1 = require("semver");
5
+ function fulfillsVersionRange({ version, acceptableVersions, canBeLatest, }) {
6
+ if (version === 'latest') {
7
+ return canBeLatest;
8
+ }
9
+ let cleanedUserVersion, isRange;
10
+ if ((0, semver_1.valid)(version)) {
11
+ cleanedUserVersion = (0, semver_1.valid)(version);
12
+ isRange = false;
13
+ }
14
+ else if ((0, semver_1.validRange)(version)) {
15
+ cleanedUserVersion = (0, semver_1.validRange)(version);
16
+ isRange = true;
17
+ }
18
+ return (
19
+ // If the given version is a bogus format, this will still be undefined and we'll automatically reject it
20
+ !!cleanedUserVersion &&
21
+ (isRange
22
+ ? (0, semver_1.subset)(cleanedUserVersion, acceptableVersions)
23
+ : (0, semver_1.satisfies)(cleanedUserVersion, acceptableVersions)));
24
+ }
25
+ //# sourceMappingURL=semver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/utils/semver.ts"],"names":[],"mappings":";;AAEA,oDA8BC;AAhCD,mCAA8D;AAE9D,SAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,kBAAkB,EAClB,WAAW,GAKZ;IACC,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,IAAI,kBAAkB,EAAE,OAAO,CAAC;IAEhC,IAAI,IAAA,cAAK,EAAC,OAAO,CAAC,EAAE,CAAC;QACnB,kBAAkB,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC;QACpC,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;SAAM,IAAI,IAAA,mBAAU,EAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,kBAAkB,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QACzC,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IAED,OAAO;IACL,yGAAyG;IACzG,CAAC,CAAC,kBAAkB;QACpB,CAAC,OAAO;YACN,CAAC,CAAC,IAAA,eAAM,EAAC,kBAAkB,EAAE,kBAAkB,CAAC;YAChD,CAAC,CAAC,IAAA,kBAAS,EAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CACvD,CAAC;AACJ,CAAC","sourcesContent":["import { satisfies, subset, valid, validRange } from 'semver';\n\nexport function fulfillsVersionRange({\n version,\n acceptableVersions,\n canBeLatest,\n}: {\n version: string;\n acceptableVersions: string;\n canBeLatest: boolean;\n}): boolean {\n if (version === 'latest') {\n return canBeLatest;\n }\n\n let cleanedUserVersion, isRange;\n\n if (valid(version)) {\n cleanedUserVersion = valid(version);\n isRange = false;\n } else if (validRange(version)) {\n cleanedUserVersion = validRange(version);\n isRange = true;\n }\n\n return (\n // If the given version is a bogus format, this will still be undefined and we'll automatically reject it\n !!cleanedUserVersion &&\n (isRange\n ? subset(cleanedUserVersion, acceptableVersions)\n : satisfies(cleanedUserVersion, acceptableVersions))\n );\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function stripAnsii(str: string): string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripAnsii = stripAnsii;
4
+ function stripAnsii(str) {
5
+ return str.replace(
6
+ // eslint-disable-next-line no-control-regex
7
+ /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
8
+ }
9
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":";;AAAA,gCAMC;AAND,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO;IAChB,4CAA4C;IAC5C,6EAA6E,EAC7E,EAAE,CACH,CAAC;AACJ,CAAC","sourcesContent":["export function stripAnsii(str: string): string {\n return str.replace(\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,\n '',\n );\n}\n"]}
@@ -0,0 +1,30 @@
1
+ export type PostHogProjectData = Record<string, unknown>;
2
+ export type PreselectedProject = {
3
+ project: PostHogProjectData;
4
+ authToken: string;
5
+ };
6
+ export type WizardOptions = {
7
+ /**
8
+ * Controls whether the wizard should send telemetry data to PostHog.
9
+ */
10
+ telemetryEnabled: boolean;
11
+ /**
12
+ * Whether to enable debug mode.
13
+ */
14
+ debug: boolean;
15
+ /**
16
+ * Whether to force install the SDK package to continue with the installation in case
17
+ * any package manager checks are failing (e.g. peer dependency versions).
18
+ *
19
+ * Use with caution and only if you know what you're doing.
20
+ *
21
+ * Does not apply to all wizard flows (currently NPM only)
22
+ */
23
+ forceInstall: boolean;
24
+ };
25
+ export interface Feature {
26
+ id: string;
27
+ prompt: string;
28
+ enabledHint?: string;
29
+ disabledHint?: string;
30
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export type PostHogProjectData = Record<string, unknown>;\n\nexport type PreselectedProject = {\n project: PostHogProjectData;\n authToken: string;\n};\n\nexport type WizardOptions = {\n /**\n * Controls whether the wizard should send telemetry data to PostHog.\n */\n telemetryEnabled: boolean;\n\n /**\n * Whether to enable debug mode.\n */\n debug: boolean;\n\n /**\n * Whether to force install the SDK package to continue with the installation in case\n * any package manager checks are failing (e.g. peer dependency versions).\n *\n * Use with caution and only if you know what you're doing.\n *\n * Does not apply to all wizard flows (currently NPM only)\n */\n forceInstall: boolean;\n};\n\nexport interface Feature {\n id: string;\n prompt: string;\n enabledHint?: string;\n disabledHint?: string;\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function isUnicodeSupported(): boolean;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ // Vendored from: https://github.com/sindresorhus/is-unicode-supported/blob/c80c691dde9e2fcfe3996810858c6672c8f35ad9/index.js#L3
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isUnicodeSupported = isUnicodeSupported;
5
+ // MIT License
6
+ // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
7
+ // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+ // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+ function isUnicodeSupported() {
11
+ if (process.platform !== 'win32') {
12
+ return process.env.TERM !== 'linux'; // Linux console (kernel)
13
+ }
14
+ return (Boolean(process.env.CI) ||
15
+ Boolean(process.env.WT_SESSION) || // Windows Terminal
16
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
17
+ process.env.ConEmuTask === '{cmd::Cmder}' || // ConEmu and cmder
18
+ process.env.TERM_PROGRAM === 'Terminus-Sublime' ||
19
+ process.env.TERM_PROGRAM === 'vscode' ||
20
+ process.env.TERM === 'xterm-256color' ||
21
+ process.env.TERM === 'alacritty' ||
22
+ process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm');
23
+ }
24
+ //# sourceMappingURL=is-unicorn-supported.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-unicorn-supported.js","sourceRoot":"","sources":["../../../../src/utils/vendor/is-unicorn-supported.ts"],"names":[],"mappings":";AAAA,gIAAgI;;AAYhI,gDAgBC;AA1BD,cAAc;AAEd,kFAAkF;AAElF,mbAAmb;AAEnb,iIAAiI;AAEjI,+cAA+c;AAE/c,SAAgB,kBAAkB;IAChC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,yBAAyB;IAChE,CAAC;IAED,OAAO,CACL,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,mBAAmB;QACtD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,qBAAqB;QAC9D,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,cAAc,IAAI,mBAAmB;QAChE,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,kBAAkB;QAC/C,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,QAAQ;QACrC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,gBAAgB;QACrC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW;QAChC,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,oBAAoB,CACvD,CAAC;AACJ,CAAC","sourcesContent":["// Vendored from: https://github.com/sindresorhus/is-unicode-supported/blob/c80c691dde9e2fcfe3996810858c6672c8f35ad9/index.js#L3\n\n// MIT License\n\n// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport function isUnicodeSupported() {\n if (process.platform !== 'win32') {\n return process.env.TERM !== 'linux'; // Linux console (kernel)\n }\n\n return (\n Boolean(process.env.CI) ||\n Boolean(process.env.WT_SESSION) || // Windows Terminal\n Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)\n process.env.ConEmuTask === '{cmd::Cmder}' || // ConEmu and cmder\n process.env.TERM_PROGRAM === 'Terminus-Sublime' ||\n process.env.TERM_PROGRAM === 'vscode' ||\n process.env.TERM === 'xterm-256color' ||\n process.env.TERM === 'alacritty' ||\n process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm'\n );\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,135 @@
1
+ {
2
+ "name": "@posthog/wizard",
3
+ "version": "0.2.2",
4
+ "homepage": "https://github.com/posthog/wizard",
5
+ "repository": "https://github.com/posthog/wizard",
6
+ "description": "The PostHog wizard helps you to configure your project",
7
+ "keywords": [
8
+ "posthog",
9
+ "wizard",
10
+ "sdk",
11
+ "cli",
12
+ "project",
13
+ "setup",
14
+ "install",
15
+ "configure"
16
+ ],
17
+ "bin": {
18
+ "wizard": "dist/bin.js"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "files": [
24
+ "dist/bin.*",
25
+ "dist/src",
26
+ "package.json",
27
+ "README.md"
28
+ ],
29
+ "main": "dist/index.js",
30
+ "typings": "dist/index.d.ts",
31
+ "typescript": {
32
+ "definition": "dist/index.d.ts"
33
+ },
34
+ "dependencies": {
35
+ "@clack/core": "^0.3.4",
36
+ "@clack/prompts": "0.7.0",
37
+ "@langchain/core": "^0.3.40",
38
+ "axios": "1.7.4",
39
+ "chalk": "^2.4.1",
40
+ "fast-glob": "^3.3.3",
41
+ "glob": "9.3.5",
42
+ "inquirer": "^6.2.0",
43
+ "magicast": "^0.2.10",
44
+ "opn": "^5.4.0",
45
+ "read-env": "^1.3.0",
46
+ "recast": "^0.23.3",
47
+ "semver": "^7.5.3",
48
+ "xcode": "3.0.1",
49
+ "xml-js": "^1.6.11",
50
+ "yargs": "^16.2.0",
51
+ "zod": "^3.24.2",
52
+ "zod-to-json-schema": "^3.24.3"
53
+ },
54
+ "devDependencies": {
55
+ "@babel/types": "~7.21.4",
56
+ "@types/chai": "^4.3.17",
57
+ "@types/glob": "^7.2.0",
58
+ "@types/inquirer": "^0.0.43",
59
+ "@types/jest": "^29.5.14",
60
+ "@types/lodash": "^4.14.144",
61
+ "@types/node": "^18.19.76",
62
+ "@types/opn": "5.1.0",
63
+ "@types/rimraf": "^3.0.2",
64
+ "@types/semver": "^7.3.7",
65
+ "@types/yargs": "^16.0.9",
66
+ "@typescript-eslint/eslint-plugin": "^5.13.0",
67
+ "@typescript-eslint/parser": "^5.13.0",
68
+ "dotenv": "^16.4.7",
69
+ "eslint": "^8.18.0",
70
+ "eslint-config-prettier": "^8.3.0",
71
+ "eslint-plugin-jest": "^25.3.0",
72
+ "jest": "^29.5.0",
73
+ "prettier": "^2.8.7",
74
+ "rimraf": "^3.0.2",
75
+ "ts-jest": "^29.1.0",
76
+ "ts-node": "^10.9.1",
77
+ "tsx": "^3.14.0",
78
+ "typescript": "^5.0.4"
79
+ },
80
+ "engines": {
81
+ "node": "18.x || 20.x",
82
+ "npm": ">=3.10.7"
83
+ },
84
+ "jest": {
85
+ "collectCoverage": true,
86
+ "coveragePathIgnorePatterns": [
87
+ "dist"
88
+ ],
89
+ "transform": {
90
+ "^.+\\.tsx?$": "ts-jest"
91
+ },
92
+ "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
93
+ "moduleFileExtensions": [
94
+ "ts",
95
+ "tsx",
96
+ "js",
97
+ "jsx",
98
+ "json"
99
+ ],
100
+ "modulePathIgnorePatterns": [
101
+ "<rootDir>/dist/"
102
+ ],
103
+ "testPathIgnorePatterns": [
104
+ "/dist/",
105
+ "/node_modules/",
106
+ "\\.d\\.(jsx?|tsx?)$",
107
+ "\\.no-jest\\.(jsx?|tsx?)$",
108
+ "/e2e-tests/"
109
+ ],
110
+ "testEnvironment": "node"
111
+ },
112
+ "author": "PostHog",
113
+ "license": "MIT",
114
+ "volta": {
115
+ "node": "18.20.6",
116
+ "pnpm": "9.15.5"
117
+ },
118
+ "scripts": {
119
+ "clean": "rm -rf ./dist",
120
+ "prebuild": "pnpm clean",
121
+ "build:watch": "pnpm tsc -w",
122
+ "build": "pnpm tsc",
123
+ "postbuild": "chmod +x ./dist/bin.js && cp -r scripts/** dist",
124
+ "lint": "pnpm lint:prettier && pnpm lint:eslint",
125
+ "lint:prettier": "prettier --check \"{lib,src,test}/**/*.ts\"",
126
+ "lint:eslint": "eslint . --cache --format stylish",
127
+ "fix": "pnpm fix:eslint && pnpm fix:prettier",
128
+ "fix:prettier": "prettier --write \"{lib,src,test}/**/*.ts\"",
129
+ "fix:eslint": "eslint . --format stylish --fix",
130
+ "test": "pnpm build && jest",
131
+ "test:e2e": "pnpm build && ./e2e-tests/run.sh",
132
+ "try": "ts-node bin.ts",
133
+ "test:watch": "jest --watch"
134
+ }
135
+ }