@nstudio/xplat-utils
Advanced tools
Comparing version 16.5.0 to 16.5.1
{ | ||
"name": "@nstudio/xplat-utils", | ||
"version": "16.5.0", | ||
"version": "16.5.1", | ||
"description": "Utilities for xplat tooling.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://nstudio.io/xplat", |
@@ -28,11 +28,13 @@ <h1 align="center">Cross-platform (xplat) tools for Nx workspaces</h1> | ||
// Choose "Integrated monorepo" at the prompt: | ||
✔ Where would you like to create your workspace? · {your-workspace-name} | ||
? Choose what to create … | ||
> Integrated monorepo: Nx configures your favorite frameworks and lets you focus on shipping features. | ||
// 1. Choose "None" at the prompt: | ||
// Choose "apps" at the prompt: | ||
? Which stack do you want to use? … | ||
None: Configures a minimal structure without specific frameworks or technologies. | ||
? What to create in the new workspace … | ||
> apps [an empty monorepo with no plugins with a layout that works best for building apps] | ||
// 2. Choose "Integrated" at the prompt: | ||
? Package-based or integrated? … | ||
Integrated: Nx creates a workspace structure most suitable for building apps. | ||
``` | ||
@@ -39,0 +41,0 @@ |
@@ -7,3 +7,3 @@ import type { FrameworkTypes, PlatformNxExtraTypes, PlatformTypes, PlatformWithNxTypes } from './types'; | ||
export declare const supportedFrameworks: Array<FrameworkTypes>; | ||
export declare function getNpmScope(): string; | ||
export declare function getNpmScope(tree?: NgTree): string; | ||
export declare function getPrefix(): string; | ||
@@ -20,3 +20,2 @@ export declare function getFrontendFramework(): "angular"; | ||
export declare function updateFile(tree: NgTree, path: string, content: string): import("@angular-devkit/schematics/src/tree/interface").Tree; | ||
export declare function getNxWorkspaceConfig(tree: NgTree): any; | ||
export declare const copy: (tree: NgTree, from: string, to: string) => void; | ||
@@ -23,0 +22,0 @@ export declare function getRootTsConfigPath(): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toFileName = exports.parseProjectNameFromPath = exports.sanitizeCommaDelimitedArg = exports.prerun = exports.getAppPaths = exports.getRootTsConfigPath = exports.copy = exports.getNxWorkspaceConfig = exports.updateFile = exports.updateJsonFile = exports.getJsonFromFile = exports.jsonParse = exports.isTesting = exports.setTest = exports.isXplatWorkspace = exports.getAppName = exports.getGroupByName = exports.getFrontendFramework = exports.getPrefix = exports.getNpmScope = exports.supportedFrameworks = exports.supportedPlatformsWithNx = exports.supportedNxExtraPlatforms = exports.supportedPlatforms = void 0; | ||
exports.toFileName = exports.parseProjectNameFromPath = exports.sanitizeCommaDelimitedArg = exports.prerun = exports.getAppPaths = exports.getRootTsConfigPath = exports.copy = exports.updateFile = exports.updateJsonFile = exports.getJsonFromFile = exports.jsonParse = exports.isTesting = exports.setTest = exports.isXplatWorkspace = exports.getAppName = exports.getGroupByName = exports.getFrontendFramework = exports.getPrefix = exports.getNpmScope = exports.supportedFrameworks = exports.supportedPlatformsWithNx = exports.supportedNxExtraPlatforms = exports.supportedPlatforms = void 0; | ||
const schematics_1 = require("@angular-devkit/schematics"); | ||
@@ -29,4 +29,18 @@ const devkit_1 = require("@nx/devkit"); | ||
let usingXplatWorkspace = false; | ||
function getNpmScope() { | ||
return npmScope; | ||
function getNpmScope(tree) { | ||
var _a; | ||
if (npmScope) { | ||
return npmScope; | ||
} | ||
const nxJson = getJsonFromFile(tree, 'nx.json'); | ||
// TODO(v17): Remove reading this from nx.json | ||
if (nxJson.npmScope) { | ||
npmScope = nxJson.npmScope; | ||
return npmScope; | ||
} | ||
const packageJson = getJsonFromFile(tree, 'package.json'); | ||
if ((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.name) === null || _a === void 0 ? void 0 : _a.startsWith('@')) { | ||
npmScope = packageJson.name.split('/')[0].substring(1); | ||
return npmScope; | ||
} | ||
} | ||
@@ -109,14 +123,2 @@ exports.getNpmScope = getNpmScope; | ||
exports.updateFile = updateFile; | ||
function getNxWorkspaceConfig(tree) { | ||
const nxConfig = getJsonFromFile(tree, 'nx.json'); | ||
const hasWorkspaceDirs = tree.exists('apps') && tree.exists('libs'); | ||
// determine if Nx workspace | ||
if (nxConfig) { | ||
if (nxConfig.npmScope || hasWorkspaceDirs) { | ||
return nxConfig; | ||
} | ||
} | ||
throw new schematics_1.SchematicsException('@nstudio/xplat must be used inside an Nx workspace. Create a workspace first. https://nx.dev'); | ||
} | ||
exports.getNxWorkspaceConfig = getNxWorkspaceConfig; | ||
const copy = (tree, from, to) => { | ||
@@ -207,6 +209,3 @@ const file = tree.get(from); | ||
return (tree) => { | ||
const nxJson = getNxWorkspaceConfig(tree); | ||
if (nxJson) { | ||
npmScope = nxJson.npmScope || 'workspace'; | ||
} | ||
npmScope = getNpmScope(tree) || 'workspace'; | ||
// console.log('npmScope:', npmScope); | ||
@@ -213,0 +212,0 @@ const packageJson = getJsonFromFile(tree, 'package.json'); |
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
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
180
22480
385