@farm.js/create-app 0.1.0-beta.37 → 0.1.0-beta.39

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/index.js CHANGED
@@ -2569,7 +2569,7 @@ const PACKAGE_MANAGERS = [
2569
2569
  function defaultConfig() {
2570
2570
  return {
2571
2571
  version: TELEMETRY_SCHEMA_VERSION,
2572
- enabled: false,
2572
+ enabled: true,
2573
2573
  noticeShown: false
2574
2574
  };
2575
2575
  }
@@ -2585,15 +2585,24 @@ function getFarmTelemetryConfigFile() {
2585
2585
  async function readConfig() {
2586
2586
  try {
2587
2587
  const parsed = JSON.parse(await (0, node_fs_promises.readFile)(getFarmTelemetryConfigFile(), "utf8"));
2588
- if (parsed.version !== TELEMETRY_SCHEMA_VERSION) return defaultConfig();
2588
+ if (parsed.version !== TELEMETRY_SCHEMA_VERSION) return {
2589
+ config: defaultConfig(),
2590
+ stored: false
2591
+ };
2589
2592
  return {
2590
- version: TELEMETRY_SCHEMA_VERSION,
2591
- enabled: parsed.enabled === true,
2592
- noticeShown: parsed.noticeShown === true,
2593
- anonymousId: isUuid(parsed.anonymousId) ? parsed.anonymousId : void 0
2593
+ config: {
2594
+ version: TELEMETRY_SCHEMA_VERSION,
2595
+ enabled: parsed.enabled === true,
2596
+ noticeShown: parsed.noticeShown === true,
2597
+ anonymousId: isUuid(parsed.anonymousId) ? parsed.anonymousId : void 0
2598
+ },
2599
+ stored: true
2594
2600
  };
2595
2601
  } catch {
2596
- return defaultConfig();
2602
+ return {
2603
+ config: defaultConfig(),
2604
+ stored: false
2605
+ };
2597
2606
  }
2598
2607
  }
2599
2608
  async function writeConfig(config) {
@@ -2669,10 +2678,10 @@ function getEndpoint() {
2669
2678
  }
2670
2679
  }
2671
2680
  async function resolveState() {
2672
- const config = await readConfig();
2681
+ const { config, stored } = await readConfig();
2673
2682
  const environment = environmentDecision();
2674
2683
  const enabled = environment.enabled ?? config.enabled;
2675
- const source = environment.enabled !== void 0 ? "environment" : config.enabled ? "configuration" : "default";
2684
+ const source = environment.enabled !== void 0 ? "environment" : stored ? "configuration" : "default";
2676
2685
  if (!enabled) return {
2677
2686
  config,
2678
2687
  enabled,
@@ -2717,9 +2726,9 @@ async function resolveState() {
2717
2726
  async function showFarmTelemetryNotice() {
2718
2727
  if (!isInteractive() || isContinuousIntegration() || process.env.NODE_ENV === "test") return;
2719
2728
  if (environmentDecision().enabled !== void 0) return;
2720
- const config = await readConfig();
2729
+ const { config } = await readConfig();
2721
2730
  if (config.noticeShown) return;
2722
- process.stderr.write(`Farm.js anonymous telemetry is off during beta. Run "farm telemetry enable" to opt in.\nLearn more: ${TELEMETRY_NOTICE_URL}\n`);
2731
+ process.stderr.write(`Farm.js collects anonymous CLI telemetry by default. Run "farm telemetry disable" to opt out.\nLearn more: ${TELEMETRY_NOTICE_URL}\n`);
2723
2732
  await writeConfig({
2724
2733
  ...config,
2725
2734
  noticeShown: true