@contentful/app-scripts 1.10.2 → 1.11.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/README.md
CHANGED
|
@@ -106,14 +106,15 @@ When passing the `--ci` argument the command will fail when the required variabl
|
|
|
106
106
|
|
|
107
107
|
**Options:**
|
|
108
108
|
|
|
109
|
-
| Argument | Description |
|
|
110
|
-
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
111
|
-
| `--bundle-dir` | The directory of your build folder (e.g.: `./build`) |
|
|
112
|
-
| `--organization-id` | The ID of your organisation |
|
|
113
|
-
| `--definition-id` | The ID of the app to which to add the bundle |
|
|
114
|
-
| `--token` | A personal [access token](https://www.contentful.com/developers/docs/references/content-management-api/#/reference/personal-access-tokens) |
|
|
115
|
-
| `--skip-activation` | (optional) Boolean flag to skip the automatic activation of the `AppBundle` |
|
|
116
|
-
| `--comment` | (optional) A comment which will be associated with the created `AppBundle`. Can be used to differentiate bundles. |
|
|
109
|
+
| Argument | Description | Default value |
|
|
110
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | - |
|
|
111
|
+
| `--bundle-dir` | The directory of your build folder (e.g.: `./build`) | |
|
|
112
|
+
| `--organization-id` | The ID of your organisation | |
|
|
113
|
+
| `--definition-id` | The ID of the app to which to add the bundle | |
|
|
114
|
+
| `--token` | A personal [access token](https://www.contentful.com/developers/docs/references/content-management-api/#/reference/personal-access-tokens) | |
|
|
115
|
+
| `--skip-activation` | (optional) Boolean flag to skip the automatic activation of the `AppBundle` | `false` |
|
|
116
|
+
| `--comment` | (optional) A comment which will be associated with the created `AppBundle`. Can be used to differentiate bundles. | |
|
|
117
|
+
| `--host` | (optional) Contentful CMA-endpoint to use | `api.contentful.com` |
|
|
117
118
|
|
|
118
119
|
**Note:** You can also pass all arguments in interactive mode to skip being asked for it.
|
|
119
120
|
|
|
@@ -148,12 +149,13 @@ When passing the `--ci` argument adding all variables as arguments is required.
|
|
|
148
149
|
|
|
149
150
|
**Options:**
|
|
150
151
|
|
|
151
|
-
| Argument | Description |
|
|
152
|
-
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
153
|
-
| `--bundle-id` | The ID of the AppBundle you want to activate |
|
|
154
|
-
| `--organization-id` | The ID of your organisation |
|
|
155
|
-
| `--definition-id` | The ID of the app to which to add the bundle |
|
|
156
|
-
| `--token` | A personal [access token](https://www.contentful.com/developers/docs/references/content-management-api/#/reference/personal-access-tokens) |
|
|
152
|
+
| Argument | Description | Default value |
|
|
153
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | --- |
|
|
154
|
+
| `--bundle-id` | The ID of the AppBundle you want to activate | |
|
|
155
|
+
| `--organization-id` | The ID of your organisation | |
|
|
156
|
+
| `--definition-id` | The ID of the app to which to add the bundle | |
|
|
157
|
+
| `--token` | A personal [access token](https://www.contentful.com/developers/docs/references/content-management-api/#/reference/personal-access-tokens) | |
|
|
158
|
+
| `--host` | (optional) Contentful CMA-endpoint to use | `api.contentful.com` |
|
|
157
159
|
|
|
158
160
|
**Note:** You can also pass all arguments in interactive mode to skip being asked for it.
|
|
159
161
|
|
|
@@ -208,13 +210,13 @@ When passing the `--ci` argument adding all variables as arguments is required
|
|
|
208
210
|
|
|
209
211
|
**Options:**
|
|
210
212
|
|
|
211
|
-
| Argument | Description |
|
|
212
|
-
| ------------------- | -------------------------------------------- |
|
|
213
|
-
| `--bundle-id` | The ID of the AppBundle you want to activate |
|
|
214
|
-
| `--organization-id` | The ID of your organisation |
|
|
215
|
-
| `--definition-id` | The ID of the app to which to add the bundle |
|
|
216
|
-
| `--keep` |
|
|
217
|
-
| `--host` |
|
|
213
|
+
| Argument | Description | Default value |
|
|
214
|
+
| ------------------- | -------------------------------------------- | -------------------- |
|
|
215
|
+
| `--bundle-id` | The ID of the AppBundle you want to activate | |
|
|
216
|
+
| `--organization-id` | The ID of your organisation | |
|
|
217
|
+
| `--definition-id` | The ID of the app to which to add the bundle | |
|
|
218
|
+
| `--keep` | (optional) The amount of bundles to keep | `50` |
|
|
219
|
+
| `--host` | (optional) Contentful CMA-endpoint to use | `api.contentful.com` |
|
|
218
220
|
|
|
219
221
|
**Note:** You can also pass all arguments in interactive mode to skip being asked for it.
|
|
220
222
|
|
|
@@ -4,25 +4,33 @@ const inquirer = require('inquirer');
|
|
|
4
4
|
const { getAppInfo } = require('../get-app-info');
|
|
5
5
|
|
|
6
6
|
async function buildBundleActivateSettings(options) {
|
|
7
|
-
|
|
7
|
+
const { bundleId, host } = options;
|
|
8
|
+
const prompts = [];
|
|
9
|
+
|
|
8
10
|
if (!bundleId) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
prompts.push({
|
|
12
|
+
name: 'bundleId',
|
|
13
|
+
message: `The id of the bundle you want to activate (required):`,
|
|
14
|
+
validate: (input) => input.length > 0,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (!host) {
|
|
18
|
+
prompts.push({
|
|
19
|
+
name: 'host',
|
|
20
|
+
message: `Contentful CMA endpoint URL:`,
|
|
21
|
+
default: 'api.contentful.com',
|
|
22
|
+
});
|
|
17
23
|
}
|
|
18
24
|
|
|
25
|
+
const appActivateSettings = await inquirer.prompt(prompts);
|
|
19
26
|
const appInfo = await getAppInfo(options);
|
|
20
27
|
|
|
21
28
|
// Add app-config & dialog automatically
|
|
22
29
|
return {
|
|
23
|
-
...appInfo,
|
|
24
30
|
bundleId,
|
|
25
31
|
host,
|
|
32
|
+
...appActivateSettings,
|
|
33
|
+
...appInfo,
|
|
26
34
|
};
|
|
27
35
|
}
|
|
28
36
|
|
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
const
|
|
1
|
+
const inquirer = require('inquirer');
|
|
2
|
+
const { DEFAULT_BUNDLES_TO_KEEP, CONTENTFUL_API_HOST } = require('../../utils/constants');
|
|
2
3
|
const { getAppInfo } = require('../get-app-info');
|
|
3
4
|
|
|
4
5
|
async function buildCleanUpSettings(options) {
|
|
6
|
+
const { keep, host } = options;
|
|
7
|
+
const prompts = [];
|
|
8
|
+
|
|
9
|
+
if (!keep) {
|
|
10
|
+
prompts.push({
|
|
11
|
+
type: 'number',
|
|
12
|
+
name: 'keep',
|
|
13
|
+
message: `The amount of newest bundles to keep:`,
|
|
14
|
+
default: DEFAULT_BUNDLES_TO_KEEP,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (!host) {
|
|
18
|
+
prompts.push({
|
|
19
|
+
name: 'host',
|
|
20
|
+
message: `Contentful CMA endpoint URL:`,
|
|
21
|
+
default: CONTENTFUL_API_HOST,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const appCleanUpSettings = await inquirer.prompt(prompts);
|
|
5
26
|
const appInfo = await getAppInfo(options);
|
|
27
|
+
|
|
6
28
|
return {
|
|
29
|
+
keep: +keep,
|
|
30
|
+
host,
|
|
31
|
+
...appCleanUpSettings,
|
|
7
32
|
...appInfo,
|
|
8
|
-
keep: options.keep !== undefined ? +options.keep : DEFAULT_BUNDLES_TO_KEEP,
|
|
9
|
-
host: options.host,
|
|
10
33
|
};
|
|
11
34
|
}
|
|
12
35
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const inquirer = require('inquirer');
|
|
4
4
|
const { getAppInfo } = require('../get-app-info');
|
|
5
5
|
const { getActionsManifest } = require('../utils');
|
|
6
|
+
const { CONTENTFUL_API_HOST } = require('../../utils/constants');
|
|
6
7
|
|
|
7
8
|
async function buildAppUploadSettings(options) {
|
|
8
9
|
const actionsManifest = getActionsManifest();
|
|
@@ -22,14 +23,29 @@ async function buildAppUploadSettings(options) {
|
|
|
22
23
|
default: '',
|
|
23
24
|
});
|
|
24
25
|
}
|
|
26
|
+
if (skipActivation === undefined) {
|
|
27
|
+
prompts.push({
|
|
28
|
+
type: 'confirm',
|
|
29
|
+
name: 'activateBundle',
|
|
30
|
+
message: `Do you want to activate the bundle after upload?`,
|
|
31
|
+
default: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (!host) {
|
|
35
|
+
prompts.push({
|
|
36
|
+
name: 'host',
|
|
37
|
+
message: `Contentful CMA endpoint URL:`,
|
|
38
|
+
default: CONTENTFUL_API_HOST,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
25
41
|
|
|
26
|
-
const appUploadSettings = await inquirer.prompt(prompts);
|
|
42
|
+
const { activateBundle, ...appUploadSettings } = await inquirer.prompt(prompts);
|
|
27
43
|
|
|
28
44
|
const appInfo = await getAppInfo(options);
|
|
29
45
|
// Add app-config & dialog automatically
|
|
30
46
|
return {
|
|
31
47
|
bundleDirectory: bundleDir,
|
|
32
|
-
skipActivation:
|
|
48
|
+
skipActivation: skipActivation === undefined ? !activateBundle : skipActivation,
|
|
33
49
|
comment,
|
|
34
50
|
host,
|
|
35
51
|
actions: actionsManifest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/app-scripts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "A collection of scripts for building Contentful Apps",
|
|
5
5
|
"author": "Contentful GmbH",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"analytics-node": "^6.2.0",
|
|
53
53
|
"bottleneck": "2.19.5",
|
|
54
54
|
"chalk": "4.1.2",
|
|
55
|
-
"commander": "
|
|
56
|
-
"contentful-management": "10.
|
|
57
|
-
"dotenv": "16.
|
|
55
|
+
"commander": "11.0.0",
|
|
56
|
+
"contentful-management": "10.39.2",
|
|
57
|
+
"dotenv": "16.3.1",
|
|
58
58
|
"ignore": "5.2.4",
|
|
59
|
-
"inquirer": "8.2.
|
|
59
|
+
"inquirer": "8.2.6",
|
|
60
60
|
"lodash": "4.17.21",
|
|
61
61
|
"open": "8.4.2",
|
|
62
62
|
"ora": "5.4.1"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "5c1470b0d752ec3e8e6cdf412b8ea2d1183a32ab"
|
|
65
65
|
}
|
package/utils/constants.js
CHANGED
|
@@ -7,12 +7,15 @@ const DEFAULT_BUNDLES_TO_KEEP = 50;
|
|
|
7
7
|
const DEFAULT_BUNDLES_TO_FETCH = 1000;
|
|
8
8
|
const MAX_CONCURRENT_DELETION_CALLS = 5;
|
|
9
9
|
|
|
10
|
+
const DEFAULT_CONTENTFUL_API_HOST = 'api.contentful.com';
|
|
11
|
+
|
|
10
12
|
module.exports = {
|
|
11
13
|
DOTENV_FILE,
|
|
12
|
-
DEFAULT_BUNDLES_TO_KEEP,
|
|
13
14
|
ACCESS_TOKEN_ENV_KEY,
|
|
14
15
|
ORG_ID_ENV_KEY,
|
|
15
16
|
APP_DEF_ENV_KEY,
|
|
16
|
-
|
|
17
|
+
DEFAULT_BUNDLES_TO_KEEP,
|
|
17
18
|
DEFAULT_BUNDLES_TO_FETCH,
|
|
19
|
+
MAX_CONCURRENT_DELETION_CALLS,
|
|
20
|
+
CONTENTFUL_API_HOST: DEFAULT_CONTENTFUL_API_HOST,
|
|
18
21
|
};
|