@contentful/app-scripts 2.5.5 → 2.5.10-alpha.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.
- package/lib/activate/activate-bundle.js +26 -0
- package/lib/analytics.d.ts +1 -1
- package/lib/analytics.js +2 -1
- package/lib/bin.js +3 -2
- package/lib/build-functions/build-functions.js +1 -1
- package/lib/create-type-safe-locations.d.ts +1 -1
- package/lib/generate-function/get-github-folder-names.js +8 -1
- package/lib/get-management-token.js +1 -1
- package/lib/types.d.ts +1 -0
- package/package.json +13 -11
|
@@ -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/analytics.d.ts
CHANGED
package/lib/analytics.js
CHANGED
|
@@ -11,7 +11,7 @@ const SEGMENT_WRITE_KEY = 'IzCq3j4dQlTAgLdMykRW9oBHQKUy1xMm';
|
|
|
11
11
|
* @param {boolean} properties.ci value if --ci flag has been set
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
function track({ command, ci }) {
|
|
14
|
+
async function track({ command, ci }) {
|
|
15
15
|
if (process.env.DISABLE_ANALYTICS) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
@@ -31,6 +31,7 @@ function track({ command, ci }) {
|
|
|
31
31
|
anonymousId: Date.now().toString(), // generate a random id
|
|
32
32
|
timestamp: new Date(),
|
|
33
33
|
});
|
|
34
|
+
await client.closeAndFlush();
|
|
34
35
|
// eslint-disable-next-line no-empty
|
|
35
36
|
}
|
|
36
37
|
catch (e) {
|
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
|
});
|
|
@@ -114,8 +115,8 @@ async function runCommand(command, options) {
|
|
|
114
115
|
.action(async (options) => {
|
|
115
116
|
await runCommand(index_1.addLocations, options);
|
|
116
117
|
});
|
|
117
|
-
commander_1.program.hook('preAction', (thisCommand) => {
|
|
118
|
-
(0, index_1.track)({ command: thisCommand.args[0], ci: thisCommand.opts().ci });
|
|
118
|
+
commander_1.program.hook('preAction', async (thisCommand) => {
|
|
119
|
+
await (0, index_1.track)({ command: thisCommand.args[0], ci: thisCommand.opts().ci });
|
|
119
120
|
});
|
|
120
121
|
await commander_1.program.parseAsync(process.argv);
|
|
121
122
|
})().catch((e) => {
|
|
@@ -10,6 +10,6 @@ export declare function createTypeSafeLocations(settings: LocationsSettings): ({
|
|
|
10
10
|
location: "page";
|
|
11
11
|
fieldTypes?: undefined;
|
|
12
12
|
} | {
|
|
13
|
-
location: "app-config" | "entry-sidebar" | "entry-editor" | "dialog" | "home";
|
|
13
|
+
location: "app-config" | "entry-sidebar" | "entry-editor" | "dialog" | "home" | "agent";
|
|
14
14
|
fieldTypes?: undefined;
|
|
15
15
|
})[];
|
|
@@ -9,7 +9,14 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
9
9
|
const types_1 = require("./types");
|
|
10
10
|
async function getGithubFolderNames() {
|
|
11
11
|
try {
|
|
12
|
-
const
|
|
12
|
+
const config = {};
|
|
13
|
+
const githubToken = process.env.GITHUB_TOKEN;
|
|
14
|
+
if (githubToken) {
|
|
15
|
+
config.headers = {
|
|
16
|
+
Authorization: `Bearer ${githubToken}`,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const response = await axios_1.default.get(constants_1.CONTENTFUL_FUNCTIONS_EXAMPLE_REPO_PATH, config);
|
|
13
20
|
const contents = response.data;
|
|
14
21
|
const filteredContents = contents.filter((content) => content.type === 'dir');
|
|
15
22
|
return filteredContents.map((content) => content.name);
|
|
@@ -37,7 +37,7 @@ async function getManagementToken(host) {
|
|
|
37
37
|
(0, open_1.default)(oauthUrl);
|
|
38
38
|
}
|
|
39
39
|
catch (err) {
|
|
40
|
-
console.log(`${chalk_1.default.red('Error:')} Failed to open browser
|
|
40
|
+
console.log(`${chalk_1.default.red('Error:')} Failed to open browser.`);
|
|
41
41
|
console.log(err.message);
|
|
42
42
|
throw err;
|
|
43
43
|
}
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/app-scripts",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.10-alpha.0",
|
|
4
4
|
"description": "A collection of scripts for building Contentful Apps",
|
|
5
5
|
"author": "Contentful GmbH",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test": "ts-mocha \"./{,!(node_modules)/**/}*.test.ts\"",
|
|
32
32
|
"test:watch": "npm t -- --watch",
|
|
33
33
|
"pre-commit": "lint-staged",
|
|
34
|
-
"build": "
|
|
34
|
+
"build": "rimraf lib && tsc"
|
|
35
35
|
},
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/contentful/create-contentful-app/issues"
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"lib"
|
|
45
45
|
],
|
|
46
46
|
"publishConfig": {
|
|
47
|
-
"access": "public"
|
|
47
|
+
"access": "public",
|
|
48
|
+
"registry": "https://npm.pkg.github.com/"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
51
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
@@ -56,10 +57,10 @@
|
|
|
56
57
|
"chalk": "4.1.2",
|
|
57
58
|
"commander": "12.1.0",
|
|
58
59
|
"contentful-management": "^11.48.1",
|
|
59
|
-
"dotenv": "
|
|
60
|
-
"esbuild": "^0.
|
|
60
|
+
"dotenv": "17.2.2",
|
|
61
|
+
"esbuild": "^0.27.0",
|
|
61
62
|
"ignore": "7.0.5",
|
|
62
|
-
"inquirer": "8.2.
|
|
63
|
+
"inquirer": "8.2.7",
|
|
63
64
|
"lodash": "4.17.21",
|
|
64
65
|
"merge-options": "^3.0.4",
|
|
65
66
|
"open": "8.4.2",
|
|
@@ -67,21 +68,22 @@
|
|
|
67
68
|
"tiged": "^2.12.7",
|
|
68
69
|
"zod": "^3.24.1"
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "83eea204b666977602cb680d5e5913864aa6dcc1",
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@types/adm-zip": "0.5.7",
|
|
73
74
|
"@types/analytics-node": "3.1.14",
|
|
74
75
|
"@types/chai": "4.3.16",
|
|
75
76
|
"@types/inquirer": "8.2.1",
|
|
76
|
-
"@types/lodash": "4.17.
|
|
77
|
+
"@types/lodash": "4.17.21",
|
|
77
78
|
"@types/mocha": "10.0.10",
|
|
78
79
|
"@types/node": "^22.13.10",
|
|
79
80
|
"@types/proxyquire": "1.3.31",
|
|
80
|
-
"@types/sinon": "
|
|
81
|
+
"@types/sinon": "21.0.0",
|
|
81
82
|
"chai": "4.5.0",
|
|
82
|
-
"mocha": "11.
|
|
83
|
+
"mocha": "11.7.5",
|
|
83
84
|
"proxyquire": "2.1.3",
|
|
84
|
-
"
|
|
85
|
+
"rimraf": "5.0.8",
|
|
86
|
+
"sinon": "21.0.1",
|
|
85
87
|
"ts-mocha": "11.1.0",
|
|
86
88
|
"ts-node": "10.9.2"
|
|
87
89
|
}
|