@fontoxml/fontoxml-development-tools 3.10.0 → 3.12.0-beta.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/npm-shrinkwrap.json +3842 -8330
- package/package.json +13 -19
- package/src/App.js +1 -1
- package/src/FdtCommand.js +3 -3
- package/src/FdtLicense.js +95 -114
- package/src/ModuleRegistrationApi.js +44 -16
- package/src/addCoreModulesToApp.js +8 -0
- package/src/editorVersions.js +19 -5
- package/src/modules/connectors/index.js +109 -16
- package/src/modules/connectors/instanceBuild/Dockerfile.build +1 -1
- package/src/modules/connectors/instanceBuild/Dockerfile.run +1 -1
- package/src/modules/connectors/instanceDevBuild/docker-compose.yml +2 -2
- package/src/modules/content-quality/index.js +101 -20
- package/src/modules/content-quality/instanceBuild/Dockerfile +1 -1
- package/src/modules/content-quality/instanceDevBuild/docker-compose.yml +1 -1
- package/src/modules/core/src/precontroller.help.js +23 -26
- package/src/modules/document-history/index.js +101 -20
- package/src/modules/document-history/instanceBuild/Dockerfile +1 -1
- package/src/modules/document-history/instanceDevBuild/docker-compose.yml +1 -1
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureConnectorsCmsStandardDocumentRouter.js +10 -0
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentHistoryGetPostRouteHandler.js +51 -0
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentPostRouteHandler.js +65 -76
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentPresearchPostRouteHandler.js +10 -7
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentPreviewRouteHandler.js +10 -0
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentRevisionGetPostRouteHandler.js +69 -0
- package/src/modules/editor/src/commands/command.convert.editor.controller.js +11 -4
- package/src/modules/editor/src/commands/command.convert.package.controller.js +11 -4
- package/src/modules/editor/src/getAppManifest.js +3 -3
- package/src/modules/editor/src/getWebpackConfig.js +13 -0
- package/src/modules/editor/src/webpackPlugins/CheckDeepImportsResolvePlugin.js +4 -0
- package/src/modules/editor-pre-7-7-0/src/api/downloadEditorSDK.js +16 -12
- package/src/modules/editor-pre-7-7-0/src/api/executeAndLog.js +3 -2
- package/src/modules/editor-pre-7-7-0/src/api/init/createConfigConfiguration.js +86 -48
- package/src/modules/editor-pre-7-7-0/src/api/schema/compile.js +16 -22
- package/src/modules/editor-pre-7-7-0/src/api/schema/createSchemaPackages.js +8 -0
- package/src/modules/editor-pre-7-7-0/src/api/schema/getSchemaFontoJson.js +76 -48
- package/src/modules/editor-pre-7-7-0/src/api/schema/zipHelpers.js +6 -1
- package/src/modules/editor-pre-7-7-0/src/command.schema.compile.controller.js +51 -2
- package/src/modules/editor-pre-7-7-0/test/api/init/createConfigConfiguration.test.js +71 -33
- package/src/modules/editor-pre-7-7-0/test/api/init/fixtures/configjs-7160.js +45 -0
- package/src/modules/editor-pre-7-7-0/test/api/init/fixtures/configjs-800.js +45 -0
- package/src/modules/editor-pre-7-7-0/test/api/init/fixtures/configjs-810.js +32 -0
- package/src/modules/editor-pre-7-7-0/test/api/schema/buildSchemaExperienceConfigurationModel.test.js +70 -79
- package/src/modules/editor-pre-7-7-0/test/api/schema/fixtures/dita-example-schema-bundle/listOfFiles.json +1 -36
- package/src/modules/editor-pre-7-7-0/test/api/schema/fixtures/invalid-fonto-json/fonto.json +1 -0
- package/src/modules/editor-pre-7-7-0/test/api/schema/getSchemaFontoJson.test.js +174 -0
- package/src/modules/editor-pre-7-7-0/test/api/schema/zipSchemaSource.test.js +10 -4
- package/src/modules/editor-pre-7-7-0/test/schemaCompileController.test.js +205 -0
- package/src/modules/localization/index.js +2 -2
- package/src/modules/operations/src/api/getOperations.js +3 -3
- package/src/modules/review/index.js +103 -18
- package/src/modules/review/instanceBuild/Dockerfile +1 -1
- package/src/modules/review/instanceDevBuild/docker-compose.yml +1 -1
- package/src/modules/schema/src/api/getSchemaSummaries.js +2 -2
- package/src/modules/schema/test/getSchemaSummaries.test.js +14 -10
- package/src/modules/schema-compiler/index.js +99 -18
- package/src/modules/schema-compiler/instanceBuild/Dockerfile +1 -1
- package/src/modules/schema-compiler/instanceDevBuild/docker-compose.yml +1 -1
- package/src/modules/shared/index.js +3 -0
- package/src/modules/shared/package.json +14 -0
- package/src/modules/shared/src/addBackendDockerCommands.js +334 -0
- package/src/modules/shared/src/addBackendDownloadSelfContainedCommands.js +78 -0
- package/src/modules/shared/src/addBackendVersionsCommands.js +55 -0
- package/src/modules/shared/src/controller-templates/command.backend.build.controller.factory.js +273 -0
- package/src/modules/shared/src/controller-templates/command.backend.download-self-contained.controller.factory.js +131 -0
- package/src/modules/shared/src/controller-templates/command.backend.init.controller.factory.js +88 -0
- package/src/modules/shared/src/controller-templates/command.backend.run.controller.factory.js +420 -0
- package/src/modules/shared/src/controller-templates/command.backend.upgrade.controller.factory.js +79 -0
- package/src/modules/shared/src/controller-templates/command.backend.versions.controller.factory.js +23 -0
- package/src/modules/shared/src/controller-templates/docker/BackendManifest.js +42 -0
- package/src/modules/shared/src/controller-templates/docker/copyWhitelistedFiles.js +23 -0
- package/src/modules/shared/src/controller-templates/docker/dockerCleanup.js +146 -0
- package/src/modules/shared/src/controller-templates/docker/tryDockerLogout.js +31 -0
- package/src/modules/shared/src/controller-templates/docker/validateBackendInstance.js +48 -0
- package/src/modules/shared/src/ensureDockerCommands.js +61 -0
- package/src/modules/shared/src/executeAndLog.js +113 -0
- package/src/modules/{review/src/utilities/setEntryVisibility.js → shared/src/setFileVisibility.js} +8 -2
- package/src/modules/spell-checker/index.js +101 -18
- package/src/modules/spell-checker/instanceBuild/Dockerfile +1 -1
- package/src/modules/spell-checker/instanceDevBuild/docker-compose.yml +1 -1
- package/test/module.shared.test.js +81 -0
- package/src/modules/connectors/src/command.build.controller.js +0 -256
- package/src/modules/connectors/src/command.build.js +0 -54
- package/src/modules/connectors/src/command.download-self-contained.controller.js +0 -110
- package/src/modules/connectors/src/command.download-self-contained.js +0 -50
- package/src/modules/connectors/src/command.init.controller.js +0 -91
- package/src/modules/connectors/src/command.init.js +0 -42
- package/src/modules/connectors/src/command.run.controller.js +0 -462
- package/src/modules/connectors/src/command.run.js +0 -67
- package/src/modules/connectors/src/command.upgrade.controller.js +0 -52
- package/src/modules/connectors/src/command.upgrade.js +0 -42
- package/src/modules/connectors/src/command.versions.controller.js +0 -14
- package/src/modules/connectors/src/command.versions.js +0 -25
- package/src/modules/connectors/src/utilities/FontoxmlConnectorsManifest.js +0 -32
- package/src/modules/connectors/src/utilities/cleanup.js +0 -70
- package/src/modules/connectors/src/utilities/constants.js +0 -42
- package/src/modules/connectors/src/utilities/copyWhitelistedFiles.js +0 -22
- package/src/modules/connectors/src/utilities/executeAndLog.js +0 -63
- package/src/modules/connectors/src/utilities/getVerbosityLevel.js +0 -11
- package/src/modules/connectors/src/utilities/getWhitelist.js +0 -16
- package/src/modules/connectors/src/utilities/setEntryVisibility.js +0 -22
- package/src/modules/connectors/src/utilities/validateInstance.js +0 -29
- package/src/modules/content-quality/src/command.build.controller.js +0 -260
- package/src/modules/content-quality/src/command.build.js +0 -56
- package/src/modules/content-quality/src/command.download-self-contained.controller.js +0 -110
- package/src/modules/content-quality/src/command.download-self-contained.js +0 -52
- package/src/modules/content-quality/src/command.init.controller.js +0 -91
- package/src/modules/content-quality/src/command.init.js +0 -44
- package/src/modules/content-quality/src/command.run.controller.js +0 -444
- package/src/modules/content-quality/src/command.run.js +0 -64
- package/src/modules/content-quality/src/command.upgrade.controller.js +0 -52
- package/src/modules/content-quality/src/command.upgrade.js +0 -44
- package/src/modules/content-quality/src/command.versions.controller.js +0 -14
- package/src/modules/content-quality/src/command.versions.js +0 -25
- package/src/modules/content-quality/src/utilities/FontoxmlFcqManifest.js +0 -30
- package/src/modules/content-quality/src/utilities/cleanup.js +0 -70
- package/src/modules/content-quality/src/utilities/constants.js +0 -44
- package/src/modules/content-quality/src/utilities/copyWhitelistedFiles.js +0 -22
- package/src/modules/content-quality/src/utilities/executeAndLog.js +0 -63
- package/src/modules/content-quality/src/utilities/getVerbosityLevel.js +0 -11
- package/src/modules/content-quality/src/utilities/getWhitelist.js +0 -16
- package/src/modules/content-quality/src/utilities/setEntryVisibility.js +0 -22
- package/src/modules/content-quality/src/utilities/validateInstance.js +0 -29
- package/src/modules/document-history/src/command.build.controller.js +0 -260
- package/src/modules/document-history/src/command.build.js +0 -56
- package/src/modules/document-history/src/command.download-self-contained.controller.js +0 -110
- package/src/modules/document-history/src/command.download-self-contained.js +0 -50
- package/src/modules/document-history/src/command.init.controller.js +0 -91
- package/src/modules/document-history/src/command.init.js +0 -44
- package/src/modules/document-history/src/command.run.controller.js +0 -444
- package/src/modules/document-history/src/command.run.js +0 -64
- package/src/modules/document-history/src/command.upgrade.controller.js +0 -52
- package/src/modules/document-history/src/command.upgrade.js +0 -44
- package/src/modules/document-history/src/command.versions.controller.js +0 -14
- package/src/modules/document-history/src/command.versions.js +0 -25
- package/src/modules/document-history/src/utilities/FontoxmlFdhManifest.js +0 -30
- package/src/modules/document-history/src/utilities/cleanup.js +0 -70
- package/src/modules/document-history/src/utilities/constants.js +0 -44
- package/src/modules/document-history/src/utilities/copyWhitelistedFiles.js +0 -22
- package/src/modules/document-history/src/utilities/executeAndLog.js +0 -63
- package/src/modules/document-history/src/utilities/getVerbosityLevel.js +0 -11
- package/src/modules/document-history/src/utilities/getWhitelist.js +0 -16
- package/src/modules/document-history/src/utilities/setEntryVisibility.js +0 -22
- package/src/modules/document-history/src/utilities/validateInstance.js +0 -29
- package/src/modules/review/src/command.build.controller.js +0 -256
- package/src/modules/review/src/command.build.js +0 -54
- package/src/modules/review/src/command.download-self-contained.controller.js +0 -107
- package/src/modules/review/src/command.download-self-contained.js +0 -50
- package/src/modules/review/src/command.init.controller.js +0 -89
- package/src/modules/review/src/command.init.js +0 -42
- package/src/modules/review/src/command.run.controller.js +0 -428
- package/src/modules/review/src/command.run.js +0 -60
- package/src/modules/review/src/command.upgrade.controller.js +0 -59
- package/src/modules/review/src/command.upgrade.js +0 -42
- package/src/modules/review/src/command.versions.controller.js +0 -12
- package/src/modules/review/src/command.versions.js +0 -25
- package/src/modules/review/src/utilities/FontoxmlReviewManifest.js +0 -30
- package/src/modules/review/src/utilities/cleanup.js +0 -70
- package/src/modules/review/src/utilities/constants.js +0 -42
- package/src/modules/review/src/utilities/copyWhitelistedFiles.js +0 -22
- package/src/modules/review/src/utilities/executeAndLog.js +0 -63
- package/src/modules/review/src/utilities/getVerbosityLevel.js +0 -11
- package/src/modules/review/src/utilities/getWhitelist.js +0 -16
- package/src/modules/review/src/utilities/validateInstance.js +0 -45
- package/src/modules/schema-compiler/src/command.build.controller.js +0 -256
- package/src/modules/schema-compiler/src/command.build.js +0 -54
- package/src/modules/schema-compiler/src/command.download-self-contained.controller.js +0 -110
- package/src/modules/schema-compiler/src/command.download-self-contained.js +0 -50
- package/src/modules/schema-compiler/src/command.init.controller.js +0 -91
- package/src/modules/schema-compiler/src/command.init.js +0 -42
- package/src/modules/schema-compiler/src/command.run.controller.js +0 -430
- package/src/modules/schema-compiler/src/command.run.js +0 -60
- package/src/modules/schema-compiler/src/command.upgrade.controller.js +0 -64
- package/src/modules/schema-compiler/src/command.upgrade.js +0 -42
- package/src/modules/schema-compiler/src/command.versions.controller.js +0 -14
- package/src/modules/schema-compiler/src/command.versions.js +0 -25
- package/src/modules/schema-compiler/src/utilities/FontoxmlSchemaCompilerManifest.js +0 -32
- package/src/modules/schema-compiler/src/utilities/cleanup.js +0 -70
- package/src/modules/schema-compiler/src/utilities/constants.js +0 -43
- package/src/modules/schema-compiler/src/utilities/copyWhitelistedFiles.js +0 -22
- package/src/modules/schema-compiler/src/utilities/executeAndLog.js +0 -63
- package/src/modules/schema-compiler/src/utilities/getVerbosityLevel.js +0 -11
- package/src/modules/schema-compiler/src/utilities/getWhitelist.js +0 -16
- package/src/modules/schema-compiler/src/utilities/setEntryVisibility.js +0 -22
- package/src/modules/schema-compiler/src/utilities/validateInstance.js +0 -47
- package/src/modules/spell-checker/src/command.build.controller.js +0 -257
- package/src/modules/spell-checker/src/command.build.js +0 -54
- package/src/modules/spell-checker/src/command.download-self-contained.controller.js +0 -110
- package/src/modules/spell-checker/src/command.download-self-contained.js +0 -50
- package/src/modules/spell-checker/src/command.init.controller.js +0 -91
- package/src/modules/spell-checker/src/command.init.js +0 -42
- package/src/modules/spell-checker/src/command.run.controller.js +0 -430
- package/src/modules/spell-checker/src/command.run.js +0 -62
- package/src/modules/spell-checker/src/command.upgrade.controller.js +0 -61
- package/src/modules/spell-checker/src/command.upgrade.js +0 -42
- package/src/modules/spell-checker/src/command.versions.controller.js +0 -14
- package/src/modules/spell-checker/src/command.versions.js +0 -25
- package/src/modules/spell-checker/src/utilities/FontoxmlSpellCheckerManifest.js +0 -32
- package/src/modules/spell-checker/src/utilities/cleanup.js +0 -70
- package/src/modules/spell-checker/src/utilities/constants.js +0 -42
- package/src/modules/spell-checker/src/utilities/copyWhitelistedFiles.js +0 -22
- package/src/modules/spell-checker/src/utilities/executeAndLog.js +0 -63
- package/src/modules/spell-checker/src/utilities/getVerbosityLevel.js +0 -11
- package/src/modules/spell-checker/src/utilities/getWhitelist.js +0 -16
- package/src/modules/spell-checker/src/utilities/setEntryVisibility.js +0 -22
- package/src/modules/spell-checker/src/utilities/validateInstance.js +0 -47
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
3
|
+
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = path.dirname(__filename);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef AddBackendDockerCommandsOptions
|
|
9
|
+
*
|
|
10
|
+
* @property {string} productLabel
|
|
11
|
+
* @property {string} commandPrefix
|
|
12
|
+
* @property {string} [commandAlias]
|
|
13
|
+
* @property {string} licenseProductName
|
|
14
|
+
*
|
|
15
|
+
* @property {string} [documentationConfigurationGuide]
|
|
16
|
+
* @property {string} [documentationExecuteError]
|
|
17
|
+
* @property {string} [documentationGettingStartedGuide]
|
|
18
|
+
*
|
|
19
|
+
* @property {string} defaultHttpPort
|
|
20
|
+
* @property {string} [defaultHttpsPort]
|
|
21
|
+
* @property {string} defaultImageName
|
|
22
|
+
* @property {string} defaultImageTag
|
|
23
|
+
*
|
|
24
|
+
* @property {string} manifestFileName
|
|
25
|
+
* @property {string} manifestVersionPropertyName
|
|
26
|
+
*
|
|
27
|
+
* @property {string} instanceBuildDockerfilePath
|
|
28
|
+
* @property {string} instanceDevBuildDirectoryPath
|
|
29
|
+
* @property {string} instanceDevBuildDockerfilePath
|
|
30
|
+
* @property {string} instanceTemplateDirectoryPath
|
|
31
|
+
*
|
|
32
|
+
* @property {string} temporaryBuildDirectoryName
|
|
33
|
+
* @property {string} temporaryDirectoryName
|
|
34
|
+
* @property {string[]} requiredConfiguration
|
|
35
|
+
* @property {string[]} whitelist
|
|
36
|
+
*
|
|
37
|
+
* @property {{[key: string]: string}} debugEnvEntries
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {ModuleRegistrationApi} moduleRegistration
|
|
42
|
+
* @param {FdtCommand} command
|
|
43
|
+
* @param {AddBackendDockerCommandsOptions} options
|
|
44
|
+
*/
|
|
45
|
+
function addBackendDockerBuildCommand(moduleRegistration, command, options) {
|
|
46
|
+
const buildCommand = command.addCommand('build', async (...args) => {
|
|
47
|
+
const controllerFactory = (
|
|
48
|
+
await import(
|
|
49
|
+
pathToFileURL(
|
|
50
|
+
path.resolve(
|
|
51
|
+
__dirname,
|
|
52
|
+
'controller-templates',
|
|
53
|
+
'command.backend.build.controller.factory.js'
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
).default;
|
|
58
|
+
return controllerFactory(options)(...args);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
buildCommand
|
|
62
|
+
.setDescription(
|
|
63
|
+
`Build a ${options.productLabel} Docker image for production use. Requires Docker to be installed.`
|
|
64
|
+
)
|
|
65
|
+
.addOption(
|
|
66
|
+
'image-name',
|
|
67
|
+
'n',
|
|
68
|
+
`The name of the Docker image which will be created. This defaults to ${options.defaultImageName}.`,
|
|
69
|
+
false
|
|
70
|
+
)
|
|
71
|
+
.addOption(
|
|
72
|
+
'image-tag',
|
|
73
|
+
't',
|
|
74
|
+
`The tag of the Docker image which will be created. This defaults to ${options.defaultImageTag}.`,
|
|
75
|
+
false
|
|
76
|
+
)
|
|
77
|
+
.addOption(
|
|
78
|
+
'location',
|
|
79
|
+
'l',
|
|
80
|
+
'The directory where the instance is located. Defaults to the current working directory.',
|
|
81
|
+
false
|
|
82
|
+
)
|
|
83
|
+
.addOption(
|
|
84
|
+
'verbose',
|
|
85
|
+
null,
|
|
86
|
+
'Output default stdout and stderr information.'
|
|
87
|
+
)
|
|
88
|
+
.addOption('debug', null, 'Output all debug information.')
|
|
89
|
+
|
|
90
|
+
.addExample(
|
|
91
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
92
|
+
options.commandPrefix
|
|
93
|
+
} build`,
|
|
94
|
+
`Build production image "${options.defaultImageName}:${options.defaultImageTag}" using the ${options.productLabel} instance located at the current working directory.`
|
|
95
|
+
)
|
|
96
|
+
.addExample(
|
|
97
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
98
|
+
options.commandPrefix
|
|
99
|
+
} build --image-name my-instance --image-tag 1.0.0 --location /opt/my-instance/`,
|
|
100
|
+
`Build production image "my-instance:1.0.0" using the ${options.productLabel} instance located at "/opt/my-instance/".`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @param {ModuleRegistrationApi} moduleRegistration
|
|
106
|
+
* @param {FdtCommand} command
|
|
107
|
+
* @param {AddBackendDockerCommandsOptions} options
|
|
108
|
+
*/
|
|
109
|
+
function addBackendDockerInitCommand(moduleRegistration, command, options) {
|
|
110
|
+
const initCommand = command.addCommand('init', async (...args) => {
|
|
111
|
+
const controllerFactory = (
|
|
112
|
+
await import(
|
|
113
|
+
pathToFileURL(
|
|
114
|
+
path.resolve(
|
|
115
|
+
__dirname,
|
|
116
|
+
'controller-templates',
|
|
117
|
+
'command.backend.init.controller.factory.js'
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
).default;
|
|
122
|
+
return controllerFactory(options)(...args);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
initCommand
|
|
126
|
+
.setDescription(
|
|
127
|
+
`Initialize a ${options.productLabel} instance in an empty or nonexistent directory.`
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
.addOption(
|
|
131
|
+
'location',
|
|
132
|
+
'l',
|
|
133
|
+
'The directory where to initialize the instance. If not set this defaults to the current working directory. Note that the directory has to empty or nonexistent.',
|
|
134
|
+
false
|
|
135
|
+
)
|
|
136
|
+
.addOption(
|
|
137
|
+
'version',
|
|
138
|
+
null,
|
|
139
|
+
'The version to initialize with. Can be either a specific version or "nightly". Be warned: nightly can be unstable or may not work at all.',
|
|
140
|
+
true
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
.addExample(
|
|
144
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
145
|
+
options.commandPrefix
|
|
146
|
+
} init --version x.x.x`,
|
|
147
|
+
`Initialize a new ${options.productLabel} instance located at the current working directory.`
|
|
148
|
+
)
|
|
149
|
+
.addExample(
|
|
150
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
151
|
+
options.commandPrefix
|
|
152
|
+
} init --location /opt/my-instance/ --version x.x.x`,
|
|
153
|
+
`Initialize a new ${options.productLabel} instance located at "/opt/my-instance/".`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @param {ModuleRegistrationApi} moduleRegistration
|
|
159
|
+
* @param {FdtCommand} command
|
|
160
|
+
* @param {AddBackendDockerCommandsOptions} options
|
|
161
|
+
*/
|
|
162
|
+
function addBackendDockerRunCommand(moduleRegistration, command, options) {
|
|
163
|
+
const hasHttps = !!options.defaultHttpsPort;
|
|
164
|
+
|
|
165
|
+
const runCommand = command.addCommand('run', async (...args) => {
|
|
166
|
+
const controllerFactory = (
|
|
167
|
+
await import(
|
|
168
|
+
pathToFileURL(
|
|
169
|
+
path.resolve(
|
|
170
|
+
__dirname,
|
|
171
|
+
'controller-templates',
|
|
172
|
+
'command.backend.run.controller.factory.js'
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
)
|
|
176
|
+
).default;
|
|
177
|
+
return controllerFactory(options)(...args);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
runCommand.setDescription(
|
|
181
|
+
`Run a ${options.productLabel} instance${
|
|
182
|
+
hasHttps ? 'with a self-signed certificate' : ''
|
|
183
|
+
} for development purposes. Requires Docker to be installed.`
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
if (hasHttps) {
|
|
187
|
+
runCommand
|
|
188
|
+
.addOption(
|
|
189
|
+
'http-port',
|
|
190
|
+
null,
|
|
191
|
+
`Listen on the specified http port instead of listening on the default port (default=${options.defaultHttpPort}).`
|
|
192
|
+
)
|
|
193
|
+
.addOption(
|
|
194
|
+
'https-port',
|
|
195
|
+
null,
|
|
196
|
+
`Listen on the specified https port instead of listening on the default port (default=${options.defaultHttpsPort}).`
|
|
197
|
+
);
|
|
198
|
+
} else {
|
|
199
|
+
runCommand.addOption(
|
|
200
|
+
'port',
|
|
201
|
+
'p',
|
|
202
|
+
`Listen on the specified http port instead of listening on the default port (default=${options.defaultHttpPort}).`
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
runCommand
|
|
207
|
+
.addOption(
|
|
208
|
+
'location',
|
|
209
|
+
'l',
|
|
210
|
+
'The directory where the instance is located. Defaults to the current working directory.',
|
|
211
|
+
false
|
|
212
|
+
)
|
|
213
|
+
.addOption(
|
|
214
|
+
'config-location',
|
|
215
|
+
'c',
|
|
216
|
+
`The path where the configuration file (.env) is located.${
|
|
217
|
+
options.documentationConfigurationGuide
|
|
218
|
+
? ` Information about the .env file can be found at ${options.documentationConfigurationGuide}.`
|
|
219
|
+
: ''
|
|
220
|
+
}`,
|
|
221
|
+
false
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
.addOption(
|
|
225
|
+
'verbose',
|
|
226
|
+
null,
|
|
227
|
+
'Output default stdout and stderr information.'
|
|
228
|
+
)
|
|
229
|
+
.addOption(
|
|
230
|
+
'debug',
|
|
231
|
+
null,
|
|
232
|
+
`Output all debug information. This also overrides the ${Object.keys(
|
|
233
|
+
options.debugEnvEntries
|
|
234
|
+
).join(', ')} environment options if set.`
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
.addExample(
|
|
238
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
239
|
+
options.commandPrefix
|
|
240
|
+
} run`,
|
|
241
|
+
`Build and run a development image using the ${options.productLabel} instance and configuration located at the current working directory.`
|
|
242
|
+
)
|
|
243
|
+
.addExample(
|
|
244
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
245
|
+
options.commandPrefix
|
|
246
|
+
} run --location /opt/my-instances/specific-instance/ --config-location /opt/my-instances/.env`,
|
|
247
|
+
`Build and run a development image using the ${options.productLabel} instance located at "/opt/my-instances/specific-instance/" using the configuration located at "/opt/my-instances/.env".`
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
if (hasHttps) {
|
|
251
|
+
runCommand.addExample(
|
|
252
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
253
|
+
options.commandPrefix
|
|
254
|
+
} run --http-port 8080 --https-port 8443`,
|
|
255
|
+
`Build and run a development image using the ${options.productLabel} instance and configuration located at the current working directory on the non-default ports 8080 and 8443.`
|
|
256
|
+
);
|
|
257
|
+
} else {
|
|
258
|
+
runCommand.addExample(
|
|
259
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
260
|
+
options.commandPrefix
|
|
261
|
+
} run --port 7455`,
|
|
262
|
+
`Build and run a development image using the ${options.productLabel} instance and configuration located at the current working directory on the non-default port 7455.`
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* @param {ModuleRegistrationApi} moduleRegistration
|
|
269
|
+
* @param {FdtCommand} command
|
|
270
|
+
* @param {AddBackendDockerCommandsOptions} options
|
|
271
|
+
*/
|
|
272
|
+
function addBackendDockerUpgradeCommand(moduleRegistration, command, options) {
|
|
273
|
+
const upgradeCommand = command.addCommand('upgrade', async (...args) => {
|
|
274
|
+
const controllerFactory = (
|
|
275
|
+
await import(
|
|
276
|
+
pathToFileURL(
|
|
277
|
+
path.resolve(
|
|
278
|
+
__dirname,
|
|
279
|
+
'controller-templates',
|
|
280
|
+
'command.backend.upgrade.controller.factory.js'
|
|
281
|
+
)
|
|
282
|
+
)
|
|
283
|
+
)
|
|
284
|
+
).default;
|
|
285
|
+
return controllerFactory(options)(...args);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
upgradeCommand
|
|
289
|
+
.setDescription(
|
|
290
|
+
`Upgrade an existing ${options.productLabel} instance to the specified version.`
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
.addOption(
|
|
294
|
+
'location',
|
|
295
|
+
'l',
|
|
296
|
+
'The directory of the instance to upgrade. If not set this defaults to the current working directory.',
|
|
297
|
+
false
|
|
298
|
+
)
|
|
299
|
+
.addOption(
|
|
300
|
+
'version',
|
|
301
|
+
null,
|
|
302
|
+
'The version to upgrade to. Can be either a specific version or "nightly". Be warned: nightly can be unstable or may not work at all.',
|
|
303
|
+
true
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
.addExample(
|
|
307
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
308
|
+
options.commandPrefix
|
|
309
|
+
} upgrade --version x.x.x`,
|
|
310
|
+
`Upgrade the ${options.productLabel} instance located at the current working directory to version x.x.x.`
|
|
311
|
+
)
|
|
312
|
+
.addExample(
|
|
313
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
314
|
+
options.commandPrefix
|
|
315
|
+
} upgrade --location /opt/my-instance/ --version x.x.x`,
|
|
316
|
+
`Upgrade the ${options.productLabel} instance located at "/opt/my-instance/" to version x.x.x.`
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* @param {ModuleRegistrationApi} moduleRegistration
|
|
322
|
+
* @param {FdtCommand} command
|
|
323
|
+
* @param {AddBackendDockerCommandsOptions} options
|
|
324
|
+
*/
|
|
325
|
+
export default function addBackendDockerCommands(
|
|
326
|
+
moduleRegistration,
|
|
327
|
+
command,
|
|
328
|
+
options
|
|
329
|
+
) {
|
|
330
|
+
addBackendDockerBuildCommand(moduleRegistration, command, options);
|
|
331
|
+
addBackendDockerInitCommand(moduleRegistration, command, options);
|
|
332
|
+
addBackendDockerRunCommand(moduleRegistration, command, options);
|
|
333
|
+
addBackendDockerUpgradeCommand(moduleRegistration, command, options);
|
|
334
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
3
|
+
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = path.dirname(__filename);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef AddBackendDownloadSelfContainedCommandsOptions
|
|
9
|
+
*
|
|
10
|
+
* @property {string} productLabel
|
|
11
|
+
* @property {string} commandPrefix
|
|
12
|
+
* @property {string} licenseProductName
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {ModuleRegistrationApi} moduleRegistration
|
|
17
|
+
* @param {FdtCommand} command
|
|
18
|
+
* @param {AddBackendDownloadSelfContainedCommandsOptions} options
|
|
19
|
+
*/
|
|
20
|
+
export default function addBackendDownloadSelfContainedCommands(
|
|
21
|
+
moduleRegistration,
|
|
22
|
+
command,
|
|
23
|
+
options
|
|
24
|
+
) {
|
|
25
|
+
const downloadSelfContainedCommand = command.addCommand(
|
|
26
|
+
'download-self-contained',
|
|
27
|
+
async (...args) => {
|
|
28
|
+
const controllerFactory = (
|
|
29
|
+
await import(
|
|
30
|
+
pathToFileURL(
|
|
31
|
+
path.resolve(
|
|
32
|
+
__dirname,
|
|
33
|
+
'controller-templates',
|
|
34
|
+
'command.backend.download-self-contained.controller.factory.js'
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
).default;
|
|
39
|
+
return controllerFactory(options)(...args);
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
downloadSelfContainedCommand
|
|
44
|
+
.addAlias('dsc')
|
|
45
|
+
.setDescription('Downloads a self-contained build.')
|
|
46
|
+
|
|
47
|
+
.addOption(
|
|
48
|
+
'location',
|
|
49
|
+
'l',
|
|
50
|
+
'The directory where to save the self-contained build. If not set this defaults to the current working directory.',
|
|
51
|
+
false
|
|
52
|
+
)
|
|
53
|
+
.addOption(
|
|
54
|
+
'runtime',
|
|
55
|
+
null,
|
|
56
|
+
'The runtime to download. Supported values: linux-x64, win-x64.',
|
|
57
|
+
true
|
|
58
|
+
)
|
|
59
|
+
.addOption(
|
|
60
|
+
'version',
|
|
61
|
+
null,
|
|
62
|
+
'The version to download. Can be either a specific version or "nightly". Be warned: nightly can be unstable or may not work at all.',
|
|
63
|
+
true
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
.addExample(
|
|
67
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
68
|
+
options.commandPrefix
|
|
69
|
+
} download-self-contained --runtime linux-x64 --version x.x.x`,
|
|
70
|
+
`Download the linux-x64 self-contained build for ${options.productLabel} into the current working directory.`
|
|
71
|
+
)
|
|
72
|
+
.addExample(
|
|
73
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
74
|
+
options.commandPrefix
|
|
75
|
+
} download-self-contained --runtime linux-x64 --version x.x.x --location /opt/my-instance/`,
|
|
76
|
+
`Download the linux-x64 self-contained build for ${options.productLabel} into "/opt/my-instance/".`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
3
|
+
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = path.dirname(__filename);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef AddBackendVersionsCommandsOptions
|
|
9
|
+
*
|
|
10
|
+
* @property {string} productLabel
|
|
11
|
+
* @property {string} commandPrefix
|
|
12
|
+
* @property {string} licenseProductName
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {ModuleRegistrationApi} moduleRegistration
|
|
17
|
+
* @param {FdtCommand} command
|
|
18
|
+
* @param {AddBackendVersionsCommandsOptions} options
|
|
19
|
+
*/
|
|
20
|
+
export default function addBackendVersionsCommands(
|
|
21
|
+
moduleRegistration,
|
|
22
|
+
command,
|
|
23
|
+
options
|
|
24
|
+
) {
|
|
25
|
+
const versionsCommand = command.addCommand('versions', async (...args) => {
|
|
26
|
+
const controllerFactory = (
|
|
27
|
+
await import(
|
|
28
|
+
pathToFileURL(
|
|
29
|
+
path.resolve(
|
|
30
|
+
__dirname,
|
|
31
|
+
'controller-templates',
|
|
32
|
+
'command.backend.versions.controller.factory.js'
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
).default;
|
|
37
|
+
return controllerFactory(options)(...args);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
versionsCommand
|
|
41
|
+
.setDescription(`List the available ${options.productLabel} versions.`)
|
|
42
|
+
|
|
43
|
+
.addHiddenOption(
|
|
44
|
+
'all',
|
|
45
|
+
undefined,
|
|
46
|
+
'Include nightly and prerelease versions.'
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
.addExample(
|
|
50
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
51
|
+
options.commandPrefix
|
|
52
|
+
} versions`,
|
|
53
|
+
`Request the available versions for ${options.productLabel}.`
|
|
54
|
+
);
|
|
55
|
+
}
|