# All files / src/webpack/utils directories.js

83.33% Statements 10/12
50% Branches 1/2
100% Functions 0/0
83.33% Lines 10/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    302x
    2x

    2x

    2x

    2x
    2x
    2x
    2x

    2x

    2xconst path = require("path");
    const fs = require("fs");

    /**
     * Default directory list
     * @type {{root: *, src: *, dist: *, build: *}}
     */
    const defaultDirectories = {
      root: process.env.__project_root,
      src: path.resolve(process.env.__project_root, "src"),
      dist: path.join(process.env.__project_root, "dist"),
      build: path.join(process.env.__project_root, "dist", "build"),
    };

    const defaultsDeep = require("lodash/defaultsDeep");

    let directories = {};
    try {
      const directoriesConfigPath = `${process.env.__project_root}/directories.js`;
      Iif (fs.existsSync(directoriesConfigPath)) {
        directories = require(directoriesConfigPath);
      }
    } catch (ex) {
      // reset directories to blank object
      directories = {};
    }

    directories = defaultsDeep(directories, defaultDirectories);

    module.exports = Object.assign({}, directories);