@ikas/storefront-next 4.3.0-beta.5 → 4.3.1
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/api/uploadTheme.js +1 -1
- package/package.json +14 -14
package/build/api/uploadTheme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import n from"fs";import r from"path";import s from"archiver";import o from"axios";import i from"@ikas/storefront-assets/checkout/de.js";import c from"@ikas/storefront-assets/checkout/en.js";import a from"@ikas/storefront-assets/checkout/tr.js";import{corsMiddleware as u}from"./middleware.js";var l=function(s,o){return e(void 0,void 0,void 0,(function(){var e,l,f,y,v,S,w,j,b;return t(this,(function(t){switch(t.label){case 0:return[4,u(s,o)];case 1:t.sent(),e=function(){o.statusCode=200,o.setHeader("Content-Type","application/json"),o.json({status:"ok"})},l=function(){o.statusCode=400,o.setHeader("Content-Type","application/json"),o.json({status:"failed"})},f="",t.label=2;case 2:return t.trys.push([2,10,11,12]),[4,new Promise((function(e,t){var s=r.join(process.cwd(),"src","theme.json");n.readFile(s,(function(n,r){if(n)return t(n);e(JSON.parse(r.toString()))}))}))];case 3:return y=t.sent(),[4,new Promise((function(e,t){var s=r.join(process.cwd(),"public","locales"),o=function(e){return e.length?e.split(".")[0]:e};n.readdir(s,(function(u,l){if(u)return t(u);var f=l.filter((function(e){return n.lstatSync(r.join(s,e)).isDirectory()})),p={},d=!1;f.forEach((function(e){var t=r.join(process.cwd(),"public","locales",e);p[e]={};try{var s=n.readdirSync(t);s.forEach((function(t){var s=n.readFileSync(r.join(process.cwd(),"public","locales",e,t)),u=o(e).toLowerCase(),l=o(t);p[u][l]=JSON.parse(s.toString()),p[u]["checkout-page"]="tr"===u?a:"de"===u?i:c}))}catch(e){console.error(e),d=!0}})),d?t(null):e(p)}))}))];case 4:return v=t.sent(),[4,d(y,v)];case 5:return S=t.sent(),w=!1,"string"!=typeof S?[3,9]:[4,p()];case 6:return f=t.sent(),j=n.statSync(f),[4,h(S,n.readFileSync(f),j.size)];case 7:return(w=t.sent())?[4,m()]:[3,9];case 8:w=t.sent(),t.label=9;case 9:return w?e():l(),[3,12];case 10:return b=t.sent(),console.error(b),l(),[3,12];case 11:return f&&function(e){try{n.unlinkSync(e)}catch(e){console.error(e)}}(f),[7];case 12:return[2]}}))}))},f={};function p(){return e(this,void 0,void 0,(function(){var e,o,i,c,a;return t(this,(function(t){switch(t.label){case 0:return e=r.join(process.cwd()),"theme.zip",o=r.join(process.cwd(),"theme.zip"),i=n.createWriteStream(o),(c=s("zip",{zlib:{level:9}})).on("warning",(function(e){if("ENOENT"!==e.code)throw e})),c.on("error",(function(e){throw e})),c.pipe(i),a=["node_modules",".next","out",".git"],n.readdirSync(e).forEach((function(t){var s=r.join(e,t);if(n.lstatSync(s).isDirectory()){if(a.includes(t))return;c.directory(s,t)}else c.file(s,{name:t})})),[4,c.finalize()];case 1:return t.sent(),[2,new Promise((function(e){setTimeout((function(){e(o)}),
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import n from"fs";import r from"path";import s from"archiver";import o from"axios";import i from"@ikas/storefront-assets/checkout/de.js";import c from"@ikas/storefront-assets/checkout/en.js";import a from"@ikas/storefront-assets/checkout/tr.js";import{corsMiddleware as u}from"./middleware.js";var l=function(s,o){return e(void 0,void 0,void 0,(function(){var e,l,f,y,v,S,w,j,b;return t(this,(function(t){switch(t.label){case 0:return[4,u(s,o)];case 1:t.sent(),e=function(){o.statusCode=200,o.setHeader("Content-Type","application/json"),o.json({status:"ok"})},l=function(){o.statusCode=400,o.setHeader("Content-Type","application/json"),o.json({status:"failed"})},f="",t.label=2;case 2:return t.trys.push([2,10,11,12]),[4,new Promise((function(e,t){var s=r.join(process.cwd(),"src","theme.json");n.readFile(s,(function(n,r){if(n)return t(n);e(JSON.parse(r.toString()))}))}))];case 3:return y=t.sent(),[4,new Promise((function(e,t){var s=r.join(process.cwd(),"public","locales"),o=function(e){return e.length?e.split(".")[0]:e};n.readdir(s,(function(u,l){if(u)return t(u);var f=l.filter((function(e){return n.lstatSync(r.join(s,e)).isDirectory()})),p={},d=!1;f.forEach((function(e){var t=r.join(process.cwd(),"public","locales",e);p[e]={};try{var s=n.readdirSync(t);s.forEach((function(t){var s=n.readFileSync(r.join(process.cwd(),"public","locales",e,t)),u=o(e).toLowerCase(),l=o(t);p[u][l]=JSON.parse(s.toString()),p[u]["checkout-page"]="tr"===u?a:"de"===u?i:c}))}catch(e){console.error(e),d=!0}})),d?t(null):e(p)}))}))];case 4:return v=t.sent(),[4,d(y,v)];case 5:return S=t.sent(),w=!1,"string"!=typeof S?[3,9]:[4,p()];case 6:return f=t.sent(),j=n.statSync(f),[4,h(S,n.readFileSync(f),j.size)];case 7:return(w=t.sent())?[4,m()]:[3,9];case 8:w=t.sent(),t.label=9;case 9:return w?e():l(),[3,12];case 10:return b=t.sent(),console.error(b),l(),[3,12];case 11:return f&&function(e){try{n.unlinkSync(e)}catch(e){console.error(e)}}(f),[7];case 12:return[2]}}))}))},f={};function p(){return e(this,void 0,void 0,(function(){var e,o,i,c,a;return t(this,(function(t){switch(t.label){case 0:return e=r.join(process.cwd()),"theme.zip",o=r.join(process.cwd(),"theme.zip"),i=n.createWriteStream(o),(c=s("zip",{zlib:{level:9}})).on("warning",(function(e){if("ENOENT"!==e.code)throw e})),c.on("error",(function(e){throw e})),c.pipe(i),a=["node_modules",".next","out",".git"],n.readdirSync(e).forEach((function(t){var s=r.join(e,t);if(n.lstatSync(s).isDirectory()){if(a.includes(t))return;c.directory(s,t)}else c.file(s,{name:t})})),[4,c.finalize()];case 1:return t.sent(),[2,new Promise((function(e){setTimeout((function(){e(o)}),1e4)}))]}}))}))}function d(n,r){return e(this,void 0,void 0,(function(){var e,s,i,c,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),e=Object.keys(r),s=e.some((function(e){return"en"===e}))?"en":e[0],[4,y()];case 1:return i=t.sent(),[4,o({method:"post",url:process.env.NEXT_PUBLIC_PARTNER_GQL_URL,headers:{"x-api-key":i.apiKey,"Content-Type":"application/json"},data:JSON.stringify({query:"\n mutation createNewThemeVersion($input: CreateNewThemeVersionInput!) {\n createNewThemeVersion(input: $input) {\n themeVersionId\n uploadUrl\n }\n }\n ",variables:{input:{themeId:i.themeId,themeSecret:i.themeSecret,themeJson:JSON.stringify(n),locales:Object.entries(r).map((function(e){var t=e[0],n=e[1];return{isDefaultLocale:t===s,locale:t,localeJson:JSON.stringify(n)}}))}}})})];case 2:return[4,t.sent().data];case 3:return(c=t.sent()).data&&c.data.createNewThemeVersion?[2,c.data.createNewThemeVersion.uploadUrl]:[3,5];case 4:return a=t.sent(),console.log(a),[3,5];case 5:return[2]}}))}))}function h(n,r,s){return e(this,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:e={headers:{"Content-Type":"application/zip","Content-Length":s+""}},t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.put(n,r,e)];case 2:return[2,200===t.sent().status];case 3:return i=t.sent(),console.log(i),[2,!1];case 4:return[2]}}))}))}function m(){return e(this,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),[4,y()];case 1:return e=t.sent(),[4,fetch(process.env.NEXT_PUBLIC_PARTNER_GQL_URL,{method:"POST",body:JSON.stringify({query:"\n mutation buildThemeLatestVersion(\n $themeSecret: String!\n $themeId: String!\n ) {\n buildThemeLatestVersion(\n themeSecret: $themeSecret\n themeId: $themeId\n )\n }\n ",variables:{themeSecret:e.themeSecret,themeId:e.themeId}}),headers:{"x-api-key":e.apiKey,"Content-Type":"application/json"}})];case 2:return[4,t.sent().json()];case 3:return t.sent(),[2,!0];case 4:return n=t.sent(),console.log(n),[2,!1];case 5:return[2]}}))}))}function y(){return new Promise((function(e,t){var s=r.join(process.cwd(),"config.json");n.readFile(s,(function(n,r){if(n)return t(n);e(JSON.parse(r.toString()))}))}))}export{f as config,l as uploadTheme};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-next",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Next.js specific functions for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"next": "12.2.0",
|
|
20
|
-
"@ikas/storefront-config": "^4.3.
|
|
21
|
-
"@ikas/storefront-providers": "^4.3.
|
|
22
|
-
"@ikas/storefront-models": "^4.3.
|
|
23
|
-
"@ikas/storefront-api": "^4.3.
|
|
24
|
-
"@ikas/storefront-assets": "^4.3.
|
|
25
|
-
"axios": "^0.
|
|
20
|
+
"@ikas/storefront-config": "^4.3.1",
|
|
21
|
+
"@ikas/storefront-providers": "^4.3.1",
|
|
22
|
+
"@ikas/storefront-models": "^4.3.1",
|
|
23
|
+
"@ikas/storefront-api": "^4.3.1",
|
|
24
|
+
"@ikas/storefront-assets": "^4.3.1",
|
|
25
|
+
"axios": "^0.26.0",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"archiver": "^5.3.0",
|
|
28
28
|
"cors": "^2.8.5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@ikas/storefront-cmd": "^4.3.
|
|
32
|
-
"@ikas/storefront-config": "^4.3.
|
|
33
|
-
"@ikas/storefront-providers": "^4.3.
|
|
34
|
-
"@ikas/storefront-models": "^4.3.
|
|
35
|
-
"@ikas/storefront-api": "^4.3.
|
|
36
|
-
"@ikas/storefront-assets": "^4.3.
|
|
31
|
+
"@ikas/storefront-cmd": "^4.3.1",
|
|
32
|
+
"@ikas/storefront-config": "^4.3.1",
|
|
33
|
+
"@ikas/storefront-providers": "^4.3.1",
|
|
34
|
+
"@ikas/storefront-models": "^4.3.1",
|
|
35
|
+
"@ikas/storefront-api": "^4.3.1",
|
|
36
|
+
"@ikas/storefront-assets": "^4.3.1",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
38
38
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
39
39
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"typescript": "^4.7.2",
|
|
53
53
|
"ttypescript": "^1.5.12",
|
|
54
54
|
"typescript-transform-paths": "^2.2.2",
|
|
55
|
-
"axios": "^0.
|
|
55
|
+
"axios": "^0.26.0",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
57
|
"archiver": "^5.3.0",
|
|
58
58
|
"cors": "^2.8.5"
|