How to use the @hint/utils.appInsights.trackEvent function in @hint/utils

To help you get started, we’ve selected a few @hint/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webhintio / hint / packages / hint / src / lib / cli / analyze.ts View on Github external
const askToInstallPackages = async (resources: HintResources): Promise => {
    if (resources.missing.length > 0) {
        appInsights.trackEvent('cli-missing', resources.missing);
    }

    if (resources.incompatible.length > 0) {
        appInsights.trackEvent('cli-incompatible', resources.incompatible);
    }

    const missingPackages = resources.missing.map((name) => {
        return `@hint/${name}`;
    });

    const incompatiblePackages = resources.incompatible.map((name) => {
        // If the packages are incompatible, we need to force to install the latest version.
        return `@hint/${name}@latest`;
    });

    if (!(await askUserToInstallDependencies(resources) &&
        await installPackages(missingPackages) &&
        await installPackages(incompatiblePackages))) {

        // The user doesn't want to install the dependencies or something went wrong installing them
github webhintio / hint / packages / hint / src / lib / cli / analyze.ts View on Github external
const alreadyRun: boolean = configStore.get(alreadyRunKey);

    if (!alreadyRun) {
        configStore.set(alreadyRunKey, true);
    }

    if (!telemetryConfigured) {
        if (isCI) {
            showCITelemetryMessage();
            telemetryEnabled = false;
        } else if (alreadyRun) {
            /* Only prompt the user about opt-intelemetry if they have run webhint before. */
            telemetryEnabled = await askForTelemetryConfirmation();

            if (telemetryEnabled) {
                appInsights.trackEvent('cli-telemetry');
            }
        }
    }

    if (!telemetryEnabled) {
        return;
    }

    appInsights.trackEvent('cli-analyze', {
        ci: isCI,
        previouslyRun: alreadyRun,
        ...pruneUserConfig(userConfig)
    });
};
github webhintio / hint / packages / hint / src / lib / cli / analyze.ts View on Github external
const askToInstallPackages = async (resources: HintResources): Promise => {
    if (resources.missing.length > 0) {
        appInsights.trackEvent('cli-missing', resources.missing);
    }

    if (resources.incompatible.length > 0) {
        appInsights.trackEvent('cli-incompatible', resources.incompatible);
    }

    const missingPackages = resources.missing.map((name) => {
        return `@hint/${name}`;
    });

    const incompatiblePackages = resources.incompatible.map((name) => {
        // If the packages are incompatible, we need to force to install the latest version.
        return `@hint/${name}@latest`;
    });

    if (!(await askUserToInstallDependencies(resources) &&
github webhintio / hint / packages / hint / src / lib / cli / analyze.ts View on Github external
telemetryEnabled = false;
        } else if (alreadyRun) {
            /* Only prompt the user about opt-intelemetry if they have run webhint before. */
            telemetryEnabled = await askForTelemetryConfirmation();

            if (telemetryEnabled) {
                appInsights.trackEvent('cli-telemetry');
            }
        }
    }

    if (!telemetryEnabled) {
        return;
    }

    appInsights.trackEvent('cli-analyze', {
        ci: isCI,
        previouslyRun: alreadyRun,
        ...pruneUserConfig(userConfig)
    });
};