@sitecore-jss/sitecore-jss-dev-tools 22.3.0-canary.9 → 22.3.0

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.
@@ -1,36 +1,32 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getMetadata = void 0;
4
- const child_process_1 = require("child_process");
5
- const trackedScopes = ['@sitecore', '@sitecore-cloudsdk', '@sitecore-feaas', '@sitecore-jss'];
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
6
9
  /**
7
10
  * Get application metadata
8
11
  */
9
12
  function getMetadata() {
10
13
  const metadata = { packages: {} };
11
- let queryResult = [];
12
- try {
13
- queryResult = JSON.parse((0, child_process_1.execSync)('npm query [name*=@sitecore] --workspaces false').toString());
14
- }
15
- catch (error) {
16
- console.error('Failed to retrieve sitecore packages using npm query', error);
17
- return metadata;
18
- }
19
- metadata.packages = getPackagesFromQueryResult(queryResult);
20
- return metadata;
21
- }
22
- exports.getMetadata = getMetadata;
23
- /**
24
- * Retrieve all packages of the tracked scopes with their exact versions
25
- * @param {Package[]} scPackages list of packages
26
- * @returns {Record<string, string>} an object with the packages with their exact versions
27
- */
28
- function getPackagesFromQueryResult(scPackages) {
29
- const packages = {};
30
- scPackages.forEach((scPackage) => {
31
- if (trackedScopes.some((trackedScope) => scPackage.name.startsWith(trackedScope))) {
32
- packages[scPackage.name] = scPackage.version;
14
+ const trackedScopes = ['@sitecore', '@sitecore-cloudsdk', '@sitecore-feaas', '@sitecore-jss'];
15
+ const dirs = fs_1.default.readdirSync('node_modules');
16
+ dirs.forEach((dir) => {
17
+ if (trackedScopes.includes(dir)) {
18
+ const packageNames = fs_1.default.readdirSync(path_1.default.join('node_modules', dir));
19
+ packageNames.forEach((pkg) => {
20
+ try {
21
+ const json = JSON.parse(fs_1.default.readFileSync(path_1.default.join('node_modules', dir, pkg, 'package.json'), 'utf8'));
22
+ metadata.packages[json.name] = json.version;
23
+ }
24
+ catch (e) {
25
+ console.error(`Failed to read/parse package.json for ${pkg}`, e);
26
+ }
27
+ });
33
28
  }
34
29
  });
35
- return packages;
30
+ return metadata;
36
31
  }
32
+ exports.getMetadata = getMetadata;
@@ -1,32 +1,25 @@
1
- import { execSync } from 'child_process';
2
- const trackedScopes = ['@sitecore', '@sitecore-cloudsdk', '@sitecore-feaas', '@sitecore-jss'];
1
+ import fs from 'fs';
2
+ import path from 'path';
3
3
  /**
4
4
  * Get application metadata
5
5
  */
6
6
  export function getMetadata() {
7
7
  const metadata = { packages: {} };
8
- let queryResult = [];
9
- try {
10
- queryResult = JSON.parse(execSync('npm query [name*=@sitecore] --workspaces false').toString());
11
- }
12
- catch (error) {
13
- console.error('Failed to retrieve sitecore packages using npm query', error);
14
- return metadata;
15
- }
16
- metadata.packages = getPackagesFromQueryResult(queryResult);
17
- return metadata;
18
- }
19
- /**
20
- * Retrieve all packages of the tracked scopes with their exact versions
21
- * @param {Package[]} scPackages list of packages
22
- * @returns {Record<string, string>} an object with the packages with their exact versions
23
- */
24
- function getPackagesFromQueryResult(scPackages) {
25
- const packages = {};
26
- scPackages.forEach((scPackage) => {
27
- if (trackedScopes.some((trackedScope) => scPackage.name.startsWith(trackedScope))) {
28
- packages[scPackage.name] = scPackage.version;
8
+ const trackedScopes = ['@sitecore', '@sitecore-cloudsdk', '@sitecore-feaas', '@sitecore-jss'];
9
+ const dirs = fs.readdirSync('node_modules');
10
+ dirs.forEach((dir) => {
11
+ if (trackedScopes.includes(dir)) {
12
+ const packageNames = fs.readdirSync(path.join('node_modules', dir));
13
+ packageNames.forEach((pkg) => {
14
+ try {
15
+ const json = JSON.parse(fs.readFileSync(path.join('node_modules', dir, pkg, 'package.json'), 'utf8'));
16
+ metadata.packages[json.name] = json.version;
17
+ }
18
+ catch (e) {
19
+ console.error(`Failed to read/parse package.json for ${pkg}`, e);
20
+ }
21
+ });
29
22
  }
30
23
  });
31
- return packages;
24
+ return metadata;
32
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-dev-tools",
3
- "version": "22.3.0-canary.9",
3
+ "version": "22.3.0",
4
4
  "description": "Utilities to assist in the development and deployment of Sitecore JSS apps.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/parser": "^7.24.0",
36
- "@sitecore-jss/sitecore-jss": "^22.3.0-canary.9",
36
+ "@sitecore-jss/sitecore-jss": "22.3.0",
37
37
  "axios": "^1.3.2",
38
38
  "chalk": "^4.1.2",
39
39
  "chokidar": "^3.6.0",
@@ -86,7 +86,7 @@
86
86
  "typescript": "~4.9.5"
87
87
  },
88
88
  "types": "types/index.d.ts",
89
- "gitHead": "80aab2e2e832a1a9ae024c771a955c2d403e63fe",
89
+ "gitHead": "81b0239517966b6d0debdf6da3f12a98228c4d0c",
90
90
  "files": [
91
91
  "dist",
92
92
  "types",