@tridion-sites/extensions-cli 0.3.2 → 0.3.4
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/CHANGELOG.md +21 -0
- package/dist/addon/template/extension/package.json.hbs +31 -29
- package/dist/addon/template/extension/src/index.tsx.hbs +1 -3
- package/dist/addon/template/extension/tsconfig.json.hbs +4 -1
- package/dist/addon/template/extension/webpack.dev.config.js.hbs +1 -37
- package/dist/addon/template/extension/webpack.prod.config.js.hbs +1 -37
- package/dist/{addonManifest-30c25a45.js → addonManifest-45b9450a.js} +210 -210
- package/dist/cli.js +240 -242
- package/dist/index.js +72 -72
- package/package.json +5 -5
- package/dist/addon/template/extension/.npmrc.hbs +0 -1
- package/dist/addon/template/extension/src/index.css.hbs +0 -0
- package/dist/addon/template/extension/types/css.d.ts.hbs +0 -4
package/dist/index.js
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { resolve, basename } from 'node:path';
|
|
3
|
-
import { w as writeJsonFile, r as readJsonFile, A as AddonManifest } from './addonManifest-
|
|
3
|
+
import { w as writeJsonFile, r as readJsonFile, A as AddonManifest } from './addonManifest-45b9450a.js';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
|
|
6
|
-
class AddonConfiguration {
|
|
7
|
-
constructor(fileName, configPerExtension) {
|
|
8
|
-
Object.defineProperty(this, "fileName", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
configurable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
value: void 0
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(this, "configPerExtension", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: void 0
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(this, "writeFile", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: (path) => {
|
|
25
|
-
const configPath = resolve(path, this.fileName);
|
|
26
|
-
writeJsonFile(configPath, {
|
|
27
|
-
configuration: this.configPerExtension,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
this.fileName = fileName;
|
|
32
|
-
this.configPerExtension = configPerExtension;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
Object.defineProperty(AddonConfiguration, "fromFile", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: (configurationFilePath) => {
|
|
40
|
-
const configurationFile = readJsonFile(configurationFilePath);
|
|
41
|
-
const configuration = new AddonConfiguration(basename(configurationFilePath), configurationFile.configuration);
|
|
42
|
-
return configuration;
|
|
43
|
-
}
|
|
6
|
+
class AddonConfiguration {
|
|
7
|
+
constructor(fileName, configPerExtension) {
|
|
8
|
+
Object.defineProperty(this, "fileName", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: void 0
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "configPerExtension", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "writeFile", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: (path) => {
|
|
25
|
+
const configPath = resolve(path, this.fileName);
|
|
26
|
+
writeJsonFile(configPath, {
|
|
27
|
+
configuration: this.configPerExtension,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
this.fileName = fileName;
|
|
32
|
+
this.configPerExtension = configPerExtension;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(AddonConfiguration, "fromFile", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: (configurationFilePath) => {
|
|
40
|
+
const configurationFile = readJsonFile(configurationFilePath);
|
|
41
|
+
const configuration = new AddonConfiguration(basename(configurationFilePath), configurationFile.configuration);
|
|
42
|
+
return configuration;
|
|
43
|
+
}
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
const extensionsRequestBasePath = '/api/uiExtensionsRepository';
|
|
47
|
-
const getLocalFrontendAddon = ({ manifestPath, addonConfigPath }) => {
|
|
48
|
-
const manifest = AddonManifest.fromFile(manifestPath);
|
|
49
|
-
const addonConfiguration = addonConfigPath ? AddonConfiguration.fromFile(addonConfigPath) : undefined;
|
|
50
|
-
const localAddon = {
|
|
51
|
-
Hash: Date.now().toString(),
|
|
52
|
-
Id: 'LocalAddon',
|
|
53
|
-
Configuration: {},
|
|
54
|
-
Extensions: [],
|
|
55
|
-
};
|
|
56
|
-
const localExtensions = manifest.getFrontendExtensions();
|
|
57
|
-
localExtensions.forEach(extension => {
|
|
58
|
-
var _a;
|
|
59
|
-
localAddon.Configuration[extension.name] = (addonConfiguration === null || addonConfiguration === void 0 ? void 0 : addonConfiguration.configPerExtension[extension.name]) || {};
|
|
60
|
-
const extensionFiles = extension.files.map(filePath => `${extensionsRequestBasePath}/${extension.name}/${filePath}?hash=${Date.now()}`);
|
|
61
|
-
(_a = localAddon.Extensions) === null || _a === void 0 ? void 0 : _a.push({
|
|
62
|
-
Name: extension.name,
|
|
63
|
-
MainFile: `${extensionsRequestBasePath}/${extension.name}/${extension.main}`,
|
|
64
|
-
Contents: extensionFiles,
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
return localAddon;
|
|
46
|
+
const extensionsRequestBasePath = '/api/uiExtensionsRepository';
|
|
47
|
+
const getLocalFrontendAddon = ({ manifestPath, addonConfigPath }) => {
|
|
48
|
+
const manifest = AddonManifest.fromFile(manifestPath);
|
|
49
|
+
const addonConfiguration = addonConfigPath ? AddonConfiguration.fromFile(addonConfigPath) : undefined;
|
|
50
|
+
const localAddon = {
|
|
51
|
+
Hash: Date.now().toString(),
|
|
52
|
+
Id: 'LocalAddon',
|
|
53
|
+
Configuration: {},
|
|
54
|
+
Extensions: [],
|
|
55
|
+
};
|
|
56
|
+
const localExtensions = manifest.getFrontendExtensions();
|
|
57
|
+
localExtensions.forEach(extension => {
|
|
58
|
+
var _a;
|
|
59
|
+
localAddon.Configuration[extension.name] = (addonConfiguration === null || addonConfiguration === void 0 ? void 0 : addonConfiguration.configPerExtension[extension.name]) || {};
|
|
60
|
+
const extensionFiles = extension.files.map(filePath => `${extensionsRequestBasePath}/${extension.name}/${filePath}?hash=${Date.now()}`);
|
|
61
|
+
(_a = localAddon.Extensions) === null || _a === void 0 ? void 0 : _a.push({
|
|
62
|
+
Name: extension.name,
|
|
63
|
+
MainFile: `${extensionsRequestBasePath}/${extension.name}/${extension.main}`,
|
|
64
|
+
Contents: extensionFiles,
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
return localAddon;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
const setupExtensionsResponse = ({ app, webAppPath, manifestPath, addonConfigPath, }) => {
|
|
71
|
-
const basePath = webAppPath.endsWith('/') ? webAppPath : `${webAppPath}/`;
|
|
72
|
-
app.get(`${basePath}api/v2.0/extensions`, (request, response) => {
|
|
73
|
-
const localAddon = getLocalFrontendAddon({
|
|
74
|
-
manifestPath,
|
|
75
|
-
addonConfigPath,
|
|
76
|
-
});
|
|
77
|
-
const liveAddons = /*await ExtensionsService.getExtensions()*/ [];
|
|
78
|
-
const result = [...liveAddons, localAddon];
|
|
79
|
-
response.json(result);
|
|
80
|
-
});
|
|
70
|
+
const setupExtensionsResponse = ({ app, webAppPath, manifestPath, addonConfigPath, }) => {
|
|
71
|
+
const basePath = webAppPath.endsWith('/') ? webAppPath : `${webAppPath}/`;
|
|
72
|
+
app.get(`${basePath}api/v2.0/extensions`, (request, response) => {
|
|
73
|
+
const localAddon = getLocalFrontendAddon({
|
|
74
|
+
manifestPath,
|
|
75
|
+
addonConfigPath,
|
|
76
|
+
});
|
|
77
|
+
const liveAddons = /*await ExtensionsService.getExtensions()*/ [];
|
|
78
|
+
const result = [...liveAddons, localAddon];
|
|
79
|
+
response.json(result);
|
|
80
|
+
});
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
export { extensionsRequestBasePath, getLocalFrontendAddon, setupExtensionsResponse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tridion-sites/extensions-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "CLI to develop, build and package extensions for Tridion Experience Space",
|
|
5
5
|
"author": "RWS",
|
|
6
6
|
"homepage": "https://www.rws.com",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"test": "sites-extensions"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@tridion-sites/extensions": "0.5.
|
|
35
|
-
"@tridion-sites/models": "0.1.
|
|
36
|
-
"@tridion-sites/open-api-client": "1.0.
|
|
34
|
+
"@tridion-sites/extensions": "0.5.1",
|
|
35
|
+
"@tridion-sites/models": "0.1.1",
|
|
36
|
+
"@tridion-sites/open-api-client": "1.0.5",
|
|
37
37
|
"archiver": "5.3.1",
|
|
38
38
|
"chalk": "5.2.0",
|
|
39
39
|
"commander": "10.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"rollup": "3.11.0",
|
|
60
60
|
"rollup-plugin-delete": "2.0.0",
|
|
61
61
|
"rollup-plugin-node-externals": "5.1.0",
|
|
62
|
-
"typescript": "
|
|
62
|
+
"typescript": "5.0.4",
|
|
63
63
|
"typescript-transform-paths": "3.4.6"
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@tridion-sites:registry=https://nexus.sdl.com/repository/npm/
|
|
File without changes
|