@sap-ux/project-access 2.1.3 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,9 @@ import { existsSync } from 'node:fs';
2
2
  import { mkdir, readdir } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
4
  import { valid } from 'semver';
5
- import { deleteModule, getModule, getModulePath, loadModuleFromProject } from './module-loader.js';
5
+ import { deleteModule, getModule, loadModuleFromProject } from './module-loader.js';
6
6
  import { getWebappPath } from './ui5-config.js';
7
+ import { getNodeModulesPath } from './dependencies.js';
7
8
  import { getMinimumUI5Version } from './info.js';
8
9
  import { FileName, fioriToolsDirectory, moduleCacheRoot } from '../constants.js';
9
10
  import { readJSON, writeFile } from '../file/index.js';
@@ -196,15 +197,21 @@ export async function getSpecificationPath(root, options) {
196
197
  const logger = options?.logger;
197
198
  const moduleName = '@sap/ux-specification';
198
199
  if (await hasSpecificationDevDependency(root)) {
199
- const modulePath = await getModulePath(root, moduleName);
200
+ const nodeModulesParent = getNodeModulesPath(root, moduleName);
201
+ if (!nodeModulesParent) {
202
+ throw new Error(`Module '${moduleName}' not found in node_modules for project '${root}'`);
203
+ }
200
204
  logger?.debug(`Specification root found in project '${root}'`);
201
- return modulePath.slice(0, modulePath.lastIndexOf(join(moduleName)) + join(moduleName).length);
205
+ return join(nodeModulesParent, 'node_modules', moduleName);
202
206
  }
203
207
  await getSpecificationModuleFromCache(root, { logger });
204
208
  const version = await getSpecificationVersion(root, { logger });
205
209
  logger?.debug(`Specification not found in project '${root}', using path from cache with version '${version}'`);
206
210
  const moduleRoot = join(moduleCacheRoot, moduleName, version);
207
- const modulePath = await getModulePath(moduleRoot, moduleName);
208
- return modulePath.slice(0, modulePath.lastIndexOf(join(moduleName)) + join(moduleName).length);
211
+ const nodeModulesParent = getNodeModulesPath(moduleRoot, moduleName);
212
+ if (!nodeModulesParent) {
213
+ throw new Error(`Module '${moduleName}' not found in cache at '${moduleRoot}'`);
214
+ }
215
+ return join(nodeModulesParent, 'node_modules', moduleName);
209
216
  }
210
217
  //# sourceMappingURL=specification.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "type": "module",
6
6
  "repository": {