@contentful/app-scripts 2.5.5 → 2.5.6

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.
@@ -54,6 +54,32 @@ async function activateBundle({ accessToken, organization, definition, bundleId,
54
54
  }, currentDefinition);
55
55
  }
56
56
  catch (err) {
57
+ let errorData;
58
+ try {
59
+ errorData = JSON.parse(err.message);
60
+ }
61
+ catch {
62
+ errorData = null;
63
+ }
64
+ if (errorData?.status === 400 && errorData?.message?.includes('Function upload failed')) {
65
+ // Extract first line of error message (the actual error type)
66
+ const firstLine = errorData.message.split('\n')[0];
67
+ const errorType = firstLine.replace('Function upload failed: ', '');
68
+ // Clean display
69
+ console.error(`\n${(0, chalk_1.bold)((0, chalk_1.yellow)('❌ Function Upload Failed'))}\n`);
70
+ console.error(`${(0, chalk_1.bold)('Error:')} ${errorType}\n`);
71
+ if (errorData.details?.errors?.[0]) {
72
+ // Show just the first few lines of stack trace
73
+ const firstError = errorData.details.errors[0];
74
+ const lines = firstError.split('\n').slice(0, 3);
75
+ console.error(lines.join('\n'));
76
+ }
77
+ console.error(`\n${(0, chalk_1.cyan)('💡 Tip:')} Line numbers may reference minified code, rebuild with ${(0, chalk_1.bold)('--no-minify')} to debug your source code:`);
78
+ console.error(` ${(0, chalk_1.bold)('npm run build:functions -- --no-minify && npm run upload')}\n`);
79
+ // Don't re-throw (prevents Commander duplicate display)
80
+ process.exit(1);
81
+ }
82
+ // Default error handling for other errors
57
83
  (0, utils_1.throwError)(err, 'Something went wrong activating your bundle. Make sure you used the correct definition-id.');
58
84
  }
59
85
  finally {
package/lib/bin.js CHANGED
@@ -80,6 +80,7 @@ async function runCommand(command, options) {
80
80
  .option('-e, --esbuild-config <path>', 'custom esbuild config file path')
81
81
  .option('-m, --manifest-file <path>', 'Contentful app manifest file path')
82
82
  .option('-w, --watch', 'watch for changes')
83
+ .option('--no-minify', 'disable minification for debugging (not recommended for production)')
83
84
  .action(async (options) => {
84
85
  await runCommand(index_1.buildFunctions, options);
85
86
  });
@@ -130,7 +130,7 @@ const resolveEsBuildConfig = (options, manifest, cwd = process.cwd()) => {
130
130
  outdir: 'build',
131
131
  format: 'esm',
132
132
  target: 'es2022',
133
- minify: true,
133
+ minify: options.minify ?? true,
134
134
  define: {
135
135
  global: 'globalThis',
136
136
  },
package/lib/types.d.ts CHANGED
@@ -72,6 +72,7 @@ export interface BuildFunctionsOptions {
72
72
  manifestFile?: string;
73
73
  esbuildConfig?: string;
74
74
  watch?: boolean;
75
+ minify?: boolean;
75
76
  }
76
77
  export type Language = 'javascript' | 'typescript';
77
78
  export interface GenerateFunctionSettings {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/app-scripts",
3
- "version": "2.5.5",
3
+ "version": "2.5.6",
4
4
  "description": "A collection of scripts for building Contentful Apps",
5
5
  "author": "Contentful GmbH",
6
6
  "license": "MIT",
@@ -56,10 +56,10 @@
56
56
  "chalk": "4.1.2",
57
57
  "commander": "12.1.0",
58
58
  "contentful-management": "^11.48.1",
59
- "dotenv": "16.5.0",
59
+ "dotenv": "17.2.2",
60
60
  "esbuild": "^0.25.1",
61
61
  "ignore": "7.0.5",
62
- "inquirer": "8.2.6",
62
+ "inquirer": "8.2.7",
63
63
  "lodash": "4.17.21",
64
64
  "merge-options": "^3.0.4",
65
65
  "open": "8.4.2",
@@ -67,21 +67,21 @@
67
67
  "tiged": "^2.12.7",
68
68
  "zod": "^3.24.1"
69
69
  },
70
- "gitHead": "e14fb27df06ed59ffb4e08972dde3f4bdacc1f50",
70
+ "gitHead": "b44c54a3301e10a7d6b8e4b0e745f697f7be4681",
71
71
  "devDependencies": {
72
72
  "@types/adm-zip": "0.5.7",
73
73
  "@types/analytics-node": "3.1.14",
74
74
  "@types/chai": "4.3.16",
75
75
  "@types/inquirer": "8.2.1",
76
- "@types/lodash": "4.17.17",
76
+ "@types/lodash": "4.17.20",
77
77
  "@types/mocha": "10.0.10",
78
78
  "@types/node": "^22.13.10",
79
79
  "@types/proxyquire": "1.3.31",
80
80
  "@types/sinon": "17.0.4",
81
81
  "chai": "4.5.0",
82
- "mocha": "11.6.0",
82
+ "mocha": "11.7.4",
83
83
  "proxyquire": "2.1.3",
84
- "sinon": "20.0.0",
84
+ "sinon": "21.0.0",
85
85
  "ts-mocha": "11.1.0",
86
86
  "ts-node": "10.9.2"
87
87
  }