druxt-site 0.9.0 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # druxt-site
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [45bc0b9]
8
+ - druxt@0.14.0
9
+ - druxt-blocks@0.14.2
10
+ - druxt-breadcrumb@0.13.2
11
+ - druxt-entity@0.21.3
12
+ - druxt-menu@0.15.1
13
+ - druxt-router@0.24.1
14
+ - druxt-schema@0.9.1
15
+ - druxt-views@0.16.2
16
+
17
+ ## 0.10.1
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [9161b38]
22
+ - druxt-router@0.24.0
23
+ - druxt-blocks@0.14.1
24
+ - druxt-breadcrumb@0.13.1
25
+ - druxt-entity@0.21.2
26
+ - druxt-views@0.16.1
27
+
28
+ ## 0.10.0
29
+
30
+ ### Minor Changes
31
+
32
+ - 77ab204: Replaced File Proxy with Druxt proxy
33
+ - e7b1533: Refactored DruxtModule fetch hooks
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [025315a]
38
+ - druxt-entity@0.21.0
39
+ - druxt-views@0.16.0
40
+ - druxt-schema@0.9.0
41
+ - druxt-blocks@0.14.0
42
+ - druxt-breadcrumb@0.13.0
43
+ - druxt@0.13.0
44
+ - druxt-menu@0.15.0
45
+ - druxt-router@0.23.0
46
+
47
+ ## 0.9.1
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [4504a2f]
52
+ - druxt@0.12.0
53
+ - druxt-router@0.22.0
54
+ - druxt-menu@0.14.1
55
+ - druxt-entity@0.20.0
56
+ - druxt-views@0.15.0
57
+ - druxt-blocks@0.13.1
58
+ - druxt-breadcrumb@0.12.1
59
+ - druxt-schema@0.8.1
60
+
3
61
  ## 0.9.0
4
62
 
5
63
  ### Minor Changes
@@ -63,40 +63,6 @@ export default {
63
63
  defaultTheme: ($druxt.settings.site || {}).theme,
64
64
  }),
65
65
 
66
- /**
67
- * Nuxt.js fetch method.
68
- *
69
- * Fetches theme filtered region names from the Block JSON:API resources to be
70
- * used to render the `<DruxtBlockRegion />`'s.
71
- */
72
- async fetch() {
73
- const type = 'block--block'
74
-
75
- // If no default theme is provided, get the first available valid theme.
76
- if (!this.defaultTheme) {
77
- this.defaultTheme = await this.getCollection({
78
- type,
79
- query: new DrupalJsonApiParams()
80
- .addFields(type, ['theme'])
81
- .addFilter('plugin', 'system_main_block')
82
- .addPageLimit(1)
83
- }).then((resources) => resources.data[0].attributes.theme)
84
- }
85
-
86
- // Fetch all available regions.
87
- if (!this.value) {
88
- this.model = await this.getCollection({
89
- type,
90
- query: new DrupalJsonApiParams()
91
- .addFilter('theme', this.theme || this.defaultTheme)
92
- .addFields(type, ['region']),
93
- }).then((resources) => resources.data.map((resource) => resource.attributes.region).filter((v, i, s) => s.indexOf(v) === i))
94
- }
95
-
96
- // Call DruxtModule fetch hook.
97
- await DruxtModule.fetch.call(this)
98
- },
99
-
100
66
  /**
101
67
  * Vue.js Computed properties.
102
68
  */
@@ -136,6 +102,35 @@ export default {
136
102
  */
137
103
  componentOptions: ({ defaultTheme, theme }) => [[theme || defaultTheme], ['default']],
138
104
 
105
+ /**
106
+ * Fetches theme filtered region names from the Block JSON:API resources to
107
+ * be used to render the `<DruxtBlockRegion />`'s.
108
+ */
109
+ async fetchConfig() {
110
+ const type = 'block--block'
111
+
112
+ // If no default theme is provided, get the first available valid theme.
113
+ if (!this.defaultTheme) {
114
+ this.defaultTheme = await this.getCollection({
115
+ type,
116
+ query: new DrupalJsonApiParams()
117
+ .addFields(type, ['theme'])
118
+ .addFilter('plugin', 'system_main_block')
119
+ .addPageLimit(1)
120
+ }).then((resources) => resources.data[0].attributes.theme)
121
+ }
122
+
123
+ // Fetch all available regions.
124
+ if (!this.value) {
125
+ this.model = await this.getCollection({
126
+ type,
127
+ query: new DrupalJsonApiParams()
128
+ .addFilter('theme', this.theme || this.defaultTheme)
129
+ .addFields(type, ['region']),
130
+ }).then((resources) => resources.data.map((resource) => resource.attributes.region).filter((v, i, s) => s.indexOf(v) === i))
131
+ }
132
+ },
133
+
139
134
  /**
140
135
  * Provides propsData for the DruxtWrapper.
141
136
  *
@@ -6,7 +6,7 @@ import { DruxtClient } from 'druxt';
6
6
  const titleFn = (parts) => parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).replace(/_/g, " ")).join("/");
7
7
  async function DruxtSiteStorybook({ options, stories }) {
8
8
  const { addTemplate } = this;
9
- const druxt = new DruxtClient(options.baseUrl, options);
9
+ const druxt = new DruxtClient(options.baseUrl, { ...options, proxy: { api: false } });
10
10
  const type = "block--block";
11
11
  const query = new DrupalJsonApiParams().addFields(type, ["theme"]);
12
12
  const resources = (await druxt.getCollectionAll(type, query)).map((collection) => collection.data).flat();
@@ -33,17 +33,23 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
33
33
  jsonApiMenuItems: true,
34
34
  ...((this.options || {}).druxt || {}).menu
35
35
  },
36
+ proxy: {
37
+ api: false,
38
+ files: true,
39
+ ...((this.options || {}).druxt || {}).proxy
40
+ },
36
41
  site: {
37
42
  layout: true,
38
43
  ...((this.options || {}).druxt || {}).site,
39
44
  ...moduleOptions
40
45
  }
41
46
  };
47
+ this.options.druxt = options;
42
48
  this.nuxt.hook("components:dirs", (dirs) => {
43
49
  dirs.push({ path: join(__dirname, "components") });
44
50
  });
45
- this.addModule(["druxt", options]);
46
51
  const druxtModules = [
52
+ "druxt",
47
53
  "druxt-blocks",
48
54
  "druxt-breadcrumb",
49
55
  "druxt-entity",
@@ -53,13 +59,8 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
53
59
  "druxt-views"
54
60
  ];
55
61
  for (const module of druxtModules) {
56
- this.addModule([module, { baseUrl: options.baseUrl, ...options[module.split("-")[1]] || {} }]);
57
- }
58
- if (typeof this.options.proxy === "undefined") {
59
- this.options.proxy = [options.baseUrl + "/sites/default/files"];
62
+ this.addModule(module);
60
63
  }
61
- this.addModule("@nuxtjs/proxy");
62
- this.options.store = true;
63
64
  if (!await existsSync(resolve(this.options.srcDir, this.options.dir.layouts)) && options.site.layout) {
64
65
  this.addLayout(resolve(__dirname, "./layouts/default.vue"), "default");
65
66
  }
@@ -10,7 +10,7 @@ const druxt = require('druxt');
10
10
  const titleFn = (parts) => parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).replace(/_/g, " ")).join("/");
11
11
  async function DruxtSiteStorybook({ options, stories }) {
12
12
  const { addTemplate } = this;
13
- const druxt$1 = new druxt.DruxtClient(options.baseUrl, options);
13
+ const druxt$1 = new druxt.DruxtClient(options.baseUrl, { ...options, proxy: { api: false } });
14
14
  const type = "block--block";
15
15
  const query = new drupalJsonapiParams.DrupalJsonApiParams().addFields(type, ["theme"]);
16
16
  const resources = (await druxt$1.getCollectionAll(type, query)).map((collection) => collection.data).flat();
@@ -37,17 +37,23 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
37
37
  jsonApiMenuItems: true,
38
38
  ...((this.options || {}).druxt || {}).menu
39
39
  },
40
+ proxy: {
41
+ api: false,
42
+ files: true,
43
+ ...((this.options || {}).druxt || {}).proxy
44
+ },
40
45
  site: {
41
46
  layout: true,
42
47
  ...((this.options || {}).druxt || {}).site,
43
48
  ...moduleOptions
44
49
  }
45
50
  };
51
+ this.options.druxt = options;
46
52
  this.nuxt.hook("components:dirs", (dirs) => {
47
53
  dirs.push({ path: path.join(__dirname, "components") });
48
54
  });
49
- this.addModule(["druxt", options]);
50
55
  const druxtModules = [
56
+ "druxt",
51
57
  "druxt-blocks",
52
58
  "druxt-breadcrumb",
53
59
  "druxt-entity",
@@ -57,13 +63,8 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
57
63
  "druxt-views"
58
64
  ];
59
65
  for (const module of druxtModules) {
60
- this.addModule([module, { baseUrl: options.baseUrl, ...options[module.split("-")[1]] || {} }]);
61
- }
62
- if (typeof this.options.proxy === "undefined") {
63
- this.options.proxy = [options.baseUrl + "/sites/default/files"];
66
+ this.addModule(module);
64
67
  }
65
- this.addModule("@nuxtjs/proxy");
66
- this.options.store = true;
67
68
  if (!await fs.existsSync(path.resolve(this.options.srcDir, this.options.dir.layouts)) && options.site.layout) {
68
69
  this.addLayout(path.resolve(__dirname, "./layouts/default.vue"), "default");
69
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt-site",
3
- "version": "0.9.0",
3
+ "version": "0.10.2",
4
4
  "description": "Out of the box Decoupled Drupal sites with Druxt.",
5
5
  "keywords": [
6
6
  "cms",
@@ -42,16 +42,15 @@
42
42
  "templates"
43
43
  ],
44
44
  "dependencies": {
45
- "@nuxtjs/proxy": "^2.1.0",
46
45
  "drupal-jsonapi-params": "^1.2.2",
47
- "druxt": "^0.11.0",
48
- "druxt-blocks": "^0.13.0",
49
- "druxt-breadcrumb": "^0.12.0",
50
- "druxt-entity": "^0.19.0",
51
- "druxt-menu": "^0.14.0",
52
- "druxt-router": "^0.21.0",
53
- "druxt-schema": "^0.8.0",
54
- "druxt-views": "^0.14.0",
46
+ "druxt": "^0.14.0",
47
+ "druxt-blocks": "^0.14.2",
48
+ "druxt-breadcrumb": "^0.13.2",
49
+ "druxt-entity": "^0.21.3",
50
+ "druxt-menu": "^0.15.1",
51
+ "druxt-router": "^0.24.1",
52
+ "druxt-schema": "^0.9.1",
53
+ "druxt-views": "^0.16.2",
55
54
  "md5": "^2.2.1"
56
55
  },
57
56
  "optionalDependencies": {