UNPKG

@ng-doc/builder

Version:

<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>

33 lines 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createBuilderContext = createBuilderContext; const tslib_1 = require("tslib"); const path = tslib_1.__importStar(require("path")); const load_config_1 = require("./load-config"); const typescript_1 = require("./typescript"); /** * Creates builder context, with all the necessary information for the builder to work * @param targetOptions - Target options * @param context - Builder context * @param configFilePath - Path to the configuration file if it exists */ function createBuilderContext(targetOptions, context, configFilePath) { const projectRoot = path.dirname(targetOptions['browser']); const [configPath, config] = (0, load_config_1.loadConfig)(configFilePath ?? projectRoot, !configFilePath); const buildPath = path.join(context.workspaceRoot, config.outDir ?? '', 'ng-doc', context.target?.project ?? 'app'); const tsConfig = config?.tsConfig ?? String(targetOptions['tsConfig']); return { tsConfig, project: (0, typescript_1.createProject)({ tsConfigFilePath: tsConfig }), config, context, inlineStyleLanguage: targetOptions?.['inlineStyleLanguage'] ?? 'CSS', docsPath: config.docsPath ?? projectRoot, outAssetsDir: path.join(buildPath, 'assets'), cachedFiles: [configPath], outDir: buildPath, outApiDir: path.join(buildPath, 'api'), outGuidesDir: path.join(buildPath, 'guides'), }; } //# sourceMappingURL=create-builder-context.js.map