@adobe-commerce/aio-toolkit 1.0.11 → 1.0.13

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe-commerce/aio-toolkit",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "A comprehensive TypeScript toolkit for Adobe App Builder applications providing standardized Adobe Commerce integrations, I/O Events orchestration, file storage utilities, authentication helpers, and robust backend development tools with 100% test coverage.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -14,7 +14,6 @@
14
14
  },
15
15
  "files": [
16
16
  "dist/**/*",
17
- "scripts/postinstall.js",
18
17
  "README.md",
19
18
  "CHANGELOG.md",
20
19
  "LICENSE"
@@ -40,8 +39,7 @@
40
39
  "validate:push": "npm run format:check && npm run lint && npm run type-check && npm run test:ci && npm run build",
41
40
  "security:audit": "npm audit --audit-level=moderate",
42
41
  "prepublishOnly": "npm run build",
43
- "prepare": "husky",
44
- "postinstall": "node scripts/postinstall.js"
42
+ "prepare": "husky"
45
43
  },
46
44
  "keywords": [
47
45
  "adobe",
@@ -57,7 +55,7 @@
57
55
  "dependencies": {
58
56
  "@adobe-commerce/aio-services-kit": "^1.0.0",
59
57
  "@adobe/aio-lib-ims": "^7.0.2",
60
- "@adobe/aio-lib-telemetry": "^1.1.2",
58
+ "@adobe/aio-lib-telemetry": "^1.1.3",
61
59
  "@adobe/aio-sdk": "^5.0.0",
62
60
  "cloudevents": "^8.0.2",
63
61
  "got": "^11.8.6",
@@ -1,105 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Postinstall script to fix @adobe/aio-lib-telemetry package.json exports
4
- *
5
- * The telemetry package has a bug where it uses "import" instead of "default"
6
- * in its exports configuration, causing CommonJS requires to fail.
7
- *
8
- * This script patches the package.json in the client project's node_modules.
9
- */
10
-
11
- const fs = require('fs');
12
- const path = require('path');
13
-
14
- try {
15
- // Try to find the telemetry package.json in multiple locations
16
- const possiblePaths = [
17
- // When installed as a dependency in another project (most common)
18
- path.join(__dirname, '..', '..', '@adobe', 'aio-lib-telemetry', 'package.json'),
19
- // When running in the toolkit project itself during development
20
- path.join(__dirname, '..', 'node_modules', '@adobe', 'aio-lib-telemetry', 'package.json'),
21
- ];
22
-
23
- let telemetryPkgPath = null;
24
- for (const p of possiblePaths) {
25
- if (fs.existsSync(p)) {
26
- telemetryPkgPath = p;
27
- break;
28
- }
29
- }
30
-
31
- // Check if the package exists
32
- if (!telemetryPkgPath) {
33
- console.log('ℹ️ @adobe/aio-lib-telemetry not found, skipping patch');
34
- process.exit(0);
35
- }
36
-
37
- // Read the package.json
38
- const pkgContent = fs.readFileSync(telemetryPkgPath, 'utf8');
39
- const pkg = JSON.parse(pkgContent);
40
-
41
- // Check if patch is needed by looking for the bug pattern
42
- const checkNeedsPatch = (obj) => {
43
- if (!obj || typeof obj !== 'object') return false;
44
-
45
- // Check if this object has both 'import' and 'require' keys at the same level
46
- if (obj.import && obj.require) {
47
- // Check if require has 'import' key (the bug)
48
- if (obj.require.import) {
49
- return true;
50
- }
51
- // Check if import has 'import' key (the bug)
52
- if (obj.import.import) {
53
- return true;
54
- }
55
- }
56
-
57
- // Recursively check nested objects
58
- for (const key in obj) {
59
- if (typeof obj[key] === 'object' && checkNeedsPatch(obj[key])) {
60
- return true;
61
- }
62
- }
63
- return false;
64
- };
65
-
66
- if (!checkNeedsPatch(pkg.exports)) {
67
- console.log('✅ @adobe/aio-lib-telemetry already patched or fixed');
68
- process.exit(0);
69
- }
70
-
71
- // Apply the patch: replace "import" with "default" in export conditions
72
- const fixExport = (exportObj) => {
73
- if (exportObj && typeof exportObj === 'object') {
74
- // If there's an "import" key with a string value, rename it to "default"
75
- if (exportObj.import && typeof exportObj.import === 'string') {
76
- exportObj.default = exportObj.import;
77
- delete exportObj.import;
78
- }
79
- // Recursively fix nested objects
80
- Object.keys(exportObj).forEach(key => {
81
- if (typeof exportObj[key] === 'object') {
82
- fixExport(exportObj[key]);
83
- }
84
- });
85
- }
86
- };
87
-
88
- if (pkg.exports) {
89
- Object.keys(pkg.exports).forEach(key => {
90
- if (typeof pkg.exports[key] === 'object') {
91
- fixExport(pkg.exports[key]);
92
- }
93
- });
94
- }
95
-
96
- // Write the patched package.json
97
- fs.writeFileSync(telemetryPkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
98
- console.log('✅ Successfully patched @adobe/aio-lib-telemetry exports');
99
-
100
- } catch (error) {
101
- console.error('⚠️ Failed to patch @adobe/aio-lib-telemetry:', error.message);
102
- // Don't fail the installation
103
- process.exit(0);
104
- }
105
-