<commit_before>const path = require('path');
const util = require('util');
const exec = util.promisify(require('child_process').exec);

const concurrently = require('concurrently');

const config = require('../ghost/core/core/shared/config');
const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
const siteUrl = config.getSiteUrl();

const DASH_DASH_ARGS = process.argv.filter(a => a.startsWith('--')).map(a => a.slice(2));

let commands = [];

const COMMAND_GHOST = {
    name: 'ghost',
    command: 'yarn nodemon -q -i ghost/admin -i ghost/core/content -i ghost/core/core/built -i ghost/portal',
    prefixColor: 'blue',
    env: {}
};

const COMMAND_ADMIN = {
    name: 'admin',
    command: `yarn start --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`,
    cwd: path.resolve(__dirname, '../ghost/admin'),
    prefixColor: 'green',
    env: {}
};

if (DASH_DASH_ARGS.includes('ghost')) {
    commands = [COMMAND_GHOST];
} else if (DASH_DASH_ARGS.includes('admin')) {
    commands = [COMMAND_ADMIN];
} else {
    commands = [COMMAND_GHOST, COMMAND_ADMIN];
}

if (DASH_DASH_ARGS.includes('portal')) {
    commands.push({
        name: 'portal',
        command: 'yarn dev',
        cwd: path.resolve(__dirname, '../ghost/portal'),
        prefixColor: 'magenta',
        env: {}
    });
    COMMAND_GHOST.env['portal__url'] = 'http://localhost:5368/umd/portal.min.js';
}

(async () => {
    if (DASH_DASH_ARGS.includes('stripe')) {
        let stripeSecret;
        try {
            stripeSecret = await exec('stripe listen --print-secret');
        } catch (err) {
            console.error('Failed to fetch Stripe secret token, do you need to connect Stripe CLI?', err);
        }

        if (!stripeSecret || !stripeSecret.stdout) {
            console.error('No Stripe secret was present');
            return;
        }

        COMMAND_GHOST.env['WEBHOOK_SECRET'] = stripeSecret.stdout.trim();
        commands.push({
            name: 'stripe',<commit_msg>Fixed missing return when fetching Stripe key fails<commit_after>const path = require('path');
const util = require('util');
const exec = util.promisify(require('child_process').exec);

const concurrently = require('concurrently');

const config = require('../ghost/core/core/shared/config');
const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
const siteUrl = config.getSiteUrl();

const DASH_DASH_ARGS = process.argv.filter(a => a.startsWith('--')).map(a => a.slice(2));

let commands = [];

const COMMAND_GHOST = {
    name: 'ghost',
    command: 'yarn nodemon -q -i ghost/admin -i ghost/core/content -i ghost/core/core/built -i ghost/portal',
    prefixColor: 'blue',
    env: {}
};

const COMMAND_ADMIN = {
    name: 'admin',
    command: `yarn start --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`,
    cwd: path.resolve(__dirname, '../ghost/admin'),
    prefixColor: 'green',
    env: {}
};

if (DASH_DASH_ARGS.includes('ghost')) {
    commands = [COMMAND_GHOST];
} else if (DASH_DASH_ARGS.includes('admin')) {
    commands = [COMMAND_ADMIN];
} else {
    commands = [COMMAND_GHOST, COMMAND_ADMIN];
}

if (DASH_DASH_ARGS.includes('portal')) {
    commands.push({
        name: 'portal',
        command: 'yarn dev',
        cwd: path.resolve(__dirname, '../ghost/portal'),
        prefixColor: 'magenta',
        env: {}
    });
    COMMAND_GHOST.env['portal__url'] = 'http://localhost:5368/umd/portal.min.js';
}

(async () => {
    if (DASH_DASH_ARGS.includes('stripe')) {
        let stripeSecret;
        try {
            stripeSecret = await exec('stripe listen --print-secret');
        } catch (err) {
            console.error('Failed to fetch Stripe secret token, do you need to connect Stripe CLI?', err);
            return;
        }

        if (!stripeSecret || !stripeSecret.stdout) {
            console.error('No Stripe secret was present');
            return;
        }

        COMMAND_GHOST.env['WEBHOOK_SECRET'] = stripeSecret.stdout.trim();
        commands.push({
            name: 'stripe',
{'fraction_non_alphanumeric': 0.16254329539831766, 'fraction_numerical': 0.004453240969816922, 'mean_word_length': 3.0228855721393035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5153303', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1323, 'n_words': 273}