@contentful/app-scripts 1.29.0 → 1.30.1

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.
@@ -3,6 +3,9 @@ export interface AppDefinitionSettings {
3
3
  name: string;
4
4
  locations: AppLocation['location'][];
5
5
  fields?: FieldType[];
6
+ pageNav?: boolean;
7
+ pageNavLinkName?: string;
8
+ pageNavLinkPath?: string;
6
9
  host?: string;
7
10
  buildAppParameters: boolean;
8
11
  parameters?: {
@@ -68,13 +68,55 @@ NOTE: This will create an app definition in your Contentful organization.
68
68
  when(answers) {
69
69
  return answers.locations.includes('entry-field');
70
70
  },
71
- validate(answers) {
72
- if (answers.length < 1) {
71
+ validate(input) {
72
+ if (input.length < 1) {
73
73
  return 'You must choose at least one field type.';
74
74
  }
75
75
  return true;
76
76
  },
77
77
  },
78
+ {
79
+ name: 'pageNav',
80
+ message: 'Page location: Would you like your page location to render in the main navigation?',
81
+ type: 'confirm',
82
+ default: false,
83
+ when(answers) {
84
+ return answers.locations.includes('page');
85
+ },
86
+ },
87
+ {
88
+ name: 'pageNavLinkName',
89
+ message: 'Page location: Provide a name for the link in the main navigation:',
90
+ when(answers) {
91
+ return answers.locations.includes('page') && answers.pageNav;
92
+ },
93
+ validate(input) {
94
+ if (input.length < 1 || input.length > 40) {
95
+ return 'Size must be at least 1 and at most 40';
96
+ }
97
+ return true;
98
+ },
99
+ },
100
+ {
101
+ name: 'pageNavLinkPath',
102
+ message: 'Page location: Provide a path which starts with / and does not contain empty space:',
103
+ default: '/',
104
+ when(answers) {
105
+ return answers.locations.includes('page') && answers.pageNav;
106
+ },
107
+ validate(input) {
108
+ if (input.length > 512) {
109
+ return 'Maximum 512 characters';
110
+ }
111
+ if (input.includes(' ')) {
112
+ return 'Path cannot contain empty space';
113
+ }
114
+ if (!input.startsWith('/')) {
115
+ return 'Path must start with /';
116
+ }
117
+ return true;
118
+ },
119
+ },
78
120
  {
79
121
  name: 'host',
80
122
  message: `Contentful CMA endpoint URL:`,
@@ -57,6 +57,20 @@ async function createAppDefinition(accessToken, appDefinitionSettings) {
57
57
  fieldTypes: appDefinitionSettings.fields || [],
58
58
  };
59
59
  }
60
+ if (location === 'page') {
61
+ const { pageNav, pageNavLinkName, pageNavLinkPath } = appDefinitionSettings;
62
+ return {
63
+ location,
64
+ ...(pageNav
65
+ ? {
66
+ navigationItem: {
67
+ name: pageNavLinkName,
68
+ path: pageNavLinkPath,
69
+ },
70
+ }
71
+ : {}),
72
+ };
73
+ }
60
74
  return {
61
75
  location,
62
76
  };
package/lib/utils.js CHANGED
@@ -129,7 +129,7 @@ function getEntityFromManifest(type) {
129
129
  // eslint-disable-next-line no-process-exit
130
130
  process.exit(1);
131
131
  }
132
- // EntryFile is not used but we do want to strip it.
132
+ // EntryFile is not used but we do want to strip it
133
133
  // eslint-disable-next-line no-unused-vars
134
134
  const { entryFile: _, ...itemWithoutEntryFile } = item;
135
135
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/app-scripts",
3
- "version": "1.29.0",
3
+ "version": "1.30.1",
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.35.1",
55
+ "contentful-management": "11.36.1",
56
56
  "dotenv": "16.4.5",
57
57
  "ignore": "6.0.2",
58
58
  "inquirer": "8.2.6",
@@ -60,19 +60,19 @@
60
60
  "open": "8.4.2",
61
61
  "ora": "5.4.1"
62
62
  },
63
- "gitHead": "2179b34098340843ad4e6eeaa09e341f34286164",
63
+ "gitHead": "e59bc33193a054dfb5a7c87fe910c9834b89548f",
64
64
  "devDependencies": {
65
65
  "@tsconfig/node18": "18.2.4",
66
- "@types/adm-zip": "0.5.5",
66
+ "@types/adm-zip": "0.5.6",
67
67
  "@types/analytics-node": "3.1.14",
68
68
  "@types/chai": "4.3.16",
69
69
  "@types/inquirer": "8.2.1",
70
- "@types/lodash": "4.17.9",
71
- "@types/mocha": "10.0.8",
70
+ "@types/lodash": "4.17.13",
71
+ "@types/mocha": "10.0.9",
72
72
  "@types/proxyquire": "1.3.31",
73
73
  "@types/sinon": "17.0.3",
74
74
  "chai": "4.5.0",
75
- "mocha": "10.7.3",
75
+ "mocha": "10.8.2",
76
76
  "proxyquire": "2.1.3",
77
77
  "sinon": "19.0.2",
78
78
  "ts-mocha": "10.0.0",