@contentful/app-scripts 1.30.1 → 1.31.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/upload/validate-bundle.js +9 -7
- package/lib/utils.js +7 -6
- package/package.json +4 -4
|
@@ -17,14 +17,16 @@ const validateBundle = (path, { functions, actions }) => {
|
|
|
17
17
|
const buildFolder = path_1.default.join('./', path);
|
|
18
18
|
const files = fs_1.default.readdirSync(buildFolder, { recursive: true, encoding: 'utf-8' });
|
|
19
19
|
const entry = getEntryFile(files);
|
|
20
|
-
if (!entry) {
|
|
21
|
-
throw new Error('
|
|
20
|
+
if (!entry && !functions && !actions) {
|
|
21
|
+
throw new Error('Ensure your bundle includes a valid index.html file in its root folder, or a valid Contentful Function entrypoint (defined in your contentful-app-manifest.json file).');
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
if (entry) {
|
|
24
|
+
const entryFile = fs_1.default.readFileSync(path_1.default.join(buildFolder, entry), { encoding: 'utf8' });
|
|
25
|
+
if (fileContainsAbsolutePath(entryFile)) {
|
|
26
|
+
console.log('----------------------------');
|
|
27
|
+
console.warn(`${chalk_1.default.red('Warning:')} This bundle uses absolute paths. Please use relative paths instead for correct rendering. See more details here https://www.contentful.com/developers/docs/extensibility/app-framework/app-bundle/#limitations`);
|
|
28
|
+
console.log('----------------------------');
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
if (functions) {
|
|
30
32
|
const functionWithoutEntryFile = functions.find(({ path }) => !files.includes(path));
|
package/lib/utils.js
CHANGED
|
@@ -10,14 +10,15 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
10
10
|
const cache_credential_1 = require("./cache-credential");
|
|
11
11
|
const DEFAULT_MANIFEST_PATH = './contentful-app-manifest.json';
|
|
12
12
|
const functionEvents = {
|
|
13
|
-
|
|
14
|
-
queryEvent: 'graphql.query',
|
|
15
|
-
resourceLinksSearchEvent: 'resources.search',
|
|
16
|
-
resourceLinksLookupEvent: 'resources.lookup',
|
|
13
|
+
appActionCall: 'appaction.call',
|
|
17
14
|
appEventFilter: 'appevent.filter',
|
|
18
15
|
appEventHandler: 'appevent.handler',
|
|
19
16
|
appEventTransformation: 'appevent.transformation',
|
|
20
|
-
|
|
17
|
+
fieldMappingEvent: 'graphql.field.mapping',
|
|
18
|
+
resourceTypeMappingEvent: 'graphql.resourcetype.mapping',
|
|
19
|
+
queryEvent: 'graphql.query',
|
|
20
|
+
resourceLinksSearchEvent: 'resources.search',
|
|
21
|
+
resourceLinksLookupEvent: 'resources.lookup'
|
|
21
22
|
};
|
|
22
23
|
const throwValidationException = (subject, message, details) => {
|
|
23
24
|
console.log(`${chalk_1.default.red('Validation Error:')} Missing or invalid ${subject}.`);
|
|
@@ -125,7 +126,7 @@ function getEntityFromManifest(type) {
|
|
|
125
126
|
process.exit(1);
|
|
126
127
|
}
|
|
127
128
|
if (hasInvalidEvent) {
|
|
128
|
-
console.log(`${chalk_1.default.red('Error:')} Invalid events
|
|
129
|
+
console.log(`${chalk_1.default.red('Error:')} Invalid events found in the accepts array for ${type} "${item.name}".`);
|
|
129
130
|
// eslint-disable-next-line no-process-exit
|
|
130
131
|
process.exit(1);
|
|
131
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/app-scripts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "A collection of scripts for building Contentful Apps",
|
|
5
5
|
"author": "Contentful GmbH",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"bottleneck": "2.19.5",
|
|
53
53
|
"chalk": "4.1.2",
|
|
54
54
|
"commander": "12.1.0",
|
|
55
|
-
"contentful-management": "11.
|
|
55
|
+
"contentful-management": "11.39.1",
|
|
56
56
|
"dotenv": "16.4.5",
|
|
57
57
|
"ignore": "6.0.2",
|
|
58
58
|
"inquirer": "8.2.6",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"open": "8.4.2",
|
|
61
61
|
"ora": "5.4.1"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "3f63deab2526d7ebe014c7f05db849c05eb6ed02",
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@tsconfig/node18": "18.2.4",
|
|
66
66
|
"@types/adm-zip": "0.5.6",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/chai": "4.3.16",
|
|
69
69
|
"@types/inquirer": "8.2.1",
|
|
70
70
|
"@types/lodash": "4.17.13",
|
|
71
|
-
"@types/mocha": "10.0.
|
|
71
|
+
"@types/mocha": "10.0.10",
|
|
72
72
|
"@types/proxyquire": "1.3.31",
|
|
73
73
|
"@types/sinon": "17.0.3",
|
|
74
74
|
"chai": "4.5.0",
|