@farm.js/create-app 0.1.0-beta.38 → 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.mjs CHANGED
@@ -2562,7 +2562,7 @@ const PACKAGE_MANAGERS = [
2562
2562
  function defaultConfig() {
2563
2563
  return {
2564
2564
  version: TELEMETRY_SCHEMA_VERSION,
2565
- enabled: false,
2565
+ enabled: true,
2566
2566
  noticeShown: false
2567
2567
  };
2568
2568
  }
@@ -2578,15 +2578,24 @@ function getFarmTelemetryConfigFile() {
2578
2578
  async function readConfig() {
2579
2579
  try {
2580
2580
  const parsed = JSON.parse(await readFile(getFarmTelemetryConfigFile(), "utf8"));
2581
- if (parsed.version !== TELEMETRY_SCHEMA_VERSION) return defaultConfig();
2581
+ if (parsed.version !== TELEMETRY_SCHEMA_VERSION) return {
2582
+ config: defaultConfig(),
2583
+ stored: false
2584
+ };
2582
2585
  return {
2583
- version: TELEMETRY_SCHEMA_VERSION,
2584
- enabled: parsed.enabled === true,
2585
- noticeShown: parsed.noticeShown === true,
2586
- anonymousId: isUuid(parsed.anonymousId) ? parsed.anonymousId : void 0
2586
+ config: {
2587
+ version: TELEMETRY_SCHEMA_VERSION,
2588
+ enabled: parsed.enabled === true,
2589
+ noticeShown: parsed.noticeShown === true,
2590
+ anonymousId: isUuid(parsed.anonymousId) ? parsed.anonymousId : void 0
2591
+ },
2592
+ stored: true
2587
2593
  };
2588
2594
  } catch {
2589
- return defaultConfig();
2595
+ return {
2596
+ config: defaultConfig(),
2597
+ stored: false
2598
+ };
2590
2599
  }
2591
2600
  }
2592
2601
  async function writeConfig(config) {
@@ -2662,10 +2671,10 @@ function getEndpoint() {
2662
2671
  }
2663
2672
  }
2664
2673
  async function resolveState() {
2665
- const config = await readConfig();
2674
+ const { config, stored } = await readConfig();
2666
2675
  const environment = environmentDecision();
2667
2676
  const enabled = environment.enabled ?? config.enabled;
2668
- const source = environment.enabled !== void 0 ? "environment" : config.enabled ? "configuration" : "default";
2677
+ const source = environment.enabled !== void 0 ? "environment" : stored ? "configuration" : "default";
2669
2678
  if (!enabled) return {
2670
2679
  config,
2671
2680
  enabled,
@@ -2710,9 +2719,9 @@ async function resolveState() {
2710
2719
  async function showFarmTelemetryNotice() {
2711
2720
  if (!isInteractive() || isContinuousIntegration() || process.env.NODE_ENV === "test") return;
2712
2721
  if (environmentDecision().enabled !== void 0) return;
2713
- const config = await readConfig();
2722
+ const { config } = await readConfig();
2714
2723
  if (config.noticeShown) return;
2715
- process.stderr.write(`Farm.js anonymous telemetry is off during beta. Run "farm telemetry enable" to opt in.\nLearn more: ${TELEMETRY_NOTICE_URL}\n`);
2724
+ process.stderr.write(`Farm.js collects anonymous CLI telemetry by default. Run "farm telemetry disable" to opt out.\nLearn more: ${TELEMETRY_NOTICE_URL}\n`);
2716
2725
  await writeConfig({
2717
2726
  ...config,
2718
2727
  noticeShown: true