@nx/devkit
Advanced tools
Comparing version 16.7.1 to 16.8.0-beta.0
{ | ||
"name": "@nx/devkit", | ||
"version": "16.7.1", | ||
"version": "16.8.0-beta.0", | ||
"private": false, | ||
@@ -31,3 +31,3 @@ "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more.", | ||
"dependencies": { | ||
"@nrwl/devkit": "16.7.1", | ||
"@nrwl/devkit": "16.8.0-beta.0", | ||
"ejs": "^3.1.7", | ||
@@ -50,3 +50,3 @@ "enquirer": "~2.3.6", | ||
"type": "commonjs", | ||
"gitHead": "8b38708d6c18496711695499d07c95f3ecc31cc9" | ||
"gitHead": "818352404283c1d34ab303d91b3bd16474f54916" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.targetToTargetString = exports.parseTargetString = void 0; | ||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports | ||
const split_target_1 = require("nx/src/utils/split-target"); | ||
const nx_1 = require("../../nx"); | ||
const { readCachedProjectGraph } = (0, nx_1.requireNx)(); | ||
let { readCachedProjectGraph, splitTarget } = (0, nx_1.requireNx)(); | ||
// TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported | ||
splitTarget = splitTarget !== null && splitTarget !== void 0 ? splitTarget : require('nx/src/utils/split-target').splitTarget; | ||
function parseTargetString(targetString, projectGraph) { | ||
@@ -17,3 +17,3 @@ if (!projectGraph) { | ||
} | ||
const [project, target, configuration] = (0, split_target_1.splitTarget)(targetString, projectGraph); | ||
const [project, target, configuration] = splitTarget(targetString, projectGraph); | ||
if (!project || !target) { | ||
@@ -20,0 +20,0 @@ throw new Error(`Invalid Target String: ${targetString}`); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readTargetOptions = void 0; | ||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports | ||
const params_1 = require("nx/src/utils/params"); | ||
const nx_1 = require("../../nx"); | ||
const path_1 = require("path"); | ||
const { Workspaces, getExecutorInformation, calculateDefaultProjectName } = (0, nx_1.requireNx)(); | ||
let { Workspaces, getExecutorInformation, calculateDefaultProjectName, combineOptionsForExecutor, } = (0, nx_1.requireNx)(); | ||
// TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported | ||
combineOptionsForExecutor = | ||
combineOptionsForExecutor !== null && combineOptionsForExecutor !== void 0 ? combineOptionsForExecutor : require('nx/src/utils/params').combineOptionsForExecutor; | ||
/** | ||
@@ -29,4 +30,4 @@ * Reads and combines options for a given target. | ||
ws.calculateDefaultProjectName(context.cwd, { version: 2, projects: context.projectsConfigurations.projects }, context.nxJsonConfiguration); | ||
return (0, params_1.combineOptionsForExecutor)({}, (_a = configuration !== null && configuration !== void 0 ? configuration : targetConfiguration.defaultConfiguration) !== null && _a !== void 0 ? _a : '', targetConfiguration, schema, defaultProject, (0, path_1.relative)(context.cwd, context.root)); | ||
return combineOptionsForExecutor({}, (_a = configuration !== null && configuration !== void 0 ? configuration : targetConfiguration.defaultConfiguration) !== null && _a !== void 0 ? _a : '', targetConfiguration, schema, defaultProject, (0, path_1.relative)(context.cwd, context.root)); | ||
} | ||
exports.readTargetOptions = readTargetOptions; |
@@ -6,6 +6,7 @@ "use strict"; | ||
const path = require("path"); | ||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports | ||
const object_sort_1 = require("nx/src/utils/object-sort"); | ||
const nx_1 = require("../../nx"); | ||
const { updateJson, readJson } = (0, nx_1.requireNx)(); | ||
let { updateJson, readJson, sortObjectByKeys } = (0, nx_1.requireNx)(); | ||
// TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported | ||
sortObjectByKeys = | ||
sortObjectByKeys !== null && sortObjectByKeys !== void 0 ? sortObjectByKeys : require('nx/src/utils/object-sort').sortObjectByKeys; | ||
/** | ||
@@ -56,3 +57,3 @@ * Formats all the created or updated files using Prettier | ||
} | ||
updateJson(tree, tsConfigPath, (tsconfig) => (Object.assign(Object.assign({}, tsconfig), { compilerOptions: Object.assign(Object.assign({}, tsconfig.compilerOptions), { paths: (0, object_sort_1.sortObjectByKeys)(tsconfig.compilerOptions.paths) }) }))); | ||
updateJson(tree, tsConfigPath, (tsconfig) => (Object.assign(Object.assign({}, tsconfig), { compilerOptions: Object.assign(Object.assign({}, tsconfig.compilerOptions), { paths: sortObjectByKeys(tsconfig.compilerOptions.paths) }) }))); | ||
} | ||
@@ -59,0 +60,0 @@ catch (e) { |
@@ -7,2 +7,3 @@ import type { ProjectType } from 'nx/src/config/workspace-json-project-json'; | ||
projectType: ProjectType; | ||
callingGenerator: string; | ||
directory?: string; | ||
@@ -41,2 +42,4 @@ importPath?: string; | ||
}; | ||
export declare function determineProjectNameAndRootOptions(tree: Tree, options: ProjectGenerationOptions): Promise<ProjectNameAndRootOptions>; | ||
export declare function determineProjectNameAndRootOptions(tree: Tree, options: ProjectGenerationOptions): Promise<ProjectNameAndRootOptions & { | ||
projectNameAndRootFormat: ProjectNameAndRootFormat; | ||
}>; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const names_1 = require("../utils/names"); | ||
const { joinPathFragments, readJson, readNxJson } = (0, nx_1.requireNx)(); | ||
const { joinPathFragments, normalizePath, readJson, readNxJson, updateNxJson } = (0, nx_1.requireNx)(); | ||
function determineProjectNameAndRootOptions(tree, options) { | ||
@@ -16,4 +16,4 @@ var _a; | ||
const formats = getProjectNameAndRootFormats(tree, options); | ||
const format = (_a = options.projectNameAndRootFormat) !== null && _a !== void 0 ? _a : (yield determineFormat(formats)); | ||
return formats[format]; | ||
const format = (_a = options.projectNameAndRootFormat) !== null && _a !== void 0 ? _a : (yield determineFormat(tree, formats, options.callingGenerator)); | ||
return Object.assign(Object.assign({}, formats[format]), { projectNameAndRootFormat: format }); | ||
}); | ||
@@ -42,3 +42,5 @@ } | ||
} | ||
function determineFormat(formats) { | ||
function determineFormat(tree, formats, callingGenerator) { | ||
var _a, _b; | ||
var _c; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -59,3 +61,3 @@ if (!formats.derived) { | ||
const derivedSelectedValue = `${formats['derived'].projectName} @ ${formats['derived'].projectRoot} (This was derived from the folder structure. Please provide the exact name and directory in the future)`; | ||
return yield (0, enquirer_1.prompt)({ | ||
const result = yield (0, enquirer_1.prompt)({ | ||
type: 'select', | ||
@@ -76,8 +78,25 @@ name: 'format', | ||
}).then(({ format }) => format === asProvidedSelectedValue ? 'as-provided' : 'derived'); | ||
if (result === 'as-provided' && callingGenerator) { | ||
const { saveDefault } = yield (0, enquirer_1.prompt)({ | ||
type: 'confirm', | ||
message: 'Would you like to save this layout as a default?', | ||
name: 'saveDefault', | ||
}); | ||
if (saveDefault) { | ||
const nxJson = readNxJson(tree); | ||
(_a = nxJson.generators) !== null && _a !== void 0 ? _a : (nxJson.generators = {}); | ||
(_b = (_c = nxJson.generators)[callingGenerator]) !== null && _b !== void 0 ? _b : (_c[callingGenerator] = {}); | ||
nxJson.generators[callingGenerator].projectNameAndRootFormat = result; | ||
updateNxJson(tree, nxJson); | ||
} | ||
} | ||
return result; | ||
}); | ||
} | ||
function getProjectNameAndRootFormats(tree, options) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c; | ||
const name = (0, names_1.names)(options.name).fileName; | ||
const directory = (_a = options.directory) === null || _a === void 0 ? void 0 : _a.replace(/^\.?\//, ''); | ||
const directory = options.directory | ||
? normalizePath(options.directory.replace(/^\.?\//, '')) | ||
: undefined; | ||
const asProvidedProjectName = name; | ||
@@ -98,3 +117,3 @@ const asProvidedProjectDirectory = directory | ||
}, | ||
importPath: (_b = options.importPath) !== null && _b !== void 0 ? _b : asProvidedProjectName, | ||
importPath: (_a = options.importPath) !== null && _a !== void 0 ? _a : asProvidedProjectName, | ||
projectRoot: asProvidedProjectDirectory, | ||
@@ -112,3 +131,3 @@ }, | ||
asProvidedProjectDirectory === '.' | ||
? (_c = readJson(tree, 'package.json').name) !== null && _c !== void 0 ? _c : getImportPath(npmScope, asProvidedProjectName) | ||
? (_b = readJson(tree, 'package.json').name) !== null && _b !== void 0 ? _b : getImportPath(npmScope, asProvidedProjectName) | ||
: getImportPath(npmScope, asProvidedProjectName); | ||
@@ -139,3 +158,3 @@ } | ||
derivedProjectDirectory === '.' | ||
? (_d = readJson(tree, 'package.json').name) !== null && _d !== void 0 ? _d : getImportPath(npmScope, derivedProjectName) | ||
? (_c = readJson(tree, 'package.json').name) !== null && _c !== void 0 ? _c : getImportPath(npmScope, derivedProjectName) | ||
: getImportPath(npmScope, derivedProjectDirectoryWithoutLayout); | ||
@@ -142,0 +161,0 @@ } |
@@ -24,3 +24,3 @@ "use strict"; | ||
version: 2, | ||
projects: yield retrieveProjectConfigurationsWithAngularProjects(builderContext.workspaceRoot, nxJsonConfiguration), | ||
projects: yield retrieveProjectConfigurationsWithAngularProjects(builderContext.workspaceRoot, nxJsonConfiguration).then((p) => p.projectNodes), | ||
} | ||
@@ -27,0 +27,0 @@ : // TODO(v18): remove retrieveProjectConfigurations. This is to be backwards compatible with Nx 16.5 and below. |
@@ -5,7 +5,7 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports | ||
const logger_1 = require("nx/src/utils/logger"); | ||
const path_1 = require("path"); | ||
const nx_1 = require("../../nx"); | ||
const { logger } = (0, nx_1.requireNx)(); | ||
let { logger, stripIndent } = (0, nx_1.requireNx)(); | ||
// TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported | ||
stripIndent = stripIndent !== null && stripIndent !== void 0 ? stripIndent : require('nx/src/utils/logger').stripIndent; | ||
class RunCallbackTask { | ||
@@ -171,5 +171,5 @@ constructor(callback) { | ||
warnUnsupportedFilePermissionsChange(filePath, mode) { | ||
logger.warn((0, logger_1.stripIndent)(`The Angular DevKit tree does not support changing a file permissions. | ||
logger.warn(stripIndent(`The Angular DevKit tree does not support changing a file permissions. | ||
Ignoring changing ${filePath} permissions to ${mode}.`)); | ||
} | ||
} |
@@ -6,6 +6,7 @@ "use strict"; | ||
const fs_1 = require("fs"); | ||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports | ||
const package_json_1 = require("nx/src/utils/package-json"); | ||
const nx_1 = require("../../../nx"); | ||
const { readJsonFile, joinPathFragments, workspaceRoot } = (0, nx_1.requireNx)(); | ||
let { readJsonFile, joinPathFragments, workspaceRoot, readModulePackageJson } = (0, nx_1.requireNx)(); | ||
// TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported | ||
readModulePackageJson = | ||
readModulePackageJson !== null && readModulePackageJson !== void 0 ? readModulePackageJson : require('nx/src/utils/package-json').readModulePackageJson; | ||
function collectWorkspaceLibrarySecondaryEntryPoints(library, tsconfigPathAliases) { | ||
@@ -87,3 +88,3 @@ const libraryRoot = (0, path_1.join)(workspaceRoot, library.root); | ||
try { | ||
({ path: packageJsonPath, packageJson } = (0, package_json_1.readModulePackageJson)(pkgName)); | ||
({ path: packageJsonPath, packageJson } = readModulePackageJson(pkgName)); | ||
pathToPackage = (0, path_1.dirname)(packageJsonPath); | ||
@@ -90,0 +91,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
187336
4569
1
+ Added@nrwl/devkit@16.8.0-beta.0(transitive)
- Removed@nrwl/devkit@16.7.1(transitive)
Updated@nrwl/devkit@16.8.0-beta.0