@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
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import cleanup from './utilities/cleanup.js';
|
|
5
|
-
import constants from './utilities/constants.js';
|
|
6
|
-
import copyWhitelistedFiles from './utilities/copyWhitelistedFiles.js';
|
|
7
|
-
import executeAndLog from './utilities/executeAndLog.js';
|
|
8
|
-
import FontoxmlConnectorsManifest from './utilities/FontoxmlConnectorsManifest.js';
|
|
9
|
-
import getVerbosityLevel from './utilities/getVerbosityLevel.js';
|
|
10
|
-
import getWhitelist from './utilities/getWhitelist.js';
|
|
11
|
-
import setEntryVisibility from './utilities/setEntryVisibility.js';
|
|
12
|
-
import validateInstance from './utilities/validateInstance.js';
|
|
13
|
-
|
|
14
|
-
export default function buildCommand(req, res) {
|
|
15
|
-
res.caption(req.command.getLongName());
|
|
16
|
-
|
|
17
|
-
const directoryPath = path.resolve(
|
|
18
|
-
req.options.location ? req.options.location : process.cwd()
|
|
19
|
-
);
|
|
20
|
-
const temporaryDirectoryPath = path.join(
|
|
21
|
-
directoryPath,
|
|
22
|
-
constants.TEMPORARY_BUILD_DIRECTORY_NAME
|
|
23
|
-
);
|
|
24
|
-
const imageName = req.options['image-name']
|
|
25
|
-
? req.options['image-name']
|
|
26
|
-
: constants.DEFAULT_IMAGE_NAME;
|
|
27
|
-
const imageTag = req.options['image-tag']
|
|
28
|
-
? req.options['image-tag']
|
|
29
|
-
: constants.DEFAULT_IMAGE_TAG;
|
|
30
|
-
const manifestFilePath = path.join(
|
|
31
|
-
directoryPath,
|
|
32
|
-
constants.MANIFEST_FILENAME
|
|
33
|
-
);
|
|
34
|
-
const verbosityLevel = getVerbosityLevel(
|
|
35
|
-
req.options.verbose,
|
|
36
|
-
req.options.debug
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
let pidToKillOnForceExit = null;
|
|
40
|
-
const setPidToKillOnForceExit = (process) => {
|
|
41
|
-
pidToKillOnForceExit = process && process.pid;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// Ensure we cleanup before exiting.
|
|
45
|
-
let stopping = false;
|
|
46
|
-
process.on('SIGINT', (_code) => {
|
|
47
|
-
if (stopping) {
|
|
48
|
-
if (pidToKillOnForceExit) {
|
|
49
|
-
process.kill(pidToKillOnForceExit);
|
|
50
|
-
}
|
|
51
|
-
process.exit();
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
stopping = true;
|
|
56
|
-
res.log('Gracefully stopping... (press Ctrl+C again to force)');
|
|
57
|
-
return cleanup(
|
|
58
|
-
temporaryDirectoryPath,
|
|
59
|
-
undefined,
|
|
60
|
-
res,
|
|
61
|
-
verbosityLevel
|
|
62
|
-
).then(process.exit);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
validateInstance(directoryPath)
|
|
67
|
-
// Cleanup possible remaining resources from a previous build or run.
|
|
68
|
-
.then(() =>
|
|
69
|
-
cleanup(temporaryDirectoryPath, undefined, res, verbosityLevel)
|
|
70
|
-
)
|
|
71
|
-
.then(() => {
|
|
72
|
-
const destroySpinner = res.spinner(
|
|
73
|
-
`Building the production image "${imageName}:${imageTag}" at "${directoryPath}"...`
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
// Retrieve data for the docker image
|
|
77
|
-
return FontoxmlConnectorsManifest.fromJsonFile(
|
|
78
|
-
manifestFilePath
|
|
79
|
-
).then((manifestObj) => {
|
|
80
|
-
const requestObj = {
|
|
81
|
-
connectors: {
|
|
82
|
-
docker: {
|
|
83
|
-
version: manifestObj.connectorsVersion,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return req.fdt.license
|
|
89
|
-
.getDataForProducts(requestObj)
|
|
90
|
-
.catch((error) => {
|
|
91
|
-
if (error.statusCode === 404) {
|
|
92
|
-
error.solution =
|
|
93
|
-
'This error might be caused by requesting a nonexistent Fonto Connectors version, please check your version.';
|
|
94
|
-
}
|
|
95
|
-
throw error;
|
|
96
|
-
})
|
|
97
|
-
.then((productData) => {
|
|
98
|
-
const dockerData =
|
|
99
|
-
productData.products.connectors.docker;
|
|
100
|
-
|
|
101
|
-
// Create a hidden temporary directory.
|
|
102
|
-
return (
|
|
103
|
-
fs
|
|
104
|
-
.mkdir(temporaryDirectoryPath)
|
|
105
|
-
.then(() =>
|
|
106
|
-
setEntryVisibility(
|
|
107
|
-
temporaryDirectoryPath,
|
|
108
|
-
false
|
|
109
|
-
)
|
|
110
|
-
)
|
|
111
|
-
// Copy the instance files into the temporary directory.
|
|
112
|
-
.then(() => {
|
|
113
|
-
// Rewrite the version in the Dockerfile.
|
|
114
|
-
return fs
|
|
115
|
-
.readFile(
|
|
116
|
-
path.join(
|
|
117
|
-
constants.INSTANCE_BUILD_DIRECTORY_PATH,
|
|
118
|
-
'Dockerfile.build'
|
|
119
|
-
),
|
|
120
|
-
'utf8'
|
|
121
|
-
)
|
|
122
|
-
.then((dockerContent) =>
|
|
123
|
-
dockerContent.replace(
|
|
124
|
-
'${connectorsImage}',
|
|
125
|
-
dockerData.image
|
|
126
|
-
)
|
|
127
|
-
)
|
|
128
|
-
.then((fixedDockerContent) =>
|
|
129
|
-
fs.writeFile(
|
|
130
|
-
path.join(
|
|
131
|
-
temporaryDirectoryPath,
|
|
132
|
-
'Dockerfile'
|
|
133
|
-
),
|
|
134
|
-
fixedDockerContent
|
|
135
|
-
)
|
|
136
|
-
);
|
|
137
|
-
})
|
|
138
|
-
.then(() => getWhitelist())
|
|
139
|
-
.then((whitelist) =>
|
|
140
|
-
copyWhitelistedFiles(
|
|
141
|
-
whitelist,
|
|
142
|
-
directoryPath,
|
|
143
|
-
path.join(
|
|
144
|
-
temporaryDirectoryPath,
|
|
145
|
-
'instance'
|
|
146
|
-
)
|
|
147
|
-
)
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
// Pull the docker image
|
|
151
|
-
.then(() => {
|
|
152
|
-
return executeAndLog(
|
|
153
|
-
res,
|
|
154
|
-
'docker',
|
|
155
|
-
[
|
|
156
|
-
'login',
|
|
157
|
-
dockerData.registry,
|
|
158
|
-
'-u',
|
|
159
|
-
dockerData.login,
|
|
160
|
-
'-p',
|
|
161
|
-
dockerData.password,
|
|
162
|
-
],
|
|
163
|
-
null,
|
|
164
|
-
constants.VERBOSITY_LEVEL_NORMAL,
|
|
165
|
-
false,
|
|
166
|
-
setPidToKillOnForceExit
|
|
167
|
-
)
|
|
168
|
-
.then(() =>
|
|
169
|
-
executeAndLog(
|
|
170
|
-
res,
|
|
171
|
-
'docker',
|
|
172
|
-
['pull', dockerData.image],
|
|
173
|
-
null,
|
|
174
|
-
verbosityLevel,
|
|
175
|
-
false,
|
|
176
|
-
setPidToKillOnForceExit
|
|
177
|
-
)
|
|
178
|
-
)
|
|
179
|
-
.then(() =>
|
|
180
|
-
executeAndLog(
|
|
181
|
-
res,
|
|
182
|
-
'docker',
|
|
183
|
-
[
|
|
184
|
-
'logout',
|
|
185
|
-
dockerData.registry,
|
|
186
|
-
],
|
|
187
|
-
null,
|
|
188
|
-
constants.VERBOSITY_LEVEL_NORMAL,
|
|
189
|
-
false,
|
|
190
|
-
setPidToKillOnForceExit
|
|
191
|
-
)
|
|
192
|
-
)
|
|
193
|
-
.catch(() => {
|
|
194
|
-
throw new Error(
|
|
195
|
-
'Failed to retrieve the image file.'
|
|
196
|
-
);
|
|
197
|
-
});
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
// Build the docker image.
|
|
201
|
-
.then(() =>
|
|
202
|
-
executeAndLog(
|
|
203
|
-
res,
|
|
204
|
-
'docker',
|
|
205
|
-
[
|
|
206
|
-
'build',
|
|
207
|
-
'-t',
|
|
208
|
-
`${imageName}:${imageTag}`,
|
|
209
|
-
'.',
|
|
210
|
-
],
|
|
211
|
-
temporaryDirectoryPath,
|
|
212
|
-
verbosityLevel,
|
|
213
|
-
false,
|
|
214
|
-
setPidToKillOnForceExit
|
|
215
|
-
)
|
|
216
|
-
)
|
|
217
|
-
.then(() =>
|
|
218
|
-
req.fdt.license.sendTelemetry({
|
|
219
|
-
product: req.command.parent.name,
|
|
220
|
-
type: 'docker',
|
|
221
|
-
version:
|
|
222
|
-
manifestObj.connectorsVersion,
|
|
223
|
-
action: req.command.name,
|
|
224
|
-
})
|
|
225
|
-
)
|
|
226
|
-
.then(() => destroySpinner())
|
|
227
|
-
);
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
})
|
|
231
|
-
// Cleanup temporary directory.
|
|
232
|
-
.then(() =>
|
|
233
|
-
cleanup(temporaryDirectoryPath, undefined, res, verbosityLevel)
|
|
234
|
-
)
|
|
235
|
-
.catch((error) => {
|
|
236
|
-
if (!stopping) {
|
|
237
|
-
res.notice(
|
|
238
|
-
`See our documentation at ${constants.DOCUMENTATION_EXECUTE_ERROR} for help.`
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return cleanup(
|
|
243
|
-
temporaryDirectoryPath,
|
|
244
|
-
undefined,
|
|
245
|
-
res,
|
|
246
|
-
verbosityLevel
|
|
247
|
-
)
|
|
248
|
-
.then(() => {
|
|
249
|
-
throw error;
|
|
250
|
-
})
|
|
251
|
-
.catch(() => {
|
|
252
|
-
throw error;
|
|
253
|
-
});
|
|
254
|
-
})
|
|
255
|
-
);
|
|
256
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
|
|
4
|
-
import constants from './utilities/constants.js';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
|
|
9
|
-
export default (moduleRegistration, connectorsCommand) => {
|
|
10
|
-
connectorsCommand
|
|
11
|
-
.addCommand(
|
|
12
|
-
'build',
|
|
13
|
-
path.resolve(__dirname, 'command.build.controller.js')
|
|
14
|
-
)
|
|
15
|
-
.setDescription(
|
|
16
|
-
'Build a Fonto Connectors Docker image for production use. Requires Docker to be installed.'
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
.addOption(
|
|
20
|
-
'image-name',
|
|
21
|
-
'n',
|
|
22
|
-
`The name of the Docker image which will be created. This defaults to ${constants.DEFAULT_IMAGE_NAME}.`,
|
|
23
|
-
false
|
|
24
|
-
)
|
|
25
|
-
.addOption(
|
|
26
|
-
'image-tag',
|
|
27
|
-
't',
|
|
28
|
-
`The tag of the Docker image which will be created. This defaults to ${constants.DEFAULT_IMAGE_TAG}.`,
|
|
29
|
-
false
|
|
30
|
-
)
|
|
31
|
-
.addOption(
|
|
32
|
-
'location',
|
|
33
|
-
'l',
|
|
34
|
-
'The directory where the Fonto Connectors instance is located.',
|
|
35
|
-
false
|
|
36
|
-
)
|
|
37
|
-
.addOption(
|
|
38
|
-
'verbose',
|
|
39
|
-
null,
|
|
40
|
-
'Output default stdout and stderr information.'
|
|
41
|
-
)
|
|
42
|
-
.addOption('debug', null, 'Output all debug information.')
|
|
43
|
-
|
|
44
|
-
.addExample(
|
|
45
|
-
`${moduleRegistration.getAppInfo().name} connectors build`,
|
|
46
|
-
`Build production image "${constants.DEFAULT_IMAGE_NAME}:${constants.DEFAULT_IMAGE_NAME}" using the Fonto Connectors instance located at the current working directory.`
|
|
47
|
-
)
|
|
48
|
-
.addExample(
|
|
49
|
-
`${
|
|
50
|
-
moduleRegistration.getAppInfo().name
|
|
51
|
-
} connectors build --image-name my-connectors-instance --image-tag 1.0.0 --location /opt/my-instance/`,
|
|
52
|
-
'Build production image "my-connectors-instance:1.0.0" using the Fonto Connectors instance located at "/opt/my-instance/".'
|
|
53
|
-
);
|
|
54
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import requestPromise from 'request-promise-native';
|
|
4
|
-
import url from 'url';
|
|
5
|
-
|
|
6
|
-
export default function buildCommand(req, res) {
|
|
7
|
-
res.caption(req.command.getLongName());
|
|
8
|
-
|
|
9
|
-
const directoryPath = path.resolve(
|
|
10
|
-
req.options.location ? req.options.location : process.cwd()
|
|
11
|
-
);
|
|
12
|
-
const version = req.options.version;
|
|
13
|
-
const runtime = req.options.runtime;
|
|
14
|
-
|
|
15
|
-
const requestObj = {
|
|
16
|
-
connectors: {
|
|
17
|
-
selfContained: {
|
|
18
|
-
runtime,
|
|
19
|
-
version,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const destroySpinner = res.spinner(`Downloading self-contained build...`);
|
|
25
|
-
|
|
26
|
-
return req.fdt.license
|
|
27
|
-
.getDataForProducts(requestObj)
|
|
28
|
-
.catch(async (error) => {
|
|
29
|
-
if (error.statusCode === 404) {
|
|
30
|
-
try {
|
|
31
|
-
const sdkVersions =
|
|
32
|
-
await req.fdt.license.getVersionsForProduct(
|
|
33
|
-
'connectors'
|
|
34
|
-
);
|
|
35
|
-
error = new res.ErrorWithSolution(
|
|
36
|
-
`Could not download self-contained for version (${version}) and runtime environment (${runtime}). Please check if it is a valid version and runtime environment.`,
|
|
37
|
-
`The latest version is ${sdkVersions.getLatestStable()}, run \`fdt connectors versions\` to get a list of all available versions and run \`fdt connectors download-self-contained --help\` to get a list of all available runtime environments.`,
|
|
38
|
-
error
|
|
39
|
-
);
|
|
40
|
-
} catch (_error) {
|
|
41
|
-
error = new res.ErrorWithSolution(
|
|
42
|
-
`Could not download self-contained for version (${version}) and runtime environment (${runtime}). Please check if it is a valid version and runtime environment.`,
|
|
43
|
-
`Run \`fdt connectors versions\` to get a list of all available versions and run \`fdt connectors download-self-contained --help\` to get a list of all available runtime environments.`,
|
|
44
|
-
error
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
throw error;
|
|
49
|
-
})
|
|
50
|
-
.then((productData) => {
|
|
51
|
-
const downloadUri =
|
|
52
|
-
productData.products.connectors.selfContained.uri;
|
|
53
|
-
const parsed = url.parse(downloadUri);
|
|
54
|
-
const filename = path.basename(parsed.pathname);
|
|
55
|
-
const filePath = path.join(directoryPath, filename);
|
|
56
|
-
return requestPromise
|
|
57
|
-
.get(downloadUri, {
|
|
58
|
-
resolveWithFullResponse: true,
|
|
59
|
-
simple: false,
|
|
60
|
-
encoding: null,
|
|
61
|
-
})
|
|
62
|
-
.then((response) => {
|
|
63
|
-
switch (response.statusCode) {
|
|
64
|
-
case 200:
|
|
65
|
-
return response.body;
|
|
66
|
-
case 401:
|
|
67
|
-
case 403:
|
|
68
|
-
throw new Error(
|
|
69
|
-
'You are currently not allowed to download this self-contained build, even though you might have the license for it.'
|
|
70
|
-
);
|
|
71
|
-
case 404:
|
|
72
|
-
throw new Error(
|
|
73
|
-
'The file for the requested self-contained build could not be found.'
|
|
74
|
-
);
|
|
75
|
-
default:
|
|
76
|
-
throw new Error(
|
|
77
|
-
`Invalid response from the self-contained builds server (${response.statusCode}).`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
.then((data) => {
|
|
82
|
-
return fs.outputFile(filePath, data).catch((_error) => {
|
|
83
|
-
throw new Error(
|
|
84
|
-
'Could not save self-contained build download to disk.'
|
|
85
|
-
);
|
|
86
|
-
});
|
|
87
|
-
})
|
|
88
|
-
.then(() =>
|
|
89
|
-
req.fdt.license.sendTelemetry({
|
|
90
|
-
product: req.command.parent.name,
|
|
91
|
-
type: 'selfContained',
|
|
92
|
-
runtime: req.options.runtime,
|
|
93
|
-
version,
|
|
94
|
-
action: req.command.name,
|
|
95
|
-
})
|
|
96
|
-
)
|
|
97
|
-
.then(() => {
|
|
98
|
-
destroySpinner();
|
|
99
|
-
res.break();
|
|
100
|
-
const locationString = req.options.location
|
|
101
|
-
? path.isAbsolute(req.options.location)
|
|
102
|
-
? filePath
|
|
103
|
-
: path.join(req.options.location, filename)
|
|
104
|
-
: filename;
|
|
105
|
-
res.notice(
|
|
106
|
-
`Saved self contained build to ${locationString}`
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = path.dirname(__filename);
|
|
6
|
-
|
|
7
|
-
export default (moduleRegistration, connectorsCommand) => {
|
|
8
|
-
connectorsCommand
|
|
9
|
-
.addCommand(
|
|
10
|
-
'download-self-contained',
|
|
11
|
-
path.resolve(
|
|
12
|
-
__dirname,
|
|
13
|
-
'command.download-self-contained.controller.js'
|
|
14
|
-
)
|
|
15
|
-
)
|
|
16
|
-
.addAlias('dsc')
|
|
17
|
-
.setDescription('Downloads a self-contained build.')
|
|
18
|
-
|
|
19
|
-
.addOption(
|
|
20
|
-
'location',
|
|
21
|
-
'l',
|
|
22
|
-
'The directory where to save the self-contained build. If not set this defaults to the current working directory.',
|
|
23
|
-
false
|
|
24
|
-
)
|
|
25
|
-
.addOption(
|
|
26
|
-
'runtime',
|
|
27
|
-
null,
|
|
28
|
-
'The runtime to download. Supported values: linux-x64, win-x64.',
|
|
29
|
-
true
|
|
30
|
-
)
|
|
31
|
-
.addOption(
|
|
32
|
-
'version',
|
|
33
|
-
null,
|
|
34
|
-
'The version to download. Can be either a specific version or "nightly". Be warned: nightly can be unstable or may not work at all.',
|
|
35
|
-
true
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
.addExample(
|
|
39
|
-
`${
|
|
40
|
-
moduleRegistration.getAppInfo().name
|
|
41
|
-
} connectors download-self-contained --runtime linux-x64 --version x.x.x`,
|
|
42
|
-
`Download the linux-x64 self-contained build into the current working directory.`
|
|
43
|
-
)
|
|
44
|
-
.addExample(
|
|
45
|
-
`${
|
|
46
|
-
moduleRegistration.getAppInfo().name
|
|
47
|
-
} connectors download-self-contained --runtime linux-x64 --version x.x.x --location /opt/my-instance/`,
|
|
48
|
-
'Download the linux-x64 self-contained build into "/opt/my-instance/".'
|
|
49
|
-
);
|
|
50
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import constants from './utilities/constants.js';
|
|
5
|
-
import FontoxmlConnectorsManifest from './utilities/FontoxmlConnectorsManifest.js';
|
|
6
|
-
import setEntryVisibility from './utilities/setEntryVisibility.js';
|
|
7
|
-
|
|
8
|
-
export default async function initCommand(req, res) {
|
|
9
|
-
res.caption(req.command.getLongName());
|
|
10
|
-
|
|
11
|
-
// Check if the version exists.
|
|
12
|
-
const sdkVersions = await req.fdt.license.getVersionsForProduct(
|
|
13
|
-
'connectors'
|
|
14
|
-
);
|
|
15
|
-
const version = req.options.version;
|
|
16
|
-
if (!sdkVersions.includes(version)) {
|
|
17
|
-
throw new Error(
|
|
18
|
-
`Could not initialize for version (${version}), please check if it is a valid version. The latest version is ${sdkVersions.getLatestStable()}, run \`fdt connectors versions\` to get a list of all available versions.`
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const directoryPath = path.resolve(
|
|
23
|
-
req.options.location ? req.options.location : process.cwd()
|
|
24
|
-
);
|
|
25
|
-
return fs
|
|
26
|
-
.exists(directoryPath)
|
|
27
|
-
.then((exists) => {
|
|
28
|
-
if (!exists) {
|
|
29
|
-
// Create the directory if it does not exist.
|
|
30
|
-
return fs.ensureDir(directoryPath);
|
|
31
|
-
}
|
|
32
|
-
// Ensure the directory is empty if it does exist.
|
|
33
|
-
return fs.readdir(directoryPath).then((files) => {
|
|
34
|
-
if (files.length) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
`The directory "${directoryPath}" is not empty.`
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
})
|
|
41
|
-
.then(() => {
|
|
42
|
-
const destroySpinner = res.spinner(
|
|
43
|
-
`Initializing a Fonto Connectors instance at "${directoryPath}"...`
|
|
44
|
-
);
|
|
45
|
-
return fs
|
|
46
|
-
.copy(
|
|
47
|
-
constants.INSTANCE_TEMPLATE_DIRECTORY_PATH,
|
|
48
|
-
directoryPath,
|
|
49
|
-
{
|
|
50
|
-
filter: (src, _dest) => {
|
|
51
|
-
const filename = path.basename(src);
|
|
52
|
-
return filename !== '.gitkeep';
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
.then(() => {
|
|
57
|
-
const data = new FontoxmlConnectorsManifest(version);
|
|
58
|
-
const manifest = path.join(
|
|
59
|
-
directoryPath,
|
|
60
|
-
constants.MANIFEST_FILENAME
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
return fs
|
|
64
|
-
.writeJson(manifest, data)
|
|
65
|
-
.then(() => setEntryVisibility(manifest, false));
|
|
66
|
-
})
|
|
67
|
-
.catch((error) => {
|
|
68
|
-
return fs.emptyDir(directoryPath).then(() => {
|
|
69
|
-
destroySpinner();
|
|
70
|
-
throw error;
|
|
71
|
-
});
|
|
72
|
-
})
|
|
73
|
-
.then(() =>
|
|
74
|
-
req.fdt.license.sendTelemetry({
|
|
75
|
-
product: req.command.parent.name,
|
|
76
|
-
type: 'docker',
|
|
77
|
-
version,
|
|
78
|
-
action: req.command.name,
|
|
79
|
-
})
|
|
80
|
-
)
|
|
81
|
-
.then(() => destroySpinner());
|
|
82
|
-
})
|
|
83
|
-
.then(() => {
|
|
84
|
-
res.log(
|
|
85
|
-
'Complete the configuration before building or running the instance.'
|
|
86
|
-
);
|
|
87
|
-
res.log(
|
|
88
|
-
`See ${constants.DOCUMENTATION_GETTING_STARTED_GUIDE} for more information.`
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = path.dirname(__filename);
|
|
6
|
-
|
|
7
|
-
export default (moduleRegistration, connectorsCommand) => {
|
|
8
|
-
connectorsCommand
|
|
9
|
-
.addCommand(
|
|
10
|
-
'init',
|
|
11
|
-
path.resolve(__dirname, 'command.init.controller.js')
|
|
12
|
-
)
|
|
13
|
-
.setDescription(
|
|
14
|
-
'Initialize a Fonto Connectors instance in an empty or nonexistent directory.'
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
.addOption(
|
|
18
|
-
'location',
|
|
19
|
-
'l',
|
|
20
|
-
'The directory where to initialize. If not set this defaults to the current working directory. Note that the directory has to empty or nonexistent.',
|
|
21
|
-
false
|
|
22
|
-
)
|
|
23
|
-
.addOption(
|
|
24
|
-
'version',
|
|
25
|
-
null,
|
|
26
|
-
'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.',
|
|
27
|
-
true
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
.addExample(
|
|
31
|
-
`${
|
|
32
|
-
moduleRegistration.getAppInfo().name
|
|
33
|
-
} connectors init --version x.x.x`,
|
|
34
|
-
'Initialize a new Fonto Connectors instance located at the current working directory.'
|
|
35
|
-
)
|
|
36
|
-
.addExample(
|
|
37
|
-
`${
|
|
38
|
-
moduleRegistration.getAppInfo().name
|
|
39
|
-
} connectors init --location /opt/my-instance/ --version x.x.x`,
|
|
40
|
-
'Initialize a new Fonto Connectors instance located at "/opt/my-instance/".'
|
|
41
|
-
);
|
|
42
|
-
};
|