druxt-schema 0.9.3 → 0.10.2

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.
@@ -246,6 +246,9 @@ const DruxtSchemaNuxtModule = function(moduleOptions = {}) {
246
246
  proxy: { ...options.proxy || {}, api: false }
247
247
  });
248
248
  const { schemas } = await druxtSchema.get();
249
+ if (!Object.entries(schemas).length) {
250
+ throw new Error("No Druxt Schema files generated.\n Have you created any content types yet?");
251
+ }
249
252
  for (const name in schemas) {
250
253
  const schema = schemas[name];
251
254
  if (typeof schema === "undefined")
@@ -256,7 +259,7 @@ const DruxtSchemaNuxtModule = function(moduleOptions = {}) {
256
259
  options: { schema }
257
260
  });
258
261
  }
259
- consola.success("Druxt schema generated");
262
+ consola.success("Druxt schema files generated");
260
263
  });
261
264
  };
262
265
  DruxtSchemaNuxtModule.meta = require("../package.json");
@@ -254,6 +254,9 @@ const DruxtSchemaNuxtModule = function(moduleOptions = {}) {
254
254
  proxy: { ...options.proxy || {}, api: false }
255
255
  });
256
256
  const { schemas } = await druxtSchema.get();
257
+ if (!Object.entries(schemas).length) {
258
+ throw new Error("No Druxt Schema files generated.\n Have you created any content types yet?");
259
+ }
257
260
  for (const name in schemas) {
258
261
  const schema = schemas[name];
259
262
  if (typeof schema === "undefined")
@@ -264,7 +267,7 @@ const DruxtSchemaNuxtModule = function(moduleOptions = {}) {
264
267
  options: { schema }
265
268
  });
266
269
  }
267
- consola__default['default'].success("Druxt schema generated");
270
+ consola__default['default'].success("Druxt schema files generated");
268
271
  });
269
272
  };
270
273
  DruxtSchemaNuxtModule.meta = require("../package.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt-schema",
3
- "version": "0.9.3",
3
+ "version": "0.10.2",
4
4
  "description": "Drupal Content Entity schema generator for Druxt with support for View and Form displays.",
5
5
  "keywords": [
6
6
  "cms",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "consola": "^2.15.0",
43
43
  "drupal-jsonapi-params": "^1.2.2",
44
- "druxt": "^0.16.0"
44
+ "druxt": "^0.18.0"
45
45
  },
46
46
  "optionalDependencies": {
47
47
  "vue": "^2.6.14",
@@ -11,7 +11,20 @@ const DruxtSchemaPlugin = {
11
11
  * @example @lang js
12
12
  * const schema = await this.$druxtSchema.import('node--page--default--view')
13
13
  */
14
- import: async id => import(`./schemas/${id}.json`).then(m => m.default || m)
14
+ import: async id => {
15
+ return import(`./schemas/${id}.json`)
16
+ .then(m => m.default || m)
17
+ .catch(async (err) => {
18
+ const parts = id.split('--')
19
+
20
+ // Error if there's no default view mode.
21
+ if (parts[parts.length - 2] === 'default') throw err
22
+
23
+ // Fallback to the default view mode.
24
+ parts[parts.length - 2] = 'default'
25
+ return import(`./schemas/${parts.join('--')}.json`).then(m => m.default || m)
26
+ })
27
+ }
15
28
  }
16
29
 
17
30
  export default (context, inject) => {
package/CHANGELOG.md DELETED
@@ -1,150 +0,0 @@
1
- # druxt-schema
2
-
3
- ## 0.9.3
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies [7b749bd]
8
- - druxt@0.16.0
9
-
10
- ## 0.9.2
11
-
12
- ### Patch Changes
13
-
14
- - Updated dependencies [2ae1d6d]
15
- - druxt@0.15.0
16
-
17
- ## 0.9.1
18
-
19
- ### Patch Changes
20
-
21
- - Updated dependencies [45bc0b9]
22
- - druxt@0.14.0
23
-
24
- ## 0.9.0
25
-
26
- ### Minor Changes
27
-
28
- - 77ab204: Disabled API Proxy when generating schema files
29
-
30
- ### Patch Changes
31
-
32
- - d12dfb5: Added missing schemaType prop to DruxtSchemaMixin
33
- - Updated dependencies [77ab204]
34
- - druxt@0.13.0
35
-
36
- ## 0.8.1
37
-
38
- ### Patch Changes
39
-
40
- - Updated dependencies [4504a2f]
41
- - druxt@0.12.0
42
-
43
- ## 0.8.0
44
-
45
- ### Minor Changes
46
-
47
- - dae345e: Added module level options
48
-
49
- ### Patch Changes
50
-
51
- - Updated dependencies [dae345e]
52
- - druxt@0.11.0
53
-
54
- ## 0.7.10
55
-
56
- ### Patch Changes
57
-
58
- - Updated dependencies [715e5ef]
59
- - druxt@0.10.0
60
-
61
- ## 0.7.9
62
-
63
- ### Patch Changes
64
-
65
- - c4616df: Fixed dependencies
66
-
67
- ## 0.7.8
68
-
69
- ### Patch Changes
70
-
71
- - Updated dependencies [21170fb]
72
- - druxt@0.9.0
73
-
74
- ## 0.7.7
75
-
76
- ### Patch Changes
77
-
78
- - Fixed issue with inconsistent schemas
79
-
80
- ## 0.7.2
81
-
82
- ### Patch Changes
83
-
84
- - Updated get() query
85
-
86
- ## 0.7.1
87
-
88
- ### Patch Changes
89
-
90
- - Updated Nuxt module
91
-
92
- ## 0.7.0
93
-
94
- ### Minor Changes
95
-
96
- - Refactored to use DruxtClient
97
-
98
- ## 0.6.2
99
-
100
- ### Patch Changes
101
-
102
- - Add support for more than 50 schemas
103
-
104
- ## 0.6.1
105
-
106
- ### Patch Changes
107
-
108
- - Updated dependencies
109
-
110
- ## 0.6.0
111
-
112
- ### Minor Changes
113
-
114
- - Removed auth functionality
115
- - Updated dependencies
116
-
117
- ## 0.5.1
118
-
119
- ### Patch Changes
120
-
121
- - Fixed dependencies
122
-
123
- ## 0.5.0
124
-
125
- ### Minor Changes
126
-
127
- - Refactored to use Nuxt fetch hook
128
-
129
- ## 0.4.0
130
-
131
- ### Minor Changes
132
-
133
- - Added support for remapped resources
134
-
135
- ## 0.3.0
136
-
137
- ### Minor Changes
138
-
139
- - Added support for custom endpoint
140
- - Added message to Nuxt build
141
-
142
- ## 0.2.0
143
-
144
- ### Minor Changes
145
-
146
- - Add ability to filter require schemas
147
-
148
- ## 0.1.0
149
-
150
- ### Initial release