@ikas/storefront-cmd 4.0.0-alpha.68 → 4.0.0-alpha.7
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/ikas.cjs +2 -1
- package/package.json +6 -7
- package/{build/index.d.ts → src/index.ts} +4 -3
- package/src/scripts/generators/api/index.ts +27 -0
- package/src/scripts/generators/api/info.ts +47 -0
- package/src/scripts/generators/components/index.ts +244 -0
- package/src/scripts/generators/config/content.ts +168 -0
- package/src/scripts/generators/config/index.ts +106 -0
- package/{build/scripts/generators/index.d.ts → src/scripts/generators/index.ts} +6 -6
- package/src/scripts/generators/pages/index.ts +102 -0
- package/src/scripts/generators/pages/info.ts +161 -0
- package/src/scripts/generators/theme/index.ts +63 -0
- package/src/scripts/generators/types/index.ts +520 -0
- package/src/scripts/ikas.ts +45 -0
- package/src/scripts/theme-build/index.ts +99 -0
- package/src/utils/fs.ts +93 -0
- package/src/utils/helper.ts +20 -0
- package/build/_virtual/_cloneBuffer.js +0 -1
- package/build/_virtual/_commonjsHelpers.js +0 -1
- package/build/_virtual/_nodeUtil.js +0 -1
- package/build/_virtual/isBuffer.js +0 -1
- package/build/ext/lodash/_DataView.js +0 -1
- package/build/ext/lodash/_Hash.js +0 -1
- package/build/ext/lodash/_ListCache.js +0 -1
- package/build/ext/lodash/_Map.js +0 -1
- package/build/ext/lodash/_MapCache.js +0 -1
- package/build/ext/lodash/_Promise.js +0 -1
- package/build/ext/lodash/_Set.js +0 -1
- package/build/ext/lodash/_SetCache.js +0 -1
- package/build/ext/lodash/_Stack.js +0 -1
- package/build/ext/lodash/_Symbol.js +0 -1
- package/build/ext/lodash/_Uint8Array.js +0 -1
- package/build/ext/lodash/_WeakMap.js +0 -1
- package/build/ext/lodash/_arrayEach.js +0 -1
- package/build/ext/lodash/_arrayFilter.js +0 -1
- package/build/ext/lodash/_arrayIncludes.js +0 -1
- package/build/ext/lodash/_arrayIncludesWith.js +0 -1
- package/build/ext/lodash/_arrayLikeKeys.js +0 -1
- package/build/ext/lodash/_arrayPush.js +0 -1
- package/build/ext/lodash/_assignValue.js +0 -1
- package/build/ext/lodash/_assocIndexOf.js +0 -1
- package/build/ext/lodash/_baseAssign.js +0 -1
- package/build/ext/lodash/_baseAssignIn.js +0 -1
- package/build/ext/lodash/_baseAssignValue.js +0 -1
- package/build/ext/lodash/_baseClone.js +0 -1
- package/build/ext/lodash/_baseCreate.js +0 -1
- package/build/ext/lodash/_baseFindIndex.js +0 -1
- package/build/ext/lodash/_baseGetAllKeys.js +0 -1
- package/build/ext/lodash/_baseGetTag.js +0 -1
- package/build/ext/lodash/_baseIndexOf.js +0 -1
- package/build/ext/lodash/_baseIsArguments.js +0 -1
- package/build/ext/lodash/_baseIsMap.js +0 -1
- package/build/ext/lodash/_baseIsNaN.js +0 -1
- package/build/ext/lodash/_baseIsNative.js +0 -1
- package/build/ext/lodash/_baseIsSet.js +0 -1
- package/build/ext/lodash/_baseIsTypedArray.js +0 -1
- package/build/ext/lodash/_baseKeys.js +0 -1
- package/build/ext/lodash/_baseKeysIn.js +0 -1
- package/build/ext/lodash/_baseTimes.js +0 -1
- package/build/ext/lodash/_baseUnary.js +0 -1
- package/build/ext/lodash/_baseUniq.js +0 -1
- package/build/ext/lodash/_cacheHas.js +0 -1
- package/build/ext/lodash/_cloneArrayBuffer.js +0 -1
- package/build/ext/lodash/_cloneBuffer.js +0 -1
- package/build/ext/lodash/_cloneDataView.js +0 -1
- package/build/ext/lodash/_cloneRegExp.js +0 -1
- package/build/ext/lodash/_cloneSymbol.js +0 -1
- package/build/ext/lodash/_cloneTypedArray.js +0 -1
- package/build/ext/lodash/_copyArray.js +0 -1
- package/build/ext/lodash/_copyObject.js +0 -1
- package/build/ext/lodash/_copySymbols.js +0 -1
- package/build/ext/lodash/_copySymbolsIn.js +0 -1
- package/build/ext/lodash/_coreJsData.js +0 -1
- package/build/ext/lodash/_createSet.js +0 -1
- package/build/ext/lodash/_defineProperty.js +0 -1
- package/build/ext/lodash/_freeGlobal.js +0 -1
- package/build/ext/lodash/_getAllKeys.js +0 -1
- package/build/ext/lodash/_getAllKeysIn.js +0 -1
- package/build/ext/lodash/_getMapData.js +0 -1
- package/build/ext/lodash/_getNative.js +0 -1
- package/build/ext/lodash/_getPrototype.js +0 -1
- package/build/ext/lodash/_getRawTag.js +0 -1
- package/build/ext/lodash/_getSymbols.js +0 -1
- package/build/ext/lodash/_getSymbolsIn.js +0 -1
- package/build/ext/lodash/_getTag.js +0 -1
- package/build/ext/lodash/_getValue.js +0 -1
- package/build/ext/lodash/_hashClear.js +0 -1
- package/build/ext/lodash/_hashDelete.js +0 -1
- package/build/ext/lodash/_hashGet.js +0 -1
- package/build/ext/lodash/_hashHas.js +0 -1
- package/build/ext/lodash/_hashSet.js +0 -1
- package/build/ext/lodash/_initCloneArray.js +0 -1
- package/build/ext/lodash/_initCloneByTag.js +0 -1
- package/build/ext/lodash/_initCloneObject.js +0 -1
- package/build/ext/lodash/_isIndex.js +0 -1
- package/build/ext/lodash/_isKeyable.js +0 -1
- package/build/ext/lodash/_isMasked.js +0 -1
- package/build/ext/lodash/_isPrototype.js +0 -1
- package/build/ext/lodash/_listCacheClear.js +0 -1
- package/build/ext/lodash/_listCacheDelete.js +0 -1
- package/build/ext/lodash/_listCacheGet.js +0 -1
- package/build/ext/lodash/_listCacheHas.js +0 -1
- package/build/ext/lodash/_listCacheSet.js +0 -1
- package/build/ext/lodash/_mapCacheClear.js +0 -1
- package/build/ext/lodash/_mapCacheDelete.js +0 -1
- package/build/ext/lodash/_mapCacheGet.js +0 -1
- package/build/ext/lodash/_mapCacheHas.js +0 -1
- package/build/ext/lodash/_mapCacheSet.js +0 -1
- package/build/ext/lodash/_nativeCreate.js +0 -1
- package/build/ext/lodash/_nativeKeys.js +0 -1
- package/build/ext/lodash/_nativeKeysIn.js +0 -1
- package/build/ext/lodash/_nodeUtil.js +0 -1
- package/build/ext/lodash/_objectToString.js +0 -1
- package/build/ext/lodash/_overArg.js +0 -1
- package/build/ext/lodash/_root.js +0 -1
- package/build/ext/lodash/_setCacheAdd.js +0 -1
- package/build/ext/lodash/_setCacheHas.js +0 -1
- package/build/ext/lodash/_setToArray.js +0 -1
- package/build/ext/lodash/_stackClear.js +0 -1
- package/build/ext/lodash/_stackDelete.js +0 -1
- package/build/ext/lodash/_stackGet.js +0 -1
- package/build/ext/lodash/_stackHas.js +0 -1
- package/build/ext/lodash/_stackSet.js +0 -1
- package/build/ext/lodash/_strictIndexOf.js +0 -1
- package/build/ext/lodash/_toSource.js +0 -1
- package/build/ext/lodash/cloneDeep.js +0 -1
- package/build/ext/lodash/eq.js +0 -1
- package/build/ext/lodash/isArguments.js +0 -1
- package/build/ext/lodash/isArray.js +0 -1
- package/build/ext/lodash/isArrayLike.js +0 -1
- package/build/ext/lodash/isBuffer.js +0 -1
- package/build/ext/lodash/isFunction.js +0 -1
- package/build/ext/lodash/isLength.js +0 -1
- package/build/ext/lodash/isMap.js +0 -1
- package/build/ext/lodash/isObject.js +0 -1
- package/build/ext/lodash/isObjectLike.js +0 -1
- package/build/ext/lodash/isSet.js +0 -1
- package/build/ext/lodash/isTypedArray.js +0 -1
- package/build/ext/lodash/keys.js +0 -1
- package/build/ext/lodash/keysIn.js +0 -1
- package/build/ext/lodash/noop.js +0 -1
- package/build/ext/lodash/stubArray.js +0 -1
- package/build/ext/lodash/stubFalse.js +0 -1
- package/build/ext/lodash/uniq.js +0 -1
- package/build/ext/tslib/tslib.es6.js +0 -1
- package/build/index.js +0 -1
- package/build/scripts/generators/api/index.d.ts +0 -5
- package/build/scripts/generators/api/index.js +0 -1
- package/build/scripts/generators/api/info.d.ts +0 -12
- package/build/scripts/generators/api/info.js +0 -1
- package/build/scripts/generators/components/index.d.ts +0 -11
- package/build/scripts/generators/components/index.js +0 -1
- package/build/scripts/generators/config/content.d.ts +0 -61
- package/build/scripts/generators/config/content.js +0 -1
- package/build/scripts/generators/config/index.d.ts +0 -9
- package/build/scripts/generators/config/index.js +0 -1
- package/build/scripts/generators/pages/index.d.ts +0 -7
- package/build/scripts/generators/pages/index.js +0 -1
- package/build/scripts/generators/pages/info.d.ts +0 -14
- package/build/scripts/generators/pages/info.js +0 -1
- package/build/scripts/generators/theme/index.d.ts +0 -6
- package/build/scripts/generators/theme/index.js +0 -1
- package/build/scripts/generators/types/index.d.ts +0 -19
- package/build/scripts/generators/types/index.js +0 -1
- package/build/scripts/ikas.d.ts +0 -1
- package/build/scripts/theme-build/index.d.ts +0 -3
- package/build/scripts/theme-build/index.js +0 -1
- package/build/utils/fs.d.ts +0 -28
- package/build/utils/fs.js +0 -1
- package/build/utils/helper.d.ts +0 -2
- package/build/utils/helper.js +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
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
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
}
|