UNPKG

@nx/workspace

Version:

The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.

21 lines (20 loc) 735 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkDestination = checkDestination; /** * Checks whether the destination folder is valid * * - must not be outside the workspace * - must be a new folder * * @param schema The options provided to the schematic */ function checkDestination(tree, schema, providedDestination) { const INVALID_DESTINATION = `Invalid destination: [${providedDestination}]`; if (providedDestination.includes('..')) { throw new Error(`${INVALID_DESTINATION} - Please specify explicit path.`); } if (tree.children(schema.relativeToRootDestination).length > 0) { throw new Error(`${INVALID_DESTINATION} - Path is not empty.`); } }