@anywayseo/gatsby-plugin 2.8.0 → 2.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/gatsby-node.js +1 -0
- package/package.json +1 -1
- package/utils/create-pages/index.d.ts +2 -1
- package/utils/create-pages/index.js +5 -3
- package/utils/create-pages/mdx/index.js +4 -1
- package/utils/create-pages/mdx/types.d.ts +3 -12
- package/utils/create-pages/strapi-article/index.d.ts +2 -0
- package/utils/create-pages/strapi-article/index.js +78 -0
- package/utils/create-pages/strapi-article/types.d.ts +7 -0
- package/utils/create-pages/{strapi → strapi-page}/index.js +5 -2
- package/utils/create-pages/strapi-page/types.d.ts +7 -0
- package/utils/create-pages/strapi-page/types.js +2 -0
- package/utils/create-pages/types.d.ts +22 -0
- package/utils/create-pages/types.js +2 -0
- package/utils/create-pages/utils/hreflang.js +23 -4
- package/utils/create-pages/utils/slug.d.ts +4 -2
- package/utils/create-pages/utils/slug.js +17 -20
- package/utils/create-pages/utils/types.d.ts +5 -1
- package/utils/strapi-source/schema/collections/article.d.ts +1 -0
- package/utils/strapi-source/schema/collections/article.js +21 -0
- package/utils/strapi-source/schema/collections/hub.d.ts +1 -0
- package/utils/strapi-source/schema/collections/hub.js +10 -0
- package/utils/strapi-source/schema/collections/page.d.ts +1 -1
- package/utils/strapi-source/schema/collections/page.js +1 -0
- package/utils/strapi-source/schema/components/content.d.ts +1 -1
- package/utils/strapi-source/schema/components/content.js +6 -0
- package/utils/strapi-source/schema/index.js +16 -1
- package/utils/strapi-source/strapi-content/index.js +125 -1
- package/utils/create-pages/strapi/types.d.ts +0 -13
- /package/utils/create-pages/{strapi → strapi-article}/types.js +0 -0
- /package/utils/create-pages/{strapi → strapi-page}/index.d.ts +0 -0
package/gatsby-node.js
CHANGED
|
@@ -63,6 +63,7 @@ function createPages(args) {
|
|
|
63
63
|
reporter.warn('Local source mode enabled. Skipping Strapi page creation.');
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
+
yield (0, create_pages_1.createStrapiArticles)(args, root);
|
|
66
67
|
yield (0, create_pages_1.createStrapiPages)(args, root);
|
|
67
68
|
}
|
|
68
69
|
yield (0, create_pages_1.createMdxPages)(args, root);
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createStrapiPages = exports.createRedirectPage = exports.createMdxPages = void 0;
|
|
3
|
+
exports.createStrapiPages = exports.createStrapiArticles = exports.createRedirectPage = exports.createMdxPages = void 0;
|
|
4
4
|
var mdx_1 = require("./mdx");
|
|
5
5
|
Object.defineProperty(exports, "createMdxPages", { enumerable: true, get: function () { return mdx_1.createMdxPages; } });
|
|
6
6
|
var redirect_1 = require("./redirect");
|
|
7
7
|
Object.defineProperty(exports, "createRedirectPage", { enumerable: true, get: function () { return redirect_1.createRedirectPage; } });
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "
|
|
8
|
+
var strapi_article_1 = require("./strapi-article");
|
|
9
|
+
Object.defineProperty(exports, "createStrapiArticles", { enumerable: true, get: function () { return strapi_article_1.createStrapiArticles; } });
|
|
10
|
+
var strapi_page_1 = require("./strapi-page");
|
|
11
|
+
Object.defineProperty(exports, "createStrapiPages", { enumerable: true, get: function () { return strapi_page_1.createStrapiPages; } });
|
|
@@ -33,6 +33,9 @@ function createMdxPages(_a, root_1) {
|
|
|
33
33
|
allStrapiPage {
|
|
34
34
|
nodes {
|
|
35
35
|
slug
|
|
36
|
+
hub {
|
|
37
|
+
slug
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
@@ -52,7 +55,7 @@ function createMdxPages(_a, root_1) {
|
|
|
52
55
|
const slug = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.slug;
|
|
53
56
|
const contentFilePath = internal.contentFilePath;
|
|
54
57
|
if (slug && contentFilePath) {
|
|
55
|
-
const existingPage = strapiPages.find((strapiPage) => (0, slug_1.isEqualSlug)(strapiPage === null ||
|
|
58
|
+
const existingPage = strapiPages.find((strapiPage) => { var _a; return (0, slug_1.isEqualSlug)((0, slug_1.mergeSlug)(strapiPage.slug, (_a = strapiPage.hub) === null || _a === void 0 ? void 0 : _a.slug), slug); });
|
|
56
59
|
if (!!existingPage) {
|
|
57
60
|
reporter.warn(`Skipping MDX page creation: "${slug}" already exists`);
|
|
58
61
|
return;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
+
import type { IMdxPage, IStrapiPage } from '../types';
|
|
1
2
|
export interface IGetAllMdxPageQuery {
|
|
2
3
|
allMdx?: {
|
|
3
|
-
nodes:
|
|
4
|
-
frontmatter: {
|
|
5
|
-
slug: string;
|
|
6
|
-
title: string;
|
|
7
|
-
};
|
|
8
|
-
internal: {
|
|
9
|
-
contentFilePath: string;
|
|
10
|
-
};
|
|
11
|
-
}[];
|
|
4
|
+
nodes: IMdxPage[];
|
|
12
5
|
};
|
|
13
6
|
allStrapiPage?: {
|
|
14
|
-
nodes:
|
|
15
|
-
slug?: string | null;
|
|
16
|
-
}[];
|
|
7
|
+
nodes: IStrapiPage[];
|
|
17
8
|
};
|
|
18
9
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createStrapiArticles = createStrapiArticles;
|
|
13
|
+
const path_1 = require("path");
|
|
14
|
+
const slug_1 = require("../utils/slug");
|
|
15
|
+
const hreflang_1 = require("../utils/hreflang");
|
|
16
|
+
function createStrapiArticles(_a, root_1) {
|
|
17
|
+
return __awaiter(this, arguments, void 0, function* ({ actions, reporter, graphql }, root) {
|
|
18
|
+
var _b, _c, _d, _e;
|
|
19
|
+
reporter.info('Starting to create Strapi articles');
|
|
20
|
+
try {
|
|
21
|
+
const result = yield graphql(`
|
|
22
|
+
query GetAllStrapiArticle {
|
|
23
|
+
strapiSite {
|
|
24
|
+
locale
|
|
25
|
+
}
|
|
26
|
+
allStrapiArticle {
|
|
27
|
+
nodes {
|
|
28
|
+
id
|
|
29
|
+
title
|
|
30
|
+
slug
|
|
31
|
+
locale
|
|
32
|
+
hub {
|
|
33
|
+
slug
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`);
|
|
39
|
+
if (result.errors) {
|
|
40
|
+
throw new Error(`There was an error loading your Strapi articles: ${result.errors}`);
|
|
41
|
+
}
|
|
42
|
+
const defaultLocale = (_c = (_b = result.data) === null || _b === void 0 ? void 0 : _b.strapiSite) === null || _c === void 0 ? void 0 : _c.locale;
|
|
43
|
+
const strapiArticles = (_e = (_d = result.data) === null || _d === void 0 ? void 0 : _d.allStrapiArticle) === null || _e === void 0 ? void 0 : _e.nodes;
|
|
44
|
+
if (!(strapiArticles === null || strapiArticles === void 0 ? void 0 : strapiArticles.length)) {
|
|
45
|
+
reporter.warn('No Strapi articles found. Skipping Strapi articles creation.');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
reporter.info(`Found ${strapiArticles.length} Strapi articles`);
|
|
49
|
+
const hrefLangMap = (0, hreflang_1.buildHrefLangMap)(strapiArticles, defaultLocale);
|
|
50
|
+
reporter.info(`Generated hrefLangs for Strapi articles`);
|
|
51
|
+
let articleCount = 0;
|
|
52
|
+
strapiArticles.forEach(({ id, slug, title, locale, hub }) => {
|
|
53
|
+
var _a;
|
|
54
|
+
if ((0, slug_1.isDummyPage)(slug)) {
|
|
55
|
+
reporter.warn('Skipping article creation: dummy article detected');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if ((0, slug_1.isEmptyPage)(title, slug)) {
|
|
59
|
+
reporter.warn('Skipping article creation: empty article detected');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const strapiArticleTemplate = (0, path_1.resolve)(root, `./src/templates/strapi-article.tsx`);
|
|
63
|
+
const strapiArticlePath = (0, slug_1.buildPath)((0, slug_1.mergeSlug)(slug, hub === null || hub === void 0 ? void 0 : hub.slug), locale, defaultLocale);
|
|
64
|
+
const strapiArticleHrefLangs = (_a = hrefLangMap[strapiArticlePath]) !== null && _a !== void 0 ? _a : [];
|
|
65
|
+
actions.createPage({
|
|
66
|
+
path: strapiArticlePath,
|
|
67
|
+
component: strapiArticleTemplate,
|
|
68
|
+
context: { id, hrefLangs: strapiArticleHrefLangs },
|
|
69
|
+
});
|
|
70
|
+
articleCount++;
|
|
71
|
+
});
|
|
72
|
+
reporter.success(`Created ${articleCount} Strapi articles`);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
reporter.panicOnBuild(`Error creating Strapi articles: ${error}`);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -29,6 +29,9 @@ function createStrapiPages(_a, root_1) {
|
|
|
29
29
|
title
|
|
30
30
|
slug
|
|
31
31
|
locale
|
|
32
|
+
hub {
|
|
33
|
+
slug
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
}
|
|
@@ -46,7 +49,7 @@ function createStrapiPages(_a, root_1) {
|
|
|
46
49
|
const hrefLangMap = (0, hreflang_1.buildHrefLangMap)(strapiPages, defaultLocale);
|
|
47
50
|
reporter.info(`Generated hrefLangs for Strapi pages`);
|
|
48
51
|
let pageCount = 0;
|
|
49
|
-
strapiPages.forEach(({ id, slug, title, locale }) => {
|
|
52
|
+
strapiPages.forEach(({ id, slug, title, locale, hub }) => {
|
|
50
53
|
var _a;
|
|
51
54
|
if ((0, slug_1.isDummyPage)(slug)) {
|
|
52
55
|
reporter.warn('Skipping page creation: dummy page detected');
|
|
@@ -57,7 +60,7 @@ function createStrapiPages(_a, root_1) {
|
|
|
57
60
|
return;
|
|
58
61
|
}
|
|
59
62
|
const strapiPageTemplate = (0, path_1.resolve)(root, `./src/templates/strapi-page.tsx`);
|
|
60
|
-
const strapiPagePath = (0, slug_1.buildPath)(slug, locale, defaultLocale);
|
|
63
|
+
const strapiPagePath = (0, slug_1.buildPath)((0, slug_1.mergeSlug)(slug, hub === null || hub === void 0 ? void 0 : hub.slug), locale, defaultLocale);
|
|
61
64
|
const strapiPageHrefLangs = (_a = hrefLangMap[strapiPagePath]) !== null && _a !== void 0 ? _a : [];
|
|
62
65
|
actions.createPage({
|
|
63
66
|
path: strapiPagePath,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface IStrapiHub {
|
|
2
|
+
slug?: string | null;
|
|
3
|
+
}
|
|
4
|
+
export interface IStrapiPage {
|
|
5
|
+
id: string;
|
|
6
|
+
title?: string | null;
|
|
7
|
+
slug?: string | null;
|
|
8
|
+
locale?: string | null;
|
|
9
|
+
hub?: IStrapiHub | null;
|
|
10
|
+
}
|
|
11
|
+
export interface IStrapiSite {
|
|
12
|
+
locale?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface IMdxPage {
|
|
15
|
+
frontmatter: {
|
|
16
|
+
slug: string;
|
|
17
|
+
title: string;
|
|
18
|
+
};
|
|
19
|
+
internal: {
|
|
20
|
+
contentFilePath: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -2,20 +2,39 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildHrefLangMap = buildHrefLangMap;
|
|
4
4
|
const slug_1 = require("./slug");
|
|
5
|
-
|
|
5
|
+
function groupPagesBySlug(pages, defaultLocale) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const groups = {};
|
|
8
|
+
for (const page of pages) {
|
|
9
|
+
const slug = (0, slug_1.normalizeSlug)((0, slug_1.mergeSlug)(page.slug, (_a = page.hub) === null || _a === void 0 ? void 0 : _a.slug));
|
|
10
|
+
const locale = (_b = page.locale) !== null && _b !== void 0 ? _b : defaultLocale;
|
|
11
|
+
if (!groups[slug]) {
|
|
12
|
+
groups[slug] = [];
|
|
13
|
+
}
|
|
14
|
+
groups[slug].push({ slug, locale });
|
|
15
|
+
}
|
|
16
|
+
return groups;
|
|
17
|
+
}
|
|
18
|
+
function buildCanonicalHref(slug, locale, defaultLocale) {
|
|
19
|
+
const path = (0, slug_1.buildPath)(slug, locale, defaultLocale);
|
|
20
|
+
if (path === '/') {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
return path.endsWith('/') ? path : `${path}/`;
|
|
24
|
+
}
|
|
6
25
|
function getDefaultHrefLang(pages, defaultLocale) {
|
|
7
26
|
var _a;
|
|
8
27
|
const defaultPage = (_a = pages.find((page) => page.locale === defaultLocale)) !== null && _a !== void 0 ? _a : pages[0];
|
|
9
|
-
return { href: (
|
|
28
|
+
return { href: buildCanonicalHref(defaultPage.slug, defaultPage.locale, defaultLocale), hrefLang: 'x-default' };
|
|
10
29
|
}
|
|
11
30
|
function buildHrefLangMap(pages, defaultLocale = 'en') {
|
|
12
31
|
const hrefLangMap = {};
|
|
13
|
-
for (const pageGroup of Object.values(
|
|
32
|
+
for (const pageGroup of Object.values(groupPagesBySlug(pages, defaultLocale))) {
|
|
14
33
|
const defaultHreflang = getDefaultHrefLang(pageGroup, defaultLocale);
|
|
15
34
|
for (const page of pageGroup) {
|
|
16
35
|
const hrefLangs = pageGroup.map(({ slug, locale }) => ({
|
|
17
36
|
hrefLang: locale,
|
|
18
|
-
href: (
|
|
37
|
+
href: buildCanonicalHref(slug, locale, defaultLocale),
|
|
19
38
|
}));
|
|
20
39
|
hrefLangs.push(defaultHreflang);
|
|
21
40
|
const path = (0, slug_1.buildPath)(page.slug, page.locale, defaultLocale);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { IPage
|
|
1
|
+
import type { IPage } from './types';
|
|
2
|
+
export declare function mergeSlug(slug: IPage['slug'], parentSlug: IPage['slug']): string;
|
|
3
|
+
export declare function normalizeSlug(slug?: IPage['slug']): string;
|
|
4
|
+
export declare function normalizeLocale(locale?: IPage['locale']): string;
|
|
2
5
|
export declare function buildPath(slug?: IPage['slug'], locale?: IPage['locale'], defaultLocale?: string): string;
|
|
3
6
|
export declare function isEqualSlug(a?: IPage['slug'], b?: IPage['slug']): boolean;
|
|
4
7
|
export declare function isEmptyPage(title?: IPage['title'], slug?: IPage['slug']): boolean;
|
|
5
8
|
export declare function isDummyPage(slug?: IPage['slug']): boolean;
|
|
6
|
-
export declare function groupPagesBySlug(pages: IPage[], defaultLocale: string): PageGroup;
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeSlug = mergeSlug;
|
|
4
|
+
exports.normalizeSlug = normalizeSlug;
|
|
5
|
+
exports.normalizeLocale = normalizeLocale;
|
|
3
6
|
exports.buildPath = buildPath;
|
|
4
7
|
exports.isEqualSlug = isEqualSlug;
|
|
5
8
|
exports.isEmptyPage = isEmptyPage;
|
|
6
9
|
exports.isDummyPage = isDummyPage;
|
|
7
|
-
exports.groupPagesBySlug = groupPagesBySlug;
|
|
8
10
|
const INDEX_PAGE_SLUG = 'index';
|
|
9
11
|
const DUMMY_PAGE_SLUG = 'dummy';
|
|
12
|
+
function mergeSlug(slug, parentSlug) {
|
|
13
|
+
if (parentSlug) {
|
|
14
|
+
return slug ? `${parentSlug}/${slug}` : parentSlug;
|
|
15
|
+
}
|
|
16
|
+
return slug !== null && slug !== void 0 ? slug : '';
|
|
17
|
+
}
|
|
10
18
|
function normalizeSlug(slug) {
|
|
11
|
-
if (!slug || slug === INDEX_PAGE_SLUG) {
|
|
12
|
-
return '';
|
|
19
|
+
if (!slug || slug === INDEX_PAGE_SLUG || slug === '/') {
|
|
20
|
+
return '/';
|
|
13
21
|
}
|
|
14
|
-
|
|
22
|
+
const lowercaseSlug = slug.toLowerCase();
|
|
23
|
+
return lowercaseSlug.startsWith('/') ? lowercaseSlug : `/${lowercaseSlug}`;
|
|
15
24
|
}
|
|
16
25
|
function normalizeLocale(locale) {
|
|
17
26
|
return (locale !== null && locale !== void 0 ? locale : '').toLowerCase();
|
|
18
27
|
}
|
|
19
28
|
function buildPath(slug, locale, defaultLocale) {
|
|
29
|
+
const normalizedSlug = normalizeSlug(slug);
|
|
20
30
|
const normalizedLocale = normalizeLocale(locale);
|
|
21
31
|
const normalizedDefaultLocale = normalizeLocale(defaultLocale);
|
|
22
|
-
const localePrefix = normalizedLocale === normalizedDefaultLocale ?
|
|
23
|
-
return
|
|
32
|
+
const localePrefix = normalizedLocale === normalizedDefaultLocale ? null : normalizedLocale;
|
|
33
|
+
return localePrefix ? `/${localePrefix}${normalizedSlug}` : normalizedSlug;
|
|
24
34
|
}
|
|
25
35
|
function isEqualSlug(a, b) {
|
|
26
36
|
return normalizeSlug(a) === normalizeSlug(b);
|
|
@@ -29,18 +39,5 @@ function isEmptyPage(title, slug) {
|
|
|
29
39
|
return !title && !slug;
|
|
30
40
|
}
|
|
31
41
|
function isDummyPage(slug) {
|
|
32
|
-
return normalizeSlug(slug) === DUMMY_PAGE_SLUG;
|
|
33
|
-
}
|
|
34
|
-
function groupPagesBySlug(pages, defaultLocale) {
|
|
35
|
-
var _a;
|
|
36
|
-
const groups = {};
|
|
37
|
-
for (const page of pages) {
|
|
38
|
-
if (!page.slug)
|
|
39
|
-
continue;
|
|
40
|
-
if (!groups[page.slug]) {
|
|
41
|
-
groups[page.slug] = [];
|
|
42
|
-
}
|
|
43
|
-
groups[page.slug].push({ slug: page.slug, locale: (_a = page.locale) !== null && _a !== void 0 ? _a : defaultLocale });
|
|
44
|
-
}
|
|
45
|
-
return groups;
|
|
42
|
+
return normalizeSlug(slug) === normalizeSlug(DUMMY_PAGE_SLUG);
|
|
46
43
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
type Path = string;
|
|
2
|
+
type NormalizedSlug = string;
|
|
2
3
|
export interface IPage {
|
|
3
4
|
title?: string | null;
|
|
4
5
|
slug?: string | null;
|
|
5
6
|
locale?: string | null;
|
|
7
|
+
hub?: {
|
|
8
|
+
slug?: string | null;
|
|
9
|
+
} | null;
|
|
6
10
|
}
|
|
7
11
|
interface IExistedPage {
|
|
8
12
|
slug: NonNullable<IPage['slug']>;
|
|
9
13
|
locale: NonNullable<IPage['locale']>;
|
|
10
14
|
}
|
|
11
|
-
export type PageGroup = Record<
|
|
15
|
+
export type PageGroup = Record<NormalizedSlug, IExistedPage[]>;
|
|
12
16
|
export interface IHrefLang {
|
|
13
17
|
href: string;
|
|
14
18
|
hrefLang: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const article = "\n # === STRAPI ARTICLE DEFINITION ===\n type StrapiArticle implements Node {\n id: ID!\n title: String!\n description: String\n slug: String!\n hub: Hub\n previewImage: Image\n minutesToRead: Int\n seo: Seo\n author: Author\n locale: String\n content: [ContentComponent]\n createdAt: Date @dateformat\n updatedAt: Date @dateformat\n }\n";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.article = void 0;
|
|
4
|
+
exports.article = `
|
|
5
|
+
# === STRAPI ARTICLE DEFINITION ===
|
|
6
|
+
type StrapiArticle implements Node {
|
|
7
|
+
id: ID!
|
|
8
|
+
title: String!
|
|
9
|
+
description: String
|
|
10
|
+
slug: String!
|
|
11
|
+
hub: Hub
|
|
12
|
+
previewImage: Image
|
|
13
|
+
minutesToRead: Int
|
|
14
|
+
seo: Seo
|
|
15
|
+
author: Author
|
|
16
|
+
locale: String
|
|
17
|
+
content: [ContentComponent]
|
|
18
|
+
createdAt: Date @dateformat
|
|
19
|
+
updatedAt: Date @dateformat
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hub = "\n # === PAGE HUB DEFINITION ===\n type Hub {\n name: String!\n slug: String!\n }\n ";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const page = "\n # === STRAPI PAGE DEFINITION ===\n type StrapiPage implements Node {\n id: ID!\n locale: String\n title: String\n slug: String\n seo: Seo\n author: Author\n createdAt: Date @dateformat\n updatedAt: Date @dateformat\n content: [ContentComponent]\n }\n";
|
|
1
|
+
export declare const page = "\n # === STRAPI PAGE DEFINITION ===\n type StrapiPage implements Node {\n id: ID!\n locale: String\n title: String\n slug: String\n seo: Seo\n author: Author\n hub: Hub\n createdAt: Date @dateformat\n updatedAt: Date @dateformat\n content: [ContentComponent]\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const content = "\n # === COMPONENT DEFINITIONS ===\n union ContentComponent =\n STRAPI__COMPONENT_CONTENT_ACTION_BUTTON\n | STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE\n | STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE \n | STRAPI__COMPONENT_CONTENT_FAQ\n | STRAPI__COMPONENT_CONTENT_FEATURES\n | STRAPI__COMPONENT_CONTENT_GAME_CARDS\n | STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS\n | STRAPI__COMPONENT_CONTENT_GAME_DEMO\n | STRAPI__COMPONENT_CONTENT_GAME_INFO\n | STRAPI__COMPONENT_CONTENT_HOW_TO\n | STRAPI__COMPONENT_CONTENT_INFORMER\n | STRAPI__COMPONENT_CONTENT_LIST\n | STRAPI__COMPONENT_CONTENT_MEDIA\n | STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE\n | STRAPI__COMPONENT_CONTENT_PROS_CONS\n | STRAPI__COMPONENT_CONTENT_RICH_TEXT\n | STRAPI__COMPONENT_CONTENT_TABLE\n | STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE\n | STRAPI__COMPONENT_CONTENT_TIP\n\n # === ACTION_BUTTON ===\n type STRAPI__COMPONENT_CONTENT_ACTION_BUTTON @dontInfer {\n label: String!\n url: String!\n }\n\n # === CONTACTS ===\n type STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE @dontInfer {\n id: ID\n }\n\n # === COOKIE_POLICY ===\n type STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE @dontInfer {\n id: ID\n }\n\n # === FAQ ===\n type STRAPI__COMPONENT_CONTENT_FAQ @dontInfer {\n items: [FaqItem!]\n }\n\n # === FEATURES ===\n type STRAPI__COMPONENT_CONTENT_FEATURES @dontInfer {\n items: [FeaturesItem!]\n }\n\n # === GAME CARDS ===\n type STRAPI__COMPONENT_CONTENT_GAME_CARDS @dontInfer {\n items: [GameCard!]\n order: String!\n randomSeed: Int\n cardHeight: String\n }\n\n # === GAME CARD TABS ===\n type STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS @dontInfer {\n items: [GameCardTab!]\n }\n\n # === GAME_DEMO ===\n type STRAPI__COMPONENT_CONTENT_GAME_DEMO @dontInfer {\n name: String!\n src: String\n href: String\n previewImage: Image!\n partner: Partner\n }\n\n # === GAME_INFO ===\n type STRAPI__COMPONENT_CONTENT_GAME_INFO @dontInfer {\n general: GameInfoGeneral\n features: GameInfoFeatures\n currency: CurrencyList\n }\n\n # === INFORMER ===\n type STRAPI__COMPONENT_CONTENT_INFORMER @dontInfer {\n type: String!\n text: String!\n author: Author\n }\n\n # === HOW_TO ===\n type STRAPI__COMPONENT_CONTENT_HOW_TO @dontInfer {\n steps: [HowToStep!]\n }\n\n # === LIST ===\n type STRAPI__COMPONENT_CONTENT_LIST @dontInfer {\n bullet: String\n content: JsonValue\n }\n\n # === MEDIA ===\n type STRAPI__COMPONENT_CONTENT_MEDIA @dontInfer {\n file: Image\n }\n\n # === PRIVACY_POLICY ===\n type STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE @dontInfer {\n contactsSlug: String\n }\n\n # === PROS_CONS ===\n type STRAPI__COMPONENT_CONTENT_PROS_CONS @dontInfer {\n pros: [ProsConsItem!]\n cons: [ProsConsItem!]\n }\n\n # === RICH_TEXT ===\n type STRAPI__COMPONENT_CONTENT_RICH_TEXT @dontInfer {\n content: RichTextContent\n }\n\n # === TABLE ===\n type STRAPI__COMPONENT_CONTENT_TABLE @dontInfer {\n columnNumber: Int!\n content: JsonValue\n caption: String\n striped: Boolean\n bordered: Boolean\n scrollable: Boolean\n }\n\n # === TERMS_CONDITIONS ===\n type STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE @dontInfer {\n privacyPolicySlug: String\n }\n\n # === TIP ===\n type STRAPI__COMPONENT_CONTENT_TIP @dontInfer {\n tip: String!\n author: Author\n }\n ";
|
|
1
|
+
export declare const content = "\n # === COMPONENT DEFINITIONS ===\n union ContentComponent =\n STRAPI__COMPONENT_CONTENT_ACTION_BUTTON\n | STRAPI__COMPONENT_CONTENT_ARTICLE_CARDS\n | STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE\n | STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE \n | STRAPI__COMPONENT_CONTENT_FAQ\n | STRAPI__COMPONENT_CONTENT_FEATURES\n | STRAPI__COMPONENT_CONTENT_GAME_CARDS\n | STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS\n | STRAPI__COMPONENT_CONTENT_GAME_DEMO\n | STRAPI__COMPONENT_CONTENT_GAME_INFO\n | STRAPI__COMPONENT_CONTENT_HOW_TO\n | STRAPI__COMPONENT_CONTENT_INFORMER\n | STRAPI__COMPONENT_CONTENT_LIST\n | STRAPI__COMPONENT_CONTENT_MEDIA\n | STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE\n | STRAPI__COMPONENT_CONTENT_PROS_CONS\n | STRAPI__COMPONENT_CONTENT_RICH_TEXT\n | STRAPI__COMPONENT_CONTENT_TABLE\n | STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE\n | STRAPI__COMPONENT_CONTENT_TIP\n\n # === ACTION_BUTTON ===\n type STRAPI__COMPONENT_CONTENT_ACTION_BUTTON @dontInfer {\n label: String!\n url: String!\n }\n\n # === ARTICLE_CARDS ===\n type STRAPI__COMPONENT_CONTENT_ARTICLE_CARDS @dontInfer {\n articles: [StrapiArticle]\n }\n\n # === CONTACTS ===\n type STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE @dontInfer {\n id: ID\n }\n\n # === COOKIE_POLICY ===\n type STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE @dontInfer {\n id: ID\n }\n\n # === FAQ ===\n type STRAPI__COMPONENT_CONTENT_FAQ @dontInfer {\n items: [FaqItem!]\n }\n\n # === FEATURES ===\n type STRAPI__COMPONENT_CONTENT_FEATURES @dontInfer {\n items: [FeaturesItem!]\n }\n\n # === GAME CARDS ===\n type STRAPI__COMPONENT_CONTENT_GAME_CARDS @dontInfer {\n items: [GameCard!]\n order: String!\n randomSeed: Int\n cardHeight: String\n }\n\n # === GAME CARD TABS ===\n type STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS @dontInfer {\n items: [GameCardTab!]\n }\n\n # === GAME_DEMO ===\n type STRAPI__COMPONENT_CONTENT_GAME_DEMO @dontInfer {\n name: String!\n src: String\n href: String\n previewImage: Image!\n partner: Partner\n }\n\n # === GAME_INFO ===\n type STRAPI__COMPONENT_CONTENT_GAME_INFO @dontInfer {\n general: GameInfoGeneral\n features: GameInfoFeatures\n currency: CurrencyList\n }\n\n # === INFORMER ===\n type STRAPI__COMPONENT_CONTENT_INFORMER @dontInfer {\n type: String!\n text: String!\n author: Author\n }\n\n # === HOW_TO ===\n type STRAPI__COMPONENT_CONTENT_HOW_TO @dontInfer {\n steps: [HowToStep!]\n }\n\n # === LIST ===\n type STRAPI__COMPONENT_CONTENT_LIST @dontInfer {\n bullet: String\n content: JsonValue\n }\n\n # === MEDIA ===\n type STRAPI__COMPONENT_CONTENT_MEDIA @dontInfer {\n file: Image\n }\n\n # === PRIVACY_POLICY ===\n type STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE @dontInfer {\n contactsSlug: String\n }\n\n # === PROS_CONS ===\n type STRAPI__COMPONENT_CONTENT_PROS_CONS @dontInfer {\n pros: [ProsConsItem!]\n cons: [ProsConsItem!]\n }\n\n # === RICH_TEXT ===\n type STRAPI__COMPONENT_CONTENT_RICH_TEXT @dontInfer {\n content: RichTextContent\n }\n\n # === TABLE ===\n type STRAPI__COMPONENT_CONTENT_TABLE @dontInfer {\n columnNumber: Int!\n content: JsonValue\n caption: String\n striped: Boolean\n bordered: Boolean\n scrollable: Boolean\n }\n\n # === TERMS_CONDITIONS ===\n type STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE @dontInfer {\n privacyPolicySlug: String\n }\n\n # === TIP ===\n type STRAPI__COMPONENT_CONTENT_TIP @dontInfer {\n tip: String!\n author: Author\n }\n ";
|
|
@@ -5,6 +5,7 @@ exports.content = `
|
|
|
5
5
|
# === COMPONENT DEFINITIONS ===
|
|
6
6
|
union ContentComponent =
|
|
7
7
|
STRAPI__COMPONENT_CONTENT_ACTION_BUTTON
|
|
8
|
+
| STRAPI__COMPONENT_CONTENT_ARTICLE_CARDS
|
|
8
9
|
| STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE
|
|
9
10
|
| STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE
|
|
10
11
|
| STRAPI__COMPONENT_CONTENT_FAQ
|
|
@@ -30,6 +31,11 @@ exports.content = `
|
|
|
30
31
|
url: String!
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
# === ARTICLE_CARDS ===
|
|
35
|
+
type STRAPI__COMPONENT_CONTENT_ARTICLE_CARDS @dontInfer {
|
|
36
|
+
articles: [StrapiArticle]
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
# === CONTACTS ===
|
|
34
40
|
type STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE @dontInfer {
|
|
35
41
|
id: ID
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.typeDefs = void 0;
|
|
4
|
+
const article_1 = require("./collections/article");
|
|
4
5
|
const author_1 = require("./collections/author");
|
|
6
|
+
const hub_1 = require("./collections/hub");
|
|
5
7
|
const page_1 = require("./collections/page");
|
|
6
8
|
const partner_1 = require("./collections/partner");
|
|
7
9
|
const base_1 = require("./components/base");
|
|
@@ -11,4 +13,17 @@ const primitives_1 = require("./primitives");
|
|
|
11
13
|
const localization_1 = require("./single/localization");
|
|
12
14
|
const navigation_1 = require("./single/navigation");
|
|
13
15
|
const site_1 = require("./single/site");
|
|
14
|
-
exports.typeDefs = [
|
|
16
|
+
exports.typeDefs = [
|
|
17
|
+
article_1.article,
|
|
18
|
+
author_1.author,
|
|
19
|
+
hub_1.hub,
|
|
20
|
+
page_1.page,
|
|
21
|
+
partner_1.partner,
|
|
22
|
+
base_1.base,
|
|
23
|
+
content_1.content,
|
|
24
|
+
shared_1.shared,
|
|
25
|
+
primitives_1.primitives,
|
|
26
|
+
localization_1.localization,
|
|
27
|
+
navigation_1.navigation,
|
|
28
|
+
site_1.site,
|
|
29
|
+
].join('\n');
|
|
@@ -20,7 +20,7 @@ const get_entities_1 = require("./get-entities");
|
|
|
20
20
|
const utils_1 = require("./utils");
|
|
21
21
|
function sourceStrapiContentNode(args, strapiClient, config) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var _a;
|
|
23
|
+
var _a, _b;
|
|
24
24
|
const { actions, reporter } = args;
|
|
25
25
|
const { createNode } = actions;
|
|
26
26
|
reporter.info('Starting to fetch content data from Strapi');
|
|
@@ -47,6 +47,9 @@ function sourceStrapiContentNode(args, strapiClient, config) {
|
|
|
47
47
|
singularName: 'page',
|
|
48
48
|
queryParams: {
|
|
49
49
|
populate: {
|
|
50
|
+
hub: {
|
|
51
|
+
populate: '*',
|
|
52
|
+
},
|
|
50
53
|
seo: {
|
|
51
54
|
populate: '*',
|
|
52
55
|
},
|
|
@@ -55,6 +58,17 @@ function sourceStrapiContentNode(args, strapiClient, config) {
|
|
|
55
58
|
'content.action-button': {
|
|
56
59
|
populate: '*',
|
|
57
60
|
},
|
|
61
|
+
'content.article-cards': {
|
|
62
|
+
populate: {
|
|
63
|
+
articles: {
|
|
64
|
+
populate: {
|
|
65
|
+
previewImage: {
|
|
66
|
+
populate: '*',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
58
72
|
'content.contacts-page': {
|
|
59
73
|
populate: '*',
|
|
60
74
|
},
|
|
@@ -159,6 +173,116 @@ function sourceStrapiContentNode(args, strapiClient, config) {
|
|
|
159
173
|
},
|
|
160
174
|
},
|
|
161
175
|
},
|
|
176
|
+
{
|
|
177
|
+
singularName: 'article',
|
|
178
|
+
queryParams: {
|
|
179
|
+
populate: {
|
|
180
|
+
hub: {
|
|
181
|
+
populate: '*',
|
|
182
|
+
},
|
|
183
|
+
seo: {
|
|
184
|
+
populate: '*',
|
|
185
|
+
},
|
|
186
|
+
previewImage: {
|
|
187
|
+
populate: '*',
|
|
188
|
+
},
|
|
189
|
+
content: {
|
|
190
|
+
on: {
|
|
191
|
+
'content.action-button': {
|
|
192
|
+
populate: '*',
|
|
193
|
+
},
|
|
194
|
+
'content.faq': {
|
|
195
|
+
populate: '*',
|
|
196
|
+
},
|
|
197
|
+
'content.features': {
|
|
198
|
+
populate: '*',
|
|
199
|
+
},
|
|
200
|
+
'content.game-cards': {
|
|
201
|
+
populate: {
|
|
202
|
+
items: {
|
|
203
|
+
populate: {
|
|
204
|
+
image: {
|
|
205
|
+
populate: '*',
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
'content.game-card-tabs': {
|
|
212
|
+
populate: {
|
|
213
|
+
items: {
|
|
214
|
+
populate: {
|
|
215
|
+
content: {
|
|
216
|
+
populate: {
|
|
217
|
+
image: {
|
|
218
|
+
populate: '*',
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
'content.game-demo': {
|
|
227
|
+
populate: '*',
|
|
228
|
+
},
|
|
229
|
+
'content.game-info': {
|
|
230
|
+
populate: {
|
|
231
|
+
general: '*',
|
|
232
|
+
features: '*',
|
|
233
|
+
currency: {
|
|
234
|
+
populate: '*',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
'content.how-to': {
|
|
239
|
+
populate: {
|
|
240
|
+
steps: {
|
|
241
|
+
populate: '*',
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
'content.informer': {
|
|
246
|
+
populate: '*',
|
|
247
|
+
},
|
|
248
|
+
'content.list': {
|
|
249
|
+
populate: '*',
|
|
250
|
+
},
|
|
251
|
+
'content.media': {
|
|
252
|
+
populate: '*',
|
|
253
|
+
},
|
|
254
|
+
'content.pros-cons': {
|
|
255
|
+
populate: '*',
|
|
256
|
+
},
|
|
257
|
+
'content.rich-text': {
|
|
258
|
+
populate: '*',
|
|
259
|
+
},
|
|
260
|
+
'content.table': {
|
|
261
|
+
populate: '*',
|
|
262
|
+
},
|
|
263
|
+
'content.tip': {
|
|
264
|
+
populate: '*',
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
author: {
|
|
269
|
+
populate: {
|
|
270
|
+
avatar: {
|
|
271
|
+
populate: '*',
|
|
272
|
+
},
|
|
273
|
+
socialNetworks: {
|
|
274
|
+
populate: '*',
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
locale: '*',
|
|
280
|
+
pagination: {
|
|
281
|
+
page: 1,
|
|
282
|
+
pageSize: (_b = config === null || config === void 0 ? void 0 : config.pageSize) !== null && _b !== void 0 ? _b : utils_1.DEFAULT_PAGE_SIZE,
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
},
|
|
162
286
|
];
|
|
163
287
|
const schemas = yield (0, fetch_schemas_1.fetchSchemas)(strapiClient);
|
|
164
288
|
const endpoints = (0, get_endpoints_1.getEndpoints)(schemas, [...singleTypes, ...collectionTypes]);
|
|
File without changes
|
|
File without changes
|