@commercetools-frontend/mc-scripts 0.0.0-canary-20220401074414 → 0.0.0-canary-20220401092258

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/bin/cli.js CHANGED
@@ -54,6 +54,8 @@ Commands:
54
54
 
55
55
  login Log in to your Merchant Center account through the CLI, using the cloud environment information from the Custom Application config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.
56
56
 
57
+ config:sync Synchronizes the local Custom Application config with the Merchant Center. A new Custom Application will be created if none existed, otherwise it will be updated.
58
+ --dry-run (optional) Executes the command but does not send any mutation request.
57
59
  `);
58
60
  process.exit(0);
59
61
  }
@@ -122,6 +124,18 @@ const applicationDirectory = fs.realpathSync(process.cwd());
122
124
  break;
123
125
  }
124
126
 
127
+ case 'config:sync':
128
+ {
129
+ // Do this as the first thing so that any code reading it knows the right env.
130
+ process.env.NODE_ENV = 'production'; // Get specific flag for this command.
131
+
132
+ const commandArgs = getArgsForCommand(['dry-run']);
133
+ proxyCommand(command, {
134
+ commandArgs
135
+ });
136
+ break;
137
+ }
138
+
125
139
  default:
126
140
  console.log(`Unknown script "${command}".`);
127
141
  console.log('Perhaps you need to update mc-scripts?');
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+
3
+ const omit = require('lodash/omit');
4
+
5
+ const prompts = require('prompts');
6
+
7
+ const mri = require('mri');
8
+
9
+ const chalk = require('chalk');
10
+
11
+ const {
12
+ processConfig
13
+ } = require('@commercetools-frontend/application-config');
14
+
15
+ const CredentialsStorage = require('../utils/credentials-storage');
16
+
17
+ const {
18
+ fetchCustomApplication,
19
+ updateCustomApplication,
20
+ createCustomApplication,
21
+ fetchUserOrganizations
22
+ } = require('../utils/graphql-requests');
23
+
24
+ const updateApplicationIdInCustomApplicationConfig = require('../utils/update-application-id-in-custom-application-config');
25
+
26
+ const flags = mri(process.argv.slice(2), {
27
+ boolean: ['dry-run']
28
+ });
29
+ const credentialsStorage = new CredentialsStorage();
30
+
31
+ const getMcUrlLink = (mcApiUrl, organizationId, applicationId) => {
32
+ const mcUrl = mcApiUrl.replace('mc-api', 'mc');
33
+ const customAppLink = `${mcUrl}/account/organizations/${organizationId}/custom-applications/owned/${applicationId}`;
34
+ return customAppLink;
35
+ };
36
+
37
+ const configSync = async () => {
38
+ const applicationConfig = processConfig();
39
+ const {
40
+ data: localCustomAppData
41
+ } = applicationConfig;
42
+ const {
43
+ mcApiUrl
44
+ } = applicationConfig.env;
45
+
46
+ if (!credentialsStorage.isSessionValid(mcApiUrl)) {
47
+ throw new Error(`You don't have a valid session for the ${mcApiUrl} environment. Please, run the "mc-scripts login" command to authenticate yourself.`);
48
+ }
49
+
50
+ const token = credentialsStorage.getToken(mcApiUrl);
51
+ const fetchedCustomApplication = await fetchCustomApplication({
52
+ mcApiUrl,
53
+ token,
54
+ entryPointUriPath: localCustomAppData.entryPointUriPath
55
+ });
56
+
57
+ if (!fetchedCustomApplication) {
58
+ const userOrganizations = await fetchUserOrganizations({
59
+ mcApiUrl,
60
+ token
61
+ });
62
+ let organizationId, organizationName;
63
+
64
+ if (userOrganizations.total === 0) {
65
+ throw new Error(`It seems you are not an admin of any Organization. Please make sure to be part of the Administrators team of the Organization you want the Custom Application to be configured to.`);
66
+ }
67
+
68
+ if (userOrganizations.total === 1) {
69
+ const [organization] = userOrganizations.results;
70
+ organizationId = organization.id;
71
+ organizationName = organization.name;
72
+ } else {
73
+ const organizationChoices = userOrganizations.results.map(organization => ({
74
+ title: organization.name,
75
+ value: organization.id
76
+ }));
77
+ const {
78
+ organizationId: selectedOrganizationId
79
+ } = await prompts({
80
+ type: 'select',
81
+ name: 'organizationId',
82
+ message: 'Select Organization',
83
+ choices: organizationChoices,
84
+ initial: 0
85
+ });
86
+
87
+ if (!selectedOrganizationId) {
88
+ throw new Error(`No Organization selected, aborting.`);
89
+ }
90
+
91
+ organizationId = selectedOrganizationId;
92
+ organizationName = organizationChoices.find(({
93
+ value
94
+ }) => value === organizationId).title;
95
+ }
96
+
97
+ const {
98
+ confirmation
99
+ } = await prompts({
100
+ type: 'text',
101
+ name: 'confirmation',
102
+ message: `You are about to create a new Custom Application in the "${organizationName}" organization for the ${mcApiUrl} environment. Are you sure you want to proceed?`,
103
+ initial: 'yes'
104
+ });
105
+
106
+ if (!confirmation || confirmation.toLowerCase().charAt(0) !== 'y') {
107
+ console.log(chalk.red('Aborted.'));
108
+ return;
109
+ }
110
+
111
+ const data = omit(localCustomAppData, ['id']);
112
+
113
+ if (flags['dry-run']) {
114
+ console.log(chalk.gray('DRY RUN mode'));
115
+ console.log(`A new Custom Application would be created for the Organization ${organizationName} with the following payload:`);
116
+ console.log(JSON.stringify(data));
117
+ return;
118
+ }
119
+
120
+ const createdCustomApplication = await createCustomApplication({
121
+ mcApiUrl,
122
+ token,
123
+ organizationId,
124
+ data
125
+ }); // update applicationID in the custom-application-config file
126
+
127
+ updateApplicationIdInCustomApplicationConfig(createdCustomApplication.id);
128
+ const customAppLink = getMcUrlLink(mcApiUrl, organizationId, createdCustomApplication.id);
129
+ console.log(chalk.green(`Custom Application created.\nThe "applicationId" in your local Custom Application config file has been updated with the application ID.\nYou can see the Custom Application data in the Merchant Center at ${customAppLink}.`));
130
+ return;
131
+ } // TODO: show diff (followup task)
132
+
133
+
134
+ const {
135
+ confirmation
136
+ } = await prompts({
137
+ type: 'text',
138
+ name: 'confirmation',
139
+ message: `You are about to update the Custom Application "${localCustomAppData.entryPointUriPath}" in the ${mcApiUrl} environment. Are you sure you want to proceed?`,
140
+ initial: 'yes'
141
+ });
142
+
143
+ if (!confirmation || confirmation.toLowerCase().charAt(0) !== 'y') {
144
+ console.log(chalk.red('Aborted.'));
145
+ return;
146
+ }
147
+
148
+ const data = omit(localCustomAppData, ['id']);
149
+
150
+ if (flags['dry-run']) {
151
+ console.log(chalk.gray('DRY RUN mode'));
152
+ console.log(`The Custom Application ${data.name} would be updated with the following payload:`);
153
+ console.log(JSON.stringify(data));
154
+ return;
155
+ }
156
+
157
+ await updateCustomApplication({
158
+ mcApiUrl,
159
+ token,
160
+ organizationId: fetchedCustomApplication.organizationId,
161
+ data: omit(localCustomAppData, ['id']),
162
+ applicationId: fetchedCustomApplication.application.id
163
+ });
164
+ const customAppLink = getMcUrlLink(mcApiUrl, fetchedCustomApplication.organizationId, fetchedCustomApplication.application.id);
165
+ console.log(chalk.green(`Custom Application updated.\nYou can see the Custom Application data in the Merchant Center at ${customAppLink}.`));
166
+ };
167
+
168
+ configSync().catch(error => {
169
+ console.log(chalk.red(error));
170
+ process.exit(1);
171
+ });
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
 
3
- const {
4
- promisify
5
- } = require('util');
6
-
7
- const read = promisify(require('read'));
3
+ const prompts = require('prompts');
8
4
 
9
- const chalk = require('react-dev-utils/chalk');
5
+ const chalk = require('chalk');
10
6
 
11
7
  const {
12
8
  processConfig
@@ -31,13 +27,25 @@ const login = async () => {
31
27
  return;
32
28
  }
33
29
 
34
- const email = await read({
35
- prompt: 'Email: '
30
+ const {
31
+ email
32
+ } = await prompts({
33
+ type: 'text',
34
+ name: 'email',
35
+ message: 'Email'
36
36
  });
37
- const password = await read({
38
- prompt: 'Password (hidden): ',
39
- silent: true
37
+ const {
38
+ password
39
+ } = await prompts({
40
+ type: 'invisible',
41
+ name: 'password',
42
+ message: 'Password (hidden)'
40
43
  });
44
+
45
+ if (!email || !password) {
46
+ throw new Error(`Missing email or password values. Aborting.`);
47
+ }
48
+
41
49
  const credentials = await getAuthToken(mcApiUrl, {
42
50
  email,
43
51
  password
@@ -47,6 +55,6 @@ const login = async () => {
47
55
  };
48
56
 
49
57
  login().catch(error => {
50
- console.error(error);
58
+ console.log(chalk.red(error));
51
59
  process.exit(1);
52
60
  });
@@ -2,18 +2,7 @@
2
2
 
3
3
  const fetch = require('node-fetch');
4
4
 
5
- const createHttpUserAgent = require('@commercetools/http-user-agent');
6
-
7
- const pkgJson = require('../../package.json');
8
-
9
- const userAgent = createHttpUserAgent({
10
- name: 'cli-login',
11
- libraryName: 'mc-scripts',
12
- libraryVersion: pkgJson.version,
13
- contactUrl: 'https://git.io/fjuyC',
14
- // points to the appkit repo issues
15
- contactEmail: 'support@commercetools.com'
16
- });
5
+ const userAgent = require('./user-agent');
17
6
 
18
7
  const getAuthToken = async (mcApiUrl, payload) => {
19
8
  const response = await fetch(`${mcApiUrl}/tokens/cli`, {
@@ -0,0 +1,8 @@
1
+ mutation CreateCustomApplicationFromCli(
2
+ $organizationId: String!
3
+ $data: CustomApplicationDraftDataInput!
4
+ ) {
5
+ createCustomApplication(organizationId: $organizationId, data: $data) {
6
+ id
7
+ }
8
+ }
@@ -0,0 +1,35 @@
1
+ query FetchCustomApplicationFromCli($entryPointUriPath: String!) {
2
+ organizationExtensionForCustomApplication(
3
+ entryPointUriPath: $entryPointUriPath
4
+ ) {
5
+ organizationId
6
+ application {
7
+ id
8
+ entryPointUriPath
9
+ name
10
+ description
11
+ url
12
+ icon
13
+ permissions {
14
+ name
15
+ oAuthScopes
16
+ }
17
+ mainMenuLink {
18
+ defaultLabel
19
+ labelAllLocales {
20
+ locale
21
+ value
22
+ }
23
+ }
24
+ submenuLinks {
25
+ uriPath
26
+ defaultLabel
27
+ permissions
28
+ labelAllLocales {
29
+ locale
30
+ value
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,9 @@
1
+ query FetchMyOrganizationsFromCli {
2
+ myOrganizations {
3
+ total
4
+ results {
5
+ id
6
+ name
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ const {
4
+ GraphQLClient
5
+ } = require('graphql-request');
6
+
7
+ const {
8
+ GRAPHQL_TARGETS
9
+ } = require('@commercetools-frontend/constants');
10
+
11
+ const userAgent = require('./user-agent');
12
+
13
+ const requireGraphqlHelper = require('./require-graphql');
14
+
15
+ const requireGraphql = requireGraphqlHelper(__dirname);
16
+ const FetchCustomApplicationFromCli = requireGraphql('./fetch-custom-application.settings.graphql');
17
+ const UpdateCustomApplicationFromCli = requireGraphql('./update-custom-application.settings.graphql');
18
+ const CreateCustomApplicationFromCli = requireGraphql('./create-custom-application.settings.graphql');
19
+ const FetchMyOrganizationsFromCli = requireGraphql('./fetch-user-organizations.core.graphql');
20
+
21
+ const graphQLClient = (uri, token, target = GRAPHQL_TARGETS.SETTINGS_SERVICE) => new GraphQLClient(`${uri}/graphql`, {
22
+ headers: {
23
+ Accept: 'application/json',
24
+ 'Content-Type': 'application/json',
25
+ 'x-graphql-target': target,
26
+ 'x-mc-cli-access-token': token,
27
+ 'x-user-agent': userAgent
28
+ }
29
+ });
30
+
31
+ const fetchCustomApplication = async ({
32
+ mcApiUrl,
33
+ token,
34
+ entryPointUriPath
35
+ }) => {
36
+ const variables = {
37
+ entryPointUriPath
38
+ };
39
+
40
+ try {
41
+ const customAppData = await graphQLClient(mcApiUrl, token).request(FetchCustomApplicationFromCli, variables);
42
+ return customAppData.organizationExtensionForCustomApplication;
43
+ } catch (error) {
44
+ throw new Error(error.response.message);
45
+ }
46
+ };
47
+
48
+ const updateCustomApplication = async ({
49
+ mcApiUrl,
50
+ token,
51
+ applicationId,
52
+ organizationId,
53
+ data
54
+ }) => {
55
+ const variables = {
56
+ organizationId,
57
+ applicationId,
58
+ data
59
+ };
60
+
61
+ try {
62
+ const updatedCustomAppsData = await graphQLClient(mcApiUrl, token).request(UpdateCustomApplicationFromCli, variables);
63
+ return updatedCustomAppsData.updateCustomApplication;
64
+ } catch (error) {
65
+ throw new Error(error.response.message);
66
+ }
67
+ };
68
+
69
+ const createCustomApplication = async ({
70
+ mcApiUrl,
71
+ token,
72
+ organizationId,
73
+ data
74
+ }) => {
75
+ const variables = {
76
+ organizationId,
77
+ data
78
+ };
79
+
80
+ try {
81
+ const createdCustomAppData = await graphQLClient(mcApiUrl, token).request(CreateCustomApplicationFromCli, variables);
82
+ return createdCustomAppData.createCustomApplication;
83
+ } catch (error) {
84
+ throw new Error(error.response.message);
85
+ }
86
+ };
87
+
88
+ const fetchUserOrganizations = async ({
89
+ mcApiUrl,
90
+ token
91
+ }) => {
92
+ try {
93
+ const userOrganizations = await graphQLClient(mcApiUrl, token, GRAPHQL_TARGETS.ADMINISTRATION_SERVICE).request(FetchMyOrganizationsFromCli);
94
+ return userOrganizations.myOrganizations;
95
+ } catch (error) {
96
+ throw new Error(error.response.message);
97
+ }
98
+ };
99
+
100
+ module.exports = {
101
+ fetchCustomApplication,
102
+ updateCustomApplication,
103
+ createCustomApplication,
104
+ fetchUserOrganizations
105
+ };
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+
3
+ const {
4
+ graphql
5
+ } = require('msw');
6
+
7
+ const {
8
+ setupServer
9
+ } = require('msw/node');
10
+
11
+ const {
12
+ createCustomApplication,
13
+ updateCustomApplication,
14
+ fetchCustomApplication,
15
+ fetchUserOrganizations
16
+ } = require('./graphql-requests');
17
+
18
+ const mockServer = setupServer();
19
+ afterEach(() => {
20
+ mockServer.resetHandlers();
21
+ });
22
+ beforeAll(() => mockServer.listen({
23
+ onUnhandledRequest: 'bypass'
24
+ }));
25
+ afterAll(() => mockServer.close());
26
+ const mcApiUrl = 'https://mc-api.europe-west1.gcp.commercetools.com';
27
+ describe('fetch custom application data', () => {
28
+ beforeEach(() => {
29
+ mockServer.use(graphql.query('FetchCustomApplicationFromCli', (req, res, ctx) => {
30
+ return res(ctx.data({
31
+ organizationExtensionForCustomApplication: {
32
+ id: 'test-id',
33
+ organizationId: 'org-id',
34
+ application: {
35
+ url: 'https://test.com',
36
+ name: 'Test name',
37
+ description: 'Test description',
38
+ entryPointUriPath: 'test-custom-app',
39
+ icon: '<svg><path fill="#000000"></path></svg>',
40
+ submenuLinks: [],
41
+ mainMenuLink: [],
42
+ permissions: [{
43
+ oAuthScopes: ['view_products', 'view_customers'],
44
+ name: 'viewTestCustomApp'
45
+ }, {
46
+ oAuthScopes: [],
47
+ name: 'manageTestCustomApp'
48
+ }]
49
+ }
50
+ }
51
+ }));
52
+ }));
53
+ });
54
+ it('should match returned data', async () => {
55
+ const organizationExtensionForCustomApplication = await fetchCustomApplication({
56
+ entryPointUriPath: 'test-custom-app',
57
+ mcApiUrl,
58
+ token: 'test-token'
59
+ });
60
+ expect(organizationExtensionForCustomApplication.application.entryPointUriPath).toEqual('test-custom-app');
61
+ expect(organizationExtensionForCustomApplication.id).toEqual('test-id');
62
+ expect(organizationExtensionForCustomApplication.organizationId).toEqual('org-id');
63
+ });
64
+ });
65
+ describe('register custom application', () => {
66
+ beforeEach(() => {
67
+ mockServer.use(graphql.mutation('CreateCustomApplicationFromCli', (req, res, ctx) => {
68
+ return res(ctx.data({
69
+ createCustomApplication: {
70
+ id: 'new-test-id',
71
+ application: {
72
+ url: 'https://test.com',
73
+ name: 'New Test name',
74
+ description: 'Test description',
75
+ entryPointUriPath: 'new-test-custom-app',
76
+ icon: '<svg><path fill="#000000"></path></svg>',
77
+ submenuLinks: [],
78
+ mainMenuLink: [],
79
+ permissions: [{
80
+ oAuthScopes: ['view_products', 'view_customers'],
81
+ name: 'viewNewTestCustomApp'
82
+ }, {
83
+ oAuthScopes: [],
84
+ name: 'manageNewTestCustomApp'
85
+ }]
86
+ }
87
+ }
88
+ }));
89
+ }));
90
+ });
91
+ it('should match returned data', async () => {
92
+ const createdCustomAppsData = await createCustomApplication({
93
+ entryPointUriPath: 'new-test-custom-app',
94
+ mcApiUrl,
95
+ token: 'new-test-token'
96
+ });
97
+ expect(createdCustomAppsData.application.entryPointUriPath).toEqual('new-test-custom-app');
98
+ expect(createdCustomAppsData.id).toEqual('new-test-id');
99
+ });
100
+ });
101
+ describe('update custom application', () => {
102
+ beforeEach(() => {
103
+ mockServer.use(graphql.mutation('UpdateCustomApplicationFromCli', (req, res, ctx) => {
104
+ return res(ctx.data({
105
+ updateCustomApplication: {
106
+ id: 'test-id',
107
+ application: {
108
+ url: 'https://test.com',
109
+ name: 'Updated Test name',
110
+ description: 'Updated Test description',
111
+ entryPointUriPath: 'updated-test-custom-app',
112
+ icon: '<svg><path fill="#000000"></path></svg>',
113
+ submenuLinks: [],
114
+ mainMenuLink: [],
115
+ permissions: [{
116
+ oAuthScopes: ['view_products', 'view_customers'],
117
+ name: 'viewNewTestCustomApp'
118
+ }, {
119
+ oAuthScopes: [],
120
+ name: 'manageNewTestCustomApp'
121
+ }]
122
+ }
123
+ }
124
+ }));
125
+ }));
126
+ });
127
+ it('should match returned data', async () => {
128
+ const updatedCustomAppsData = await updateCustomApplication({
129
+ entryPointUriPath: 'updated-test-custom-app',
130
+ mcApiUrl,
131
+ token: 'test-token'
132
+ });
133
+ expect(updatedCustomAppsData.application.name).toEqual('Updated Test name');
134
+ expect(updatedCustomAppsData.application.description).toEqual('Updated Test description');
135
+ });
136
+ });
137
+ describe('fetch user organizations', () => {
138
+ beforeEach(() => {
139
+ mockServer.use(graphql.query('FetchMyOrganizationsFromCli', (req, res, ctx) => {
140
+ return res(ctx.data({
141
+ myOrganizations: {
142
+ total: 1,
143
+ results: [{
144
+ id: 'test-organization-id',
145
+ name: 'test-organization-name'
146
+ }]
147
+ }
148
+ }));
149
+ }));
150
+ });
151
+ it('should match returned data', async () => {
152
+ const data = await fetchUserOrganizations({
153
+ mcApiUrl,
154
+ token: 'test-token'
155
+ });
156
+ expect(data.results[0].id).toEqual('test-organization-id');
157
+ expect(data.results[0].name).toEqual('test-organization-name');
158
+ });
159
+ });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ const path = require('path');
4
+
5
+ const {
6
+ readFileSync
7
+ } = require('fs'); // At the moment there is no proper way of loading `.graphql` files
8
+ // in nodejs. This workaround basically uses `readFileSync` to read the file
9
+ // content as a string.
10
+ // https://github.com/apollographql/graphql-tools/issues/273
11
+
12
+
13
+ const requireGraphql = folderPath => filePath => readFileSync(path.join(folderPath, filePath), 'utf-8');
14
+
15
+ module.exports = requireGraphql;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ const fs = require('fs');
4
+
5
+ const rcfile = require('rcfile');
6
+
7
+ const prettier = require('prettier');
8
+
9
+ const babel = require('@babel/core');
10
+
11
+ const {
12
+ getConfigPath
13
+ } = require('@commercetools-frontend/application-config');
14
+
15
+ function updateApplicationIdInCustomApplicationConfig(applicationId) {
16
+ const filePath = getConfigPath();
17
+
18
+ if (filePath.endsWith('.json')) {
19
+ const customApplicationConfig = require(filePath);
20
+
21
+ customApplicationConfig.env.production.applicationId = applicationId;
22
+ const prettierConfig = rcfile('prettier');
23
+ const formattedData = prettier.format(JSON.stringify(customApplicationConfig), { ...prettierConfig,
24
+ parser: 'json'
25
+ });
26
+ fs.writeFileSync(filePath, formattedData, {
27
+ encoding: 'utf8'
28
+ });
29
+ return;
30
+ }
31
+
32
+ const result = babel.transformFileSync(filePath, {
33
+ plugins: [function replaceCustomApplicationConfig() {
34
+ return {
35
+ visitor: {
36
+ Identifier(nodePath) {
37
+ if (nodePath.isIdentifier({
38
+ name: 'applicationId'
39
+ })) {
40
+ if (nodePath.findParent(parentPath => parentPath.get('key').isIdentifier({
41
+ name: 'env'
42
+ }))) {
43
+ nodePath.parent.value = babel.types.stringLiteral(applicationId);
44
+ }
45
+ }
46
+ }
47
+
48
+ }
49
+ };
50
+ }],
51
+ retainLines: true
52
+ });
53
+ const prettierConfig = rcfile('prettier');
54
+ const formattedData = prettier.format(result.code, prettierConfig);
55
+ fs.writeFileSync(filePath, formattedData, {
56
+ encoding: 'utf8'
57
+ });
58
+ }
59
+
60
+ module.exports = updateApplicationIdInCustomApplicationConfig;
@@ -0,0 +1,13 @@
1
+ mutation UpdateCustomApplicationFromCli(
2
+ $organizationId: String!
3
+ $data: CustomApplicationDraftDataInput!
4
+ $applicationId: ID!
5
+ ) {
6
+ updateCustomApplication(
7
+ organizationId: $organizationId
8
+ data: $data
9
+ applicationId: $applicationId
10
+ ) {
11
+ id
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ const createHttpUserAgent = require('@commercetools/http-user-agent');
4
+
5
+ const pkgJson = require('../../package.json');
6
+
7
+ const userAgent = createHttpUserAgent({
8
+ name: 'cli-login',
9
+ libraryName: 'mc-scripts',
10
+ libraryVersion: pkgJson.version,
11
+ contactUrl: 'https://git.io/fjuyC',
12
+ // points to the appkit repo issues
13
+ contactEmail: 'support@commercetools.com'
14
+ });
15
+ module.exports = userAgent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-scripts",
3
- "version": "0.0.0-canary-20220401074414",
3
+ "version": "0.0.0-canary-20220401092258",
4
4
  "description": "Configuration and scripts for developing a MC application",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -40,28 +40,32 @@
40
40
  ]
41
41
  },
42
42
  "scripts": {
43
- "build": "rimraf build && babel src --out-dir build",
43
+ "build": "rimraf build && babel src --out-dir build && ../../scripts/copy-graphql-files.mjs src build",
44
44
  "build:bundles:watch": "yarn build -w"
45
45
  },
46
46
  "dependencies": {
47
+ "@babel/core": "^7.17.8",
47
48
  "@babel/runtime": "^7.17.8",
48
49
  "@babel/runtime-corejs3": "^7.17.8",
49
- "@commercetools-frontend/application-config": "0.0.0-canary-20220401074414",
50
+ "@commercetools-frontend/application-config": "0.0.0-canary-20220401092258",
50
51
  "@commercetools-frontend/assets": "21.0.0",
51
- "@commercetools-frontend/babel-preset-mc-app": "0.0.0-canary-20220401074414",
52
+ "@commercetools-frontend/babel-preset-mc-app": "0.0.0-canary-20220401092258",
53
+ "@commercetools-frontend/constants": "0.0.0-canary-20220401092258",
52
54
  "@commercetools-frontend/mc-dev-authentication": "21.0.0",
53
- "@commercetools-frontend/mc-html-template": "0.0.0-canary-20220401074414",
55
+ "@commercetools-frontend/mc-html-template": "0.0.0-canary-20220401092258",
54
56
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
55
57
  "@svgr/webpack": "6.2.1",
56
58
  "autoprefixer": "^10.4.4",
57
59
  "babel-loader": "8.2.4",
58
60
  "browserslist": "^4.20.2",
61
+ "chalk": "4.1.2",
59
62
  "core-js": "^3.21.1",
60
63
  "css-loader": "6.7.1",
61
64
  "css-minimizer-webpack-plugin": "3.4.1",
62
65
  "dotenv": "16.0.0",
63
66
  "dotenv-expand": "8.0.3",
64
67
  "fs-extra": "10.0.1",
68
+ "graphql-request": "^4.1.0",
65
69
  "graphql-tag": "^2.12.6",
66
70
  "html-webpack-plugin": "5.5.0",
67
71
  "json-loader": "0.5.7",
@@ -74,10 +78,12 @@
74
78
  "postcss-import": "14.1.0",
75
79
  "postcss-loader": "6.2.1",
76
80
  "postcss-reporter": "7.0.5",
81
+ "prettier": "2.6.1",
82
+ "prompts": "^2.4.2",
77
83
  "querystring-es3": "^0.2.1",
84
+ "rcfile": "1.0.3",
78
85
  "react-dev-utils": "12.0.0",
79
86
  "react-refresh": "0.12.0",
80
- "read": "^1.0.7",
81
87
  "serve-handler": "6.1.3",
82
88
  "shelljs": "0.8.5",
83
89
  "style-loader": "3.3.1",