@fontoxml/fontoxml-development-tools 3.11.0 → 3.12.0
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/README.md +4 -4
- package/npm-shrinkwrap.json +3804 -8292
- 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/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/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/command.schema.compile.controller.js +51 -2
- 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/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/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,444 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import os from 'os';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
import cleanup from './utilities/cleanup.js';
|
|
6
|
-
import constants from './utilities/constants.js';
|
|
7
|
-
import copyWhitelistedFiles from './utilities/copyWhitelistedFiles.js';
|
|
8
|
-
import executeAndLog from './utilities/executeAndLog.js';
|
|
9
|
-
import FontoxmlFdhManifest from './utilities/FontoxmlFdhManifest.js';
|
|
10
|
-
import getVerbosityLevel from './utilities/getVerbosityLevel.js';
|
|
11
|
-
import getWhitelist from './utilities/getWhitelist.js';
|
|
12
|
-
import setEntryVisibility from './utilities/setEntryVisibility.js';
|
|
13
|
-
import validateInstance from './utilities/validateInstance.js';
|
|
14
|
-
|
|
15
|
-
const verboseFdhConfigurationEntries = {
|
|
16
|
-
Logging__LogLevel__Default: 'Trace',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const DEFAULT_PORT = 6030;
|
|
20
|
-
|
|
21
|
-
function copyFdhConfiguration(fdhConfiguration, tempDir, verbosityLevel, res) {
|
|
22
|
-
const targetFdhConfiguration = path.join(tempDir, '.env');
|
|
23
|
-
|
|
24
|
-
return fs.exists(fdhConfiguration).then((exists) => {
|
|
25
|
-
// Read the configuration entries from the .env file or initialize an empty array.
|
|
26
|
-
let deferred = exists
|
|
27
|
-
? fs.readFile(fdhConfiguration, 'utf8').then((data) => {
|
|
28
|
-
return data.split(/\r?\n/g);
|
|
29
|
-
})
|
|
30
|
-
: new Promise((resolve, _reject) => {
|
|
31
|
-
resolve(new Array(0));
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// Replace or set the defaults for verbosity.
|
|
35
|
-
if (verbosityLevel === constants.VERBOSITY_LEVEL_DEBUG) {
|
|
36
|
-
deferred = deferred.then((configurationEntries) => {
|
|
37
|
-
Object.keys(verboseFdhConfigurationEntries).forEach((key) => {
|
|
38
|
-
const configurationEntryIndex =
|
|
39
|
-
configurationEntries.findIndex((entry) =>
|
|
40
|
-
entry.startsWith(`${key}=`)
|
|
41
|
-
);
|
|
42
|
-
const value = verboseFdhConfigurationEntries[key];
|
|
43
|
-
if (configurationEntryIndex === -1) {
|
|
44
|
-
configurationEntries.push(`${key}=${value}`);
|
|
45
|
-
} else {
|
|
46
|
-
configurationEntries[
|
|
47
|
-
configurationEntryIndex
|
|
48
|
-
] = `${key}=${value}`;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
return configurationEntries;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Ignore options that shouldn't be applied when running through FDT.
|
|
56
|
-
deferred = deferred.then((configurationEntries) => {
|
|
57
|
-
let i = configurationEntries.length;
|
|
58
|
-
while (i--) {
|
|
59
|
-
const configurationLine = configurationEntries[i];
|
|
60
|
-
if (
|
|
61
|
-
!configurationLine.startsWith('#') &&
|
|
62
|
-
configurationLine.indexOf('=') !== -1
|
|
63
|
-
) {
|
|
64
|
-
const [key, _value] = configurationLine.split('=', 2);
|
|
65
|
-
|
|
66
|
-
if (key === 'ASPNETCORE_URLS') {
|
|
67
|
-
configurationEntries.splice(i, 1);
|
|
68
|
-
res.notice(
|
|
69
|
-
`Notice: The '${key}' configuration option in the '.env' file will be ignored when ` +
|
|
70
|
-
"running the application using FDT. The FDT '--port' option can be used to run the application " +
|
|
71
|
-
'under a different port.'
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return configurationEntries;
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Write the configuration to the .env file.
|
|
80
|
-
return deferred.then((configurationEntries) => {
|
|
81
|
-
const configurationData = configurationEntries.join(os.EOL);
|
|
82
|
-
return fs.writeFile(targetFdhConfiguration, configurationData);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export default function runCommand(req, res) {
|
|
88
|
-
res.caption(req.command.getLongName());
|
|
89
|
-
|
|
90
|
-
const directoryPath = path.resolve(
|
|
91
|
-
req.options.location ? req.options.location : process.cwd()
|
|
92
|
-
);
|
|
93
|
-
const temporaryDirectoryPath = path.join(
|
|
94
|
-
directoryPath,
|
|
95
|
-
constants.TEMPORARY_DIRECTORY_NAME
|
|
96
|
-
);
|
|
97
|
-
const fdhConfigurationFilePath = req.options['config-location']
|
|
98
|
-
? path.resolve(req.options['config-location'])
|
|
99
|
-
: path.join(directoryPath, '.env');
|
|
100
|
-
const manifestFilePath = path.join(
|
|
101
|
-
directoryPath,
|
|
102
|
-
constants.MANIFEST_FILENAME
|
|
103
|
-
);
|
|
104
|
-
const verbosityLevel = getVerbosityLevel(
|
|
105
|
-
req.options.verbose,
|
|
106
|
-
req.options.debug
|
|
107
|
-
);
|
|
108
|
-
const port = req.options.port || DEFAULT_PORT;
|
|
109
|
-
const projectName = `${constants.DEFAULT_IMAGE_NAME}_${port}`;
|
|
110
|
-
|
|
111
|
-
let pidToKillOnForceExit = null;
|
|
112
|
-
const setPidToKillOnForceExit = (processToKill) => {
|
|
113
|
-
pidToKillOnForceExit = processToKill && processToKill.pid;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// Ensure we cleanup before exiting.
|
|
117
|
-
let stopping = false;
|
|
118
|
-
process.on('SIGINT', (_code) => {
|
|
119
|
-
if (stopping) {
|
|
120
|
-
if (pidToKillOnForceExit) {
|
|
121
|
-
process.kill(pidToKillOnForceExit);
|
|
122
|
-
}
|
|
123
|
-
process.exit();
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
stopping = true;
|
|
128
|
-
res.log('Gracefully stopping... (press Ctrl+C again to force)');
|
|
129
|
-
return cleanup(
|
|
130
|
-
temporaryDirectoryPath,
|
|
131
|
-
projectName,
|
|
132
|
-
res,
|
|
133
|
-
verbosityLevel
|
|
134
|
-
).then(process.exit);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
validateInstance(directoryPath)
|
|
139
|
-
.then(() => fs.exists(fdhConfigurationFilePath))
|
|
140
|
-
.then((exists) => {
|
|
141
|
-
if (!exists) {
|
|
142
|
-
if (req.options['config-location']) {
|
|
143
|
-
throw new Error(
|
|
144
|
-
`Fonto Document History config "${fdhConfigurationFilePath}" does not exist.`
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
res.notice(
|
|
148
|
-
`No .env file exists in the directory "${directoryPath}". See ${constants.DOCUMENTATION_CONFIGURATION_GUIDE} to configure the .env file.`
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
.then(() => fs.exists(manifestFilePath))
|
|
153
|
-
.then((exists) => {
|
|
154
|
-
// Verify fontoxmlFdhManifest file is present and valid.
|
|
155
|
-
if (!exists) {
|
|
156
|
-
throw new Error(
|
|
157
|
-
'The Fonto Document History manifest file does not exist.'
|
|
158
|
-
);
|
|
159
|
-
} else {
|
|
160
|
-
return FontoxmlFdhManifest.fromJsonFile(manifestFilePath);
|
|
161
|
-
}
|
|
162
|
-
})
|
|
163
|
-
// Cleanup possible remaining resources from a previous build or run.
|
|
164
|
-
.then(() =>
|
|
165
|
-
cleanup(
|
|
166
|
-
temporaryDirectoryPath,
|
|
167
|
-
projectName,
|
|
168
|
-
res,
|
|
169
|
-
verbosityLevel
|
|
170
|
-
)
|
|
171
|
-
)
|
|
172
|
-
.then(() => {
|
|
173
|
-
const destroySpinner = res.spinner(
|
|
174
|
-
`Building development image at "${directoryPath}"...`
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
// Retrieve data for the docker image
|
|
178
|
-
return FontoxmlFdhManifest.fromJsonFile(manifestFilePath).then(
|
|
179
|
-
(manifestObj) => {
|
|
180
|
-
const requestObj = {
|
|
181
|
-
'document-history': {
|
|
182
|
-
docker: {
|
|
183
|
-
version: manifestObj.fdhVersion,
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
return req.fdt.license
|
|
189
|
-
.getDataForProducts(requestObj)
|
|
190
|
-
.catch((error) => {
|
|
191
|
-
if (error.statusCode === 404) {
|
|
192
|
-
error.solution =
|
|
193
|
-
'This error might be caused by requesting a nonexisting Fonto Document History version, please check your version.';
|
|
194
|
-
}
|
|
195
|
-
throw error;
|
|
196
|
-
})
|
|
197
|
-
.then((productData) => {
|
|
198
|
-
const dockerData =
|
|
199
|
-
productData.products['document-history']
|
|
200
|
-
.docker;
|
|
201
|
-
|
|
202
|
-
// Create a hidden temporary directory.
|
|
203
|
-
return (
|
|
204
|
-
fs
|
|
205
|
-
.mkdir(temporaryDirectoryPath)
|
|
206
|
-
.then(() =>
|
|
207
|
-
setEntryVisibility(
|
|
208
|
-
temporaryDirectoryPath,
|
|
209
|
-
false
|
|
210
|
-
)
|
|
211
|
-
)
|
|
212
|
-
// Copy the instance files into the temporary directory.
|
|
213
|
-
.then(() => {
|
|
214
|
-
// Rewrite the version in the Dockerfile.
|
|
215
|
-
return fs
|
|
216
|
-
.readFile(
|
|
217
|
-
path.join(
|
|
218
|
-
constants.INSTANCE_BUILD_DIRECTORY_PATH,
|
|
219
|
-
'Dockerfile'
|
|
220
|
-
),
|
|
221
|
-
'utf8'
|
|
222
|
-
)
|
|
223
|
-
.then((dockerContent) =>
|
|
224
|
-
dockerContent.replace(
|
|
225
|
-
'${fdhImage}',
|
|
226
|
-
dockerData.image
|
|
227
|
-
)
|
|
228
|
-
)
|
|
229
|
-
.then((fixedDockerContent) =>
|
|
230
|
-
fs.writeFile(
|
|
231
|
-
path.join(
|
|
232
|
-
temporaryDirectoryPath,
|
|
233
|
-
'Dockerfile'
|
|
234
|
-
),
|
|
235
|
-
fixedDockerContent
|
|
236
|
-
)
|
|
237
|
-
);
|
|
238
|
-
})
|
|
239
|
-
.then(() =>
|
|
240
|
-
fs.copy(
|
|
241
|
-
constants.INSTANCE_DEV_BUILD_DIRECTORY_PATH,
|
|
242
|
-
temporaryDirectoryPath
|
|
243
|
-
)
|
|
244
|
-
)
|
|
245
|
-
.then(() => {
|
|
246
|
-
// Rewrite the port in the docker-compose file.
|
|
247
|
-
return fs
|
|
248
|
-
.readFile(
|
|
249
|
-
path.join(
|
|
250
|
-
temporaryDirectoryPath,
|
|
251
|
-
'docker-compose.yml'
|
|
252
|
-
),
|
|
253
|
-
'utf8'
|
|
254
|
-
)
|
|
255
|
-
.then((dockerComposeContent) =>
|
|
256
|
-
dockerComposeContent
|
|
257
|
-
.replace(
|
|
258
|
-
'${containerName}',
|
|
259
|
-
projectName
|
|
260
|
-
)
|
|
261
|
-
.replace(
|
|
262
|
-
'${fdhPort}',
|
|
263
|
-
port
|
|
264
|
-
)
|
|
265
|
-
)
|
|
266
|
-
.then(
|
|
267
|
-
(
|
|
268
|
-
fixedDockerComposeContent
|
|
269
|
-
) =>
|
|
270
|
-
fs.writeFile(
|
|
271
|
-
path.join(
|
|
272
|
-
temporaryDirectoryPath,
|
|
273
|
-
'docker-compose.yml'
|
|
274
|
-
),
|
|
275
|
-
fixedDockerComposeContent
|
|
276
|
-
)
|
|
277
|
-
);
|
|
278
|
-
})
|
|
279
|
-
.then(() => [
|
|
280
|
-
path.join(
|
|
281
|
-
directoryPath,
|
|
282
|
-
'Configuration'
|
|
283
|
-
),
|
|
284
|
-
])
|
|
285
|
-
.then(() => getWhitelist())
|
|
286
|
-
.then((whitelist) =>
|
|
287
|
-
copyWhitelistedFiles(
|
|
288
|
-
whitelist,
|
|
289
|
-
directoryPath,
|
|
290
|
-
path.join(
|
|
291
|
-
temporaryDirectoryPath,
|
|
292
|
-
'instance'
|
|
293
|
-
)
|
|
294
|
-
)
|
|
295
|
-
)
|
|
296
|
-
.then(() =>
|
|
297
|
-
copyFdhConfiguration(
|
|
298
|
-
fdhConfigurationFilePath,
|
|
299
|
-
temporaryDirectoryPath,
|
|
300
|
-
verbosityLevel,
|
|
301
|
-
res
|
|
302
|
-
)
|
|
303
|
-
)
|
|
304
|
-
|
|
305
|
-
// Pull the docker image
|
|
306
|
-
.then(() => {
|
|
307
|
-
return executeAndLog(
|
|
308
|
-
res,
|
|
309
|
-
'docker',
|
|
310
|
-
[
|
|
311
|
-
'login',
|
|
312
|
-
dockerData.registry,
|
|
313
|
-
'-u',
|
|
314
|
-
dockerData.login,
|
|
315
|
-
'-p',
|
|
316
|
-
dockerData.password,
|
|
317
|
-
],
|
|
318
|
-
null,
|
|
319
|
-
constants.VERBOSITY_LEVEL_NORMAL,
|
|
320
|
-
false,
|
|
321
|
-
setPidToKillOnForceExit
|
|
322
|
-
)
|
|
323
|
-
.then(() =>
|
|
324
|
-
executeAndLog(
|
|
325
|
-
res,
|
|
326
|
-
'docker',
|
|
327
|
-
[
|
|
328
|
-
'pull',
|
|
329
|
-
dockerData.image,
|
|
330
|
-
],
|
|
331
|
-
null,
|
|
332
|
-
verbosityLevel,
|
|
333
|
-
false,
|
|
334
|
-
setPidToKillOnForceExit
|
|
335
|
-
)
|
|
336
|
-
)
|
|
337
|
-
.then(() =>
|
|
338
|
-
executeAndLog(
|
|
339
|
-
res,
|
|
340
|
-
'docker',
|
|
341
|
-
[
|
|
342
|
-
'logout',
|
|
343
|
-
dockerData.registry,
|
|
344
|
-
],
|
|
345
|
-
null,
|
|
346
|
-
constants.VERBOSITY_LEVEL_NORMAL,
|
|
347
|
-
false,
|
|
348
|
-
setPidToKillOnForceExit
|
|
349
|
-
)
|
|
350
|
-
)
|
|
351
|
-
.catch(() => {
|
|
352
|
-
throw new Error(
|
|
353
|
-
'Failed to retrieve the image file.'
|
|
354
|
-
);
|
|
355
|
-
});
|
|
356
|
-
})
|
|
357
|
-
|
|
358
|
-
// Use docker-compose to build the development image.
|
|
359
|
-
.then(() =>
|
|
360
|
-
executeAndLog(
|
|
361
|
-
res,
|
|
362
|
-
'docker-compose',
|
|
363
|
-
verbosityLevel ===
|
|
364
|
-
constants.VERBOSITY_LEVEL_DEBUG
|
|
365
|
-
? [
|
|
366
|
-
'-p',
|
|
367
|
-
projectName,
|
|
368
|
-
'--verbose',
|
|
369
|
-
'build',
|
|
370
|
-
]
|
|
371
|
-
: [
|
|
372
|
-
'-p',
|
|
373
|
-
projectName,
|
|
374
|
-
'build',
|
|
375
|
-
],
|
|
376
|
-
temporaryDirectoryPath,
|
|
377
|
-
verbosityLevel,
|
|
378
|
-
false,
|
|
379
|
-
setPidToKillOnForceExit
|
|
380
|
-
)
|
|
381
|
-
)
|
|
382
|
-
.then(() =>
|
|
383
|
-
req.fdt.license.sendTelemetry({
|
|
384
|
-
product:
|
|
385
|
-
req.command.parent.name,
|
|
386
|
-
type: 'docker',
|
|
387
|
-
version: manifestObj.fdhVersion,
|
|
388
|
-
action: req.command.name,
|
|
389
|
-
})
|
|
390
|
-
)
|
|
391
|
-
.then(() => destroySpinner())
|
|
392
|
-
);
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
})
|
|
397
|
-
// Use docker-compose to run the development image. We hard-code verbose to true since docker does not yet support a --quiet or --silent flag. https://github.com/docker/compose/issues/3447
|
|
398
|
-
.then(() => {
|
|
399
|
-
res.notice(
|
|
400
|
-
`Starting Fonto Document History on "http://localhost:${port}"...`
|
|
401
|
-
);
|
|
402
|
-
return executeAndLog(
|
|
403
|
-
res,
|
|
404
|
-
'docker-compose',
|
|
405
|
-
verbosityLevel === constants.VERBOSITY_LEVEL_DEBUG
|
|
406
|
-
? ['-p', projectName, '--verbose', 'up']
|
|
407
|
-
: ['-p', projectName, 'up'],
|
|
408
|
-
temporaryDirectoryPath,
|
|
409
|
-
verbosityLevel,
|
|
410
|
-
true,
|
|
411
|
-
setPidToKillOnForceExit
|
|
412
|
-
);
|
|
413
|
-
})
|
|
414
|
-
// Cleanup temporary directory.
|
|
415
|
-
.then(() =>
|
|
416
|
-
cleanup(
|
|
417
|
-
temporaryDirectoryPath,
|
|
418
|
-
projectName,
|
|
419
|
-
res,
|
|
420
|
-
verbosityLevel
|
|
421
|
-
)
|
|
422
|
-
)
|
|
423
|
-
.catch((error) => {
|
|
424
|
-
if (!stopping) {
|
|
425
|
-
res.notice(
|
|
426
|
-
`See our documentation at ${constants.DOCUMENTATION_EXECUTE_ERROR} for help.`
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
return cleanup(
|
|
431
|
-
temporaryDirectoryPath,
|
|
432
|
-
projectName,
|
|
433
|
-
res,
|
|
434
|
-
verbosityLevel
|
|
435
|
-
)
|
|
436
|
-
.then(() => {
|
|
437
|
-
throw error;
|
|
438
|
-
})
|
|
439
|
-
.catch(() => {
|
|
440
|
-
throw error;
|
|
441
|
-
});
|
|
442
|
-
})
|
|
443
|
-
);
|
|
444
|
-
}
|
|
@@ -1,64 +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, fdhCommand) => {
|
|
10
|
-
fdhCommand
|
|
11
|
-
.addCommand('run', path.resolve(__dirname, 'command.run.controller.js'))
|
|
12
|
-
.setDescription(
|
|
13
|
-
'Run a Fonto Document History instance for development purposes. Requires Docker to be installed.'
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
.addOption(
|
|
17
|
-
'port',
|
|
18
|
-
'p',
|
|
19
|
-
'Listen on the specified port instead of listening on the default port (default=6030).'
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
.addOption(
|
|
23
|
-
'location',
|
|
24
|
-
'l',
|
|
25
|
-
'The directory where the instance is located. Defaults to the current working directory.',
|
|
26
|
-
false
|
|
27
|
-
)
|
|
28
|
-
.addOption(
|
|
29
|
-
'config-location',
|
|
30
|
-
'c',
|
|
31
|
-
`The path where the configuration file (.env) is located. Information about the .env file can be found at ${constants.DOCUMENTATION_CONFIGURATION_GUIDE}.`,
|
|
32
|
-
false
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
.addOption(
|
|
36
|
-
'verbose',
|
|
37
|
-
null,
|
|
38
|
-
'Output default stdout and stderr information.'
|
|
39
|
-
)
|
|
40
|
-
.addOption(
|
|
41
|
-
'debug',
|
|
42
|
-
null,
|
|
43
|
-
'Output all debug information. This also overrides the Logging__LogLevel__Default if set.'
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
.addExample(
|
|
47
|
-
`${moduleRegistration.getAppInfo().name} ${
|
|
48
|
-
constants.COMMAND_PREFIX
|
|
49
|
-
} run`,
|
|
50
|
-
'Build and run a development image using the Fonto Document History instance and configuration located at the current working directory.'
|
|
51
|
-
)
|
|
52
|
-
.addExample(
|
|
53
|
-
`${moduleRegistration.getAppInfo().name} ${
|
|
54
|
-
constants.COMMAND_PREFIX
|
|
55
|
-
} run --port 7455`,
|
|
56
|
-
'Build and run a development image using the Fonto Document History instance and configuration located at the current working directory on the non-default port 7455. '
|
|
57
|
-
)
|
|
58
|
-
.addExample(
|
|
59
|
-
`${moduleRegistration.getAppInfo().name} ${
|
|
60
|
-
constants.COMMAND_PREFIX
|
|
61
|
-
} run --location /opt/my-instances/specific-instance/ --config-location /opt/my-instances/.env`,
|
|
62
|
-
'Build and run a development image using the Fonto Document History instance located at "/opt/my-instances/specific-instance/" using the configuration located at "/opt/my-instances/.env".'
|
|
63
|
-
);
|
|
64
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import constants from './utilities/constants.js';
|
|
5
|
-
import FontoxmlFdhManifest from './utilities/FontoxmlFdhManifest.js';
|
|
6
|
-
import setEntryVisibility from './utilities/setEntryVisibility.js';
|
|
7
|
-
|
|
8
|
-
export default async function upgradeCommand(req, res) {
|
|
9
|
-
res.caption(req.command.getLongName());
|
|
10
|
-
|
|
11
|
-
// Check if the given version exist.
|
|
12
|
-
const sdkVersions = await req.fdt.license.getVersionsForProduct(
|
|
13
|
-
'document-history'
|
|
14
|
-
);
|
|
15
|
-
const version = req.options.version;
|
|
16
|
-
if (!sdkVersions.includes(version)) {
|
|
17
|
-
throw new Error(
|
|
18
|
-
`Could not upgrade to version (${version}), please check if it is a valid version. The latest version is ${sdkVersions.getLatestStable()}, run \`fdt document-history versions\` to get a list of all available versions.`
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const destroySpinner = res.spinner(
|
|
23
|
-
`Upgrading your Fonto Document History instance to ${version}...`
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const directoryPath = path.resolve(
|
|
27
|
-
req.options.location ? req.options.location : process.cwd()
|
|
28
|
-
);
|
|
29
|
-
const manifestFilePath = path.join(
|
|
30
|
-
directoryPath,
|
|
31
|
-
constants.MANIFEST_FILENAME
|
|
32
|
-
);
|
|
33
|
-
let currentVersion;
|
|
34
|
-
return setEntryVisibility(manifestFilePath, true)
|
|
35
|
-
.then(() => FontoxmlFdhManifest.fromJsonFile(manifestFilePath))
|
|
36
|
-
.then((manifest) => {
|
|
37
|
-
currentVersion = manifest.fdhVersion;
|
|
38
|
-
manifest.fdhVersion = version;
|
|
39
|
-
return fs.writeJson(manifestFilePath, manifest);
|
|
40
|
-
})
|
|
41
|
-
.then(() => setEntryVisibility(manifestFilePath, false))
|
|
42
|
-
.then(() =>
|
|
43
|
-
req.fdt.license.sendTelemetry({
|
|
44
|
-
product: req.command.parent.name,
|
|
45
|
-
type: 'docker',
|
|
46
|
-
version,
|
|
47
|
-
currentVersion,
|
|
48
|
-
action: req.command.name,
|
|
49
|
-
})
|
|
50
|
-
)
|
|
51
|
-
.then(() => destroySpinner());
|
|
52
|
-
}
|
|
@@ -1,44 +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, fdhCommand) => {
|
|
10
|
-
fdhCommand
|
|
11
|
-
.addCommand(
|
|
12
|
-
'upgrade',
|
|
13
|
-
path.resolve(__dirname, 'command.upgrade.controller.js')
|
|
14
|
-
)
|
|
15
|
-
.setDescription(
|
|
16
|
-
'Upgrade an existing Fonto Document History instance to the specified version.'
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
.addOption(
|
|
20
|
-
'location',
|
|
21
|
-
'l',
|
|
22
|
-
'The directory of the instance to upgrade. If not set this defaults to the current working directory.',
|
|
23
|
-
false
|
|
24
|
-
)
|
|
25
|
-
.addOption(
|
|
26
|
-
'version',
|
|
27
|
-
null,
|
|
28
|
-
'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.',
|
|
29
|
-
true
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
.addExample(
|
|
33
|
-
`${moduleRegistration.getAppInfo().name} ${
|
|
34
|
-
constants.COMMAND_PREFIX
|
|
35
|
-
} upgrade --version x.x.x`,
|
|
36
|
-
'Upgrade the Fonto Document History instance located at the current working directory to version x.x.x.'
|
|
37
|
-
)
|
|
38
|
-
.addExample(
|
|
39
|
-
`${moduleRegistration.getAppInfo().name} ${
|
|
40
|
-
constants.COMMAND_PREFIX
|
|
41
|
-
} upgrade --location /opt/my-instance/ --version x.x.x`,
|
|
42
|
-
'Upgrade the Fonto Document History instance located at "/opt/my-instance/" to version x.x.x.'
|
|
43
|
-
);
|
|
44
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default async function versionsCommand(req, res) {
|
|
2
|
-
res.caption(req.command.getLongName());
|
|
3
|
-
|
|
4
|
-
const all = req.options.all;
|
|
5
|
-
const destroySpinner = res.spinner(
|
|
6
|
-
`Retrieving ${all ? 'all ' : ''}Fonto Document History versions...`
|
|
7
|
-
);
|
|
8
|
-
const sdkVersions = await req.fdt.license.getVersionsForProduct(
|
|
9
|
-
'document-history'
|
|
10
|
-
);
|
|
11
|
-
destroySpinner();
|
|
12
|
-
res.caption('Fonto Document History versions');
|
|
13
|
-
res.list(all ? sdkVersions.getAll() : sdkVersions.getAllStable(), '-');
|
|
14
|
-
}
|
|
@@ -1,25 +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, fdhCommand) => {
|
|
8
|
-
fdhCommand
|
|
9
|
-
.addCommand(
|
|
10
|
-
'versions',
|
|
11
|
-
path.resolve(__dirname, 'command.versions.controller.js')
|
|
12
|
-
)
|
|
13
|
-
.setDescription('List the available Fonto Document History versions.')
|
|
14
|
-
|
|
15
|
-
.addHiddenOption(
|
|
16
|
-
'all',
|
|
17
|
-
undefined,
|
|
18
|
-
'Include nightly and prerelease versions.'
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
.addExample(
|
|
22
|
-
`${moduleRegistration.getAppInfo().name} document-history versions`,
|
|
23
|
-
'Request the available versions for Fonto Document History.'
|
|
24
|
-
);
|
|
25
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
|
|
3
|
-
export default class FontoxmlFdhManifest {
|
|
4
|
-
constructor(fdhVersion) {
|
|
5
|
-
this.fdhVersion = fdhVersion;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
static fromJsonFile(filePath) {
|
|
9
|
-
return fs
|
|
10
|
-
.exists(filePath)
|
|
11
|
-
.then((exists) => {
|
|
12
|
-
if (!exists) {
|
|
13
|
-
throw new Error(`The file ${filePath} does not exist.`);
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
.then(() => fs.readJson(filePath))
|
|
17
|
-
.then((content) => {
|
|
18
|
-
FontoxmlFdhManifest.validate(content);
|
|
19
|
-
return new FontoxmlFdhManifest(content.fdhVersion);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static validate(input) {
|
|
24
|
-
if (!input.fdhVersion) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
"The Fonto Document History manifest file does not contain a 'fdhVersion'."
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|