@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,52 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import constants from './utilities/constants.js';
|
|
5
|
-
import FontoxmlFcqManifest from './utilities/FontoxmlFcqManifest.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
|
-
'content-quality'
|
|
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 content-quality versions\` to get a list of all available versions.`
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const destroySpinner = res.spinner(
|
|
23
|
-
`Upgrading your Fonto Content Quality 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(() => FontoxmlFcqManifest.fromJsonFile(manifestFilePath))
|
|
36
|
-
.then((manifest) => {
|
|
37
|
-
currentVersion = manifest.fcqVersion;
|
|
38
|
-
manifest.fcqVersion = 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, fcqCommand) => {
|
|
10
|
-
fcqCommand
|
|
11
|
-
.addCommand(
|
|
12
|
-
'upgrade',
|
|
13
|
-
path.resolve(__dirname, 'command.upgrade.controller.js')
|
|
14
|
-
)
|
|
15
|
-
.setDescription(
|
|
16
|
-
'Upgrade an existing Fonto Content Quality 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 Content Quality 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 Content Quality 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 Content Quality versions...`
|
|
7
|
-
);
|
|
8
|
-
const sdkVersions = await req.fdt.license.getVersionsForProduct(
|
|
9
|
-
'content-quality'
|
|
10
|
-
);
|
|
11
|
-
destroySpinner();
|
|
12
|
-
res.caption('Fonto Content Quality 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, fcqCommand) => {
|
|
8
|
-
fcqCommand
|
|
9
|
-
.addCommand(
|
|
10
|
-
'versions',
|
|
11
|
-
path.resolve(__dirname, 'command.versions.controller.js')
|
|
12
|
-
)
|
|
13
|
-
.setDescription('List the available Fonto Content Quality versions.')
|
|
14
|
-
|
|
15
|
-
.addHiddenOption(
|
|
16
|
-
'all',
|
|
17
|
-
undefined,
|
|
18
|
-
'Include nightly and prerelease versions.'
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
.addExample(
|
|
22
|
-
`${moduleRegistration.getAppInfo().name} content-quality versions`,
|
|
23
|
-
'Request the available versions for Fonto Content Quality.'
|
|
24
|
-
);
|
|
25
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
|
|
3
|
-
export default class FontoxmlFcqManifest {
|
|
4
|
-
constructor(fcqVersion) {
|
|
5
|
-
this.fcqVersion = fcqVersion;
|
|
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
|
-
FontoxmlFcqManifest.validate(content);
|
|
19
|
-
return new FontoxmlFcqManifest(content.fcqVersion);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static validate(input) {
|
|
24
|
-
if (!input.fcqVersion) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
"The Fonto Content Quality manifest file does not contain a 'fcqVersion'."
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import constants from './constants.js';
|
|
5
|
-
import executeAndLog from './executeAndLog.js';
|
|
6
|
-
|
|
7
|
-
export default async function cleanup(
|
|
8
|
-
temporaryDirectoryPath,
|
|
9
|
-
projectName,
|
|
10
|
-
res,
|
|
11
|
-
verbosityLevel
|
|
12
|
-
) {
|
|
13
|
-
const temporaryDirectoryExists = await fs.exists(temporaryDirectoryPath);
|
|
14
|
-
if (!temporaryDirectoryExists) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const destroySpinner = res.spinner('Removing temporary resources...');
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
const dockerComposeFileExists = await fs.exists(
|
|
22
|
-
path.join(temporaryDirectoryPath, 'docker-compose.yml')
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const errors = [];
|
|
26
|
-
const tasks = [
|
|
27
|
-
async () => {
|
|
28
|
-
if (dockerComposeFileExists && projectName) {
|
|
29
|
-
await executeAndLog(
|
|
30
|
-
res,
|
|
31
|
-
'docker-compose',
|
|
32
|
-
verbosityLevel === constants.VERBOSITY_LEVEL_DEBUG
|
|
33
|
-
? [
|
|
34
|
-
'-p',
|
|
35
|
-
projectName,
|
|
36
|
-
'--verbose',
|
|
37
|
-
'down',
|
|
38
|
-
'--rmi',
|
|
39
|
-
'local',
|
|
40
|
-
]
|
|
41
|
-
: ['-p', projectName, 'down', '--rmi', 'local'],
|
|
42
|
-
temporaryDirectoryPath,
|
|
43
|
-
verbosityLevel
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
async () => {
|
|
48
|
-
await fs.remove(temporaryDirectoryPath);
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
// Run all cleanup tasks in order. Continue on errors. But collect the errors.
|
|
53
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
54
|
-
try {
|
|
55
|
-
await tasks[i]();
|
|
56
|
-
} catch (error) {
|
|
57
|
-
errors.push(error);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Only throw if a task have failed.
|
|
62
|
-
if (errors.length > 0) {
|
|
63
|
-
throw errors[0];
|
|
64
|
-
}
|
|
65
|
-
} catch (error) {
|
|
66
|
-
throw error;
|
|
67
|
-
} finally {
|
|
68
|
-
destroySpinner();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,44 +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 {
|
|
8
|
-
DEFAULT_IMAGE_NAME: 'fonto-content-quality',
|
|
9
|
-
DEFAULT_IMAGE_TAG: 'latest',
|
|
10
|
-
VERBOSITY_LEVEL_DEBUG: 'debug',
|
|
11
|
-
VERBOSITY_LEVEL_NORMAL: 'normal',
|
|
12
|
-
VERBOSITY_LEVEL_VERBOSE: 'verbose',
|
|
13
|
-
DOCUMENTATION_CONFIGURATION_GUIDE:
|
|
14
|
-
'https://documentation.fontoxml.com/latest/configuration-f6814dd919fd',
|
|
15
|
-
DOCUMENTATION_GETTING_STARTED_GUIDE:
|
|
16
|
-
'https://documentation.fontoxml.com/latest/getting-started-86c3404e841c',
|
|
17
|
-
DOCUMENTATION_EXECUTE_ERROR:
|
|
18
|
-
'https://documentation.fontoxml.com/latest/troubleshooting-fc105f9f1e60',
|
|
19
|
-
INSTANCE_BUILD_DIRECTORY_PATH: path.join(
|
|
20
|
-
__dirname,
|
|
21
|
-
'..',
|
|
22
|
-
'..',
|
|
23
|
-
'instanceBuild'
|
|
24
|
-
),
|
|
25
|
-
INSTANCE_DEV_BUILD_DIRECTORY_PATH: path.join(
|
|
26
|
-
__dirname,
|
|
27
|
-
'..',
|
|
28
|
-
'..',
|
|
29
|
-
'instanceDevBuild'
|
|
30
|
-
),
|
|
31
|
-
INSTANCE_TEMPLATE_DIRECTORY_PATH: path.join(
|
|
32
|
-
__dirname,
|
|
33
|
-
'..',
|
|
34
|
-
'..',
|
|
35
|
-
'instanceTemplate'
|
|
36
|
-
),
|
|
37
|
-
MANIFEST_FILENAME: '.fontoxmlFcqManifest',
|
|
38
|
-
REQUIRED_CONFIGURATION: ['Configuration'],
|
|
39
|
-
TEMPORARY_DIRECTORY_NAME: '.contentQualityTmp',
|
|
40
|
-
TEMPORARY_BUILD_DIRECTORY_NAME: '.contentQualityBuildTmp',
|
|
41
|
-
WHITELIST: ['nlog.config'],
|
|
42
|
-
COMMAND_PREFIX: 'content-quality',
|
|
43
|
-
COMMAND_PREFIX_ALIAS: 'fcq',
|
|
44
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
export default function copyWhitelistedFiles(
|
|
5
|
-
whitelistedFiles,
|
|
6
|
-
sourceDirectory,
|
|
7
|
-
destinationDirectory
|
|
8
|
-
) {
|
|
9
|
-
return Promise.all(
|
|
10
|
-
whitelistedFiles.map((item) => {
|
|
11
|
-
const itemPath = path.join(sourceDirectory, item);
|
|
12
|
-
return fs.exists(itemPath).then((exists) => {
|
|
13
|
-
if (exists) {
|
|
14
|
-
return fs.copy(
|
|
15
|
-
itemPath,
|
|
16
|
-
path.join(destinationDirectory, item)
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
})
|
|
21
|
-
);
|
|
22
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import cp from 'child_process';
|
|
2
|
-
|
|
3
|
-
import constants from './constants.js';
|
|
4
|
-
|
|
5
|
-
export default function executeAndLog(
|
|
6
|
-
res,
|
|
7
|
-
command,
|
|
8
|
-
args,
|
|
9
|
-
currentWorkingDirectoryPath,
|
|
10
|
-
verbosityLevel,
|
|
11
|
-
showStdout,
|
|
12
|
-
processCreatedCallback
|
|
13
|
-
) {
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
const errors = [];
|
|
16
|
-
const childProcess = cp.spawn(command, args, {
|
|
17
|
-
cwd: currentWorkingDirectoryPath,
|
|
18
|
-
});
|
|
19
|
-
const verbose = verbosityLevel !== constants.VERBOSITY_LEVEL_NORMAL;
|
|
20
|
-
|
|
21
|
-
if (processCreatedCallback) {
|
|
22
|
-
processCreatedCallback(process);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
childProcess.stdout.on('data', (data) => {
|
|
26
|
-
if (verbose || showStdout) {
|
|
27
|
-
res.log(data);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
childProcess.stderr.on('data', (data) => {
|
|
32
|
-
if (verbosityLevel === constants.VERBOSITY_LEVEL_DEBUG) {
|
|
33
|
-
res.log(data);
|
|
34
|
-
} else {
|
|
35
|
-
errors.push(data.toString());
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
childProcess.on('error', (error) => {
|
|
40
|
-
res.error(error);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
childProcess.on('close', (code) => {
|
|
44
|
-
if (code === 0) {
|
|
45
|
-
if (verbose) {
|
|
46
|
-
res.debug(
|
|
47
|
-
`${command} ${args.join(' ')} exited with code ${code}`
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
resolve();
|
|
51
|
-
} else {
|
|
52
|
-
if (verbosityLevel !== constants.VERBOSITY_LEVEL_DEBUG) {
|
|
53
|
-
errors.forEach((error) => res.log(error));
|
|
54
|
-
}
|
|
55
|
-
reject(
|
|
56
|
-
new Error(
|
|
57
|
-
`${command} ${args.join(' ')} exited with code ${code}`
|
|
58
|
-
)
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import constants from './constants.js';
|
|
2
|
-
|
|
3
|
-
export default function getVerbosityLevel(verbose, debug) {
|
|
4
|
-
if (debug) {
|
|
5
|
-
return constants.VERBOSITY_LEVEL_DEBUG;
|
|
6
|
-
}
|
|
7
|
-
if (verbose) {
|
|
8
|
-
return constants.VERBOSITY_LEVEL_VERBOSE;
|
|
9
|
-
}
|
|
10
|
-
return constants.VERBOSITY_LEVEL_NORMAL;
|
|
11
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import constants from './constants.js';
|
|
5
|
-
|
|
6
|
-
export default function getWhitelist() {
|
|
7
|
-
return fs
|
|
8
|
-
.readdir(constants.INSTANCE_TEMPLATE_DIRECTORY_PATH)
|
|
9
|
-
.then((entries) => {
|
|
10
|
-
return entries.map((entry) => path.basename(entry));
|
|
11
|
-
})
|
|
12
|
-
.then((whitelist) => {
|
|
13
|
-
whitelist.push(...constants.WHITELIST);
|
|
14
|
-
return whitelist;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import fswin from 'fswin';
|
|
2
|
-
|
|
3
|
-
export default function setEntryVisibility(entryPath, isVisible) {
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
if (fswin) {
|
|
6
|
-
fswin.setAttributes(
|
|
7
|
-
entryPath,
|
|
8
|
-
{ IS_HIDDEN: !isVisible },
|
|
9
|
-
(success) => {
|
|
10
|
-
if (!success) {
|
|
11
|
-
reject();
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
resolve();
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
resolve();
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import constants from './constants.js';
|
|
5
|
-
|
|
6
|
-
export default function validateInstance(directoryPath) {
|
|
7
|
-
return fs
|
|
8
|
-
.exists(directoryPath)
|
|
9
|
-
.then((exists) => {
|
|
10
|
-
if (!exists) {
|
|
11
|
-
throw new Error(`Directory "${directoryPath}" does not exist.`);
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
.then(() => {
|
|
15
|
-
return Promise.all(
|
|
16
|
-
constants.REQUIRED_CONFIGURATION.map((entryName) => {
|
|
17
|
-
return fs
|
|
18
|
-
.exists(path.join(directoryPath, entryName))
|
|
19
|
-
.then((exists) => {
|
|
20
|
-
if (!exists) {
|
|
21
|
-
throw new Error(
|
|
22
|
-
`Directory "${directoryPath}" does not contain a valid Fonto Content Quality instance. Missing "${entryName}".`
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
});
|
|
29
|
-
}
|