UNPKG

@consensys/create-web3-app

Version:

CLI tool for generating Web3 starter projects, streamlining the setup of monorepo structures with a frontend (Next.js or React) and blockchain tooling (HardHat or Foundry). It leverages the commander library for command-line interactions and guides users

38 lines (37 loc) 1.25 kB
var _a; import os from "os"; import { v4 as uuid } from "uuid"; import { Analytics } from "@segment/analytics-node"; var DEFAULT_WRITE_KEY = "AhYEnWamvR0lVj5JYLDsnxcySWdG6Q5J"; var WRITE_KEY = (_a = process.env.SEGMENT_WRITE_KEY) !== null && _a !== void 0 ? _a : DEFAULT_WRITE_KEY; var analyticsDisabled = process.env.SEGMENT_OPT_OUT === "1" || process.env.CI === "true"; var enabled = Boolean(WRITE_KEY) && !analyticsDisabled; var analytics = enabled ? new Analytics({ writeKey: WRITE_KEY }) : { track: function () { }, identify: function () { }, flush: function () { return Promise.resolve(); }, }; var anonymousId = uuid(); export var identifyRun = function () { if (!enabled) return; analytics.identify({ anonymousId: anonymousId, traits: { os_platform: process.platform, os_release: os.release(), node_version: process.version, }, }); }; export var track = function (event, properties) { if (properties === void 0) { properties = {}; } return analytics.track({ event: event, anonymousId: anonymousId, properties: properties, }); }; export var flush = function () { return analytics.flush(); };