@commercetools-frontend/mc-scripts 21.23.10 → 21.24.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/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +120 -326
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +120 -326
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +116 -321
- package/dist/build-980cf2c9.cjs.prod.js +170 -0
- package/dist/build-c9601b07.esm.js +156 -0
- package/dist/build-e8a49b56.cjs.dev.js +170 -0
- package/dist/build-vite-b531d3d3.esm.js +118 -0
- package/dist/build-vite-c40a55c3.cjs.dev.js +129 -0
- package/dist/build-vite-d17432ec.cjs.prod.js +129 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +2 -2
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +2 -2
- package/dist/commercetools-frontend-mc-scripts.esm.js +2 -2
- package/dist/compile-html-41195e35.cjs.dev.js +49 -0
- package/dist/compile-html-5abd78aa.cjs.prod.js +49 -0
- package/dist/compile-html-f9de842c.esm.js +40 -0
- package/dist/config-sync-0ecc13b3.cjs.dev.js +783 -0
- package/dist/config-sync-4b1ddec3.esm.js +759 -0
- package/dist/config-sync-bb59a82d.cjs.prod.js +778 -0
- package/dist/{create-postcss-config-f65c7e31.cjs.dev.js → create-postcss-config-5cc679d5.cjs.dev.js} +9 -14
- package/dist/{create-postcss-config-06b2e5c2.esm.js → create-postcss-config-a0d4cffa.esm.js} +9 -13
- package/dist/{create-postcss-config-787d905f.cjs.prod.js → create-postcss-config-f94c07fd.cjs.prod.js} +9 -14
- package/dist/{create-webpack-config-for-development-fd365d6a.esm.js → create-webpack-config-for-development-95334073.esm.js} +21 -25
- package/dist/{create-webpack-config-for-development-d46ef148.cjs.dev.js → create-webpack-config-for-development-a53bab71.cjs.dev.js} +24 -28
- package/dist/{create-webpack-config-for-development-59faaed8.cjs.prod.js → create-webpack-config-for-development-c915ec0c.cjs.prod.js} +24 -28
- package/dist/{create-webpack-config-for-production-b28b3d33.esm.js → create-webpack-config-for-production-342485cd.esm.js} +18 -21
- package/dist/{create-webpack-config-for-production-1af3a454.cjs.prod.js → create-webpack-config-for-production-af6f3138.cjs.prod.js} +20 -23
- package/dist/{create-webpack-config-for-production-e12e3c30.cjs.dev.js → create-webpack-config-for-production-db45d9ab.cjs.dev.js} +20 -23
- package/dist/{user-agent-9a470e39.cjs.dev.js → credentials-storage-a37a8915.cjs.dev.js} +24 -24
- package/dist/{user-agent-6e8d0e0b.cjs.prod.js → credentials-storage-b803a804.cjs.prod.js} +24 -24
- package/dist/{user-agent-4b60934e.esm.js → credentials-storage-cb88e8fc.esm.js} +22 -22
- package/dist/declarations/src/deprecated-entry-points.d.ts +1 -1
- package/dist/login-35040a86.cjs.dev.js +93 -0
- package/dist/login-6e17747d.esm.js +84 -0
- package/dist/login-90736d7e.cjs.prod.js +93 -0
- package/dist/{package-a5454c97.esm.js → package-17f18481.esm.js} +17 -16
- package/dist/{package-e2d9b5e0.cjs.dev.js → package-c42dc2ac.cjs.dev.js} +17 -16
- package/dist/{package-808a31f1.cjs.prod.js → package-db15171f.cjs.prod.js} +17 -16
- package/dist/{paths-76b66e74.cjs.prod.js → paths-284c77fb.cjs.prod.js} +6 -8
- package/dist/{paths-ed23d5a1.esm.js → paths-55c5d5a2.esm.js} +6 -8
- package/dist/{paths-16823f56.cjs.dev.js → paths-db35ac0f.cjs.dev.js} +6 -8
- package/dist/serve-41077dad.cjs.prod.js +48 -0
- package/dist/serve-660e2ee0.esm.js +41 -0
- package/dist/serve-b8063204.cjs.dev.js +48 -0
- package/dist/start-0aa71e9a.esm.js +166 -0
- package/dist/start-2e7ec87c.cjs.dev.js +180 -0
- package/dist/start-c0ffe8d7.cjs.prod.js +180 -0
- package/dist/start-vite-324af14d.cjs.prod.js +119 -0
- package/dist/start-vite-7d10ae71.esm.js +107 -0
- package/dist/start-vite-8f03b0df.cjs.dev.js +119 -0
- package/dist/{vendors-to-transpile-367e0ba8.cjs.prod.js → vendors-to-transpile-04a49d40.cjs.prod.js} +1 -1
- package/dist/{vendors-to-transpile-b51af5d3.cjs.dev.js → vendors-to-transpile-6ab4ea06.cjs.dev.js} +1 -1
- package/dist/{vendors-to-transpile-68e03526.esm.js → vendors-to-transpile-7dc84a72.esm.js} +1 -1
- package/dist/vite-plugin-svgr-9a4e7f77.cjs.prod.js +79 -0
- package/dist/vite-plugin-svgr-f17db78a.esm.js +55 -0
- package/dist/vite-plugin-svgr-fdb37ccf.cjs.dev.js +79 -0
- package/package.json +17 -16
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -4
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -4
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -4
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +12 -13
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +12 -13
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +12 -13
- package/dist/build-0e6d74d1.esm.js +0 -209
- package/dist/build-9074fc85.cjs.dev.js +0 -224
- package/dist/build-ae132901.cjs.prod.js +0 -224
- package/dist/build-vite-482a21b8.cjs.dev.js +0 -151
- package/dist/build-vite-cc68e3bf.esm.js +0 -139
- package/dist/build-vite-f095b68d.cjs.prod.js +0 -151
- package/dist/compile-html-4361a0b3.esm.js +0 -77
- package/dist/compile-html-d6331c35.cjs.prod.js +0 -87
- package/dist/compile-html-d9e731aa.cjs.dev.js +0 -87
- package/dist/config-sync-2a9945bc.cjs.dev.js +0 -989
- package/dist/config-sync-43a80f60.cjs.prod.js +0 -984
- package/dist/config-sync-c6c4d1cf.esm.js +0 -964
- package/dist/login-7f1cc8d0.cjs.prod.js +0 -167
- package/dist/login-d21a49e8.esm.js +0 -157
- package/dist/login-ed827138.cjs.dev.js +0 -167
- package/dist/serve-12de323b.cjs.dev.js +0 -70
- package/dist/serve-784f4fcd.cjs.prod.js +0 -70
- package/dist/serve-d6b437b1.esm.js +0 -62
- package/dist/start-10a4d95a.esm.js +0 -194
- package/dist/start-d021fa98.cjs.prod.js +0 -209
- package/dist/start-eea524f2.cjs.dev.js +0 -209
- package/dist/start-vite-57ec5175.cjs.dev.js +0 -146
- package/dist/start-vite-94c2db8c.esm.js +0 -133
- package/dist/start-vite-fc0b15d3.cjs.prod.js +0 -146
- package/dist/vite-plugin-svgr-4205f2b5.cjs.dev.js +0 -110
- package/dist/vite-plugin-svgr-eb8524fa.esm.js +0 -85
- package/dist/vite-plugin-svgr-f3bbedbe.cjs.prod.js +0 -110
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
-
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
-
var prompts = require('prompts');
|
|
6
|
-
var chalk = require('chalk');
|
|
7
|
-
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
8
|
-
var userAgent = require('./user-agent-6e8d0e0b.cjs.prod.js');
|
|
9
|
-
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
10
|
-
var fetch = require('node-fetch');
|
|
11
|
-
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
12
|
-
require('@babel/runtime-corejs3/helpers/createClass');
|
|
13
|
-
require('@babel/runtime-corejs3/core-js-stable/date/now');
|
|
14
|
-
require('fs');
|
|
15
|
-
require('path');
|
|
16
|
-
require('os');
|
|
17
|
-
require('@commercetools/http-user-agent');
|
|
18
|
-
require('./package-808a31f1.cjs.prod.js');
|
|
19
|
-
|
|
20
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
21
|
-
|
|
22
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
23
|
-
var prompts__default = /*#__PURE__*/_interopDefault(prompts);
|
|
24
|
-
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
25
|
-
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
26
|
-
var fetch__default = /*#__PURE__*/_interopDefault(fetch);
|
|
27
|
-
|
|
28
|
-
var getAuthToken = /*#__PURE__*/function () {
|
|
29
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(mcApiUrl, payload) {
|
|
30
|
-
var response, text, parsed, errorMessage, authToken;
|
|
31
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
32
|
-
while (1) {
|
|
33
|
-
switch (_context.prev = _context.next) {
|
|
34
|
-
case 0:
|
|
35
|
-
_context.next = 2;
|
|
36
|
-
return fetch__default["default"]("".concat(mcApiUrl, "/tokens/cli"), {
|
|
37
|
-
method: 'POST',
|
|
38
|
-
headers: {
|
|
39
|
-
Accept: 'application/json',
|
|
40
|
-
'Content-Type': 'application/json',
|
|
41
|
-
'x-user-agent': userAgent.userAgent
|
|
42
|
-
},
|
|
43
|
-
body: _JSON$stringify__default["default"](payload)
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
case 2:
|
|
47
|
-
response = _context.sent;
|
|
48
|
-
|
|
49
|
-
if (response.ok) {
|
|
50
|
-
_context.next = 10;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
_context.next = 6;
|
|
55
|
-
return response.text();
|
|
56
|
-
|
|
57
|
-
case 6:
|
|
58
|
-
text = _context.sent;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
parsed = JSON.parse(text);
|
|
62
|
-
} catch (error) {}
|
|
63
|
-
|
|
64
|
-
errorMessage = parsed ? parsed.message : text;
|
|
65
|
-
throw new Error(errorMessage);
|
|
66
|
-
|
|
67
|
-
case 10:
|
|
68
|
-
_context.next = 12;
|
|
69
|
-
return response.json();
|
|
70
|
-
|
|
71
|
-
case 12:
|
|
72
|
-
authToken = _context.sent;
|
|
73
|
-
return _context.abrupt("return", authToken);
|
|
74
|
-
|
|
75
|
-
case 14:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, _callee);
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
return function getAuthToken(_x, _x2) {
|
|
84
|
-
return _ref.apply(this, arguments);
|
|
85
|
-
};
|
|
86
|
-
}();
|
|
87
|
-
|
|
88
|
-
var credentialsStorage = new userAgent.CredentialsStorage();
|
|
89
|
-
|
|
90
|
-
function run() {
|
|
91
|
-
return _run.apply(this, arguments);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function _run() {
|
|
95
|
-
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
96
|
-
var applicationConfig$1, mcApiUrl, _yield$prompts, email, _yield$prompts2, password, credentials;
|
|
97
|
-
|
|
98
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
99
|
-
while (1) {
|
|
100
|
-
switch (_context.prev = _context.next) {
|
|
101
|
-
case 0:
|
|
102
|
-
applicationConfig$1 = applicationConfig.processConfig();
|
|
103
|
-
mcApiUrl = applicationConfig$1.env.mcApiUrl;
|
|
104
|
-
console.log("Using Merchant Center environment \"".concat(chalk__default["default"].green(mcApiUrl), "\"."));
|
|
105
|
-
console.log();
|
|
106
|
-
|
|
107
|
-
if (!credentialsStorage.isSessionValid(mcApiUrl)) {
|
|
108
|
-
_context.next = 7;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
console.log("You already have a valid session.");
|
|
113
|
-
return _context.abrupt("return");
|
|
114
|
-
|
|
115
|
-
case 7:
|
|
116
|
-
console.log("Enter the login credentials:");
|
|
117
|
-
_context.next = 10;
|
|
118
|
-
return prompts__default["default"]({
|
|
119
|
-
type: 'text',
|
|
120
|
-
name: 'email',
|
|
121
|
-
message: 'Email'
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
case 10:
|
|
125
|
-
_yield$prompts = _context.sent;
|
|
126
|
-
email = _yield$prompts.email;
|
|
127
|
-
_context.next = 14;
|
|
128
|
-
return prompts__default["default"]({
|
|
129
|
-
type: 'invisible',
|
|
130
|
-
name: 'password',
|
|
131
|
-
message: 'Password (hidden)'
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
case 14:
|
|
135
|
-
_yield$prompts2 = _context.sent;
|
|
136
|
-
password = _yield$prompts2.password;
|
|
137
|
-
|
|
138
|
-
if (!(!email || !password)) {
|
|
139
|
-
_context.next = 18;
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
throw new Error("Missing email or password values. Aborting.");
|
|
144
|
-
|
|
145
|
-
case 18:
|
|
146
|
-
_context.next = 20;
|
|
147
|
-
return getAuthToken(mcApiUrl, {
|
|
148
|
-
email: email,
|
|
149
|
-
password: password
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
case 20:
|
|
153
|
-
credentials = _context.sent;
|
|
154
|
-
credentialsStorage.setToken(mcApiUrl, credentials);
|
|
155
|
-
console.log(chalk__default["default"].green("Login successful.\n"));
|
|
156
|
-
|
|
157
|
-
case 23:
|
|
158
|
-
case "end":
|
|
159
|
-
return _context.stop();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}, _callee);
|
|
163
|
-
}));
|
|
164
|
-
return _run.apply(this, arguments);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
exports["default"] = run;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
|
|
2
|
-
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
3
|
-
import prompts from 'prompts';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import { processConfig } from '@commercetools-frontend/application-config';
|
|
6
|
-
import { u as userAgent, C as CredentialsStorage } from './user-agent-4b60934e.esm.js';
|
|
7
|
-
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
8
|
-
import fetch from 'node-fetch';
|
|
9
|
-
import '@babel/runtime-corejs3/helpers/classCallCheck';
|
|
10
|
-
import '@babel/runtime-corejs3/helpers/createClass';
|
|
11
|
-
import '@babel/runtime-corejs3/core-js-stable/date/now';
|
|
12
|
-
import 'fs';
|
|
13
|
-
import 'path';
|
|
14
|
-
import 'os';
|
|
15
|
-
import '@commercetools/http-user-agent';
|
|
16
|
-
import './package-a5454c97.esm.js';
|
|
17
|
-
|
|
18
|
-
var getAuthToken = /*#__PURE__*/function () {
|
|
19
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mcApiUrl, payload) {
|
|
20
|
-
var response, text, parsed, errorMessage, authToken;
|
|
21
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
|
-
while (1) {
|
|
23
|
-
switch (_context.prev = _context.next) {
|
|
24
|
-
case 0:
|
|
25
|
-
_context.next = 2;
|
|
26
|
-
return fetch("".concat(mcApiUrl, "/tokens/cli"), {
|
|
27
|
-
method: 'POST',
|
|
28
|
-
headers: {
|
|
29
|
-
Accept: 'application/json',
|
|
30
|
-
'Content-Type': 'application/json',
|
|
31
|
-
'x-user-agent': userAgent
|
|
32
|
-
},
|
|
33
|
-
body: _JSON$stringify(payload)
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
case 2:
|
|
37
|
-
response = _context.sent;
|
|
38
|
-
|
|
39
|
-
if (response.ok) {
|
|
40
|
-
_context.next = 10;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
_context.next = 6;
|
|
45
|
-
return response.text();
|
|
46
|
-
|
|
47
|
-
case 6:
|
|
48
|
-
text = _context.sent;
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
parsed = JSON.parse(text);
|
|
52
|
-
} catch (error) {}
|
|
53
|
-
|
|
54
|
-
errorMessage = parsed ? parsed.message : text;
|
|
55
|
-
throw new Error(errorMessage);
|
|
56
|
-
|
|
57
|
-
case 10:
|
|
58
|
-
_context.next = 12;
|
|
59
|
-
return response.json();
|
|
60
|
-
|
|
61
|
-
case 12:
|
|
62
|
-
authToken = _context.sent;
|
|
63
|
-
return _context.abrupt("return", authToken);
|
|
64
|
-
|
|
65
|
-
case 14:
|
|
66
|
-
case "end":
|
|
67
|
-
return _context.stop();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}, _callee);
|
|
71
|
-
}));
|
|
72
|
-
|
|
73
|
-
return function getAuthToken(_x, _x2) {
|
|
74
|
-
return _ref.apply(this, arguments);
|
|
75
|
-
};
|
|
76
|
-
}();
|
|
77
|
-
|
|
78
|
-
var credentialsStorage = new CredentialsStorage();
|
|
79
|
-
|
|
80
|
-
function run() {
|
|
81
|
-
return _run.apply(this, arguments);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function _run() {
|
|
85
|
-
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
86
|
-
var applicationConfig, mcApiUrl, _yield$prompts, email, _yield$prompts2, password, credentials;
|
|
87
|
-
|
|
88
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
89
|
-
while (1) {
|
|
90
|
-
switch (_context.prev = _context.next) {
|
|
91
|
-
case 0:
|
|
92
|
-
applicationConfig = processConfig();
|
|
93
|
-
mcApiUrl = applicationConfig.env.mcApiUrl;
|
|
94
|
-
console.log("Using Merchant Center environment \"".concat(chalk.green(mcApiUrl), "\"."));
|
|
95
|
-
console.log();
|
|
96
|
-
|
|
97
|
-
if (!credentialsStorage.isSessionValid(mcApiUrl)) {
|
|
98
|
-
_context.next = 7;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
console.log("You already have a valid session.");
|
|
103
|
-
return _context.abrupt("return");
|
|
104
|
-
|
|
105
|
-
case 7:
|
|
106
|
-
console.log("Enter the login credentials:");
|
|
107
|
-
_context.next = 10;
|
|
108
|
-
return prompts({
|
|
109
|
-
type: 'text',
|
|
110
|
-
name: 'email',
|
|
111
|
-
message: 'Email'
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
case 10:
|
|
115
|
-
_yield$prompts = _context.sent;
|
|
116
|
-
email = _yield$prompts.email;
|
|
117
|
-
_context.next = 14;
|
|
118
|
-
return prompts({
|
|
119
|
-
type: 'invisible',
|
|
120
|
-
name: 'password',
|
|
121
|
-
message: 'Password (hidden)'
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
case 14:
|
|
125
|
-
_yield$prompts2 = _context.sent;
|
|
126
|
-
password = _yield$prompts2.password;
|
|
127
|
-
|
|
128
|
-
if (!(!email || !password)) {
|
|
129
|
-
_context.next = 18;
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
throw new Error("Missing email or password values. Aborting.");
|
|
134
|
-
|
|
135
|
-
case 18:
|
|
136
|
-
_context.next = 20;
|
|
137
|
-
return getAuthToken(mcApiUrl, {
|
|
138
|
-
email: email,
|
|
139
|
-
password: password
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
case 20:
|
|
143
|
-
credentials = _context.sent;
|
|
144
|
-
credentialsStorage.setToken(mcApiUrl, credentials);
|
|
145
|
-
console.log(chalk.green("Login successful.\n"));
|
|
146
|
-
|
|
147
|
-
case 23:
|
|
148
|
-
case "end":
|
|
149
|
-
return _context.stop();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}, _callee);
|
|
153
|
-
}));
|
|
154
|
-
return _run.apply(this, arguments);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export { run as default };
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
-
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
-
var prompts = require('prompts');
|
|
6
|
-
var chalk = require('chalk');
|
|
7
|
-
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
8
|
-
var userAgent = require('./user-agent-9a470e39.cjs.dev.js');
|
|
9
|
-
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
10
|
-
var fetch = require('node-fetch');
|
|
11
|
-
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
12
|
-
require('@babel/runtime-corejs3/helpers/createClass');
|
|
13
|
-
require('@babel/runtime-corejs3/core-js-stable/date/now');
|
|
14
|
-
require('fs');
|
|
15
|
-
require('path');
|
|
16
|
-
require('os');
|
|
17
|
-
require('@commercetools/http-user-agent');
|
|
18
|
-
require('./package-e2d9b5e0.cjs.dev.js');
|
|
19
|
-
|
|
20
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
21
|
-
|
|
22
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
23
|
-
var prompts__default = /*#__PURE__*/_interopDefault(prompts);
|
|
24
|
-
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
25
|
-
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
26
|
-
var fetch__default = /*#__PURE__*/_interopDefault(fetch);
|
|
27
|
-
|
|
28
|
-
var getAuthToken = /*#__PURE__*/function () {
|
|
29
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(mcApiUrl, payload) {
|
|
30
|
-
var response, text, parsed, errorMessage, authToken;
|
|
31
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
32
|
-
while (1) {
|
|
33
|
-
switch (_context.prev = _context.next) {
|
|
34
|
-
case 0:
|
|
35
|
-
_context.next = 2;
|
|
36
|
-
return fetch__default["default"]("".concat(mcApiUrl, "/tokens/cli"), {
|
|
37
|
-
method: 'POST',
|
|
38
|
-
headers: {
|
|
39
|
-
Accept: 'application/json',
|
|
40
|
-
'Content-Type': 'application/json',
|
|
41
|
-
'x-user-agent': userAgent.userAgent
|
|
42
|
-
},
|
|
43
|
-
body: _JSON$stringify__default["default"](payload)
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
case 2:
|
|
47
|
-
response = _context.sent;
|
|
48
|
-
|
|
49
|
-
if (response.ok) {
|
|
50
|
-
_context.next = 10;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
_context.next = 6;
|
|
55
|
-
return response.text();
|
|
56
|
-
|
|
57
|
-
case 6:
|
|
58
|
-
text = _context.sent;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
parsed = JSON.parse(text);
|
|
62
|
-
} catch (error) {}
|
|
63
|
-
|
|
64
|
-
errorMessage = parsed ? parsed.message : text;
|
|
65
|
-
throw new Error(errorMessage);
|
|
66
|
-
|
|
67
|
-
case 10:
|
|
68
|
-
_context.next = 12;
|
|
69
|
-
return response.json();
|
|
70
|
-
|
|
71
|
-
case 12:
|
|
72
|
-
authToken = _context.sent;
|
|
73
|
-
return _context.abrupt("return", authToken);
|
|
74
|
-
|
|
75
|
-
case 14:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, _callee);
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
return function getAuthToken(_x, _x2) {
|
|
84
|
-
return _ref.apply(this, arguments);
|
|
85
|
-
};
|
|
86
|
-
}();
|
|
87
|
-
|
|
88
|
-
var credentialsStorage = new userAgent.CredentialsStorage();
|
|
89
|
-
|
|
90
|
-
function run() {
|
|
91
|
-
return _run.apply(this, arguments);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function _run() {
|
|
95
|
-
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
96
|
-
var applicationConfig$1, mcApiUrl, _yield$prompts, email, _yield$prompts2, password, credentials;
|
|
97
|
-
|
|
98
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
99
|
-
while (1) {
|
|
100
|
-
switch (_context.prev = _context.next) {
|
|
101
|
-
case 0:
|
|
102
|
-
applicationConfig$1 = applicationConfig.processConfig();
|
|
103
|
-
mcApiUrl = applicationConfig$1.env.mcApiUrl;
|
|
104
|
-
console.log("Using Merchant Center environment \"".concat(chalk__default["default"].green(mcApiUrl), "\"."));
|
|
105
|
-
console.log();
|
|
106
|
-
|
|
107
|
-
if (!credentialsStorage.isSessionValid(mcApiUrl)) {
|
|
108
|
-
_context.next = 7;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
console.log("You already have a valid session.");
|
|
113
|
-
return _context.abrupt("return");
|
|
114
|
-
|
|
115
|
-
case 7:
|
|
116
|
-
console.log("Enter the login credentials:");
|
|
117
|
-
_context.next = 10;
|
|
118
|
-
return prompts__default["default"]({
|
|
119
|
-
type: 'text',
|
|
120
|
-
name: 'email',
|
|
121
|
-
message: 'Email'
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
case 10:
|
|
125
|
-
_yield$prompts = _context.sent;
|
|
126
|
-
email = _yield$prompts.email;
|
|
127
|
-
_context.next = 14;
|
|
128
|
-
return prompts__default["default"]({
|
|
129
|
-
type: 'invisible',
|
|
130
|
-
name: 'password',
|
|
131
|
-
message: 'Password (hidden)'
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
case 14:
|
|
135
|
-
_yield$prompts2 = _context.sent;
|
|
136
|
-
password = _yield$prompts2.password;
|
|
137
|
-
|
|
138
|
-
if (!(!email || !password)) {
|
|
139
|
-
_context.next = 18;
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
throw new Error("Missing email or password values. Aborting.");
|
|
144
|
-
|
|
145
|
-
case 18:
|
|
146
|
-
_context.next = 20;
|
|
147
|
-
return getAuthToken(mcApiUrl, {
|
|
148
|
-
email: email,
|
|
149
|
-
password: password
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
case 20:
|
|
153
|
-
credentials = _context.sent;
|
|
154
|
-
credentialsStorage.setToken(mcApiUrl, credentials);
|
|
155
|
-
console.log(chalk__default["default"].green("Login successful.\n"));
|
|
156
|
-
|
|
157
|
-
case 23:
|
|
158
|
-
case "end":
|
|
159
|
-
return _context.stop();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}, _callee);
|
|
163
|
-
}));
|
|
164
|
-
return _run.apply(this, arguments);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
exports["default"] = run;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
-
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
-
var http = require('http');
|
|
6
|
-
var serveHandler = require('serve-handler');
|
|
7
|
-
var paths = require('./paths-16823f56.cjs.dev.js');
|
|
8
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
10
|
-
require('fs');
|
|
11
|
-
require('path');
|
|
12
|
-
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
16
|
-
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
17
|
-
var serveHandler__default = /*#__PURE__*/_interopDefault(serveHandler);
|
|
18
|
-
|
|
19
|
-
var port = 3001;
|
|
20
|
-
|
|
21
|
-
function run() {
|
|
22
|
-
return _run.apply(this, arguments);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function _run() {
|
|
26
|
-
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
27
|
-
var server;
|
|
28
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
29
|
-
while (1) {
|
|
30
|
-
switch (_context.prev = _context.next) {
|
|
31
|
-
case 0:
|
|
32
|
-
server = http__default["default"].createServer(function (request, response) {
|
|
33
|
-
// You pass two more arguments for config and middleware
|
|
34
|
-
// More details here: https://github.com/vercel/serve-handler#options
|
|
35
|
-
return serveHandler__default["default"](request, response, {
|
|
36
|
-
public: paths.paths.appBuild,
|
|
37
|
-
rewrites: [{
|
|
38
|
-
source: '/favicon*',
|
|
39
|
-
destination: '/favicon.png'
|
|
40
|
-
}, {
|
|
41
|
-
source: '/login*',
|
|
42
|
-
destination: '/login.html'
|
|
43
|
-
}, {
|
|
44
|
-
source: '/logout',
|
|
45
|
-
destination: '/logout.html'
|
|
46
|
-
}, {
|
|
47
|
-
// Match all routes except for the login, logout, and favicon routes.
|
|
48
|
-
// NOTE: this complex glob pattern would not be necessary if the rewrite
|
|
49
|
-
// implementation would stop at the first match.
|
|
50
|
-
// See https://github.com/vercel/serve-handler/issues/71
|
|
51
|
-
source: '{/!(favicon|login|logout)*/**,/!(favicon|login|logout)*}',
|
|
52
|
-
destination: '/index.html'
|
|
53
|
-
}]
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
server.listen(port, function () {
|
|
57
|
-
console.log("Running at http://localhost:".concat(port));
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
case 2:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context.stop();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, _callee);
|
|
66
|
-
}));
|
|
67
|
-
return _run.apply(this, arguments);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
exports["default"] = run;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
-
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
-
var http = require('http');
|
|
6
|
-
var serveHandler = require('serve-handler');
|
|
7
|
-
var paths = require('./paths-76b66e74.cjs.prod.js');
|
|
8
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
10
|
-
require('fs');
|
|
11
|
-
require('path');
|
|
12
|
-
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
16
|
-
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
17
|
-
var serveHandler__default = /*#__PURE__*/_interopDefault(serveHandler);
|
|
18
|
-
|
|
19
|
-
var port = 3001;
|
|
20
|
-
|
|
21
|
-
function run() {
|
|
22
|
-
return _run.apply(this, arguments);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function _run() {
|
|
26
|
-
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
27
|
-
var server;
|
|
28
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
29
|
-
while (1) {
|
|
30
|
-
switch (_context.prev = _context.next) {
|
|
31
|
-
case 0:
|
|
32
|
-
server = http__default["default"].createServer(function (request, response) {
|
|
33
|
-
// You pass two more arguments for config and middleware
|
|
34
|
-
// More details here: https://github.com/vercel/serve-handler#options
|
|
35
|
-
return serveHandler__default["default"](request, response, {
|
|
36
|
-
public: paths.paths.appBuild,
|
|
37
|
-
rewrites: [{
|
|
38
|
-
source: '/favicon*',
|
|
39
|
-
destination: '/favicon.png'
|
|
40
|
-
}, {
|
|
41
|
-
source: '/login*',
|
|
42
|
-
destination: '/login.html'
|
|
43
|
-
}, {
|
|
44
|
-
source: '/logout',
|
|
45
|
-
destination: '/logout.html'
|
|
46
|
-
}, {
|
|
47
|
-
// Match all routes except for the login, logout, and favicon routes.
|
|
48
|
-
// NOTE: this complex glob pattern would not be necessary if the rewrite
|
|
49
|
-
// implementation would stop at the first match.
|
|
50
|
-
// See https://github.com/vercel/serve-handler/issues/71
|
|
51
|
-
source: '{/!(favicon|login|logout)*/**,/!(favicon|login|logout)*}',
|
|
52
|
-
destination: '/index.html'
|
|
53
|
-
}]
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
server.listen(port, function () {
|
|
57
|
-
console.log("Running at http://localhost:".concat(port));
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
case 2:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context.stop();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, _callee);
|
|
66
|
-
}));
|
|
67
|
-
return _run.apply(this, arguments);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
exports["default"] = run;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
|
|
2
|
-
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
3
|
-
import http from 'http';
|
|
4
|
-
import serveHandler from 'serve-handler';
|
|
5
|
-
import { p as paths } from './paths-ed23d5a1.esm.js';
|
|
6
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
7
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
8
|
-
import 'fs';
|
|
9
|
-
import 'path';
|
|
10
|
-
|
|
11
|
-
var port = 3001;
|
|
12
|
-
|
|
13
|
-
function run() {
|
|
14
|
-
return _run.apply(this, arguments);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function _run() {
|
|
18
|
-
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
19
|
-
var server;
|
|
20
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
|
-
while (1) {
|
|
22
|
-
switch (_context.prev = _context.next) {
|
|
23
|
-
case 0:
|
|
24
|
-
server = http.createServer(function (request, response) {
|
|
25
|
-
// You pass two more arguments for config and middleware
|
|
26
|
-
// More details here: https://github.com/vercel/serve-handler#options
|
|
27
|
-
return serveHandler(request, response, {
|
|
28
|
-
public: paths.appBuild,
|
|
29
|
-
rewrites: [{
|
|
30
|
-
source: '/favicon*',
|
|
31
|
-
destination: '/favicon.png'
|
|
32
|
-
}, {
|
|
33
|
-
source: '/login*',
|
|
34
|
-
destination: '/login.html'
|
|
35
|
-
}, {
|
|
36
|
-
source: '/logout',
|
|
37
|
-
destination: '/logout.html'
|
|
38
|
-
}, {
|
|
39
|
-
// Match all routes except for the login, logout, and favicon routes.
|
|
40
|
-
// NOTE: this complex glob pattern would not be necessary if the rewrite
|
|
41
|
-
// implementation would stop at the first match.
|
|
42
|
-
// See https://github.com/vercel/serve-handler/issues/71
|
|
43
|
-
source: '{/!(favicon|login|logout)*/**,/!(favicon|login|logout)*}',
|
|
44
|
-
destination: '/index.html'
|
|
45
|
-
}]
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
server.listen(port, function () {
|
|
49
|
-
console.log("Running at http://localhost:".concat(port));
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
case 2:
|
|
53
|
-
case "end":
|
|
54
|
-
return _context.stop();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}, _callee);
|
|
58
|
-
}));
|
|
59
|
-
return _run.apply(this, arguments);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { run as default };
|