contentful-migration 4.7.2 → 4.9.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/CHANGELOG.md +6 -1
- package/README.md +237 -139
- package/built/bin/cli.js +10 -10
- package/built/bin/cli.js.map +1 -1
- package/built/bin/lib/config.js +10 -9
- package/built/bin/lib/config.js.map +1 -1
- package/built/bin/lib/contentful-client/index.js.map +1 -1
- package/built/bin/lib/contentful-client/proxy.js.map +1 -1
- package/built/bin/lib/render-migration.js.map +1 -1
- package/built/bin/lib/steps-errors.js +7 -5
- package/built/bin/lib/steps-errors.js.map +1 -1
- package/built/bin/usage-params.js +3 -3
- package/built/bin/usage-params.js.map +1 -1
- package/built/lib/action/action.js.map +1 -1
- package/built/lib/action/content-type-annotate.js +27 -0
- package/built/lib/action/content-type-annotate.js.map +1 -0
- package/built/lib/action/content-type-create.js.map +1 -1
- package/built/lib/action/content-type-delete.js.map +1 -1
- package/built/lib/action/content-type-publish.js.map +1 -1
- package/built/lib/action/content-type-save.js.map +1 -1
- package/built/lib/action/content-type-unpublish.js.map +1 -1
- package/built/lib/action/content-type-update.js.map +1 -1
- package/built/lib/action/editor-layout/editor-layout-change-field-group-control.js +23 -0
- package/built/lib/action/editor-layout/editor-layout-change-field-group-control.js.map +1 -0
- package/built/lib/action/editor-layout/editor-layout-create-field-group.js +26 -0
- package/built/lib/action/editor-layout/editor-layout-create-field-group.js.map +1 -0
- package/built/lib/action/editor-layout/editor-layout-create.js +18 -0
- package/built/lib/action/editor-layout/editor-layout-create.js.map +1 -0
- package/built/lib/action/editor-layout/editor-layout-delete-field-group.js +23 -0
- package/built/lib/action/editor-layout/editor-layout-delete-field-group.js.map +1 -0
- package/built/lib/action/editor-layout/editor-layout-delete.js +21 -0
- package/built/lib/action/editor-layout/editor-layout-delete.js.map +1 -0
- package/built/lib/action/editor-layout/editor-layout-move-field.js +24 -0
- package/built/lib/action/editor-layout/editor-layout-move-field.js.map +1 -0
- package/built/lib/action/editor-layout/editor-layout-update-field-group.js +41 -0
- package/built/lib/action/editor-layout/editor-layout-update-field-group.js.map +1 -0
- package/built/lib/action/editorinterface-copy.js.map +1 -1
- package/built/lib/action/editorinterface-reset.js.map +1 -1
- package/built/lib/action/editorinterface-save.js.map +1 -1
- package/built/lib/action/editorinterface-update.js.map +1 -1
- package/built/lib/action/entry-derive.js +4 -2
- package/built/lib/action/entry-derive.js.map +1 -1
- package/built/lib/action/entry-field-purge.js.map +1 -1
- package/built/lib/action/entry-field-rename.js.map +1 -1
- package/built/lib/action/entry-set-tags.js.map +1 -1
- package/built/lib/action/entry-transform-to-type.js +3 -1
- package/built/lib/action/entry-transform-to-type.js.map +1 -1
- package/built/lib/action/entry-transform.js.map +1 -1
- package/built/lib/action/entryeditor-configure.js.map +1 -1
- package/built/lib/action/entryeditor-reset-to-default.js.map +1 -1
- package/built/lib/action/entryeditors-configure.js.map +1 -1
- package/built/lib/action/field-action.js.map +1 -1
- package/built/lib/action/field-annotate.js +28 -0
- package/built/lib/action/field-annotate.js.map +1 -0
- package/built/lib/action/field-create.js.map +1 -1
- package/built/lib/action/field-move.js.map +1 -1
- package/built/lib/action/field-rename.js +4 -0
- package/built/lib/action/field-rename.js.map +1 -1
- package/built/lib/action/field-update.js.map +1 -1
- package/built/lib/action/sidebar-reset-to-default.js.map +1 -1
- package/built/lib/action/sidebarwidget-add.js.map +1 -1
- package/built/lib/action/sidebarwidget-remove.js.map +1 -1
- package/built/lib/action/sidebarwidget-update.js.map +1 -1
- package/built/lib/action/sidebarwidget.js.map +1 -1
- package/built/lib/action/tag-create.js.map +1 -1
- package/built/lib/action/tag-delete.js.map +1 -1
- package/built/lib/action/tag-save.js.map +1 -1
- package/built/lib/action/tag-update.js.map +1 -1
- package/built/lib/entities/content-type.js +247 -17
- package/built/lib/entities/content-type.js.map +1 -1
- package/built/lib/entities/entry.js.map +1 -1
- package/built/lib/entities/link.js.map +1 -1
- package/built/lib/entities/tag.js.map +1 -1
- package/built/lib/errors/chunks-validation.js.map +1 -1
- package/built/lib/errors/payload-validation.js.map +1 -1
- package/built/lib/errors/steps-validation.js.map +1 -1
- package/built/lib/fetcher.js +14 -12
- package/built/lib/fetcher.js.map +1 -1
- package/built/lib/intent/base-intent.js +48 -3
- package/built/lib/intent/base-intent.js.map +1 -1
- package/built/lib/intent/composed-intent.js +56 -6
- package/built/lib/intent/composed-intent.js.map +1 -1
- package/built/lib/intent/content-type-annotate.js +57 -0
- package/built/lib/intent/content-type-annotate.js.map +1 -0
- package/built/lib/intent/content-type-create.js +1 -3
- package/built/lib/intent/content-type-create.js.map +1 -1
- package/built/lib/intent/content-type-update.js +4 -5
- package/built/lib/intent/content-type-update.js.map +1 -1
- package/built/lib/intent/editor-layout/editor-layout-change-field-group-control.js +57 -0
- package/built/lib/intent/editor-layout/editor-layout-change-field-group-control.js.map +1 -0
- package/built/lib/intent/editor-layout/editor-layout-change-field-group-id.js +59 -0
- package/built/lib/intent/editor-layout/editor-layout-change-field-group-id.js.map +1 -0
- package/built/lib/intent/editor-layout/editor-layout-create-field-group.js +54 -0
- package/built/lib/intent/editor-layout/editor-layout-create-field-group.js.map +1 -0
- package/built/lib/intent/editor-layout/editor-layout-create.js +49 -0
- package/built/lib/intent/editor-layout/editor-layout-create.js.map +1 -0
- package/built/lib/intent/editor-layout/editor-layout-delete-field-group.js +53 -0
- package/built/lib/intent/editor-layout/editor-layout-delete-field-group.js.map +1 -0
- package/built/lib/intent/editor-layout/editor-layout-delete.js +45 -0
- package/built/lib/intent/editor-layout/editor-layout-delete.js.map +1 -0
- package/built/lib/intent/editor-layout/editor-layout-invalid-method.js +38 -0
- package/built/lib/intent/editor-layout/editor-layout-invalid-method.js.map +1 -0
- package/built/lib/intent/editor-layout/editor-layout-move-field.js +81 -0
- package/built/lib/intent/editor-layout/editor-layout-move-field.js.map +1 -0
- package/built/lib/intent/editor-layout/editor-layout-update-field-group.js +57 -0
- package/built/lib/intent/editor-layout/editor-layout-update-field-group.js.map +1 -0
- package/built/lib/intent/editorinterface-copy.js +1 -3
- package/built/lib/intent/editorinterface-copy.js.map +1 -1
- package/built/lib/intent/editorinterface-reset.js +1 -3
- package/built/lib/intent/editorinterface-reset.js.map +1 -1
- package/built/lib/intent/editorinterface-update.js +3 -7
- package/built/lib/intent/editorinterface-update.js.map +1 -1
- package/built/lib/intent/entry-derive.js +2 -7
- package/built/lib/intent/entry-derive.js.map +1 -1
- package/built/lib/intent/entry-set-tags.js +1 -3
- package/built/lib/intent/entry-set-tags.js.map +1 -1
- package/built/lib/intent/entry-transform-to-type.js +2 -6
- package/built/lib/intent/entry-transform-to-type.js.map +1 -1
- package/built/lib/intent/entryeditors-configure.js.map +1 -1
- package/built/lib/intent/field-annotate.js +57 -0
- package/built/lib/intent/field-annotate.js.map +1 -0
- package/built/lib/intent/field-create.js +8 -7
- package/built/lib/intent/field-create.js.map +1 -1
- package/built/lib/intent/field-delete.js +4 -2
- package/built/lib/intent/field-delete.js.map +1 -1
- package/built/lib/intent/field-move.js +10 -5
- package/built/lib/intent/field-move.js.map +1 -1
- package/built/lib/intent/field-rename.js +4 -2
- package/built/lib/intent/field-rename.js.map +1 -1
- package/built/lib/intent/field-update.js +7 -4
- package/built/lib/intent/field-update.js.map +1 -1
- package/built/lib/intent/index.js +23 -1
- package/built/lib/intent/index.js.map +1 -1
- package/built/lib/intent/sidebar-reset-to-default.js.map +1 -1
- package/built/lib/intent/sidebarwidget-add.js +7 -10
- package/built/lib/intent/sidebarwidget-add.js.map +1 -1
- package/built/lib/intent/sidebarwidget-remove.js +6 -8
- package/built/lib/intent/sidebarwidget-remove.js.map +1 -1
- package/built/lib/intent/sidebarwidget-update.js +7 -10
- package/built/lib/intent/sidebarwidget-update.js.map +1 -1
- package/built/lib/intent/tag-create.js +1 -3
- package/built/lib/intent/tag-create.js.map +1 -1
- package/built/lib/intent/tag-delete.js +1 -3
- package/built/lib/intent/tag-delete.js.map +1 -1
- package/built/lib/intent/tag-update.js +1 -3
- package/built/lib/intent/tag-update.js.map +1 -1
- package/built/lib/intent-list/index.js +7 -1
- package/built/lib/intent-list/index.js.map +1 -1
- package/built/lib/intent-validator/content-transform.js.map +1 -1
- package/built/lib/intent-validator/content-type-update.js.map +1 -1
- package/built/lib/intent-validator/entry-derive.js.map +1 -1
- package/built/lib/intent-validator/entry-set-tags.js.map +1 -1
- package/built/lib/intent-validator/entry-transform-to-type.js.map +1 -1
- package/built/lib/intent-validator/field-movement.js.map +1 -1
- package/built/lib/intent-validator/field-update.js.map +1 -1
- package/built/lib/intent-validator/schema-validator.js +2 -2
- package/built/lib/intent-validator/schema-validator.js.map +1 -1
- package/built/lib/intent-validator/tag-update.js.map +1 -1
- package/built/lib/interfaces/annotation.js +86 -0
- package/built/lib/interfaces/annotation.js.map +1 -0
- package/built/lib/migration-chunks/validation/content-type.js +9 -4
- package/built/lib/migration-chunks/validation/content-type.js.map +1 -1
- package/built/lib/migration-chunks/validation/duplicate-props.js +2 -2
- package/built/lib/migration-chunks/validation/duplicate-props.js.map +1 -1
- package/built/lib/migration-chunks/validation/editor-layout.js +305 -0
- package/built/lib/migration-chunks/validation/editor-layout.js.map +1 -0
- package/built/lib/migration-chunks/validation/errors.js +91 -0
- package/built/lib/migration-chunks/validation/errors.js.map +1 -1
- package/built/lib/migration-chunks/validation/field.js +27 -24
- package/built/lib/migration-chunks/validation/field.js.map +1 -1
- package/built/lib/migration-chunks/validation/index.js +16 -3
- package/built/lib/migration-chunks/validation/index.js.map +1 -1
- package/built/lib/migration-chunks/validation/tag.js +4 -2
- package/built/lib/migration-chunks/validation/tag.js.map +1 -1
- package/built/lib/migration-parser.js +10 -4
- package/built/lib/migration-parser.js.map +1 -1
- package/built/lib/migration-steps/action-creators.js +165 -1
- package/built/lib/migration-steps/action-creators.js.map +1 -1
- package/built/lib/migration-steps/dispatch-proxy.js.map +1 -1
- package/built/lib/migration-steps/first-external-caller.js.map +1 -1
- package/built/lib/migration-steps/index.js +112 -4
- package/built/lib/migration-steps/index.js.map +1 -1
- package/built/lib/offline-api/index.js +14 -5
- package/built/lib/offline-api/index.js.map +1 -1
- package/built/lib/offline-api/validator/annotations.js +76 -0
- package/built/lib/offline-api/validator/annotations.js.map +1 -0
- package/built/lib/offline-api/validator/display-field.js.map +1 -1
- package/built/lib/offline-api/validator/editor-interface.js +16 -0
- package/built/lib/offline-api/validator/editor-interface.js.map +1 -0
- package/built/lib/offline-api/validator/errors.js +21 -0
- package/built/lib/offline-api/validator/errors.js.map +1 -1
- package/built/lib/offline-api/validator/field-deletion.js +3 -1
- package/built/lib/offline-api/validator/field-deletion.js.map +1 -1
- package/built/lib/offline-api/validator/field-groups-count.js +34 -0
- package/built/lib/offline-api/validator/field-groups-count.js.map +1 -0
- package/built/lib/offline-api/validator/schema/content-type-schema.js.map +1 -1
- package/built/lib/offline-api/validator/schema/editor-layout-schema.js +46 -0
- package/built/lib/offline-api/validator/schema/editor-layout-schema.js.map +1 -0
- package/built/lib/offline-api/validator/schema/field-validations-schema.js +1 -1
- package/built/lib/offline-api/validator/schema/field-validations-schema.js.map +1 -1
- package/built/lib/offline-api/validator/schema/fields-schema.js +13 -5
- package/built/lib/offline-api/validator/schema/fields-schema.js.map +1 -1
- package/built/lib/offline-api/validator/schema/index.js.map +1 -1
- package/built/lib/offline-api/validator/schema/schema-validation.js +42 -1
- package/built/lib/offline-api/validator/schema/schema-validation.js.map +1 -1
- package/built/lib/offline-api/validator/schema/tag-schema.js.map +1 -1
- package/built/lib/offline-api/validator/tag.js.map +1 -1
- package/built/lib/offline-api/validator/tags-on-entry.js.map +1 -1
- package/built/lib/offline-api/validator/type-change.js.map +1 -1
- package/built/lib/utils/deprecated.js.map +1 -1
- package/built/lib/utils/editor-layout.js +60 -0
- package/built/lib/utils/editor-layout.js.map +1 -0
- package/built/lib/utils/is-defined.js.map +1 -1
- package/built/lib/utils/should-publish-local-changes.js.map +1 -1
- package/docs/validation.md +104 -0
- package/index.d.ts +217 -83
- package/package.json +22 -3
package/index.d.ts
CHANGED
|
@@ -7,9 +7,10 @@ export type RunMigrationConfig = {
|
|
|
7
7
|
proxy?: string
|
|
8
8
|
rawProxy?: boolean
|
|
9
9
|
yes?: boolean
|
|
10
|
+
retryLimit?: number
|
|
10
11
|
} & ({ filePath: string } | { migrationFunction: MigrationFunction })
|
|
11
12
|
|
|
12
|
-
export function runMigration
|
|
13
|
+
export function runMigration(config: RunMigrationConfig): Promise<any>
|
|
13
14
|
|
|
14
15
|
export interface Movement {
|
|
15
16
|
toTheTop(): void
|
|
@@ -18,7 +19,27 @@ export interface Movement {
|
|
|
18
19
|
afterField(field: string): void
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
export interface EditorLayoutMovement {
|
|
23
|
+
toTheTopOfFieldGroup(groupId?: string): void
|
|
24
|
+
toTheBottomOfFieldGroup(groupId?: string): void
|
|
25
|
+
beforeField(field: string): void
|
|
26
|
+
afterField(field: string): void
|
|
27
|
+
beforeFieldGroup(groupId?: string): void
|
|
28
|
+
afterFieldGroup(groupId?: string): void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type FieldType =
|
|
32
|
+
| 'Symbol'
|
|
33
|
+
| 'Text'
|
|
34
|
+
| 'Integer'
|
|
35
|
+
| 'Number'
|
|
36
|
+
| 'Date'
|
|
37
|
+
| 'Boolean'
|
|
38
|
+
| 'Object'
|
|
39
|
+
| 'Location'
|
|
40
|
+
| 'RichText'
|
|
41
|
+
| 'Array'
|
|
42
|
+
| 'Link'
|
|
22
43
|
|
|
23
44
|
export interface IFieldOptions {
|
|
24
45
|
newId?: string
|
|
@@ -79,32 +100,52 @@ export interface Field {
|
|
|
79
100
|
|
|
80
101
|
/** Sets the default value for the field. */
|
|
81
102
|
defaultValue(defaultValue: { [locale: string]: any }): Field
|
|
103
|
+
|
|
104
|
+
/** Set annotations associated with the field */
|
|
105
|
+
setAnnotations(annotationsIds: string[]): Field
|
|
106
|
+
|
|
107
|
+
/** Removes all annotaions associated with the field */
|
|
108
|
+
clearAnnotations(): Field
|
|
82
109
|
}
|
|
83
110
|
|
|
84
|
-
type LinkMimetype =
|
|
85
|
-
|
|
111
|
+
type LinkMimetype =
|
|
112
|
+
| 'attachment'
|
|
113
|
+
| 'plaintext'
|
|
114
|
+
| 'image'
|
|
115
|
+
| 'audio'
|
|
116
|
+
| 'video'
|
|
117
|
+
| 'richtext'
|
|
118
|
+
| 'presentation'
|
|
119
|
+
| 'spreadsheet'
|
|
120
|
+
| 'pdfdocument'
|
|
121
|
+
| 'archive'
|
|
122
|
+
| 'code'
|
|
123
|
+
| 'markup'
|
|
86
124
|
|
|
87
125
|
export interface IValidation {
|
|
88
126
|
/** Takes an array of content type ids and validates that the link points to an entry of that content type. */
|
|
89
|
-
linkContentType?: string[]
|
|
127
|
+
linkContentType?: string[]
|
|
90
128
|
/** Takes an array of values and validates that the field value is in this array. */
|
|
91
|
-
in?: string[] | number[]
|
|
129
|
+
in?: string[] | number[]
|
|
92
130
|
/** Takes a MIME type group name and validates that the link points to an asset of this group. */
|
|
93
|
-
linkMimetypeGroup?: LinkMimetype[]
|
|
131
|
+
linkMimetypeGroup?: LinkMimetype[]
|
|
94
132
|
/** Takes min and/or max parameters and validates the size of the array (number of objects in it). */
|
|
95
|
-
size?: { max?: number
|
|
133
|
+
size?: { max?: number; min?: number }
|
|
96
134
|
/** Takes min and/or max parameters and validates the range of a value. */
|
|
97
|
-
range?: { max?: number
|
|
135
|
+
range?: { max?: number; min?: number }
|
|
98
136
|
/** Takes a string that reflects a JS regex and flags, validates against a string. See JS reference for the parameters. */
|
|
99
|
-
regexp?: { pattern: string
|
|
137
|
+
regexp?: { pattern: string; flags?: string }
|
|
100
138
|
/** Validates that there are no other entries that have the same field value at the time of publication. */
|
|
101
|
-
unique?: true
|
|
139
|
+
unique?: true
|
|
102
140
|
/** Validates that a value falls within a certain range of dates. */
|
|
103
|
-
dateRange?: { min?: string
|
|
141
|
+
dateRange?: { min?: string; max?: string }
|
|
104
142
|
/** Validates that an image asset is of a certain image dimension. */
|
|
105
|
-
assetImageDimensions?: {
|
|
143
|
+
assetImageDimensions?: {
|
|
144
|
+
width: { min?: number; max?: number }
|
|
145
|
+
height: { min?: number; max?: number }
|
|
146
|
+
}
|
|
106
147
|
/** Validates that an asset is of a certain file size. */
|
|
107
|
-
assetFileSize?: { max?: number
|
|
148
|
+
assetFileSize?: { max?: number; min?: number }
|
|
108
149
|
|
|
109
150
|
message?: string
|
|
110
151
|
|
|
@@ -115,7 +156,6 @@ export interface IValidation {
|
|
|
115
156
|
export type WidgetSettingsValue = number | boolean | string | undefined
|
|
116
157
|
|
|
117
158
|
export interface IEditorInterfaceOptions {
|
|
118
|
-
|
|
119
159
|
/** This help text will show up below the field. */
|
|
120
160
|
helpText?: string
|
|
121
161
|
/** (only for fields of type boolean) Shows this text next to the radio button that sets this value to true. Defaults to “Yes”. */
|
|
@@ -142,6 +182,11 @@ export interface ISidebarWidgetSettings {
|
|
|
142
182
|
[setting: string]: WidgetSettingsValue
|
|
143
183
|
}
|
|
144
184
|
|
|
185
|
+
export interface IFieldGroupWidgetSettings {
|
|
186
|
+
/** Instance settings for the field group widget as key-value pairs. */
|
|
187
|
+
[setting: string]: WidgetSettingsValue
|
|
188
|
+
}
|
|
189
|
+
|
|
145
190
|
export interface ContentType {
|
|
146
191
|
id: string
|
|
147
192
|
instanceId: string
|
|
@@ -153,19 +198,25 @@ export interface ContentType {
|
|
|
153
198
|
/** ID of the field to use as the display field for the content type. */
|
|
154
199
|
displayField(displayField: string): ContentType
|
|
155
200
|
|
|
201
|
+
/** Annotations associated with the content type */
|
|
202
|
+
setAnnotations(annotationIds: string[]): ContentType
|
|
203
|
+
|
|
204
|
+
/** Removes all annotaions associated with the field */
|
|
205
|
+
clearAnnotations(): ContentType
|
|
206
|
+
|
|
156
207
|
/** Creates a field with provided id. */
|
|
157
|
-
createField
|
|
208
|
+
createField(id: string, init?: IFieldOptions): Field
|
|
158
209
|
|
|
159
210
|
/** Edits the field of provided id. */
|
|
160
|
-
editField
|
|
211
|
+
editField(id: string, init?: IFieldOptions): Field
|
|
161
212
|
|
|
162
|
-
moveField
|
|
213
|
+
moveField(id: string): Movement
|
|
163
214
|
|
|
164
215
|
/** Shorthand method to omit a field, publish its content type, and then delete the field. This implies that associated content for the field will be lost. */
|
|
165
|
-
deleteField
|
|
216
|
+
deleteField(id: string): void
|
|
166
217
|
|
|
167
218
|
/** Changes the field's ID. */
|
|
168
|
-
changeFieldId
|
|
219
|
+
changeFieldId(oldId: string, newId: string): void
|
|
169
220
|
|
|
170
221
|
/**
|
|
171
222
|
*
|
|
@@ -173,7 +224,11 @@ export interface ContentType {
|
|
|
173
224
|
* @param widgetId The new widget ID for the field.
|
|
174
225
|
* @param settings Widget settings
|
|
175
226
|
*/
|
|
176
|
-
configureEntryEditor(
|
|
227
|
+
configureEntryEditor(
|
|
228
|
+
widgetNamespace: 'builtin' | 'extension' | 'app',
|
|
229
|
+
widgetId: string,
|
|
230
|
+
settings?: IEditorInterfaceOptions
|
|
231
|
+
): void
|
|
177
232
|
|
|
178
233
|
/**
|
|
179
234
|
* Changes the control of given field's ID.
|
|
@@ -183,26 +238,36 @@ export interface ContentType {
|
|
|
183
238
|
* @param widgetId The new widget ID for the field.
|
|
184
239
|
* @param settings Widget settings
|
|
185
240
|
*/
|
|
186
|
-
changeFieldControl
|
|
241
|
+
changeFieldControl(
|
|
242
|
+
fieldId: string,
|
|
243
|
+
widgetNamespace: 'builtin' | 'extension' | 'app',
|
|
244
|
+
widgetId: string,
|
|
245
|
+
settings?: IEditorInterfaceOptions
|
|
246
|
+
): void
|
|
187
247
|
|
|
188
248
|
/**
|
|
189
249
|
* @deprecated
|
|
190
250
|
* Use change field control instead
|
|
191
251
|
*/
|
|
192
|
-
changeEditorInterface
|
|
252
|
+
changeEditorInterface(
|
|
253
|
+
fieldId: string,
|
|
254
|
+
widgetId: string,
|
|
255
|
+
settings?: IEditorInterfaceOptions,
|
|
256
|
+
widgetNamespace?: 'builtin' | 'extension'
|
|
257
|
+
): void
|
|
193
258
|
|
|
194
259
|
/**
|
|
195
260
|
* Resets the field control of given field's ID.
|
|
196
261
|
*
|
|
197
262
|
* @param fieldId The ID of the field.
|
|
198
263
|
*/
|
|
199
|
-
resetFieldControl
|
|
264
|
+
resetFieldControl(fieldId: string): void
|
|
200
265
|
|
|
201
266
|
/**
|
|
202
267
|
* @deprecated
|
|
203
268
|
* Use resetFieldControl instead
|
|
204
269
|
*/
|
|
205
|
-
resetEditorInterface
|
|
270
|
+
resetEditorInterface(fieldId: string): void
|
|
206
271
|
|
|
207
272
|
/**
|
|
208
273
|
* copies the control settings from a field to another field in the same content type.
|
|
@@ -210,13 +275,13 @@ export interface ContentType {
|
|
|
210
275
|
* @param sourceFieldId The ID of the field to copy the control setting from.
|
|
211
276
|
* @param destinationFieldId The ID of the field to apply the copied control setting to.
|
|
212
277
|
*/
|
|
213
|
-
copyFieldControl
|
|
278
|
+
copyFieldControl(sourceFieldId: string, destinationFieldId: string): void
|
|
214
279
|
|
|
215
280
|
/**
|
|
216
281
|
* @deprecated
|
|
217
282
|
* Use copyFieldControl instead
|
|
218
283
|
*/
|
|
219
|
-
copyEditorInterface
|
|
284
|
+
copyEditorInterface(sourceFieldId: string, destinationFieldId: string): void
|
|
220
285
|
|
|
221
286
|
/**
|
|
222
287
|
* Adds a builtin or custom widget to the sidebar of the content type.
|
|
@@ -226,10 +291,12 @@ export interface ContentType {
|
|
|
226
291
|
* @param settings Instance settings for the widget
|
|
227
292
|
* @param insertBeforeWidgetId Insert widget above this widget in the sidebar. If null, the widget will be added to the end.
|
|
228
293
|
*/
|
|
229
|
-
addSidebarWidget
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
294
|
+
addSidebarWidget(
|
|
295
|
+
widgetNamespace: 'sidebar-builtin' | 'extension' | 'app',
|
|
296
|
+
widgetId: string,
|
|
297
|
+
settings?: ISidebarWidgetSettings,
|
|
298
|
+
insertBeforeWidgetId?: string | null
|
|
299
|
+
): void
|
|
233
300
|
|
|
234
301
|
/**
|
|
235
302
|
* Updates the configuration of a widget in the sidebar of the content type.
|
|
@@ -238,9 +305,11 @@ export interface ContentType {
|
|
|
238
305
|
* @param widgetId The ID of the widget to update.
|
|
239
306
|
* @param settings Instance settings for the widget
|
|
240
307
|
*/
|
|
241
|
-
updateSidebarWidget
|
|
242
|
-
|
|
243
|
-
|
|
308
|
+
updateSidebarWidget(
|
|
309
|
+
widgetNamespace: 'sidebar-builtin' | 'extension' | 'app',
|
|
310
|
+
widgetId: string,
|
|
311
|
+
settings: ISidebarWidgetSettings
|
|
312
|
+
): void
|
|
244
313
|
|
|
245
314
|
/**
|
|
246
315
|
* Removes a widget from the sidebar of the content type.
|
|
@@ -248,20 +317,83 @@ export interface ContentType {
|
|
|
248
317
|
* @param widgetNamespace The namespace of the widget. Use 'sidebar-builtin' for standard widgets or 'extension' for UI extensions.
|
|
249
318
|
* @param widgetId The ID of the widget to remove.
|
|
250
319
|
*/
|
|
251
|
-
removeSidebarWidget
|
|
252
|
-
|
|
320
|
+
removeSidebarWidget(
|
|
321
|
+
widgetNamespace: 'sidebar-builtin' | 'extension' | 'app',
|
|
322
|
+
widgetId: string
|
|
323
|
+
): void
|
|
253
324
|
|
|
254
325
|
/**
|
|
255
326
|
* Resets the sidebar of the content type to default
|
|
256
327
|
*/
|
|
257
|
-
resetSidebarToDefault
|
|
328
|
+
resetSidebarToDefault(): void
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Generates the default editor layout in the editor interface related to this content type.
|
|
332
|
+
*/
|
|
333
|
+
createEditorLayout(): EditorLayout
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Returns the editor layout related to this content type.
|
|
337
|
+
*/
|
|
338
|
+
editEditorLayout(): EditorLayout
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Removes editor layout and group controls from the editor interface of this content type.
|
|
342
|
+
*/
|
|
343
|
+
deleteEditorLayout(): void
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface InitFieldGroupOptions {
|
|
347
|
+
name: string
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export type FieldGroupUpdateFunction = (groupId: string, init?: InitFieldGroupOptions) => FieldGroup
|
|
351
|
+
export interface FieldGroup {
|
|
352
|
+
name: (name: string) => FieldGroup
|
|
353
|
+
/**
|
|
354
|
+
* Creates a field group nested to this one
|
|
355
|
+
*/
|
|
356
|
+
createFieldGroup: FieldGroupUpdateFunction
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export interface EditorLayout {
|
|
360
|
+
/**
|
|
361
|
+
* Creates a field group at the top level of editor layout
|
|
362
|
+
* A group control is automatically generated
|
|
363
|
+
*/
|
|
364
|
+
createFieldGroup: FieldGroupUpdateFunction
|
|
365
|
+
/**
|
|
366
|
+
* Edits a field group
|
|
367
|
+
*/
|
|
368
|
+
editFieldGroup: FieldGroupUpdateFunction
|
|
369
|
+
/**
|
|
370
|
+
* Changes the identifier of a field group
|
|
371
|
+
*/
|
|
372
|
+
changeFieldGroupId: (currentId: string, newId: string) => void
|
|
373
|
+
/**
|
|
374
|
+
* Removes a field group from the editor layout
|
|
375
|
+
*/
|
|
376
|
+
deleteFieldGroup: (groupId: string) => void
|
|
377
|
+
/**
|
|
378
|
+
* Allows movements of a field in the editor layout
|
|
379
|
+
*/
|
|
380
|
+
moveField: (fieldId: string) => EditorLayoutMovement
|
|
381
|
+
/**
|
|
382
|
+
* Edits the field group control of a field group
|
|
383
|
+
*/
|
|
384
|
+
changeFieldGroupControl: (
|
|
385
|
+
groupId: string,
|
|
386
|
+
widgetNameSpace: 'builtin',
|
|
387
|
+
widgetId: 'fieldset' | 'topLevelTab',
|
|
388
|
+
settings?: IFieldGroupWidgetSettings
|
|
389
|
+
) => void
|
|
258
390
|
}
|
|
259
391
|
|
|
260
392
|
export interface IContentTypeOptions {
|
|
261
393
|
/** Name of the content type. */
|
|
262
|
-
name: string
|
|
394
|
+
name: string
|
|
263
395
|
/** Description of the content type. */
|
|
264
|
-
description?: string
|
|
396
|
+
description?: string
|
|
265
397
|
/** ID of the field to use as the display field for the content type. */
|
|
266
398
|
displayField?: string
|
|
267
399
|
}
|
|
@@ -270,11 +402,11 @@ type ContentFields = { [field: string]: { [locale: string]: any } }
|
|
|
270
402
|
|
|
271
403
|
export interface ITransformEntriesConfig {
|
|
272
404
|
/** (required) – Content type ID */
|
|
273
|
-
contentType: string
|
|
405
|
+
contentType: string
|
|
274
406
|
/** (required) – Array of the source field IDs */
|
|
275
|
-
from: string[]
|
|
407
|
+
from: string[]
|
|
276
408
|
/** (required) – Array of the target field IDs */
|
|
277
|
-
to: string[]
|
|
409
|
+
to: string[]
|
|
278
410
|
/**
|
|
279
411
|
* (required) – Transformation function to be applied.
|
|
280
412
|
*
|
|
@@ -282,27 +414,27 @@ export interface ITransformEntriesConfig {
|
|
|
282
414
|
* locale one of the locales in the space being transformed
|
|
283
415
|
*
|
|
284
416
|
* The return value must be an object with the same keys as specified in to. Their values will be written to the respective entry fields for the current locale (i.e. {nameField: 'myNewValue'}). If it returns undefined, this the values for this locale on the entry will be left untouched.
|
|
285
|
-
|
|
286
|
-
transformEntryForLocale: (fromFields: ContentFields, currentLocale: string) => any
|
|
417
|
+
*/
|
|
418
|
+
transformEntryForLocale: (fromFields: ContentFields, currentLocale: string) => any
|
|
287
419
|
/** (optional) – If true, the transformed entries will be published. If false, they will remain in draft state. When the value is set to "preserve" items will be published only if the original entry was published as well (default true) */
|
|
288
|
-
shouldPublish?: boolean|
|
|
420
|
+
shouldPublish?: boolean | 'preserve'
|
|
289
421
|
}
|
|
290
422
|
|
|
291
423
|
export interface ITransformEntriesToTypeConfig {
|
|
292
424
|
/** (required) – Content type ID of source entries */
|
|
293
|
-
sourceContentType: string
|
|
425
|
+
sourceContentType: string
|
|
294
426
|
/** (required) – Targeted Content type ID */
|
|
295
|
-
targetContentType: string
|
|
427
|
+
targetContentType: string
|
|
296
428
|
/** (optional) – Array of the source field IDs, returns complete list of fields if not configured */
|
|
297
|
-
from?: string[]
|
|
429
|
+
from?: string[]
|
|
298
430
|
/** (required) - Function to create a new entry ID for the target entry */
|
|
299
|
-
identityKey: (fromFields: ContentFields) => string
|
|
431
|
+
identityKey: (fromFields: ContentFields) => string
|
|
300
432
|
/** (optional) – Flag that specifies publishing of target entries, preserve will keep current states of the source entries (default false) */
|
|
301
|
-
shouldPublish?: boolean|
|
|
433
|
+
shouldPublish?: boolean | 'preserve'
|
|
302
434
|
/** (optional) – Flag that specifies if linking entries should be updated with target entries (default false) */
|
|
303
|
-
updateReferences?: boolean
|
|
435
|
+
updateReferences?: boolean
|
|
304
436
|
/** (optional) – Flag that specifies if source entries should be deleted (default false). Note that this flag does not support Rich Text Fields references. */
|
|
305
|
-
removeOldEntries?: boolean
|
|
437
|
+
removeOldEntries?: boolean
|
|
306
438
|
/**
|
|
307
439
|
* (required) – Transformation function to be applied.
|
|
308
440
|
*
|
|
@@ -310,8 +442,8 @@ export interface ITransformEntriesToTypeConfig {
|
|
|
310
442
|
* locale one of the locales in the space being transformed
|
|
311
443
|
*
|
|
312
444
|
* The return value must be an object with the same keys as specified in to. Their values will be written to the respective entry fields for the current locale (i.e. {nameField: 'myNewValue'}). If it returns undefined, this the values for this locale on the entry will be left untouched.
|
|
313
|
-
|
|
314
|
-
transformEntryForLocale: (fromFields: ContentFields, currentLocale: string) => any
|
|
445
|
+
*/
|
|
446
|
+
transformEntryForLocale: (fromFields: ContentFields, currentLocale: string) => any
|
|
315
447
|
}
|
|
316
448
|
|
|
317
449
|
export interface IDeriveLinkedEntriesConfig {
|
|
@@ -319,44 +451,44 @@ export interface IDeriveLinkedEntriesConfig {
|
|
|
319
451
|
* (required) – Source content type ID
|
|
320
452
|
*
|
|
321
453
|
* This is the content type which has the 'from' fields
|
|
322
|
-
|
|
323
|
-
contentType: string
|
|
454
|
+
*/
|
|
455
|
+
contentType: string
|
|
324
456
|
/**
|
|
325
457
|
* (required) – Target content type ID
|
|
326
458
|
*
|
|
327
459
|
* This is the content type that the link points to
|
|
328
460
|
*/
|
|
329
|
-
derivedContentType: string
|
|
461
|
+
derivedContentType: string
|
|
330
462
|
/**
|
|
331
463
|
* (required) – Array of the source field IDs
|
|
332
464
|
*
|
|
333
465
|
* The values in these fields on the source content type
|
|
334
466
|
* will be given to "deriveEntryForLocale"
|
|
335
467
|
*/
|
|
336
|
-
from: string[]
|
|
468
|
+
from: string[]
|
|
337
469
|
/** (required) – ID of the field on the source content type in which to insert the reference */
|
|
338
|
-
toReferenceField: string
|
|
470
|
+
toReferenceField: string
|
|
339
471
|
/**
|
|
340
472
|
* (required) – Array of the field IDs on the target content type
|
|
341
473
|
*
|
|
342
474
|
* The fields returned from "deriveEntryForLocale" will be written to these fields
|
|
343
475
|
* on the new instance of the derived content type.
|
|
344
476
|
*/
|
|
345
|
-
derivedFields: string[]
|
|
477
|
+
derivedFields: string[]
|
|
346
478
|
/**
|
|
347
479
|
* (required) - Called once per source entry. Returns the ID used for the derived entry, which is also used for de-duplication so that multiple source entries can link to the same derived entry.
|
|
348
480
|
* fields is an object containing each of the from fields. Each field will contain their current localized values (i.e. fields == {myField: {'en-US': 'my field value'}})
|
|
349
481
|
*/
|
|
350
|
-
identityKey: (fromFields: ContentFields) => string
|
|
482
|
+
identityKey: (fromFields: ContentFields) => string
|
|
351
483
|
/** (optional) – If true, both the source and the derived entries will be published. If false, both will remain in draft state. If preserve, will keep current states of the source entries (default true) */
|
|
352
|
-
shouldPublish?: boolean | 'preserve'
|
|
484
|
+
shouldPublish?: boolean | 'preserve'
|
|
353
485
|
/**
|
|
354
486
|
* (required) – Function that generates the field values for the derived entry.
|
|
355
487
|
* fields is an object containing each of the from fields. Each field will contain their current localized values (i.e. fields == {myField: {'en-US': 'my field value'}})
|
|
356
488
|
* locale one of the locales in the space being transformed
|
|
357
489
|
*
|
|
358
490
|
* The return value must be an object with the same keys as specified in derivedFields. Their values will be written to the respective new entry fields for the current locale (i.e. {nameField: 'myNewValue'})
|
|
359
|
-
|
|
491
|
+
*/
|
|
360
492
|
deriveEntryForLocale: (inputFields: ContentFields, locale: string) => { [field: string]: any }
|
|
361
493
|
}
|
|
362
494
|
|
|
@@ -371,12 +503,12 @@ export interface ITag {
|
|
|
371
503
|
|
|
372
504
|
export interface ITagOptions {
|
|
373
505
|
/** Name of the tag. */
|
|
374
|
-
name: string
|
|
506
|
+
name: string
|
|
375
507
|
}
|
|
376
508
|
|
|
377
509
|
export interface ITagLink {
|
|
378
510
|
sys: {
|
|
379
|
-
id: string
|
|
511
|
+
id: string
|
|
380
512
|
type: 'Link'
|
|
381
513
|
linkType: 'Tag'
|
|
382
514
|
}
|
|
@@ -384,9 +516,9 @@ export interface ITagLink {
|
|
|
384
516
|
|
|
385
517
|
export interface ISetTagsForEntriesConfig {
|
|
386
518
|
/** (required) – Content type ID */
|
|
387
|
-
contentType: string
|
|
519
|
+
contentType: string
|
|
388
520
|
/** (required) – Array of the source field IDs */
|
|
389
|
-
from: string[]
|
|
521
|
+
from: string[]
|
|
390
522
|
/**
|
|
391
523
|
* (required) – Transformation function to be applied.
|
|
392
524
|
*
|
|
@@ -396,11 +528,14 @@ export interface ISetTagsForEntriesConfig {
|
|
|
396
528
|
*
|
|
397
529
|
* The return value must be an array with TagLinks. The corresponding tags will be attached to the entry. If the transformation function returns undefined, the entry will be left untouched.
|
|
398
530
|
*
|
|
399
|
-
|
|
400
|
-
setTagsForEntry: (
|
|
531
|
+
*/
|
|
532
|
+
setTagsForEntry: (
|
|
533
|
+
entryFields: ContentFields,
|
|
534
|
+
entryTags: ITagLink[],
|
|
535
|
+
apiTags: ITagLink[]
|
|
536
|
+
) => ITagLink[] | undefined
|
|
401
537
|
}
|
|
402
538
|
|
|
403
|
-
|
|
404
539
|
/**
|
|
405
540
|
* The main interface for creating and editing content types.
|
|
406
541
|
*/
|
|
@@ -419,38 +554,38 @@ export default interface Migration {
|
|
|
419
554
|
* @param id string – The ID of the content type.
|
|
420
555
|
* @param init Object – Content type definition
|
|
421
556
|
*/
|
|
422
|
-
createContentType
|
|
557
|
+
createContentType(id: string, init?: IContentTypeOptions): ContentType
|
|
423
558
|
|
|
424
559
|
/**
|
|
425
560
|
* Edits an existing content type of provided id and returns a reference to the content type. Uses the same options as createContentType.
|
|
426
561
|
* @param id string – The ID of the content type.
|
|
427
562
|
* @param changes Object – Content type definition
|
|
428
563
|
*/
|
|
429
|
-
editContentType
|
|
564
|
+
editContentType(id: string, changes?: IContentTypeOptions): ContentType
|
|
430
565
|
|
|
431
566
|
/**
|
|
432
567
|
* Deletes the content type with the provided id and returns undefined. Note that the content type must not have any entries.
|
|
433
568
|
* @param id string – The ID of the content type.
|
|
434
569
|
*/
|
|
435
|
-
deleteContentType
|
|
570
|
+
deleteContentType(id: string): void
|
|
436
571
|
|
|
437
572
|
/**
|
|
438
573
|
* For the given content type, transforms all its entries according to the user-provided transformEntryForLocale function. For each entry, the CLI will call this function once per locale in the space, passing in the from fields and the locale as arguments. The transform function is expected to return an object with the desired target fields. If it returns undefined, this entry locale will be left untouched.
|
|
439
574
|
* @param transformation
|
|
440
575
|
*/
|
|
441
|
-
transformEntries
|
|
576
|
+
transformEntries(transformation: ITransformEntriesConfig): void
|
|
442
577
|
|
|
443
578
|
/**
|
|
444
579
|
* For the given content type, transforms all its entries according to the user-provided transformEntryForLocale function into a new content type. For each entry, the CLI will call this function once per locale in the space, passing in the from fields and the locale as arguments. The transform function is expected to return an object with the desired target fields. If it returns undefined, this entry locale will be left untouched
|
|
445
580
|
* @param transformation
|
|
446
581
|
*/
|
|
447
|
-
transformEntriesToType
|
|
582
|
+
transformEntriesToType(transformation: ITransformEntriesToTypeConfig): void
|
|
448
583
|
|
|
449
584
|
/**
|
|
450
585
|
* For each entry of the given content type (source entry), derives a new entry and sets up a reference to it on the source entry. The content of the new entry is generated by the user-provided deriveEntryForLocale function. For each source entry, this function will be called as many times as there are locales in the space. Each time, it will be called with the from fields and one of the locales as arguments. The derive function is expected to return an object with the desired target fields. If it returns undefined, the new entry will have no values for the current locale.
|
|
451
586
|
* @param transformation
|
|
452
587
|
*/
|
|
453
|
-
deriveLinkedEntries
|
|
588
|
+
deriveLinkedEntries(transformation: IDeriveLinkedEntriesConfig): void
|
|
454
589
|
|
|
455
590
|
/**
|
|
456
591
|
* Creates a tag with provided id and returns a reference to the newly created tag.
|
|
@@ -465,34 +600,33 @@ export default interface Migration {
|
|
|
465
600
|
* @param init Object – Tag definition
|
|
466
601
|
* @param tagVisibility string - Whether the tag should be public or private
|
|
467
602
|
*/
|
|
468
|
-
createTag
|
|
603
|
+
createTag(id: string, init?: ITagOptions, tagVisibility?: TagVisibility): ITag
|
|
469
604
|
|
|
470
605
|
/**
|
|
471
606
|
* Edits an existing tag of provided id and returns a reference to the tag. Uses the same options as createTag.
|
|
472
607
|
* @param id string – The ID of the tag.
|
|
473
608
|
* @param changes Object – Tag definition
|
|
474
609
|
*/
|
|
475
|
-
editTag
|
|
610
|
+
editTag(id: string, changes?: ITagOptions): ITag
|
|
476
611
|
|
|
477
612
|
/**
|
|
478
613
|
* Deletes the tag with the provided id and returns undefined.
|
|
479
614
|
* @param id string – The ID of the tag.
|
|
480
615
|
*/
|
|
481
|
-
deleteTag
|
|
616
|
+
deleteTag(id: string): void
|
|
482
617
|
|
|
483
618
|
/**
|
|
484
619
|
* For the given content type, transforms all its entries according to the user-provided transformEntryForLocale function. For each entry, the CLI will call this function once per locale in the space, passing in the from fields and the locale as arguments. The transform function is expected to return an object with the desired target fields. If it returns undefined, this entry locale will be left untouched.
|
|
485
620
|
* @param transformation
|
|
486
621
|
*/
|
|
487
|
-
setTagsForEntries
|
|
488
|
-
|
|
622
|
+
setTagsForEntries(transformation: ISetTagsForEntriesConfig): void
|
|
489
623
|
}
|
|
490
624
|
|
|
491
625
|
export interface ClientConfig {
|
|
492
626
|
accessToken?: string
|
|
493
627
|
spaceId?: string
|
|
494
|
-
environmentId?: string
|
|
495
|
-
proxy?: string
|
|
628
|
+
environmentId?: string
|
|
629
|
+
proxy?: string
|
|
496
630
|
rawProxy?: boolean
|
|
497
631
|
}
|
|
498
632
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-migration",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "Migration tooling for contentful",
|
|
5
5
|
"author": "Contentful GmbH",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"clean": "rimraf built",
|
|
26
26
|
"build": "npm run clean && tsc -p tsconfig.json",
|
|
27
27
|
"build-dev": "npm run clean && tsc -p tsconfig-dev.json",
|
|
28
|
-
"prepare": "npm run build",
|
|
28
|
+
"prepare": "npm run build && husky install",
|
|
29
29
|
"test": "NOCK_RECORD=0 npm run build && npm run test:unit && npm run test:integration && npm run test:e2e && npm run lint && npm run test:typescript-declaration",
|
|
30
30
|
"test:watch": "npm run test:unit -- --watch",
|
|
31
31
|
"test:unit": "NODE_ENV=test mocha --require test/setup-unit.js --recursive 'test/unit/**/**/*.spec.{js,ts}'",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"test:e2e": "NODE_ENV=test mocha 'test/end-to-end/**/*.spec.js'",
|
|
34
34
|
"test:typescript-declaration": "tsc --strict --noEmit index.d.ts",
|
|
35
35
|
"lint": "eslint 'examples/**/*.js' 'test/**/*.js' 'src/**/*.js' && tslint --project tsconfig-dev.json --config tslint.json -e '**/*.js'",
|
|
36
|
+
"lint:fix": "prettier --write 'src/**/*.{ts,tsx,js,jsx}' 'test/**/*.{ts,tsx,js,jsx}' && eslint --fix 'examples/**/*.js' 'test/**/*.js' 'src/**/*.js' && tslint --fix --project tsconfig-dev.json --config tslint.json -e '**/*.js'",
|
|
36
37
|
"semantic-release": "semantic-release",
|
|
37
38
|
"travis-deploy-once": "travis-deploy-once",
|
|
38
39
|
"test:unit:debug": "NODE_ENV=test mocha debug --require test/setup-unit.js --recursive 'test/unit/**/**/*.spec.{js,ts}'",
|
|
@@ -84,14 +85,18 @@
|
|
|
84
85
|
"cz-conventional-changelog": "^3.3.0",
|
|
85
86
|
"dirty-chai": "^2.0.1",
|
|
86
87
|
"eslint": "^7.7.0",
|
|
88
|
+
"eslint-config-prettier": "^8.3.0",
|
|
87
89
|
"eslint-plugin-import": "^2.20.2",
|
|
88
|
-
"eslint-plugin-mocha": "^
|
|
90
|
+
"eslint-plugin-mocha": "^10.0.4",
|
|
89
91
|
"eslint-plugin-node": "^11.1.0",
|
|
90
92
|
"eslint-plugin-promise": "^6.0.0",
|
|
91
93
|
"eslint-plugin-standard": "^5.0.0",
|
|
94
|
+
"husky": "^7.0.4",
|
|
95
|
+
"lint-staged": "^12.3.4",
|
|
92
96
|
"mocha": "^7.1.1",
|
|
93
97
|
"nixt": "^0.5.1",
|
|
94
98
|
"nock": "^13.0.0",
|
|
99
|
+
"prettier": "^2.5.1",
|
|
95
100
|
"rewire": "^5.0.0",
|
|
96
101
|
"rimraf": "^3.0.2",
|
|
97
102
|
"semantic-release": "^18.0.0",
|
|
@@ -102,6 +107,7 @@
|
|
|
102
107
|
"travis-deploy-once": "^5.0.11",
|
|
103
108
|
"ts-node": "^10.0.0",
|
|
104
109
|
"tslint": "^6.1.1",
|
|
110
|
+
"tslint-config-prettier": "^1.18.0",
|
|
105
111
|
"tslint-config-standard": "^9.0.0",
|
|
106
112
|
"typescript": "^4.5.5",
|
|
107
113
|
"zlib": "^1.0.5"
|
|
@@ -136,5 +142,18 @@
|
|
|
136
142
|
"commitizen": {
|
|
137
143
|
"path": "./node_modules/cz-conventional-changelog"
|
|
138
144
|
}
|
|
145
|
+
},
|
|
146
|
+
"lint-staged": {
|
|
147
|
+
"*.{js,jsx}": [
|
|
148
|
+
"prettier --write",
|
|
149
|
+
"eslint"
|
|
150
|
+
],
|
|
151
|
+
"*.{ts,tsx}": [
|
|
152
|
+
"prettier --write",
|
|
153
|
+
"tslint"
|
|
154
|
+
],
|
|
155
|
+
"*.md": [
|
|
156
|
+
"prettier --write"
|
|
157
|
+
]
|
|
139
158
|
}
|
|
140
159
|
}
|