@ikas/storefront-cmd 4.0.0-alpha.9 → 4.0.0-beta.10

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.
Files changed (44) hide show
  1. package/build/ext/tslib/tslib.es6.js +1 -0
  2. package/build/ikas.cjs +1 -2
  3. package/{src/index.ts → build/index.d.ts} +3 -4
  4. package/build/index.js +1 -0
  5. package/build/scripts/generators/api/index.d.ts +5 -0
  6. package/build/scripts/generators/api/index.js +1 -0
  7. package/build/scripts/generators/api/info.d.ts +12 -0
  8. package/build/scripts/generators/api/info.js +1 -0
  9. package/build/scripts/generators/components/index.d.ts +11 -0
  10. package/build/scripts/generators/components/index.js +1 -0
  11. package/build/scripts/generators/config/content.d.ts +61 -0
  12. package/build/scripts/generators/config/content.js +1 -0
  13. package/build/scripts/generators/config/index.d.ts +9 -0
  14. package/build/scripts/generators/config/index.js +1 -0
  15. package/{src/scripts/generators/index.ts → build/scripts/generators/index.d.ts} +6 -6
  16. package/build/scripts/generators/pages/index.d.ts +7 -0
  17. package/build/scripts/generators/pages/index.js +1 -0
  18. package/build/scripts/generators/pages/info.d.ts +14 -0
  19. package/build/scripts/generators/pages/info.js +1 -0
  20. package/build/scripts/generators/theme/index.d.ts +6 -0
  21. package/build/scripts/generators/theme/index.js +1 -0
  22. package/build/scripts/generators/types/index.d.ts +19 -0
  23. package/build/scripts/generators/types/index.js +1 -0
  24. package/build/scripts/ikas.d.ts +1 -0
  25. package/build/scripts/theme-build/index.d.ts +3 -0
  26. package/build/scripts/theme-build/index.js +1 -0
  27. package/build/utils/fs.d.ts +28 -0
  28. package/build/utils/fs.js +1 -0
  29. package/build/utils/helper.d.ts +2 -0
  30. package/build/utils/helper.js +1 -0
  31. package/package.json +12 -10
  32. package/src/scripts/generators/api/index.ts +0 -27
  33. package/src/scripts/generators/api/info.ts +0 -47
  34. package/src/scripts/generators/components/index.ts +0 -270
  35. package/src/scripts/generators/config/content.ts +0 -168
  36. package/src/scripts/generators/config/index.ts +0 -113
  37. package/src/scripts/generators/pages/index.ts +0 -102
  38. package/src/scripts/generators/pages/info.ts +0 -161
  39. package/src/scripts/generators/theme/index.ts +0 -63
  40. package/src/scripts/generators/types/index.ts +0 -526
  41. package/src/scripts/ikas.ts +0 -45
  42. package/src/scripts/theme-build/index.ts +0 -99
  43. package/src/utils/fs.ts +0 -93
  44. package/src/utils/helper.ts +0 -20
@@ -0,0 +1 @@
1
+ import{__awaiter as n,__generator as e}from'./../../ext/tslib/tslib.es6.js';import t from"lodash/cloneDeep";import"../generators/api/index.js";import{ComponentImportsGenerator as o}from"../generators/components/index.js";import{ConfigGenerator as i}from"../generators/config/index.js";import{PageGenerator as s}from"../generators/pages/index.js";import"../generators/theme/index.js";import{CustomDataTypesGenerator as r}from"../generators/types/index.js";function c(n,e){return!(!n.pages.some((function(n){return!e.pages.find((function(e){return e.id===n.id}))}))&&!e.pages.some((function(e){return!n.pages.find((function(n){return n.id===e.id}))})))||n.pages.some((function(n){var t,o,i=e.pages.find((function(e){return e.id===n.id})),s=n.components;(null===(t=n.specifications)||void 0===t?void 0:t.length)&&n.specifications.forEach((function(n){s.push.apply(s,n.components)}));var r=(null==i?void 0:i.components)||[];(null===(o=null==i?void 0:i.specifications)||void 0===o?void 0:o.length)&&i.specifications.forEach((function(n){r.push.apply(r,n.components)}));var c=s.filter((function(n){return!r.find((function(e){return n.componentId===e.componentId}))})),a=r.filter((function(n){return!s.find((function(e){return n.componentId===e.componentId}))}));return!!c.length||!!a.length}))}function a(c,a){return n(this,void 0,void 0,(function(){var n,p,u,f,m;return e(this,(function(e){switch(e.label){case 0:return n=t(c),(p={components:[],pages:[],customData:[],name:"",settings:{}}).components=n[0].components,p.customData=n[0].customData,n.forEach((function(n){n.pages.forEach((function(n){var e,t,o=p.pages.find((function(e){return e.type===n.type})),i=o||n;(e=i.components).push.apply(e,n.components),i.specifications||(i.specifications=[]),(t=i.specifications).push.apply(t,n.specifications||[]),o||p.pages.push(i)}))})),[4,o.generate(p,a)];case 1:return(m=e.sent())?[4,s.generate(a)]:[3,3];case 2:m=e.sent(),e.label=3;case 3:return(f=m)?[4,r.generate(p,a)]:[3,5];case 4:f=e.sent(),e.label=5;case 5:return(u=f)?[4,i.generate("prod",a)]:[3,7];case 6:u=e.sent(),e.label=7;case 7:return[2,u]}}))}))}export{a as generate,c as shouldDeploy};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Divides the given filePath string into directory part and fileName part
3
+ * @param path Path for the file
4
+ */
5
+ export declare function getFilePathParts(path: string): {
6
+ dirParts: string[];
7
+ filePart: string;
8
+ } | {
9
+ filePart: string;
10
+ dirParts?: undefined;
11
+ };
12
+ /**
13
+ * Deletes the contents of the given directory, exluding the ignoreFiles
14
+ * @param dirPath Path for the directory
15
+ * @param ignoreFiles List of files to keep in directory. Does not accept recursive paths, only first level files
16
+ *
17
+ * @returns true for successfull operation, false otherwise
18
+ */
19
+ export declare function deleteDirContent(dirPath: string, ignoreFiles?: string[]): Promise<boolean>;
20
+ /**
21
+ * Creates the given file and directories for the filePath
22
+ * @param basePath Base directory path for the file
23
+ * @param fileSubPath Filename or the sub directory path for the file to write
24
+ * @param fileStr File contents
25
+ *
26
+ * @returns true for successfull operation, false otherwise
27
+ */
28
+ export declare function createFile(basePath: string, fileSubPath: string, fileStr: string): Promise<boolean>;
@@ -0,0 +1 @@
1
+ import{__awaiter as r,__generator as t,__spreadArray as n}from'./../ext/tslib/tslib.es6.js';import i from"fs";import e from"path";function o(r){var t=r.split("/");return t.length>1?{dirParts:t.slice(0,t.length-1),filePart:t[t.length-1]}:{filePart:r}}function u(n,o){return r(this,void 0,void 0,(function(){return t(this,(function(r){try{return i.readdirSync(n).forEach((function(r){(null==o?void 0:o.includes(r))||i.unlinkSync(e.join(n,r))})),[2,!0]}catch(r){return[2,!1]}return[2]}))}))}function c(u,c,l){var s;return r(this,void 0,void 0,(function(){var r,d,f;return t(this,(function(t){try{return r=u,d=o(c),(null===(s=d.dirParts)||void 0===s?void 0:s.length)&&(r=e.join.apply(e,n([r],d.dirParts,!1))),i.existsSync(r)||i.mkdirSync(r,{recursive:!0}),f=e.join(r,d.filePart),i.writeFileSync(f,l),[2,!0]}catch(r){return console.error(r),[2,!1]}return[2]}))}))}export{c as createFile,u as deleteDirContent,o as getFilePathParts};
@@ -0,0 +1,2 @@
1
+ export declare function sortObject(obj: Record<string, any>): Record<string, any>;
2
+ export declare function findAllByKey(obj: Record<string, any>, keyToFind: string): any;
@@ -0,0 +1 @@
1
+ function t(t){return Object.keys(t).sort().reduce((function(e,n){return e[n]=t[n],e}),{})}function e(t,n){return Object.entries(t||{}).reduce((function(t,r){var c=r[0],o=r[1];return c===n?t.concat(o):"object"==typeof o?t.concat(e(o,n)):t}),[])}export{e as findAllByKey,t as sortObject};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@ikas/storefront-cmd",
3
- "version": "4.0.0-alpha.9",
3
+ "version": "4.0.0-beta.10",
4
4
  "description": "Command line tool for ikas storefront themes.",
5
- "author": "Umut Ozan Yıldırım",
5
+ "author": "ikas",
6
6
  "license": "ISC",
7
- "main": "./src/index.ts",
8
- "module": "./src/index.ts",
7
+ "main": "./build/index.js",
8
+ "module": "./build/index.js",
9
9
  "sideEffects": false,
10
10
  "files": [
11
- "./src"
11
+ "./build"
12
12
  ],
13
13
  "bin": {
14
14
  "ikas": "./build/ikas.cjs"
@@ -20,26 +20,28 @@
20
20
  "test": "echo \"Error: no test specified\" && exit 1"
21
21
  },
22
22
  "dependencies": {
23
- "command-line-args": "^5.2.0",
24
- "lodash": "^4.17.21"
23
+ "command-line-args": "^5.2.0"
25
24
  },
26
25
  "devDependencies": {
27
- "@ikas/storefront-models": "^4.0.0-alpha.9",
26
+ "@ikas/storefront-models": "^4.0.0-beta.10",
28
27
  "@rollup/plugin-commonjs": "^22.0.0",
29
28
  "@rollup/plugin-node-resolve": "^13.3.0",
30
29
  "rollup-plugin-typescript2": "^0.32.1",
31
30
  "rollup-plugin-peer-deps-external": "^2.2.4",
32
31
  "rollup-plugin-terser": "^7.0.2",
33
32
  "rollup-plugin-executable": "^1.6.3",
33
+ "rollup-plugin-rename-node-modules": "^1.2.0",
34
34
  "@types/command-line-args": "^5.2.0",
35
35
  "@types/lodash": "^4.14.182",
36
36
  "@types/node": "^14.14.6",
37
37
  "rollup": "^2.75.6",
38
38
  "ttypescript": "^1.5.12",
39
39
  "typescript": "^4.5.4",
40
- "typescript-transform-paths": "^2.2.2"
40
+ "typescript-transform-paths": "^2.2.2",
41
+ "lodash": "^4.17.21"
41
42
  },
42
43
  "peerDependencies": {
43
- "@ikas/storefront-models": "^4.0.0-alpha.9"
44
+ "lodash": "^4.17.21",
45
+ "@ikas/storefront-models": "^4.0.0-beta.10"
44
46
  }
45
47
  }
@@ -1,27 +0,0 @@
1
- import path from "path";
2
- import { createFile, deleteDirContent } from "../../../utils/fs";
3
-
4
- import { APIInfo, API_INFO } from "./info";
5
-
6
- export class APIGenerator {
7
- static async generate() {
8
- const apiDir = path.join(process.cwd(), "src", "pages", "api");
9
- await deleteDirContent(apiDir);
10
-
11
- let isSuccess = true;
12
-
13
- for (const info of API_INFO) {
14
- isSuccess = isSuccess && (await APIGenerator.generateAPI(info));
15
- }
16
-
17
- return isSuccess;
18
- }
19
-
20
- static generateAPI(apiInfo: APIInfo) {
21
- return createFile(
22
- path.join(process.cwd(), "src", "pages", "api"),
23
- apiInfo.fileName,
24
- apiInfo.content
25
- );
26
- }
27
- }
@@ -1,47 +0,0 @@
1
- export const GET_COMPONENT_DIRS_API_CONTENT = `import { IkasLocalThemeAPI } from "@ikas/storefront-next";
2
-
3
- export default IkasLocalThemeAPI.GetComponentDirs.getComponentDirs;
4
- export const config = IkasLocalThemeAPI.GetComponentDirs.config;
5
- `;
6
-
7
- export const GET_THEME_API_CONTENT = `import { IkasLocalThemeAPI } from "@ikas/storefront-next";
8
-
9
- export default IkasLocalThemeAPI.GetTheme.getTheme;
10
- export const config = IkasLocalThemeAPI.GetTheme.config;
11
- `;
12
-
13
- export const UPDATE_THEME_API_CONTENT = `import { IkasLocalThemeAPI } from "@ikas/storefront-next";
14
-
15
- export default IkasLocalThemeAPI.UpdateTheme.updateTheme;
16
- export const config = IkasLocalThemeAPI.UpdateTheme.config;
17
- `;
18
-
19
- export const UPLOAD_THEME_API_CONTENT = `import { IkasLocalThemeAPI } from "@ikas/storefront-next";
20
-
21
- export default IkasLocalThemeAPI.UploadTheme.uploadTheme;
22
- export const config = IkasLocalThemeAPI.UploadTheme.config;
23
- `;
24
-
25
- export const API_INFO = [
26
- {
27
- content: GET_COMPONENT_DIRS_API_CONTENT,
28
- fileName: "getComponentDirs.ts",
29
- },
30
- {
31
- content: GET_THEME_API_CONTENT,
32
- fileName: "getTheme.ts",
33
- },
34
- {
35
- content: UPDATE_THEME_API_CONTENT,
36
- fileName: "updateTheme.ts",
37
- },
38
- {
39
- content: UPLOAD_THEME_API_CONTENT,
40
- fileName: "uploadTheme.ts",
41
- },
42
- ];
43
-
44
- export type APIInfo = {
45
- content: string;
46
- fileName: string;
47
- };
@@ -1,270 +0,0 @@
1
- import path from "path";
2
- import { createFile, deleteDirContent } from "../../../utils/fs";
3
- import {
4
- IkasThemeJson,
5
- IkasThemeJsonComponent,
6
- IkasThemeJsonPageType,
7
- } from "@ikas/storefront-models";
8
- import { CHECKOUT_COMPONENT_ID, PageInfo, PAGE_INFO } from "../pages/info";
9
- import { findAllByKey } from "../../../utils/helper";
10
-
11
- export class ComponentImportsGenerator {
12
- static async generate(themeJson: IkasThemeJson, workingDir?: string) {
13
- await deleteDirContent(
14
- path.join(
15
- workingDir || process.cwd(),
16
- "src",
17
- "components",
18
- "__generated__"
19
- )
20
- );
21
-
22
- return (
23
- (await ComponentImportsGenerator.generateAllPageComponentImportsFiles(
24
- themeJson,
25
- workingDir
26
- )) &&
27
- (await ComponentImportsGenerator.generateAllComponentImportsFileForEditor(
28
- themeJson,
29
- workingDir
30
- ))
31
- );
32
- }
33
-
34
- static async generateAllPageComponentImportsFiles(
35
- themeJson: IkasThemeJson,
36
- workingDir?: string
37
- ) {
38
- let isSuccess = true;
39
-
40
- for (const pageInfo of PAGE_INFO) {
41
- // const themeHasPage = themeJson.pages.some((page) =>
42
- // pageInfo.pageTypes.includes(page.type)
43
- // );
44
- // if (themeHasPage) {
45
- // }
46
- isSuccess =
47
- isSuccess &&
48
- (await ComponentImportsGenerator.generatePageComponentImportsFileWithInfo(
49
- pageInfo,
50
- themeJson,
51
- workingDir
52
- ));
53
- }
54
-
55
- return isSuccess;
56
- }
57
-
58
- static async generatePageComponentImportsFileWithInfo(
59
- pageInfo: PageInfo,
60
- themeJson: IkasThemeJson,
61
- workingDir?: string
62
- ) {
63
- if (pageInfo.isCheckout || pageInfo.isEditor) return true;
64
-
65
- try {
66
- const components = themeJson.components;
67
- const componentIds: string[] = [];
68
-
69
- pageInfo.pageTypes.forEach((pageType) => {
70
- const pages = themeJson.pages.filter((page) => page.type === pageType);
71
-
72
- if (pages.length) {
73
- pages.forEach((page) => {
74
- const allPageComponents = page.components;
75
- if (page.specifications?.length) {
76
- page.specifications.forEach((specification) => {
77
- allPageComponents.push(...specification.components);
78
- });
79
- }
80
-
81
- componentIds.push(...allPageComponents.map((c) => c.componentId));
82
-
83
- allPageComponents.forEach((pageComponent) => {
84
- const component = components.find(
85
- (c) => c.id === pageComponent.componentId
86
- );
87
- if (!component) return;
88
-
89
- const nestedComponentIds = findAllByKey(
90
- pageComponent.propValues,
91
- "componentId"
92
- ) as Array<any>;
93
-
94
- componentIds.push(...nestedComponentIds);
95
- });
96
- });
97
- }
98
- });
99
-
100
- const componentsInPage = components.filter(
101
- (c) => componentIds.includes(c.id) && c.id !== CHECKOUT_COMPONENT_ID
102
- );
103
-
104
- return await ComponentImportsGenerator.generateComponentImportsFile(
105
- componentsInPage,
106
- pageInfo,
107
- workingDir
108
- );
109
- } catch (err) {
110
- console.error(err);
111
- return false;
112
- }
113
- }
114
-
115
- static generatePageComponentImportsFileWithType(
116
- pageType: IkasThemeJsonPageType,
117
- themeJson: IkasThemeJson,
118
- workingDir?: string
119
- ) {
120
- if (pageType === IkasThemeJsonPageType.CHECKOUT) return;
121
-
122
- try {
123
- const pageInfo = PAGE_INFO.find((pi) => pi.pageTypes.includes(pageType));
124
- if (pageInfo) {
125
- return ComponentImportsGenerator.generatePageComponentImportsFileWithInfo(
126
- pageInfo,
127
- themeJson,
128
- workingDir
129
- );
130
- }
131
- } catch (err) {
132
- console.error(err);
133
- }
134
-
135
- return false;
136
- }
137
-
138
- static generateComponentImportsFile(
139
- components: IkasThemeJsonComponent[],
140
- pageInfo: PageInfo,
141
- workingDir?: string
142
- ) {
143
- try {
144
- let fileStr = "";
145
-
146
- components
147
- .filter((c: any) => c.id !== "checkout")
148
- .forEach((component: any, index: number) => {
149
- fileStr += `import Component${index} from "src/components/${component.dir}";\r\n`;
150
- });
151
-
152
- fileStr += `
153
- const Components = {
154
- ${components.map(
155
- (component: any, index: number) => `"${component.id}": Component${index}`
156
- )}
157
- };
158
- `;
159
-
160
- fileStr += "\r\n";
161
- fileStr += "export default Components;";
162
-
163
- return createFile(
164
- path.join(
165
- workingDir || process.cwd(),
166
- "src",
167
- "components",
168
- "__generated__",
169
- "pages"
170
- ),
171
- pageInfo.path.replace("tsx", "ts"),
172
- fileStr
173
- );
174
- } catch (err) {
175
- console.error(err);
176
- return false;
177
- }
178
- }
179
-
180
- static async generateAllComponentImportsFileForEditor(
181
- themeJson: IkasThemeJson,
182
- workingDir?: string
183
- ) {
184
- try {
185
- let fileStr = `import dynamic from "next/dynamic";\r\n`;
186
- fileStr += `import { IkasEditorComponentLoader } from "@ikas/storefront";\r\n`;
187
- fileStr += "\r\n";
188
- fileStr += "\r\n";
189
-
190
- const components = themeJson.components.filter(
191
- (tc: any) => tc.id !== "checkout"
192
- );
193
-
194
- // Component imports
195
- components
196
- .filter((c: any) => c.id !== "checkout")
197
- .forEach((component: any, index: number) => {
198
- fileStr += `const Component${index} = dynamic(() => import("../${component.dir}"), { loading: () => <IkasEditorComponentLoader /> });\r\n`;
199
- });
200
-
201
- fileStr += "\r\n";
202
- fileStr += `
203
- const Components = {
204
- ${components.map(
205
- (component: any, index: number) => `"${component.id}": Component${index}`
206
- )}
207
- };
208
- `;
209
-
210
- fileStr += "\r\n";
211
- fileStr += "export default Components;";
212
-
213
- const generatedFolderPath = path.join(
214
- workingDir || process.cwd(),
215
- "src",
216
- "components",
217
- "__generated__"
218
- );
219
-
220
- return await createFile(generatedFolderPath, "editor.tsx", fileStr);
221
- } catch (err) {
222
- console.error(err);
223
- return false;
224
- }
225
- }
226
-
227
- static async generateAllComponentImportsFile(
228
- themeJson: IkasThemeJson,
229
- workingDir?: string
230
- ) {
231
- try {
232
- let fileStr = ``;
233
-
234
- const components = themeJson.components.filter(
235
- (tc: any) => tc.id !== "checkout"
236
- );
237
-
238
- // Component imports
239
- components
240
- .filter((c: any) => c.id !== "checkout")
241
- .forEach((component: any, index: number) => {
242
- fileStr += `import Component${index} from "../${component.dir}";\r\n`;
243
- });
244
-
245
- fileStr += "\r\n";
246
- fileStr += `
247
- const Components = {
248
- ${components.map(
249
- (component: any, index: number) => `"${component.id}": Component${index}`
250
- )}
251
- };
252
- `;
253
-
254
- fileStr += "\r\n";
255
- fileStr += "export default Components;";
256
-
257
- const generatedFolderPath = path.join(
258
- workingDir || process.cwd(),
259
- "src",
260
- "components",
261
- "__generated__"
262
- );
263
-
264
- return await createFile(generatedFolderPath, "index.tsx", fileStr);
265
- } catch (err) {
266
- console.error(err);
267
- return false;
268
- }
269
- }
270
- }
@@ -1,168 +0,0 @@
1
- export const DEPENDENCIES = {
2
- next: "canary",
3
- react: "17.0.2",
4
- "react-dom": "17.0.2",
5
- mobx: "^6.1.3",
6
- axios: "^0.26.0",
7
- lodash: "^4.17.20",
8
- archiver: "^5.3.0",
9
- cors: "^2.8.5",
10
- "html-react-parser": "^1.4.0",
11
- "mobx-react-lite": "^3.1.5",
12
- "next-transpile-modules": "^9.0.0",
13
- "@ikas/storefront": "^4.0.0-alpha.7",
14
- "@ikas/storefront-api": "^4.0.0-alpha.7",
15
- "@ikas/storefront-assets": "^4.0.0-alpha.7",
16
- "@ikas/storefront-cmd": "^4.0.0-alpha.7",
17
- "@ikas/storefront-config": "^4.0.0-alpha.7",
18
- "@ikas/storefront-model-functions": "^4.0.0-alpha.7",
19
- "@ikas/storefront-models": "^4.0.0-alpha.7",
20
- "@ikas/storefront-next": "^4.0.0-alpha.7",
21
- "@ikas/storefront-providers": "^4.0.0-alpha.7",
22
- };
23
-
24
- export const DEV_DEPENDENCIES = {
25
- "@types/node": "^14.14.6",
26
- "@types/react": "^17.0.2",
27
- "@types/react-dom": "^17.0.2",
28
- "@typescript-eslint/eslint-plugin": "^2.10.0",
29
- "@typescript-eslint/parser": "^2.10.0",
30
- eslint: "^6.6.0",
31
- "eslint-config-react-app": "^5.2.1",
32
- "eslint-loader": "3.0.3",
33
- "eslint-plugin-flowtype": "4.6.0",
34
- "eslint-plugin-import": "2.20.1",
35
- "eslint-plugin-jsx-a11y": "6.2.3",
36
- "eslint-plugin-react": "7.19.0",
37
- "eslint-plugin-react-hooks": "^1.6.1",
38
- sass: "^1.43.4",
39
- typescript: "^4.5.2",
40
- };
41
-
42
- export const RESOLUTIONS = {
43
- "@types/react": "17.0.2",
44
- "@types/react-dom": "17.0.2",
45
- };
46
-
47
- export const SCRIPTS = {
48
- upgradeDependencies:
49
- "yarn upgrade @ikas/storefront @ikas/storefront-api @ikas/storefront-assets @ikas/storefront-cmd @ikas/storefront-config @ikas/storefront-model-functions @ikas/storefront-models @ikas/storefront-next @ikas/storefront-providers",
50
- dev: "next dev -p 3333",
51
- build: "next build",
52
- start: "next start",
53
- generate: "ikas --generate",
54
- "prettier:all": "npx prettier@^2.1 './**/src/**/*.(ts|tsx|css|scss)' --write",
55
- };
56
-
57
- export const TS_CONFIG = `{
58
- "compilerOptions": {
59
- "target": "esnext",
60
- "lib": [
61
- "dom",
62
- "dom.iterable",
63
- "esnext"
64
- ],
65
- "allowJs": true,
66
- "skipLibCheck": true,
67
- "strict": true,
68
- "forceConsistentCasingInFileNames": true,
69
- "experimentalDecorators": true,
70
- "noEmit": true,
71
- "esModuleInterop": true,
72
- "module": "esnext",
73
- "moduleResolution": "node",
74
- "resolveJsonModule": true,
75
- "isolatedModules": true,
76
- "jsx": "preserve",
77
- "baseUrl": ".",
78
- "useUnknownInCatchVariables": false,
79
- "incremental": true
80
- },
81
- "typeRoots": [
82
- "./node_modules/@types"
83
- ],
84
- "include": [
85
- "next-env.d.ts",
86
- "**/*.ts",
87
- "**/*.tsx",
88
- "**/typings/global.d.ts",
89
- ],
90
- "exclude": [
91
- "node_modules",
92
- "./src/pages/api",
93
- ]
94
- }`;
95
-
96
- export const NEXT_CONFIG = `const withTM = require("next-transpile-modules")([
97
- "@ikas/storefront",
98
- "@ikas/storefront-api",
99
- "@ikas/storefront-assets",
100
- "@ikas/storefront-cmd",
101
- "@ikas/storefront-config",
102
- "@ikas/storefront-model-functions",
103
- "@ikas/storefront-models",
104
- "@ikas/storefront-next",
105
- "@ikas/storefront-providers",
106
- ]);
107
-
108
- const config = {
109
- i18n: {
110
- defaultLocale: "en",
111
- locales: ["en"],
112
- localeDetection: false,
113
- },
114
- basePath: process.env.NEXTJS_BASE_PATH || "",
115
-
116
- images: {
117
- deviceSizes: [
118
- 180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 1950, 2560, 3840,
119
- ],
120
- },
121
-
122
- webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
123
- if (!isServer) {
124
- config.resolve.fallback.fs = false;
125
- config.resolve.fallback.net = false;
126
- config.resolve.fallback.encoding = false;
127
- config.resolve.fallback.crypto = false;
128
- config.resolve.fallback.assert = false;
129
- config.resolve.fallback.stream = false;
130
- config.module.rules = [
131
- ...config.module.rules,
132
- {
133
- test: /@ikas/i,
134
- sideEffects: false,
135
- },
136
- ];
137
- }
138
- return config;
139
- },
140
- };
141
-
142
- module.exports = withTM(config);`;
143
-
144
- export const DEV_ENV = `NEXT_PUBLIC_ENV=local
145
- NEXT_PUBLIC_BASE_URL=https://api.myikas.dev/api/sf
146
- NEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.dev/
147
- NEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.dev/api/admin/graphql
148
- NEXT_PUBLIC_GQL_URL=https://api.myikas.dev/api/sf/graphql
149
- `;
150
-
151
- export const PROD_ENV = `NEXT_PUBLIC_ENV=local
152
- NEXT_PUBLIC_BASE_URL=https://api.myikas.com/api/sf
153
- NEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.com/
154
- NEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.com/api/admin/graphql
155
- NEXT_PUBLIC_GQL_URL=https://api.myikas.com/api/sf/graphql
156
- `;
157
-
158
- export const BABEL_RC = `{
159
- "presets": [
160
- [
161
- "next/babel",
162
- {
163
- "preset-react": { "throwIfNamespace": false },
164
- }
165
- ]
166
- ],
167
- "plugins": []
168
- }`;