@sitecore-content-sdk/nextjs 0.2.0-beta.10 → 0.2.0-beta.12
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/dist/cjs/tools/codegen/{extract-components.js → extract-files.js} +19 -7
- package/dist/cjs/tools/codegen/utils.js +38 -26
- package/dist/cjs/tools/index.js +3 -3
- package/dist/esm/tools/codegen/{extract-components.js → extract-files.js} +17 -5
- package/dist/esm/tools/codegen/utils.js +39 -27
- package/dist/esm/tools/index.js +1 -1
- package/package.json +4 -4
- package/types/tools/codegen/extract-files.d.ts +10 -0
- package/types/tools/codegen/utils.d.ts +4 -4
- package/types/tools/index.d.ts +1 -1
- package/types/tools/codegen/extract-components.d.ts +0 -10
|
@@ -12,16 +12,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.extractFiles = void 0;
|
|
16
16
|
const chalk_1 = __importDefault(require("chalk"));
|
|
17
17
|
const utils_1 = require("./utils");
|
|
18
18
|
const core_1 = require("@sitecore-content-sdk/core");
|
|
19
19
|
const tools_1 = require("@sitecore-content-sdk/core/tools");
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
20
21
|
/**
|
|
21
22
|
* Extracts components from the app folder and sends them to XMCloud.
|
|
22
|
-
* @param {
|
|
23
|
+
* @param {ExtractFilesConfig} args - Config for components extraction
|
|
23
24
|
*/
|
|
24
|
-
const
|
|
25
|
+
const extractFiles = (args) => {
|
|
25
26
|
const authParams = {
|
|
26
27
|
clientId: process.env.SITECORE_AUTH_CLIENT_ID || '',
|
|
27
28
|
clientSecret: process.env.SITECORE_AUTH_CLIENT_SECRET || '',
|
|
@@ -39,26 +40,37 @@ const extractComponents = (args) => {
|
|
|
39
40
|
}
|
|
40
41
|
const basePath = process.cwd();
|
|
41
42
|
try {
|
|
43
|
+
// MESH_URL is temporary option to use until mesh is onboarded into Edge Proxy
|
|
44
|
+
const targetUrl = process.env.SITECORE_MESH_URL || args.scConfig.api.edge.edgeUrl;
|
|
42
45
|
const bearer = yield (0, tools_1.fetchBearerToken)(authParams);
|
|
43
46
|
if (!bearer) {
|
|
44
47
|
console.error(chalk_1.default.red('Failed to get bearer token, aborting code extraction'));
|
|
45
48
|
return;
|
|
46
49
|
}
|
|
47
50
|
const componentPaths = yield (0, utils_1.resolveComponentImportFiles)(basePath, args.componentMapPath);
|
|
48
|
-
const
|
|
51
|
+
const fileDispatches = Array.from(componentPaths, (mapEntry) => (0, utils_1.sendCode)({
|
|
49
52
|
file: {
|
|
50
53
|
name: mapEntry[0],
|
|
51
54
|
path: mapEntry[1],
|
|
52
55
|
type: utils_1.ExtractedFileType.Component,
|
|
53
56
|
},
|
|
54
57
|
token: bearer,
|
|
55
|
-
|
|
58
|
+
targetUrl,
|
|
56
59
|
}));
|
|
57
|
-
|
|
60
|
+
fileDispatches.push((0, utils_1.sendCode)({
|
|
61
|
+
file: {
|
|
62
|
+
name: 'package.json',
|
|
63
|
+
path: path_1.default.resolve(basePath, './package.json'),
|
|
64
|
+
type: utils_1.ExtractedFileType.PackageJson,
|
|
65
|
+
},
|
|
66
|
+
token: bearer,
|
|
67
|
+
targetUrl,
|
|
68
|
+
}));
|
|
69
|
+
yield Promise.all(fileDispatches);
|
|
58
70
|
}
|
|
59
71
|
catch (error) {
|
|
60
72
|
console.error(chalk_1.default.red('Error during component extraction:', error));
|
|
61
73
|
}
|
|
62
74
|
});
|
|
63
75
|
};
|
|
64
|
-
exports.
|
|
76
|
+
exports.extractFiles = extractFiles;
|
|
@@ -58,7 +58,7 @@ var ExtractedFileType;
|
|
|
58
58
|
(function (ExtractedFileType) {
|
|
59
59
|
ExtractedFileType["Component"] = "component";
|
|
60
60
|
ExtractedFileType["Json"] = "json";
|
|
61
|
-
ExtractedFileType["
|
|
61
|
+
ExtractedFileType["PackageJson"] = "package.json";
|
|
62
62
|
})(ExtractedFileType || (exports.ExtractedFileType = ExtractedFileType = {}));
|
|
63
63
|
/**
|
|
64
64
|
* Validates consent for code extraction procedures
|
|
@@ -95,10 +95,10 @@ exports.validateDeployContext = validateDeployContext;
|
|
|
95
95
|
* Parses the componentBuilder.ts file and returns a map of component names
|
|
96
96
|
* and their respective import strings
|
|
97
97
|
* @param {string} appPath path to the JSS app root
|
|
98
|
-
* @param {string} [componentMapPath] path to the app's component map file. Default: 'src/lib/
|
|
98
|
+
* @param {string} [componentMapPath] path to the app's component map file. Default: 'src/lib/component-map.ts'
|
|
99
99
|
* @returns map of component names and their respective import strings
|
|
100
100
|
*/
|
|
101
|
-
const resolveComponentImportFiles = (appPath, componentMapPath = './src/lib/
|
|
101
|
+
const resolveComponentImportFiles = (appPath, componentMapPath = './src/lib/component-map.ts') => {
|
|
102
102
|
appPath = path_1.default.isAbsolute(appPath) ? appPath : path_1.default.resolve(process.cwd(), appPath);
|
|
103
103
|
const tsConfig = ts.readConfigFile(path_1.default.resolve(appPath, 'tsconfig.json'), ts.sys.readFile);
|
|
104
104
|
if (tsConfig.error) {
|
|
@@ -164,8 +164,10 @@ const resolveComponentImportFiles = (appPath, componentMapPath = './src/lib/comp
|
|
|
164
164
|
const resolvedModule = ts.nodeModuleNameResolver(moduleName, componentMapFullPath, cliCompilerOptions, tsHost);
|
|
165
165
|
const resolvedFile = (_a = resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName;
|
|
166
166
|
// module imports will be resolved to /node_modules location - we don't support that yet
|
|
167
|
-
if (resolvedFile
|
|
168
|
-
|
|
167
|
+
if (resolvedFile) {
|
|
168
|
+
if (resolvedFile.indexOf('node_modules') === -1 && !resolvedFile.endsWith('.d.ts')) {
|
|
169
|
+
importStringsMap[childNode.importClause.getText()] = path_1.default.resolve(resolvedFile);
|
|
170
|
+
}
|
|
169
171
|
}
|
|
170
172
|
else {
|
|
171
173
|
console.warn('Could not resolve a file for import %s', moduleName);
|
|
@@ -222,34 +224,44 @@ const resolveComponentImportFiles = (appPath, componentMapPath = './src/lib/comp
|
|
|
222
224
|
return componentImportsMap;
|
|
223
225
|
};
|
|
224
226
|
exports.resolveComponentImportFiles = resolveComponentImportFiles;
|
|
225
|
-
const sendCode = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file, token,
|
|
226
|
-
const
|
|
227
|
+
const sendCode = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file, token, targetUrl, }) {
|
|
228
|
+
const apiEndpoint = `${targetUrl}/api/v1/contentsdk/code/extracted`;
|
|
227
229
|
if (!fs_1.default.existsSync(file.path)) {
|
|
228
|
-
console.error(chalk_1.default.red(`
|
|
230
|
+
console.error(chalk_1.default.red(`File not found: ${file.path}`));
|
|
229
231
|
return;
|
|
230
232
|
}
|
|
231
233
|
const code = fs_1.default.readFileSync(file.path);
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
234
|
+
try {
|
|
235
|
+
const response = yield fetch(apiEndpoint, {
|
|
236
|
+
method: 'POST',
|
|
237
|
+
headers: {
|
|
238
|
+
Authorization: `Bearer ${token}`,
|
|
239
|
+
'Content-Type': 'application/json',
|
|
240
|
+
},
|
|
241
|
+
body: JSON.stringify({
|
|
242
|
+
// EnvironmentId can have any value - but it's required
|
|
243
|
+
EnvironmentId: 'ContentSDK',
|
|
244
|
+
name: file.name,
|
|
245
|
+
content: code.toString(),
|
|
246
|
+
labels: {
|
|
243
247
|
type: file.type,
|
|
244
248
|
},
|
|
245
|
-
},
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
}),
|
|
250
|
+
});
|
|
251
|
+
if (!response.ok) {
|
|
252
|
+
console.error(chalk_1.default.red(`Failed to send extracted code from ${file.path}: ${response.statusText}`));
|
|
253
|
+
core_1.debug.http('Error details: %o', {
|
|
254
|
+
status: response.status,
|
|
255
|
+
text: yield response.text(),
|
|
256
|
+
url: response.url,
|
|
257
|
+
headers: response.headers,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
250
260
|
}
|
|
251
|
-
|
|
252
|
-
console.
|
|
261
|
+
catch (error) {
|
|
262
|
+
console.error(chalk_1.default.red(`Fetch request to send extracted code from ${file.path} failed: ${JSON.stringify(error)}`));
|
|
263
|
+
return;
|
|
253
264
|
}
|
|
265
|
+
console.log(chalk_1.default.green(`Contents from ${file.path} extracted and sent to mesh endpoint`));
|
|
254
266
|
});
|
|
255
267
|
exports.sendCode = sendCode;
|
package/dist/cjs/tools/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.extractFiles = exports.ModuleType = exports.generatePlugins = exports.getComponentList = exports.generateMetadata = exports.generateSites = void 0;
|
|
4
4
|
var tools_1 = require("@sitecore-content-sdk/core/tools");
|
|
5
5
|
Object.defineProperty(exports, "generateSites", { enumerable: true, get: function () { return tools_1.generateSites; } });
|
|
6
6
|
Object.defineProperty(exports, "generateMetadata", { enumerable: true, get: function () { return tools_1.generateMetadata; } });
|
|
7
7
|
Object.defineProperty(exports, "getComponentList", { enumerable: true, get: function () { return tools_1.getComponentList; } });
|
|
8
8
|
Object.defineProperty(exports, "generatePlugins", { enumerable: true, get: function () { return tools_1.generatePlugins; } });
|
|
9
9
|
Object.defineProperty(exports, "ModuleType", { enumerable: true, get: function () { return tools_1.ModuleType; } });
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var extract_files_1 = require("./codegen/extract-files");
|
|
11
|
+
Object.defineProperty(exports, "extractFiles", { enumerable: true, get: function () { return extract_files_1.extractFiles; } });
|
|
@@ -11,11 +11,12 @@ import chalk from 'chalk';
|
|
|
11
11
|
import { ExtractedFileType, resolveComponentImportFiles, sendCode, validateConsent, validateDeployContext, } from './utils';
|
|
12
12
|
import { constants } from '@sitecore-content-sdk/core';
|
|
13
13
|
import { fetchBearerToken } from '@sitecore-content-sdk/core/tools';
|
|
14
|
+
import path from 'path';
|
|
14
15
|
/**
|
|
15
16
|
* Extracts components from the app folder and sends them to XMCloud.
|
|
16
|
-
* @param {
|
|
17
|
+
* @param {ExtractFilesConfig} args - Config for components extraction
|
|
17
18
|
*/
|
|
18
|
-
export const
|
|
19
|
+
export const extractFiles = (args) => {
|
|
19
20
|
const authParams = {
|
|
20
21
|
clientId: process.env.SITECORE_AUTH_CLIENT_ID || '',
|
|
21
22
|
clientSecret: process.env.SITECORE_AUTH_CLIENT_SECRET || '',
|
|
@@ -33,22 +34,33 @@ export const extractComponents = (args) => {
|
|
|
33
34
|
}
|
|
34
35
|
const basePath = process.cwd();
|
|
35
36
|
try {
|
|
37
|
+
// MESH_URL is temporary option to use until mesh is onboarded into Edge Proxy
|
|
38
|
+
const targetUrl = process.env.SITECORE_MESH_URL || args.scConfig.api.edge.edgeUrl;
|
|
36
39
|
const bearer = yield fetchBearerToken(authParams);
|
|
37
40
|
if (!bearer) {
|
|
38
41
|
console.error(chalk.red('Failed to get bearer token, aborting code extraction'));
|
|
39
42
|
return;
|
|
40
43
|
}
|
|
41
44
|
const componentPaths = yield resolveComponentImportFiles(basePath, args.componentMapPath);
|
|
42
|
-
const
|
|
45
|
+
const fileDispatches = Array.from(componentPaths, (mapEntry) => sendCode({
|
|
43
46
|
file: {
|
|
44
47
|
name: mapEntry[0],
|
|
45
48
|
path: mapEntry[1],
|
|
46
49
|
type: ExtractedFileType.Component,
|
|
47
50
|
},
|
|
48
51
|
token: bearer,
|
|
49
|
-
|
|
52
|
+
targetUrl,
|
|
50
53
|
}));
|
|
51
|
-
|
|
54
|
+
fileDispatches.push(sendCode({
|
|
55
|
+
file: {
|
|
56
|
+
name: 'package.json',
|
|
57
|
+
path: path.resolve(basePath, './package.json'),
|
|
58
|
+
type: ExtractedFileType.PackageJson,
|
|
59
|
+
},
|
|
60
|
+
token: bearer,
|
|
61
|
+
targetUrl,
|
|
62
|
+
}));
|
|
63
|
+
yield Promise.all(fileDispatches);
|
|
52
64
|
}
|
|
53
65
|
catch (error) {
|
|
54
66
|
console.error(chalk.red('Error during component extraction:', error));
|
|
@@ -11,7 +11,7 @@ import chalk from 'chalk';
|
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import fs from 'fs';
|
|
13
13
|
import * as ts from 'typescript';
|
|
14
|
-
import {
|
|
14
|
+
import { debug } from '@sitecore-content-sdk/core';
|
|
15
15
|
/**
|
|
16
16
|
* Type of file to be sent to the mesh endpoint
|
|
17
17
|
*/
|
|
@@ -19,7 +19,7 @@ export var ExtractedFileType;
|
|
|
19
19
|
(function (ExtractedFileType) {
|
|
20
20
|
ExtractedFileType["Component"] = "component";
|
|
21
21
|
ExtractedFileType["Json"] = "json";
|
|
22
|
-
ExtractedFileType["
|
|
22
|
+
ExtractedFileType["PackageJson"] = "package.json";
|
|
23
23
|
})(ExtractedFileType || (ExtractedFileType = {}));
|
|
24
24
|
/**
|
|
25
25
|
* Validates consent for code extraction procedures
|
|
@@ -54,10 +54,10 @@ export const validateDeployContext = () => {
|
|
|
54
54
|
* Parses the componentBuilder.ts file and returns a map of component names
|
|
55
55
|
* and their respective import strings
|
|
56
56
|
* @param {string} appPath path to the JSS app root
|
|
57
|
-
* @param {string} [componentMapPath] path to the app's component map file. Default: 'src/lib/
|
|
57
|
+
* @param {string} [componentMapPath] path to the app's component map file. Default: 'src/lib/component-map.ts'
|
|
58
58
|
* @returns map of component names and their respective import strings
|
|
59
59
|
*/
|
|
60
|
-
export const resolveComponentImportFiles = (appPath, componentMapPath = './src/lib/
|
|
60
|
+
export const resolveComponentImportFiles = (appPath, componentMapPath = './src/lib/component-map.ts') => {
|
|
61
61
|
appPath = path.isAbsolute(appPath) ? appPath : path.resolve(process.cwd(), appPath);
|
|
62
62
|
const tsConfig = ts.readConfigFile(path.resolve(appPath, 'tsconfig.json'), ts.sys.readFile);
|
|
63
63
|
if (tsConfig.error) {
|
|
@@ -123,8 +123,10 @@ export const resolveComponentImportFiles = (appPath, componentMapPath = './src/l
|
|
|
123
123
|
const resolvedModule = ts.nodeModuleNameResolver(moduleName, componentMapFullPath, cliCompilerOptions, tsHost);
|
|
124
124
|
const resolvedFile = (_a = resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName;
|
|
125
125
|
// module imports will be resolved to /node_modules location - we don't support that yet
|
|
126
|
-
if (resolvedFile
|
|
127
|
-
|
|
126
|
+
if (resolvedFile) {
|
|
127
|
+
if (resolvedFile.indexOf('node_modules') === -1 && !resolvedFile.endsWith('.d.ts')) {
|
|
128
|
+
importStringsMap[childNode.importClause.getText()] = path.resolve(resolvedFile);
|
|
129
|
+
}
|
|
128
130
|
}
|
|
129
131
|
else {
|
|
130
132
|
console.warn('Could not resolve a file for import %s', moduleName);
|
|
@@ -180,33 +182,43 @@ export const resolveComponentImportFiles = (appPath, componentMapPath = './src/l
|
|
|
180
182
|
}
|
|
181
183
|
return componentImportsMap;
|
|
182
184
|
};
|
|
183
|
-
export const sendCode = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file, token,
|
|
184
|
-
const
|
|
185
|
+
export const sendCode = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file, token, targetUrl, }) {
|
|
186
|
+
const apiEndpoint = `${targetUrl}/api/v1/contentsdk/code/extracted`;
|
|
185
187
|
if (!fs.existsSync(file.path)) {
|
|
186
|
-
console.error(chalk.red(`
|
|
188
|
+
console.error(chalk.red(`File not found: ${file.path}`));
|
|
187
189
|
return;
|
|
188
190
|
}
|
|
189
191
|
const code = fs.readFileSync(file.path);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
192
|
+
try {
|
|
193
|
+
const response = yield fetch(apiEndpoint, {
|
|
194
|
+
method: 'POST',
|
|
195
|
+
headers: {
|
|
196
|
+
Authorization: `Bearer ${token}`,
|
|
197
|
+
'Content-Type': 'application/json',
|
|
198
|
+
},
|
|
199
|
+
body: JSON.stringify({
|
|
200
|
+
// EnvironmentId can have any value - but it's required
|
|
201
|
+
EnvironmentId: 'ContentSDK',
|
|
202
|
+
name: file.name,
|
|
203
|
+
content: code.toString(),
|
|
204
|
+
labels: {
|
|
201
205
|
type: file.type,
|
|
202
206
|
},
|
|
203
|
-
},
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
}),
|
|
208
|
+
});
|
|
209
|
+
if (!response.ok) {
|
|
210
|
+
console.error(chalk.red(`Failed to send extracted code from ${file.path}: ${response.statusText}`));
|
|
211
|
+
debug.http('Error details: %o', {
|
|
212
|
+
status: response.status,
|
|
213
|
+
text: yield response.text(),
|
|
214
|
+
url: response.url,
|
|
215
|
+
headers: response.headers,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
208
218
|
}
|
|
209
|
-
|
|
210
|
-
console.
|
|
219
|
+
catch (error) {
|
|
220
|
+
console.error(chalk.red(`Fetch request to send extracted code from ${file.path} failed: ${JSON.stringify(error)}`));
|
|
221
|
+
return;
|
|
211
222
|
}
|
|
223
|
+
console.log(chalk.green(`Contents from ${file.path} extracted and sent to mesh endpoint`));
|
|
212
224
|
});
|
package/dist/esm/tools/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { generateSites, generateMetadata, getComponentList, generatePlugins, ModuleType, } from '@sitecore-content-sdk/core/tools';
|
|
2
|
-
export {
|
|
2
|
+
export { extractFiles } from './codegen/extract-files';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/nextjs",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.12",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -79,15 +79,15 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@babel/parser": "^7.27.2",
|
|
82
|
-
"@sitecore-content-sdk/core": "0.2.0-beta.
|
|
83
|
-
"@sitecore-content-sdk/react": "0.2.0-beta.
|
|
82
|
+
"@sitecore-content-sdk/core": "0.2.0-beta.12",
|
|
83
|
+
"@sitecore-content-sdk/react": "0.2.0-beta.12",
|
|
84
84
|
"recast": "^0.23.11",
|
|
85
85
|
"regex-parser": "^2.3.1",
|
|
86
86
|
"sync-disk-cache": "^2.1.0"
|
|
87
87
|
},
|
|
88
88
|
"description": "",
|
|
89
89
|
"types": "types/index.d.ts",
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "0f881567f6a9a60932f17d6c0397f54f1ce7673c",
|
|
91
91
|
"files": [
|
|
92
92
|
"dist",
|
|
93
93
|
"types",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SitecoreConfig } from '@sitecore-content-sdk/core/config';
|
|
2
|
+
export type ExtractFilesConfig = {
|
|
3
|
+
scConfig: SitecoreConfig;
|
|
4
|
+
componentMapPath?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Extracts components from the app folder and sends them to XMCloud.
|
|
8
|
+
* @param {ExtractFilesConfig} args - Config for components extraction
|
|
9
|
+
*/
|
|
10
|
+
export declare const extractFiles: (args: ExtractFilesConfig) => () => Promise<void>;
|
|
@@ -12,7 +12,7 @@ export type ExtractedFile = {
|
|
|
12
12
|
export declare enum ExtractedFileType {
|
|
13
13
|
Component = "component",
|
|
14
14
|
Json = "json",
|
|
15
|
-
|
|
15
|
+
PackageJson = "package.json"
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Validates consent for code extraction procedures
|
|
@@ -29,12 +29,12 @@ export declare const validateDeployContext: () => boolean;
|
|
|
29
29
|
* Parses the componentBuilder.ts file and returns a map of component names
|
|
30
30
|
* and their respective import strings
|
|
31
31
|
* @param {string} appPath path to the JSS app root
|
|
32
|
-
* @param {string} [componentMapPath] path to the app's component map file. Default: 'src/lib/
|
|
32
|
+
* @param {string} [componentMapPath] path to the app's component map file. Default: 'src/lib/component-map.ts'
|
|
33
33
|
* @returns map of component names and their respective import strings
|
|
34
34
|
*/
|
|
35
35
|
export declare const resolveComponentImportFiles: (appPath: string, componentMapPath?: string) => Map<string, string>;
|
|
36
|
-
export declare const sendCode: ({ file, token,
|
|
36
|
+
export declare const sendCode: ({ file, token, targetUrl, }: {
|
|
37
37
|
file: ExtractedFile;
|
|
38
38
|
token: string;
|
|
39
|
-
|
|
39
|
+
targetUrl: string;
|
|
40
40
|
}) => Promise<void>;
|
package/types/tools/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { generateSites, GenerateSitesConfig, generateMetadata, ComponentFile, PackageDefinition, getComponentList, PluginDefinition, generatePlugins, ModuleType, } from '@sitecore-content-sdk/core/tools';
|
|
2
|
-
export {
|
|
2
|
+
export { extractFiles } from './codegen/extract-files';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SitecoreConfig } from '@sitecore-content-sdk/core/config';
|
|
2
|
-
export type ExtractComponentsConfig = {
|
|
3
|
-
scConfig: SitecoreConfig;
|
|
4
|
-
componentMapPath?: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Extracts components from the app folder and sends them to XMCloud.
|
|
8
|
-
* @param {ExtractComponentsConfig} args - Config for components extraction
|
|
9
|
-
*/
|
|
10
|
-
export declare const extractComponents: (args: ExtractComponentsConfig) => () => Promise<void>;
|