@ikas/storefront-cmd 4.0.0-alpha.7 → 4.0.0-alpha.71
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/build/_virtual/_cloneBuffer.js +1 -0
- package/build/_virtual/_commonjsHelpers.js +1 -0
- package/build/_virtual/_nodeUtil.js +1 -0
- package/build/_virtual/isBuffer.js +1 -0
- package/build/ext/lodash/_DataView.js +1 -0
- package/build/ext/lodash/_Hash.js +1 -0
- package/build/ext/lodash/_ListCache.js +1 -0
- package/build/ext/lodash/_Map.js +1 -0
- package/build/ext/lodash/_MapCache.js +1 -0
- package/build/ext/lodash/_Promise.js +1 -0
- package/build/ext/lodash/_Set.js +1 -0
- package/build/ext/lodash/_SetCache.js +1 -0
- package/build/ext/lodash/_Stack.js +1 -0
- package/build/ext/lodash/_Symbol.js +1 -0
- package/build/ext/lodash/_Uint8Array.js +1 -0
- package/build/ext/lodash/_WeakMap.js +1 -0
- package/build/ext/lodash/_arrayEach.js +1 -0
- package/build/ext/lodash/_arrayFilter.js +1 -0
- package/build/ext/lodash/_arrayIncludes.js +1 -0
- package/build/ext/lodash/_arrayIncludesWith.js +1 -0
- package/build/ext/lodash/_arrayLikeKeys.js +1 -0
- package/build/ext/lodash/_arrayPush.js +1 -0
- package/build/ext/lodash/_assignValue.js +1 -0
- package/build/ext/lodash/_assocIndexOf.js +1 -0
- package/build/ext/lodash/_baseAssign.js +1 -0
- package/build/ext/lodash/_baseAssignIn.js +1 -0
- package/build/ext/lodash/_baseAssignValue.js +1 -0
- package/build/ext/lodash/_baseClone.js +1 -0
- package/build/ext/lodash/_baseCreate.js +1 -0
- package/build/ext/lodash/_baseFindIndex.js +1 -0
- package/build/ext/lodash/_baseGetAllKeys.js +1 -0
- package/build/ext/lodash/_baseGetTag.js +1 -0
- package/build/ext/lodash/_baseIndexOf.js +1 -0
- package/build/ext/lodash/_baseIsArguments.js +1 -0
- package/build/ext/lodash/_baseIsMap.js +1 -0
- package/build/ext/lodash/_baseIsNaN.js +1 -0
- package/build/ext/lodash/_baseIsNative.js +1 -0
- package/build/ext/lodash/_baseIsSet.js +1 -0
- package/build/ext/lodash/_baseIsTypedArray.js +1 -0
- package/build/ext/lodash/_baseKeys.js +1 -0
- package/build/ext/lodash/_baseKeysIn.js +1 -0
- package/build/ext/lodash/_baseTimes.js +1 -0
- package/build/ext/lodash/_baseUnary.js +1 -0
- package/build/ext/lodash/_baseUniq.js +1 -0
- package/build/ext/lodash/_cacheHas.js +1 -0
- package/build/ext/lodash/_cloneArrayBuffer.js +1 -0
- package/build/ext/lodash/_cloneBuffer.js +1 -0
- package/build/ext/lodash/_cloneDataView.js +1 -0
- package/build/ext/lodash/_cloneRegExp.js +1 -0
- package/build/ext/lodash/_cloneSymbol.js +1 -0
- package/build/ext/lodash/_cloneTypedArray.js +1 -0
- package/build/ext/lodash/_copyArray.js +1 -0
- package/build/ext/lodash/_copyObject.js +1 -0
- package/build/ext/lodash/_copySymbols.js +1 -0
- package/build/ext/lodash/_copySymbolsIn.js +1 -0
- package/build/ext/lodash/_coreJsData.js +1 -0
- package/build/ext/lodash/_createSet.js +1 -0
- package/build/ext/lodash/_defineProperty.js +1 -0
- package/build/ext/lodash/_freeGlobal.js +1 -0
- package/build/ext/lodash/_getAllKeys.js +1 -0
- package/build/ext/lodash/_getAllKeysIn.js +1 -0
- package/build/ext/lodash/_getMapData.js +1 -0
- package/build/ext/lodash/_getNative.js +1 -0
- package/build/ext/lodash/_getPrototype.js +1 -0
- package/build/ext/lodash/_getRawTag.js +1 -0
- package/build/ext/lodash/_getSymbols.js +1 -0
- package/build/ext/lodash/_getSymbolsIn.js +1 -0
- package/build/ext/lodash/_getTag.js +1 -0
- package/build/ext/lodash/_getValue.js +1 -0
- package/build/ext/lodash/_hashClear.js +1 -0
- package/build/ext/lodash/_hashDelete.js +1 -0
- package/build/ext/lodash/_hashGet.js +1 -0
- package/build/ext/lodash/_hashHas.js +1 -0
- package/build/ext/lodash/_hashSet.js +1 -0
- package/build/ext/lodash/_initCloneArray.js +1 -0
- package/build/ext/lodash/_initCloneByTag.js +1 -0
- package/build/ext/lodash/_initCloneObject.js +1 -0
- package/build/ext/lodash/_isIndex.js +1 -0
- package/build/ext/lodash/_isKeyable.js +1 -0
- package/build/ext/lodash/_isMasked.js +1 -0
- package/build/ext/lodash/_isPrototype.js +1 -0
- package/build/ext/lodash/_listCacheClear.js +1 -0
- package/build/ext/lodash/_listCacheDelete.js +1 -0
- package/build/ext/lodash/_listCacheGet.js +1 -0
- package/build/ext/lodash/_listCacheHas.js +1 -0
- package/build/ext/lodash/_listCacheSet.js +1 -0
- package/build/ext/lodash/_mapCacheClear.js +1 -0
- package/build/ext/lodash/_mapCacheDelete.js +1 -0
- package/build/ext/lodash/_mapCacheGet.js +1 -0
- package/build/ext/lodash/_mapCacheHas.js +1 -0
- package/build/ext/lodash/_mapCacheSet.js +1 -0
- package/build/ext/lodash/_nativeCreate.js +1 -0
- package/build/ext/lodash/_nativeKeys.js +1 -0
- package/build/ext/lodash/_nativeKeysIn.js +1 -0
- package/build/ext/lodash/_nodeUtil.js +1 -0
- package/build/ext/lodash/_objectToString.js +1 -0
- package/build/ext/lodash/_overArg.js +1 -0
- package/build/ext/lodash/_root.js +1 -0
- package/build/ext/lodash/_setCacheAdd.js +1 -0
- package/build/ext/lodash/_setCacheHas.js +1 -0
- package/build/ext/lodash/_setToArray.js +1 -0
- package/build/ext/lodash/_stackClear.js +1 -0
- package/build/ext/lodash/_stackDelete.js +1 -0
- package/build/ext/lodash/_stackGet.js +1 -0
- package/build/ext/lodash/_stackHas.js +1 -0
- package/build/ext/lodash/_stackSet.js +1 -0
- package/build/ext/lodash/_strictIndexOf.js +1 -0
- package/build/ext/lodash/_toSource.js +1 -0
- package/build/ext/lodash/cloneDeep.js +1 -0
- package/build/ext/lodash/eq.js +1 -0
- package/build/ext/lodash/isArguments.js +1 -0
- package/build/ext/lodash/isArray.js +1 -0
- package/build/ext/lodash/isArrayLike.js +1 -0
- package/build/ext/lodash/isBuffer.js +1 -0
- package/build/ext/lodash/isFunction.js +1 -0
- package/build/ext/lodash/isLength.js +1 -0
- package/build/ext/lodash/isMap.js +1 -0
- package/build/ext/lodash/isObject.js +1 -0
- package/build/ext/lodash/isObjectLike.js +1 -0
- package/build/ext/lodash/isSet.js +1 -0
- package/build/ext/lodash/isTypedArray.js +1 -0
- package/build/ext/lodash/keys.js +1 -0
- package/build/ext/lodash/keysIn.js +1 -0
- package/build/ext/lodash/noop.js +1 -0
- package/build/ext/lodash/stubArray.js +1 -0
- package/build/ext/lodash/stubFalse.js +1 -0
- package/build/ext/lodash/uniq.js +1 -0
- package/build/ext/tslib/tslib.es6.js +1 -0
- package/build/ikas.cjs +1 -2
- package/{src/index.ts → build/index.d.ts} +3 -4
- package/build/index.js +1 -0
- package/build/scripts/generators/api/index.d.ts +5 -0
- package/build/scripts/generators/api/index.js +1 -0
- package/build/scripts/generators/api/info.d.ts +12 -0
- package/build/scripts/generators/api/info.js +1 -0
- package/build/scripts/generators/components/index.d.ts +11 -0
- package/build/scripts/generators/components/index.js +1 -0
- package/build/scripts/generators/config/content.d.ts +61 -0
- package/build/scripts/generators/config/content.js +1 -0
- package/build/scripts/generators/config/index.d.ts +9 -0
- package/build/scripts/generators/config/index.js +1 -0
- package/{src/scripts/generators/index.ts → build/scripts/generators/index.d.ts} +6 -6
- package/build/scripts/generators/pages/index.d.ts +7 -0
- package/build/scripts/generators/pages/index.js +1 -0
- package/build/scripts/generators/pages/info.d.ts +14 -0
- package/build/scripts/generators/pages/info.js +1 -0
- package/build/scripts/generators/theme/index.d.ts +6 -0
- package/build/scripts/generators/theme/index.js +1 -0
- package/build/scripts/generators/types/index.d.ts +19 -0
- package/build/scripts/generators/types/index.js +1 -0
- package/build/scripts/ikas.d.ts +1 -0
- package/build/scripts/theme-build/index.d.ts +3 -0
- package/build/scripts/theme-build/index.js +1 -0
- package/build/utils/fs.d.ts +28 -0
- package/build/utils/fs.js +1 -0
- package/build/utils/helper.d.ts +2 -0
- package/build/utils/helper.js +1 -0
- package/package.json +7 -6
- package/src/scripts/generators/api/index.ts +0 -27
- package/src/scripts/generators/api/info.ts +0 -47
- package/src/scripts/generators/components/index.ts +0 -244
- package/src/scripts/generators/config/content.ts +0 -168
- package/src/scripts/generators/config/index.ts +0 -106
- package/src/scripts/generators/pages/index.ts +0 -102
- package/src/scripts/generators/pages/info.ts +0 -161
- package/src/scripts/generators/theme/index.ts +0 -63
- package/src/scripts/generators/types/index.ts +0 -520
- package/src/scripts/ikas.ts +0 -45
- package/src/scripts/theme-build/index.ts +0 -99
- package/src/utils/fs.ts +0 -93
- package/src/utils/helper.ts +0 -20
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { IkasThemeJsonPageType } from "@ikas/storefront-models";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { createFile, deleteDirContent } from "../../../utils/fs";
|
|
4
|
-
import {
|
|
5
|
-
PageInfo,
|
|
6
|
-
PAGE_INFO,
|
|
7
|
-
CHECKOUT_PAGE_CONTENT,
|
|
8
|
-
EDITOR_PAGE_CONTENT,
|
|
9
|
-
} from "./info";
|
|
10
|
-
|
|
11
|
-
export class PageGenerator {
|
|
12
|
-
static async generate() {
|
|
13
|
-
const pagesDir = path.join(process.cwd(), "src", "pages");
|
|
14
|
-
await deleteDirContent(pagesDir, ["_app.tsx", "_document.tsx", "api"]);
|
|
15
|
-
|
|
16
|
-
let pagesGenerateSuccess = true;
|
|
17
|
-
for (const pageInfo of PAGE_INFO) {
|
|
18
|
-
pagesGenerateSuccess =
|
|
19
|
-
pagesGenerateSuccess &&
|
|
20
|
-
(await PageGenerator.generatePageWithInfo(pageInfo));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const checkoutPageInfo = PAGE_INFO.find((pi) => pi.isCheckout);
|
|
24
|
-
const editorPageInfo = PAGE_INFO.find((pi) => pi.isEditor);
|
|
25
|
-
|
|
26
|
-
const checkoutPageGenerateSuccess = checkoutPageInfo
|
|
27
|
-
? await PageGenerator.generatePageWithInfo(checkoutPageInfo)
|
|
28
|
-
: false;
|
|
29
|
-
const editorPageGenerateSuccess = editorPageInfo
|
|
30
|
-
? await PageGenerator.generatePageWithInfo(editorPageInfo)
|
|
31
|
-
: false;
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
pagesGenerateSuccess &&
|
|
35
|
-
checkoutPageGenerateSuccess &&
|
|
36
|
-
editorPageGenerateSuccess
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static async generatePageWithInfo(pageInfo: PageInfo) {
|
|
41
|
-
try {
|
|
42
|
-
let fileStr = "";
|
|
43
|
-
|
|
44
|
-
if (pageInfo.isCheckout) {
|
|
45
|
-
fileStr = CHECKOUT_PAGE_CONTENT;
|
|
46
|
-
} else if (pageInfo.isEditor) {
|
|
47
|
-
fileStr = EDITOR_PAGE_CONTENT;
|
|
48
|
-
} else {
|
|
49
|
-
const providerName = pageInfo.pageComponentName + "Next";
|
|
50
|
-
const pageComponentImportStr = `import { ${pageInfo.pageComponentName} } from "@ikas/storefront";\r\n`;
|
|
51
|
-
const providerImportStr = `import { ${pageInfo.pageComponentName} as ${providerName} } from "@ikas/storefront-next";\r\n`;
|
|
52
|
-
const componentsImportStr = `import Components from "src/components/__generated__/pages/${pageInfo.path.replace(
|
|
53
|
-
".tsx",
|
|
54
|
-
""
|
|
55
|
-
)}";\r\n`;
|
|
56
|
-
|
|
57
|
-
const pageComponentStr = `
|
|
58
|
-
const PageComponent = ${pageInfo.pageComponentName}.default;
|
|
59
|
-
|
|
60
|
-
const Page = (props: any) => {
|
|
61
|
-
return <PageComponent components={Components} {...props} />;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export default Page;\r\n`;
|
|
65
|
-
|
|
66
|
-
const getStaticPathsStr = pageInfo.isDynamicSSG
|
|
67
|
-
? `export const getStaticPaths = ${providerName}.getStaticPaths;\r\n`
|
|
68
|
-
: "";
|
|
69
|
-
|
|
70
|
-
const dataFetchingStr = pageInfo.isSSR
|
|
71
|
-
? `export const getServerSideProps = ${providerName}.getServerSideProps;\r\n`
|
|
72
|
-
: `export const getStaticProps = ${providerName}.getStaticProps;\r\n`;
|
|
73
|
-
|
|
74
|
-
fileStr =
|
|
75
|
-
pageComponentImportStr +
|
|
76
|
-
providerImportStr +
|
|
77
|
-
componentsImportStr +
|
|
78
|
-
pageComponentStr +
|
|
79
|
-
getStaticPathsStr +
|
|
80
|
-
dataFetchingStr;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return await createFile(
|
|
84
|
-
path.join(process.cwd(), "src", "pages"),
|
|
85
|
-
pageInfo.path,
|
|
86
|
-
fileStr
|
|
87
|
-
);
|
|
88
|
-
} catch (err) {
|
|
89
|
-
console.error(err);
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
static async generatePageWithType(pageType: IkasThemeJsonPageType) {
|
|
95
|
-
const pageInfo = PAGE_INFO.find((pi) => pi.pageTypes.includes(pageType));
|
|
96
|
-
if (pageInfo) {
|
|
97
|
-
return await PageGenerator.generatePageWithInfo(pageInfo);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { IkasThemeJsonPageType } from "@ikas/storefront-models";
|
|
2
|
-
|
|
3
|
-
export type PageInfo = {
|
|
4
|
-
path: string;
|
|
5
|
-
pageComponentName: string;
|
|
6
|
-
pageTypes: IkasThemeJsonPageType[];
|
|
7
|
-
isDynamicSSG?: boolean;
|
|
8
|
-
isSSR?: boolean;
|
|
9
|
-
isEditor?: boolean;
|
|
10
|
-
isCheckout?: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const CHECKOUT_COMPONENT_ID = "checkout";
|
|
14
|
-
|
|
15
|
-
export const PAGE_INFO: PageInfo[] = [
|
|
16
|
-
{
|
|
17
|
-
path: "[slug]/index.tsx",
|
|
18
|
-
pageComponentName: "SlugPage",
|
|
19
|
-
pageTypes: [
|
|
20
|
-
IkasThemeJsonPageType.PRODUCT,
|
|
21
|
-
IkasThemeJsonPageType.CATEGORY,
|
|
22
|
-
IkasThemeJsonPageType.BRAND,
|
|
23
|
-
],
|
|
24
|
-
isDynamicSSG: true,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
path: "account/orders/[id].tsx",
|
|
28
|
-
pageComponentName: "OrderDetailPage",
|
|
29
|
-
pageTypes: [IkasThemeJsonPageType.ORDER_DETAIL],
|
|
30
|
-
isSSR: true,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
path: "account/orders/index.tsx",
|
|
34
|
-
pageComponentName: "OrdersPage",
|
|
35
|
-
pageTypes: [IkasThemeJsonPageType.ORDERS],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
path: "account/addresses.tsx",
|
|
39
|
-
pageComponentName: "AddressesPage",
|
|
40
|
-
pageTypes: [IkasThemeJsonPageType.ADDRESSES],
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
path: "account/favorite-products.tsx",
|
|
44
|
-
pageComponentName: "FavoriteProductsPage",
|
|
45
|
-
pageTypes: [IkasThemeJsonPageType.FAVORITE_PRODUCTS],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
path: "account/forgot-password.tsx",
|
|
49
|
-
pageComponentName: "ForgotPasswordPage",
|
|
50
|
-
pageTypes: [IkasThemeJsonPageType.FORGOT_PASSWORD],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
path: "account/index.tsx",
|
|
54
|
-
pageComponentName: "AccountPage",
|
|
55
|
-
pageTypes: [IkasThemeJsonPageType.ACCOUNT],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
path: "account/login.tsx",
|
|
59
|
-
pageComponentName: "LoginPage",
|
|
60
|
-
pageTypes: [IkasThemeJsonPageType.LOGIN],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
path: "account/raffles.tsx",
|
|
64
|
-
pageComponentName: "AccountRafflesPage",
|
|
65
|
-
pageTypes: [IkasThemeJsonPageType.RAFFLE_ACCOUNT],
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
path: "account/recover-password.tsx",
|
|
69
|
-
pageComponentName: "RecoverPasswordPage",
|
|
70
|
-
pageTypes: [IkasThemeJsonPageType.RECOVER_PASSWORD],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
path: "account/register.tsx",
|
|
74
|
-
pageComponentName: "RegisterPage",
|
|
75
|
-
pageTypes: [IkasThemeJsonPageType.REGISTER],
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
path: "blog/[slug].tsx",
|
|
79
|
-
pageComponentName: "BlogSlugPage",
|
|
80
|
-
pageTypes: [
|
|
81
|
-
IkasThemeJsonPageType.BLOG,
|
|
82
|
-
IkasThemeJsonPageType.BLOG_CATEGORY,
|
|
83
|
-
],
|
|
84
|
-
isDynamicSSG: true,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
path: "blog/index.tsx",
|
|
88
|
-
pageComponentName: "BlogPage",
|
|
89
|
-
pageTypes: [IkasThemeJsonPageType.BLOG_INDEX],
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
path: "pages/[slug].tsx",
|
|
93
|
-
pageComponentName: "CustomPage",
|
|
94
|
-
pageTypes: [IkasThemeJsonPageType.CUSTOM],
|
|
95
|
-
isDynamicSSG: true,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
path: "raffle/[slug].tsx",
|
|
99
|
-
pageComponentName: "RafflePage",
|
|
100
|
-
pageTypes: [IkasThemeJsonPageType.RAFFLE_DETAIL],
|
|
101
|
-
isDynamicSSG: true,
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
path: "raffle/index.tsx",
|
|
105
|
-
pageComponentName: "RafflesPage",
|
|
106
|
-
pageTypes: [IkasThemeJsonPageType.RAFFLE],
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
path: "404.tsx",
|
|
110
|
-
pageComponentName: "NotFoundPage",
|
|
111
|
-
pageTypes: [IkasThemeJsonPageType.NOT_FOUND],
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
path: "cart.tsx",
|
|
115
|
-
pageComponentName: "CartPage",
|
|
116
|
-
pageTypes: [IkasThemeJsonPageType.CART],
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
path: "index.tsx",
|
|
120
|
-
pageComponentName: "IndexPage",
|
|
121
|
-
pageTypes: [IkasThemeJsonPageType.INDEX],
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
path: "search.tsx",
|
|
125
|
-
pageComponentName: "SearchPage",
|
|
126
|
-
pageTypes: [IkasThemeJsonPageType.SEARCH],
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
path: "checkout.tsx",
|
|
130
|
-
pageComponentName: "CheckoutPage",
|
|
131
|
-
pageTypes: [],
|
|
132
|
-
isCheckout: true,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
path: "editor.tsx",
|
|
136
|
-
pageComponentName: "EditorPage",
|
|
137
|
-
pageTypes: [],
|
|
138
|
-
isEditor: true,
|
|
139
|
-
},
|
|
140
|
-
];
|
|
141
|
-
|
|
142
|
-
export const CHECKOUT_PAGE_CONTENT = `import { CheckoutPage } from "@ikas/storefront";
|
|
143
|
-
import { CheckoutPage as CheckoutPageNext } from "@ikas/storefront-next";
|
|
144
|
-
|
|
145
|
-
export default CheckoutPage.default;
|
|
146
|
-
export const getStaticProps = CheckoutPageNext.getStaticProps;
|
|
147
|
-
`;
|
|
148
|
-
|
|
149
|
-
export const EDITOR_PAGE_CONTENT = `import { EditorPage } from "@ikas/storefront";
|
|
150
|
-
import { EditorPage as EditorPageNext } from "@ikas/storefront-next";
|
|
151
|
-
import Components from "../components/__generated__/editor";
|
|
152
|
-
|
|
153
|
-
const PageComponent = EditorPage.default;
|
|
154
|
-
|
|
155
|
-
const Page = (props: any) => {
|
|
156
|
-
return <PageComponent components={Components} {...props} />;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export default Page;
|
|
160
|
-
export const getStaticProps = EditorPageNext.getStaticProps;
|
|
161
|
-
`;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import { createFile } from "../../../utils/fs";
|
|
4
|
-
import {
|
|
5
|
-
IkasThemeJson,
|
|
6
|
-
IkasThemeJsonPageType,
|
|
7
|
-
IkasThemeJsonStockPreference,
|
|
8
|
-
} from "@ikas/storefront-models";
|
|
9
|
-
|
|
10
|
-
export class ThemeJsonGenerator {
|
|
11
|
-
static generate(themeJson: IkasThemeJson) {
|
|
12
|
-
return createFile(
|
|
13
|
-
path.join(process.cwd(), "src", "theme.json"),
|
|
14
|
-
"",
|
|
15
|
-
JSON.stringify(themeJson, null, 2)
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static generateInitialThemeJsonFile() {
|
|
20
|
-
const themeJson: IkasThemeJson = {
|
|
21
|
-
pages: [],
|
|
22
|
-
components: [],
|
|
23
|
-
name: "My Theme",
|
|
24
|
-
customData: [],
|
|
25
|
-
settings: {
|
|
26
|
-
colors: [],
|
|
27
|
-
favicon: {
|
|
28
|
-
id: null,
|
|
29
|
-
},
|
|
30
|
-
fontFamily: {
|
|
31
|
-
name: null,
|
|
32
|
-
variants: null,
|
|
33
|
-
},
|
|
34
|
-
stockPreference: IkasThemeJsonStockPreference.SHOW_ALL,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
themeJson.pages.push({
|
|
39
|
-
id: "1",
|
|
40
|
-
components: [],
|
|
41
|
-
canonicals: null,
|
|
42
|
-
description: null,
|
|
43
|
-
disableIndex: null,
|
|
44
|
-
name: null,
|
|
45
|
-
pageTitle: null,
|
|
46
|
-
slug: null,
|
|
47
|
-
specifications: [],
|
|
48
|
-
type: IkasThemeJsonPageType.INDEX,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return ThemeJsonGenerator.generate(themeJson);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
static async getTheme() {
|
|
55
|
-
try {
|
|
56
|
-
const themePath = path.join(process.cwd(), "src", "theme.json");
|
|
57
|
-
const fileBuffer = fs.readFileSync(themePath);
|
|
58
|
-
return fileBuffer.length ? JSON.parse(fileBuffer.toString()) : null;
|
|
59
|
-
} catch (err) {
|
|
60
|
-
console.error(err);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|