@posthog/wizard 0.6.0 → 0.7.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.
Files changed (106) hide show
  1. package/package.json +1 -1
  2. package/dist/bin.d.ts +0 -2
  3. package/dist/bin.js +0 -28
  4. package/dist/bin.js.map +0 -1
  5. package/dist/src/lib/config.d.ts +0 -49
  6. package/dist/src/lib/config.js +0 -85
  7. package/dist/src/lib/config.js.map +0 -1
  8. package/dist/src/lib/constants.d.ts +0 -24
  9. package/dist/src/lib/constants.js +0 -46
  10. package/dist/src/lib/constants.js.map +0 -1
  11. package/dist/src/lib/messages.d.ts +0 -10
  12. package/dist/src/lib/messages.js +0 -37
  13. package/dist/src/lib/messages.js.map +0 -1
  14. package/dist/src/lib/prompts.d.ts +0 -16
  15. package/dist/src/lib/prompts.js +0 -83
  16. package/dist/src/lib/prompts.js.map +0 -1
  17. package/dist/src/nextjs/docs.d.ts +0 -8
  18. package/dist/src/nextjs/docs.js +0 -257
  19. package/dist/src/nextjs/docs.js.map +0 -1
  20. package/dist/src/nextjs/nextjs-wizard.d.ts +0 -2
  21. package/dist/src/nextjs/nextjs-wizard.js +0 -121
  22. package/dist/src/nextjs/nextjs-wizard.js.map +0 -1
  23. package/dist/src/nextjs/utils.d.ts +0 -9
  24. package/dist/src/nextjs/utils.js +0 -83
  25. package/dist/src/nextjs/utils.js.map +0 -1
  26. package/dist/src/react/docs.d.ts +0 -4
  27. package/dist/src/react/docs.js +0 -46
  28. package/dist/src/react/docs.js.map +0 -1
  29. package/dist/src/react/react-wizard.d.ts +0 -2
  30. package/dist/src/react/react-wizard.js +0 -105
  31. package/dist/src/react/react-wizard.js.map +0 -1
  32. package/dist/src/react-native/docs.d.ts +0 -5
  33. package/dist/src/react-native/docs.js +0 -31
  34. package/dist/src/react-native/docs.js.map +0 -1
  35. package/dist/src/react-native/react-native-wizard.d.ts +0 -2
  36. package/dist/src/react-native/react-native-wizard.js +0 -123
  37. package/dist/src/react-native/react-native-wizard.js.map +0 -1
  38. package/dist/src/run.d.ts +0 -13
  39. package/dist/src/run.js +0 -83
  40. package/dist/src/run.js.map +0 -1
  41. package/dist/src/svelte/docs.d.ts +0 -3
  42. package/dist/src/svelte/docs.js +0 -110
  43. package/dist/src/svelte/docs.js.map +0 -1
  44. package/dist/src/svelte/svelte-wizard.d.ts +0 -2
  45. package/dist/src/svelte/svelte-wizard.js +0 -113
  46. package/dist/src/svelte/svelte-wizard.js.map +0 -1
  47. package/dist/src/telemetry.d.ts +0 -2
  48. package/dist/src/telemetry.js +0 -13
  49. package/dist/src/telemetry.js.map +0 -1
  50. package/dist/src/utils/analytics.d.ts +0 -12
  51. package/dist/src/utils/analytics.js +0 -59
  52. package/dist/src/utils/analytics.js.map +0 -1
  53. package/dist/src/utils/bash.d.ts +0 -2
  54. package/dist/src/utils/bash.js +0 -54
  55. package/dist/src/utils/bash.js.map +0 -1
  56. package/dist/src/utils/clack-utils.d.ts +0 -184
  57. package/dist/src/utils/clack-utils.js +0 -683
  58. package/dist/src/utils/clack-utils.js.map +0 -1
  59. package/dist/src/utils/clack.d.ts +0 -2
  60. package/dist/src/utils/clack.js +0 -9
  61. package/dist/src/utils/clack.js.map +0 -1
  62. package/dist/src/utils/debug.d.ts +0 -2
  63. package/dist/src/utils/debug.js +0 -22
  64. package/dist/src/utils/debug.js.map +0 -1
  65. package/dist/src/utils/environment.d.ts +0 -9
  66. package/dist/src/utils/environment.js +0 -164
  67. package/dist/src/utils/environment.js.map +0 -1
  68. package/dist/src/utils/file-utils.d.ts +0 -29
  69. package/dist/src/utils/file-utils.js +0 -177
  70. package/dist/src/utils/file-utils.js.map +0 -1
  71. package/dist/src/utils/logging.d.ts +0 -9
  72. package/dist/src/utils/logging.js +0 -50
  73. package/dist/src/utils/logging.js.map +0 -1
  74. package/dist/src/utils/package-json.d.ts +0 -25
  75. package/dist/src/utils/package-json.js +0 -27
  76. package/dist/src/utils/package-json.js.map +0 -1
  77. package/dist/src/utils/package-manager.d.ts +0 -21
  78. package/dist/src/utils/package-manager.js +0 -208
  79. package/dist/src/utils/package-manager.js.map +0 -1
  80. package/dist/src/utils/query.d.ts +0 -8
  81. package/dist/src/utils/query.js +0 -27
  82. package/dist/src/utils/query.js.map +0 -1
  83. package/dist/src/utils/rules/add-editor-rules.d.ts +0 -9
  84. package/dist/src/utils/rules/add-editor-rules.js +0 -90
  85. package/dist/src/utils/rules/add-editor-rules.js.map +0 -1
  86. package/dist/src/utils/rules/add-editor-rules.ts +0 -86
  87. package/dist/src/utils/rules/next-rules.md +0 -9
  88. package/dist/src/utils/rules/react-native-rules.md +0 -7
  89. package/dist/src/utils/rules/react-rules.md +0 -7
  90. package/dist/src/utils/rules/svelte-rules.md +0 -7
  91. package/dist/src/utils/rules/universal.md +0 -20
  92. package/dist/src/utils/semver.d.ts +0 -5
  93. package/dist/src/utils/semver.js +0 -25
  94. package/dist/src/utils/semver.js.map +0 -1
  95. package/dist/src/utils/string.d.ts +0 -1
  96. package/dist/src/utils/string.js +0 -9
  97. package/dist/src/utils/string.js.map +0 -1
  98. package/dist/src/utils/types.d.ts +0 -48
  99. package/dist/src/utils/types.js +0 -3
  100. package/dist/src/utils/types.js.map +0 -1
  101. package/dist/src/utils/urls.d.ts +0 -4
  102. package/dist/src/utils/urls.js +0 -35
  103. package/dist/src/utils/urls.js.map +0 -1
  104. package/dist/src/utils/vendor/is-unicorn-supported.d.ts +0 -1
  105. package/dist/src/utils/vendor/is-unicorn-supported.js +0 -24
  106. package/dist/src/utils/vendor/is-unicorn-supported.js.map +0 -1
@@ -1,113 +0,0 @@
1
- "use strict";
2
- /* eslint-disable max-lines */
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.runSvelteWizard = runSvelteWizard;
8
- const clack_utils_1 = require("../utils/clack-utils");
9
- const package_json_1 = require("../utils/package-json");
10
- const clack_1 = __importDefault(require("../utils/clack"));
11
- const constants_1 = require("../lib/constants");
12
- const docs_1 = require("./docs");
13
- const analytics_1 = require("../utils/analytics");
14
- const environment_1 = require("../utils/environment");
15
- const file_utils_1 = require("../utils/file-utils");
16
- const clack_utils_2 = require("../utils/clack-utils");
17
- const add_editor_rules_1 = require("../utils/rules/add-editor-rules");
18
- const messages_1 = require("../lib/messages");
19
- async function runSvelteWizard(options) {
20
- (0, clack_utils_1.printWelcome)({
21
- wizardName: 'PostHog Svelte Wizard',
22
- });
23
- const aiConsent = await (0, clack_utils_1.askForAIConsent)(options);
24
- if (!aiConsent) {
25
- await (0, clack_utils_1.abort)('The Svelte wizard requires AI to get setup right now. Please view the docs to setup Svelte manually instead: https://posthog.com/docs/libraries/svelte', 0);
26
- }
27
- const cloudRegion = options.cloudRegion ?? (await (0, clack_utils_2.askForCloudRegion)());
28
- const typeScriptDetected = (0, clack_utils_1.isUsingTypeScript)(options);
29
- await (0, clack_utils_1.confirmContinueIfNoOrDirtyGitRepo)(options);
30
- const packageJson = await (0, clack_utils_1.getPackageDotJson)(options);
31
- await (0, clack_utils_1.ensurePackageIsInstalled)(packageJson, '@sveltejs/kit', '@sveltejs/kit');
32
- const svelteVersion = (0, package_json_1.getPackageVersion)('@sveltejs/kit', packageJson);
33
- if (svelteVersion) {
34
- analytics_1.analytics.setTag('svelte-version', svelteVersion);
35
- }
36
- const { projectApiKey, wizardHash, host } = await (0, clack_utils_1.getOrAskForProjectData)({
37
- ...options,
38
- cloudRegion,
39
- });
40
- const sdkAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('posthog-js', packageJson);
41
- analytics_1.analytics.setTag('sdk-already-installed', sdkAlreadyInstalled);
42
- const { packageManager: packageManagerFromInstallStep } = await (0, clack_utils_1.installPackage)({
43
- packageName: 'posthog-js',
44
- packageNameDisplayLabel: 'posthog-js',
45
- alreadyInstalled: !!packageJson?.dependencies?.['posthog-js'],
46
- forceInstall: options.forceInstall,
47
- askBeforeUpdating: false,
48
- installDir: options.installDir,
49
- integration: constants_1.Integration.svelte,
50
- });
51
- await (0, clack_utils_1.installPackage)({
52
- packageName: 'posthog-node',
53
- packageNameDisplayLabel: 'posthog-node',
54
- packageManager: packageManagerFromInstallStep,
55
- alreadyInstalled: !!packageJson?.dependencies?.['posthog-node'],
56
- forceInstall: options.forceInstall,
57
- askBeforeUpdating: false,
58
- installDir: options.installDir,
59
- integration: constants_1.Integration.svelte,
60
- });
61
- const relevantFiles = await (0, file_utils_1.getRelevantFilesForIntegration)({
62
- installDir: options.installDir,
63
- integration: constants_1.Integration.svelte,
64
- });
65
- const installationDocumentation = (0, docs_1.getSvelteDocumentation)({
66
- language: typeScriptDetected ? 'typescript' : 'javascript',
67
- });
68
- clack_1.default.log.info(`Reviewing PostHog documentation for Svelte`);
69
- const filesToChange = await (0, file_utils_1.getFilesToChange)({
70
- integration: constants_1.Integration.svelte,
71
- relevantFiles,
72
- documentation: installationDocumentation,
73
- wizardHash,
74
- cloudRegion,
75
- });
76
- await (0, file_utils_1.generateFileChangesForIntegration)({
77
- integration: constants_1.Integration.svelte,
78
- filesToChange,
79
- wizardHash,
80
- installDir: options.installDir,
81
- documentation: installationDocumentation,
82
- cloudRegion,
83
- });
84
- await (0, environment_1.addOrUpdateEnvironmentVariables)({
85
- variables: {
86
- ['PUBLIC_POSTHOG_KEY']: projectApiKey,
87
- ['PUBLIC_POSTHOG_HOST']: host,
88
- },
89
- installDir: options.installDir,
90
- integration: constants_1.Integration.svelte,
91
- });
92
- const packageManagerForOutro = packageManagerFromInstallStep ?? (await (0, clack_utils_1.getPackageManager)(options));
93
- await (0, clack_utils_1.runPrettierIfInstalled)({
94
- installDir: options.installDir,
95
- integration: constants_1.Integration.svelte,
96
- });
97
- const addedEditorRules = await (0, add_editor_rules_1.addEditorRules)({
98
- installDir: options.installDir,
99
- rulesName: 'svelte-rules.md',
100
- integration: constants_1.Integration.svelte,
101
- default: options.default,
102
- });
103
- const outroMessage = (0, messages_1.getOutroMessage)({
104
- options,
105
- integration: constants_1.Integration.svelte,
106
- cloudRegion,
107
- addedEditorRules,
108
- packageManager: packageManagerForOutro,
109
- });
110
- clack_1.default.outro(outroMessage);
111
- await analytics_1.analytics.shutdown('success');
112
- }
113
- //# sourceMappingURL=svelte-wizard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"svelte-wizard.js","sourceRoot":"","sources":["../../../src/svelte/svelte-wizard.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;;;AA+B9B,0CA4HC;AAzJD,sDAY8B;AAC9B,wDAA+E;AAC/E,2DAAmC;AACnC,gDAA+C;AAC/C,iCAAgD;AAChD,kDAA+C;AAC/C,sDAAuE;AACvE,oDAI6B;AAE7B,sDAAyD;AACzD,sEAAiE;AACjE,8CAAkD;AAE3C,KAAK,UAAU,eAAe,CAAC,OAAsB;IAC1D,IAAA,0BAAY,EAAC;QACX,UAAU,EAAE,uBAAuB;KACpC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,MAAM,IAAA,6BAAe,EAAC,OAAO,CAAC,CAAC;IAEjD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAA,mBAAK,EACT,wJAAwJ,EACxJ,CAAC,CACF,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,MAAM,IAAA,+BAAiB,GAAE,CAAC,CAAC;IAEvE,MAAM,kBAAkB,GAAG,IAAA,+BAAiB,EAAC,OAAO,CAAC,CAAC;IAEtD,MAAM,IAAA,+CAAiC,EAAC,OAAO,CAAC,CAAC;IAEjD,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAiB,EAAC,OAAO,CAAC,CAAC;IAErD,MAAM,IAAA,sCAAwB,EAAC,WAAW,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;IAE9E,MAAM,aAAa,GAAG,IAAA,gCAAiB,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAEtE,IAAI,aAAa,EAAE,CAAC;QAClB,q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O;QACP,WAAW,EAAE,uBAAW,CAAC,MAAM;QAC/B,WAAW;QACX,gBAAgB;QAChB,cAAc,EAAE,sBAAsB;KACvC,CAAC,CAAC;IAEH,eAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE1B,MAAM,qBAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC","sourcesContent":["/* eslint-disable max-lines */\n\nimport {\n abort,\n askForAIConsent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n runPrettierIfInstalled,\n} from '../utils/clack-utils';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport clack from '../utils/clack';\nimport { Integration } from '../lib/constants';\nimport { getSvelteDocumentation } from './docs';\nimport { analytics } from '../utils/analytics';\nimport { addOrUpdateEnvironmentVariables } from '../utils/environment';\nimport {\n generateFileChangesForIntegration,\n getFilesToChange,\n getRelevantFilesForIntegration,\n} from '../utils/file-utils';\nimport type { WizardOptions } from '../utils/types';\nimport { askForCloudRegion } from '../utils/clack-utils';\nimport { addEditorRules } from '../utils/rules/add-editor-rules';\nimport { getOutroMessage } from '../lib/messages';\n\nexport async function runSvelteWizard(options: WizardOptions): Promise<void> {\n printWelcome({\n wizardName: 'PostHog Svelte Wizard',\n });\n\n const aiConsent = await askForAIConsent(options);\n\n if (!aiConsent) {\n await abort(\n 'The Svelte wizard requires AI to get setup right now. Please view the docs to setup Svelte manually instead: https://posthog.com/docs/libraries/svelte',\n 0,\n );\n }\n\n const cloudRegion = options.cloudRegion ?? (await askForCloudRegion());\n\n const typeScriptDetected = isUsingTypeScript(options);\n\n await confirmContinueIfNoOrDirtyGitRepo(options);\n\n const packageJson = await getPackageDotJson(options);\n\n await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', '@sveltejs/kit');\n\n const svelteVersion = getPackageVersion('@sveltejs/kit', packageJson);\n\n if (svelteVersion) {\n analytics.setTag('svelte-version', svelteVersion);\n }\n\n const { projectApiKey, wizardHash, host } = await getOrAskForProjectData({\n ...options,\n cloudRegion,\n });\n\n const sdkAlreadyInstalled = hasPackageInstalled('posthog-js', packageJson);\n\n analytics.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n const { packageManager: packageManagerFromInstallStep } =\n await installPackage({\n packageName: 'posthog-js',\n packageNameDisplayLabel: 'posthog-js',\n alreadyInstalled: !!packageJson?.dependencies?.['posthog-js'],\n forceInstall: options.forceInstall,\n askBeforeUpdating: false,\n installDir: options.installDir,\n integration: Integration.svelte,\n });\n\n await installPackage({\n packageName: 'posthog-node',\n packageNameDisplayLabel: 'posthog-node',\n packageManager: packageManagerFromInstallStep,\n alreadyInstalled: !!packageJson?.dependencies?.['posthog-node'],\n forceInstall: options.forceInstall,\n askBeforeUpdating: false,\n installDir: options.installDir,\n integration: Integration.svelte,\n });\n\n const relevantFiles = await getRelevantFilesForIntegration({\n installDir: options.installDir,\n integration: Integration.svelte,\n });\n\n const installationDocumentation = getSvelteDocumentation({\n language: typeScriptDetected ? 'typescript' : 'javascript',\n });\n\n clack.log.info(`Reviewing PostHog documentation for Svelte`);\n\n const filesToChange = await getFilesToChange({\n integration: Integration.svelte,\n relevantFiles,\n documentation: installationDocumentation,\n wizardHash,\n cloudRegion,\n });\n\n await generateFileChangesForIntegration({\n integration: Integration.svelte,\n filesToChange,\n wizardHash,\n installDir: options.installDir,\n documentation: installationDocumentation,\n cloudRegion,\n });\n\n await addOrUpdateEnvironmentVariables({\n variables: {\n ['PUBLIC_POSTHOG_KEY']: projectApiKey,\n ['PUBLIC_POSTHOG_HOST']: host,\n },\n installDir: options.installDir,\n integration: Integration.svelte,\n });\n\n const packageManagerForOutro =\n packageManagerFromInstallStep ?? (await getPackageManager(options));\n\n await runPrettierIfInstalled({\n installDir: options.installDir,\n integration: Integration.svelte,\n });\n\n const addedEditorRules = await addEditorRules({\n installDir: options.installDir,\n rulesName: 'svelte-rules.md',\n integration: Integration.svelte,\n default: options.default,\n });\n\n const outroMessage = getOutroMessage({\n options,\n integration: Integration.svelte,\n cloudRegion,\n addedEditorRules,\n packageManager: packageManagerForOutro,\n });\n\n clack.outro(outroMessage);\n\n await analytics.shutdown('success');\n}\n"]}
@@ -1,2 +0,0 @@
1
- export declare function traceStep<T>(step: string, callback: () => T): T;
2
- export declare function updateProgress(step: string): void;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.traceStep = traceStep;
4
- exports.updateProgress = updateProgress;
5
- const analytics_1 = require("./utils/analytics");
6
- function traceStep(step, callback) {
7
- updateProgress(step);
8
- return callback();
9
- }
10
- function updateProgress(step) {
11
- analytics_1.analytics.setTag('progress', step);
12
- }
13
- //# sourceMappingURL=telemetry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/telemetry.ts"],"names":[],"mappings":";;AAEA,8BAGC;AAED,wCAEC;AATD,iDAA8C;AAE9C,SAAgB,SAAS,CAAI,IAAY,EAAE,QAAiB;IAC1D,cAAc,CAAC,IAAI,CAAC,CAAC;IACrB,OAAO,QAAQ,EAAE,CAAC;AACpB,CAAC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,qBAAS,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { analytics } from './utils/analytics';\n\nexport function traceStep<T>(step: string, callback: () => T): T {\n updateProgress(step);\n return callback();\n}\n\nexport function updateProgress(step: string) {\n analytics.setTag('progress', step);\n}\n"]}
@@ -1,12 +0,0 @@
1
- export declare class Analytics {
2
- private client;
3
- private tags;
4
- private distinctId?;
5
- private anonymousId;
6
- constructor();
7
- setDistinctId(distinctId: string): void;
8
- setTag(key: string, value: string | boolean | number | null | undefined): void;
9
- capture(eventName: string, properties?: Record<string, unknown>): void;
10
- shutdown(status: 'success' | 'error' | 'cancelled'): Promise<void>;
11
- }
12
- export declare const analytics: Analytics;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.analytics = exports.Analytics = void 0;
4
- const posthog_node_1 = require("posthog-node");
5
- const constants_1 = require("../lib/constants");
6
- const uuid_1 = require("uuid");
7
- class Analytics {
8
- client;
9
- tags = {};
10
- distinctId;
11
- anonymousId;
12
- constructor() {
13
- this.client = new posthog_node_1.PostHog(constants_1.ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY, {
14
- host: constants_1.ANALYTICS_HOST_URL,
15
- flushAt: 1,
16
- flushInterval: 0,
17
- });
18
- this.tags = {};
19
- this.anonymousId = (0, uuid_1.v4)();
20
- this.distinctId = undefined;
21
- }
22
- setDistinctId(distinctId) {
23
- this.distinctId = distinctId;
24
- this.client.alias({
25
- distinctId,
26
- alias: this.anonymousId,
27
- });
28
- }
29
- setTag(key, value) {
30
- this.tags[key] = value;
31
- }
32
- capture(eventName, properties) {
33
- this.client.capture({
34
- distinctId: this.distinctId ?? this.anonymousId,
35
- event: eventName,
36
- properties: {
37
- ...this.tags,
38
- ...properties,
39
- },
40
- });
41
- }
42
- async shutdown(status) {
43
- if (Object.keys(this.tags).length === 0) {
44
- return;
45
- }
46
- this.client.capture({
47
- distinctId: this.distinctId ?? this.anonymousId,
48
- event: 'setup wizard finished',
49
- properties: {
50
- status,
51
- tags: this.tags,
52
- },
53
- });
54
- await this.client.shutdown();
55
- }
56
- }
57
- exports.Analytics = Analytics;
58
- exports.analytics = new Analytics();
59
- //# sourceMappingURL=analytics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/utils/analytics.ts"],"names":[],"mappings":";;;AAAA,+CAAuC;AACvC,gDAG0B;AAC1B,+BAAoC;AACpC,MAAa,SAAS;IACZ,MAAM,CAAU;IAChB,IAAI,GACV,EAAE,CAAC;IACG,UAAU,CAAU;IACpB,WAAW,CAAS;IAE5B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CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;CACF;AA5DD,8BA4DC;AAEY,QAAA,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC","sourcesContent":["import { PostHog } from 'posthog-node';\nimport {\n ANALYTICS_HOST_URL,\n ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY,\n} from '../lib/constants';\nimport { v4 as uuidv4 } from 'uuid';\nexport class Analytics {\n private client: PostHog;\n private tags: Record<string, string | boolean | number | null | undefined> =\n {};\n private distinctId?: string;\n private anonymousId: string;\n\n constructor() {\n this.client = new PostHog(ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY, {\n host: ANALYTICS_HOST_URL,\n flushAt: 1,\n flushInterval: 0,\n });\n\n this.tags = {};\n\n this.anonymousId = uuidv4();\n\n this.distinctId = undefined;\n }\n\n setDistinctId(distinctId: string) {\n this.distinctId = distinctId;\n this.client.alias({\n distinctId,\n alias: this.anonymousId,\n });\n }\n\n setTag(key: string, value: string | boolean | number | null | undefined) {\n this.tags[key] = value;\n }\n\n capture(eventName: string, properties?: Record<string, unknown>) {\n this.client.capture({\n distinctId: this.distinctId ?? this.anonymousId,\n event: eventName,\n properties: {\n ...this.tags,\n ...properties,\n },\n });\n }\n\n async shutdown(status: 'success' | 'error' | 'cancelled') {\n if (Object.keys(this.tags).length === 0) {\n return;\n }\n\n this.client.capture({\n distinctId: this.distinctId ?? this.anonymousId,\n event: 'setup wizard finished',\n properties: {\n status,\n tags: this.tags,\n },\n });\n\n await this.client.shutdown();\n }\n}\n\nexport const analytics = new Analytics();\n"]}
@@ -1,2 +0,0 @@
1
- export declare function executeSync(command: string): string;
2
- export declare function execute(command: string): Promise<string>;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.executeSync = executeSync;
37
- exports.execute = execute;
38
- const child_process = __importStar(require("child_process"));
39
- function executeSync(command) {
40
- const output = child_process.execSync(command);
41
- return output.toString();
42
- }
43
- function execute(command) {
44
- return new Promise((resolve, reject) => {
45
- child_process.exec(command, (error, stdout, _) => {
46
- if (error) {
47
- reject(error);
48
- return;
49
- }
50
- resolve(stdout);
51
- });
52
- });
53
- }
54
- //# sourceMappingURL=bash.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/utils/bash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kCAGC;AAED,0BAWC;AAlBD,6DAA+C;AAE/C,SAAgB,WAAW,CAAC,OAAe;IACzC,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YAED,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as child_process from 'child_process';\n\nexport function executeSync(command: string): string {\n const output = child_process.execSync(command);\n return output.toString();\n}\n\nexport function execute(command: string): Promise<string> {\n return new Promise((resolve, reject) => {\n child_process.exec(command, (error, stdout, _) => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve(stdout);\n });\n });\n}\n"]}
@@ -1,184 +0,0 @@
1
- import { type PackageDotJson } from './package-json';
2
- import { type PackageManager } from './package-manager';
3
- import type { CloudRegion, Feature, WizardOptions } from './types';
4
- import { type Integration } from '../lib/constants';
5
- export interface CliSetupConfig {
6
- filename: string;
7
- name: string;
8
- gitignore: boolean;
9
- likelyAlreadyHasAuthToken(contents: string): boolean;
10
- tokenContent(authToken: string): string;
11
- likelyAlreadyHasOrgAndProject(contents: string): boolean;
12
- orgAndProjContent(org: string, project: string): string;
13
- likelyAlreadyHasUrl?(contents: string): boolean;
14
- urlContent?(url: string): string;
15
- }
16
- export interface CliSetupConfigContent {
17
- authToken: string;
18
- org?: string;
19
- project?: string;
20
- url?: string;
21
- }
22
- export declare function abort(message?: string, status?: number): Promise<never>;
23
- export declare function abortIfCancelled<T>(input: T | Promise<T>): Promise<Exclude<T, symbol>>;
24
- export declare function printWelcome(options: {
25
- wizardName: string;
26
- message?: string;
27
- }): void;
28
- export declare function confirmContinueIfNoOrDirtyGitRepo(options: Pick<WizardOptions, 'default'>): Promise<void>;
29
- export declare function isInGitRepo(): boolean;
30
- export declare function getUncommittedOrUntrackedFiles(): string[];
31
- export declare function askForItemSelection(items: string[], message: string): Promise<{
32
- value: string;
33
- index: number;
34
- }>;
35
- export declare function confirmContinueIfPackageVersionNotSupported({ packageId, packageName, packageVersion, acceptableVersions, note, }: {
36
- packageId: string;
37
- packageName: string;
38
- packageVersion: string;
39
- acceptableVersions: string;
40
- note?: string;
41
- }): Promise<void>;
42
- /**
43
- * Installs or updates a package with the user's package manager.
44
- *
45
- * IMPORTANT: This function modifies the `package.json`! Be sure to re-read
46
- * it if you make additional modifications to it after calling this function!
47
- */
48
- export declare function installPackage({ packageName, alreadyInstalled, askBeforeUpdating, packageNameDisplayLabel, packageManager, forceInstall, integration, installDir, }: {
49
- /** The string that is passed to the package manager CLI as identifier to install (e.g. `posthog-js`, or `posthog-js@^1.100.0`) */
50
- packageName: string;
51
- alreadyInstalled: boolean;
52
- askBeforeUpdating?: boolean;
53
- /** Overrides what is shown in the installation logs in place of the `packageName` option. Useful if the `packageName` is ugly */
54
- packageNameDisplayLabel?: string;
55
- packageManager?: PackageManager;
56
- /** Add force install flag to command to skip install precondition fails */
57
- forceInstall?: boolean;
58
- /** The integration that is being used */
59
- integration?: string;
60
- /** The directory to install the package in */
61
- installDir: string;
62
- }): Promise<{
63
- packageManager?: PackageManager;
64
- }>;
65
- export declare function runPrettierIfInstalled({ installDir, integration, }: Pick<WizardOptions, 'installDir'> & {
66
- integration: Integration;
67
- }): Promise<void>;
68
- /**
69
- * Checks if @param packageId is listed as a dependency in @param packageJson.
70
- * If not, it will ask users if they want to continue without the package.
71
- *
72
- * Use this function to check if e.g. a the framework of the SDK is installed
73
- *
74
- * @param packageJson the package.json object
75
- * @param packageId the npm name of the package
76
- * @param packageName a human readable name of the package
77
- */
78
- export declare function ensurePackageIsInstalled(packageJson: PackageDotJson, packageId: string, packageName: string): Promise<void>;
79
- export declare function getPackageDotJson({ installDir, }: Pick<WizardOptions, 'installDir'>): Promise<PackageDotJson>;
80
- export declare function updatePackageDotJson(packageDotJson: PackageDotJson, { installDir }: Pick<WizardOptions, 'installDir'>): Promise<void>;
81
- export declare function getPackageManager({ installDir, }: Pick<WizardOptions, 'installDir'>): Promise<PackageManager>;
82
- export declare function isUsingTypeScript({ installDir, }: Pick<WizardOptions, 'installDir'>): boolean;
83
- /**
84
- *
85
- * Use this function to get project data for the wizard.
86
- *
87
- * @param options wizard options
88
- * @returns project data (token, url)
89
- */
90
- export declare function getOrAskForProjectData(_options: WizardOptions & {
91
- cloudRegion: CloudRegion;
92
- }): Promise<{
93
- wizardHash: string;
94
- host: string;
95
- projectApiKey: string;
96
- }>;
97
- /**
98
- * Asks users if they have a config file for @param tool (e.g. Vite).
99
- * If yes, asks users to specify the path to their config file.
100
- *
101
- * Use this helper function as a fallback mechanism if the lookup for
102
- * a config file with its most usual location/name fails.
103
- *
104
- * @param toolName Name of the tool for which we're looking for the config file
105
- * @param configFileName Name of the most common config file name (e.g. vite.config.js)
106
- *
107
- * @returns a user path to the config file or undefined if the user doesn't have a config file
108
- */
109
- export declare function askForToolConfigPath(toolName: string, configFileName: string): Promise<string | undefined>;
110
- /**
111
- * Prints copy/paste-able instructions to the console.
112
- * Afterwards asks the user if they added the code snippet to their file.
113
- *
114
- * While there's no point in providing a "no" answer here, it gives users time to fulfill the
115
- * task before the wizard continues with additional steps.
116
- *
117
- * Use this function if you want to show users instructions on how to add/modify
118
- * code in their file. This is helpful if automatic insertion failed or is not possible/feasible.
119
- *
120
- * @param filename the name of the file to which the code snippet should be applied.
121
- * If a path is provided, only the filename will be used.
122
- *
123
- * @param codeSnippet the snippet to be printed. Use {@link makeCodeSnippet} to create the
124
- * diff-like format for visually highlighting unchanged or modified lines of code.
125
- *
126
- * @param hint (optional) a hint to be printed after the main instruction to add
127
- * the code from @param codeSnippet to their @param filename.
128
- *
129
- * TODO: refactor copy paste instructions across different wizards to use this function.
130
- * this might require adding a custom message parameter to the function
131
- */
132
- export declare function showCopyPasteInstructions(filename: string, codeSnippet: string, hint?: string): Promise<void>;
133
- /**
134
- * Callback that exposes formatting helpers for a code snippet.
135
- * @param unchanged - Formats text as old code.
136
- * @param plus - Formats text as new code.
137
- * @param minus - Formats text as removed code.
138
- */
139
- type CodeSnippetFormatter = (unchanged: (txt: string) => string, plus: (txt: string) => string, minus: (txt: string) => string) => string;
140
- /**
141
- * Crafts a code snippet that can be used to e.g.
142
- * - print copy/paste instructions to the console
143
- * - create a new config file.
144
- *
145
- * @param colors set this to true if you want the final snippet to be colored.
146
- * This is useful for printing the snippet to the console as part of copy/paste instructions.
147
- *
148
- * @param callback the callback that returns the formatted code snippet.
149
- * It exposes takes the helper functions for marking code as unchanged, new or removed.
150
- * These functions no-op if no special formatting should be applied
151
- * and otherwise apply the appropriate formatting/coloring.
152
- * (@see {@link CodeSnippetFormatter})
153
- *
154
- * @see {@link showCopyPasteInstructions} for the helper with which to display the snippet in the console.
155
- *
156
- * @returns a string containing the final, formatted code snippet.
157
- */
158
- export declare function makeCodeSnippet(colors: boolean, callback: CodeSnippetFormatter): string;
159
- /**
160
- * Creates a new config file with the given @param filepath and @param codeSnippet.
161
- *
162
- * Use this function to create a new config file for users. This is useful
163
- * when users answered that they don't yet have a config file for a tool.
164
- *
165
- * (This doesn't mean that they don't yet have some other way of configuring
166
- * their tool but we can leave it up to them to figure out how to merge configs
167
- * here.)
168
- *
169
- * @param filepath absolute path to the new config file
170
- * @param codeSnippet the snippet to be inserted into the file
171
- * @param moreInformation (optional) the message to be printed after the file was created
172
- * For example, this can be a link to more information about configuring the tool.
173
- *
174
- * @returns true on success, false otherwise
175
- */
176
- export declare function createNewConfigFile(filepath: string, codeSnippet: string, { installDir }: Pick<WizardOptions, 'installDir'>, moreInformation?: string): Promise<boolean>;
177
- export declare function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(features: F): Promise<{
178
- [key in F[number]['id']]: boolean;
179
- }>;
180
- export declare function askShouldInstallPackage(pkgName: string): Promise<boolean>;
181
- export declare function askShouldAddPackageOverride(pkgName: string, pkgVersion: string): Promise<boolean>;
182
- export declare function askForAIConsent(options: Pick<WizardOptions, 'default'>): Promise<boolean>;
183
- export declare function askForCloudRegion(): Promise<CloudRegion>;
184
- export {};