@fontoxml/fontoxml-development-tools 3.8.0-beta.1 → 3.8.0-beta.2
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 +2 -2
- package/package.json +1 -1
- package/src/modules/document-history/index.js +12 -2
- package/src/modules/document-history/instanceBuild/Dockerfile +4 -0
- package/src/modules/document-history/instanceDevBuild/.env +2 -0
- package/src/modules/document-history/instanceDevBuild/docker-compose.yml +9 -0
- package/src/modules/document-history/instanceTemplate/.env +7 -0
- package/src/modules/document-history/instanceTemplate/Configuration/sx.xml +4 -0
- package/src/modules/document-history/src/command.build.controller.js +260 -0
- package/src/modules/document-history/src/command.build.js +56 -0
- package/src/modules/document-history/src/command.init.controller.js +91 -0
- package/src/modules/document-history/src/command.init.js +44 -0
- package/src/modules/document-history/src/command.run.controller.js +444 -0
- package/src/modules/document-history/src/command.run.js +64 -0
- package/src/modules/document-history/src/command.upgrade.controller.js +52 -0
- package/src/modules/document-history/src/command.upgrade.js +44 -0
- package/src/modules/document-history/src/utilities/FontoxmlFdhManifest.js +30 -0
- package/src/modules/document-history/src/utilities/cleanup.js +70 -0
- package/src/modules/document-history/src/utilities/constants.js +44 -0
- package/src/modules/document-history/src/utilities/copyWhitelistedFiles.js +22 -0
- package/src/modules/document-history/src/utilities/executeAndLog.js +63 -0
- package/src/modules/document-history/src/utilities/getVerbosityLevel.js +11 -0
- package/src/modules/document-history/src/utilities/getWhitelist.js +16 -0
- package/src/modules/document-history/src/utilities/setEntryVisibility.js +22 -0
- package/src/modules/document-history/src/utilities/validateInstance.js +29 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fontoxml/fontoxml-development-tools",
|
|
3
|
-
"version": "3.8.0-beta.
|
|
3
|
+
"version": "3.8.0-beta.2",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@fontoxml/fontoxml-development-tools",
|
|
9
|
-
"version": "3.8.0-beta.
|
|
9
|
+
"version": "3.8.0-beta.2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/core": "7.14.6",
|
package/package.json
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
+
import commandBuild from './src/command.build.js';
|
|
1
2
|
import commandDownloadSelfContained from './src/command.download-self-contained.js';
|
|
3
|
+
import commandInit from './src/command.init.js';
|
|
4
|
+
import commandRun from './src/command.run.js';
|
|
5
|
+
import commandUpgrade from './src/command.upgrade.js';
|
|
2
6
|
import commandVersions from './src/command.versions.js';
|
|
7
|
+
import constants from './src/utilities/constants.js';
|
|
3
8
|
|
|
4
9
|
export default (moduleRegistration) => {
|
|
5
10
|
const fdhCommand = moduleRegistration
|
|
6
|
-
.registerCommand(
|
|
11
|
+
.registerCommand(constants.COMMAND_PREFIX)
|
|
7
12
|
.setDescription(
|
|
8
13
|
'Provides tools for working with Fonto Document History.'
|
|
9
14
|
)
|
|
10
|
-
.addAlias(
|
|
15
|
+
.addAlias(constants.COMMAND_PREFIX_ALIAS)
|
|
16
|
+
|
|
11
17
|
.addRequiredProductLicenses(['document-history'])
|
|
12
18
|
.setHideIfMissingRequiredProductLicenses()
|
|
13
19
|
.setAsHelpCommand();
|
|
14
20
|
|
|
21
|
+
commandBuild(moduleRegistration, fdhCommand);
|
|
15
22
|
commandDownloadSelfContained(moduleRegistration, fdhCommand);
|
|
23
|
+
commandInit(moduleRegistration, fdhCommand);
|
|
24
|
+
commandRun(moduleRegistration, fdhCommand);
|
|
25
|
+
commandUpgrade(moduleRegistration, fdhCommand);
|
|
16
26
|
commandVersions(moduleRegistration, fdhCommand);
|
|
17
27
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# WARNING: We recommend not storing this file in version control since it can contain secrets.
|
|
2
|
+
|
|
3
|
+
# Required configuration:
|
|
4
|
+
#Cms__ApiBaseUrl=http://host.docker.internal:8080/connectors/cms/standard/
|
|
5
|
+
|
|
6
|
+
# Optional configuration:
|
|
7
|
+
#Logging__LogLevel__Default=Warning
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<sx:schemaExperience xmlns:sx="http://schemas.fontoxml.com/document-history/2.0/schema-experience.xsd">
|
|
3
|
+
<!-- This is where your schema experience configuration needs to be filled in. See https://documentation.fontoxml.com/latest/configuration-for-document-history-c2092b6378a3 for more information. -->
|
|
4
|
+
</sx:schemaExperience>
|
|
@@ -0,0 +1,260 @@
|
|
|
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 FontoxmlFdhManifest from './utilities/FontoxmlFdhManifest.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 FontoxmlFdhManifest.fromJsonFile(manifestFilePath).then(
|
|
78
|
+
(manifestObj) => {
|
|
79
|
+
const requestObj = {
|
|
80
|
+
'document-history': {
|
|
81
|
+
docker: {
|
|
82
|
+
version: manifestObj.fdhVersion,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return req.fdt.license
|
|
88
|
+
.getDataForProducts(requestObj)
|
|
89
|
+
.catch((error) => {
|
|
90
|
+
if (error.statusCode === 404) {
|
|
91
|
+
error.solution =
|
|
92
|
+
'This error might be caused by requesting a nonexistent Fonto Document History version, please check your version.';
|
|
93
|
+
}
|
|
94
|
+
throw error;
|
|
95
|
+
})
|
|
96
|
+
.then((productData) => {
|
|
97
|
+
const dockerData =
|
|
98
|
+
productData.products['document-history']
|
|
99
|
+
.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'
|
|
119
|
+
),
|
|
120
|
+
'utf8'
|
|
121
|
+
)
|
|
122
|
+
.then((dockerContent) =>
|
|
123
|
+
dockerContent.replace(
|
|
124
|
+
'${fdhImage}',
|
|
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
|
+
[
|
|
173
|
+
'pull',
|
|
174
|
+
dockerData.image,
|
|
175
|
+
],
|
|
176
|
+
null,
|
|
177
|
+
verbosityLevel,
|
|
178
|
+
false,
|
|
179
|
+
setPidToKillOnForceExit
|
|
180
|
+
)
|
|
181
|
+
)
|
|
182
|
+
.then(() =>
|
|
183
|
+
executeAndLog(
|
|
184
|
+
res,
|
|
185
|
+
'docker',
|
|
186
|
+
[
|
|
187
|
+
'logout',
|
|
188
|
+
dockerData.registry,
|
|
189
|
+
],
|
|
190
|
+
null,
|
|
191
|
+
constants.VERBOSITY_LEVEL_NORMAL,
|
|
192
|
+
false,
|
|
193
|
+
setPidToKillOnForceExit
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
.catch(() => {
|
|
197
|
+
throw new Error(
|
|
198
|
+
'Failed to retrieve the image file.'
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
// Build the docker image.
|
|
204
|
+
.then(() =>
|
|
205
|
+
executeAndLog(
|
|
206
|
+
res,
|
|
207
|
+
'docker',
|
|
208
|
+
[
|
|
209
|
+
'build',
|
|
210
|
+
'-t',
|
|
211
|
+
`${imageName}:${imageTag}`,
|
|
212
|
+
'.',
|
|
213
|
+
],
|
|
214
|
+
temporaryDirectoryPath,
|
|
215
|
+
verbosityLevel,
|
|
216
|
+
false,
|
|
217
|
+
setPidToKillOnForceExit
|
|
218
|
+
)
|
|
219
|
+
)
|
|
220
|
+
.then(() =>
|
|
221
|
+
req.fdt.license.sendTelemetry({
|
|
222
|
+
product:
|
|
223
|
+
req.command.parent.name,
|
|
224
|
+
type: 'docker',
|
|
225
|
+
version: manifestObj.fdhVersion,
|
|
226
|
+
action: req.command.name,
|
|
227
|
+
})
|
|
228
|
+
)
|
|
229
|
+
.then(() => destroySpinner())
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
})
|
|
235
|
+
// Cleanup temporary directory.
|
|
236
|
+
.then(() =>
|
|
237
|
+
cleanup(temporaryDirectoryPath, undefined, res, verbosityLevel)
|
|
238
|
+
)
|
|
239
|
+
.catch((error) => {
|
|
240
|
+
if (!stopping) {
|
|
241
|
+
res.notice(
|
|
242
|
+
`See our documentation at ${constants.DOCUMENTATION_EXECUTE_ERROR} for help.`
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return cleanup(
|
|
247
|
+
temporaryDirectoryPath,
|
|
248
|
+
undefined,
|
|
249
|
+
res,
|
|
250
|
+
verbosityLevel
|
|
251
|
+
)
|
|
252
|
+
.then(() => {
|
|
253
|
+
throw error;
|
|
254
|
+
})
|
|
255
|
+
.catch(() => {
|
|
256
|
+
throw error;
|
|
257
|
+
});
|
|
258
|
+
})
|
|
259
|
+
);
|
|
260
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
'build',
|
|
13
|
+
path.resolve(__dirname, 'command.build.controller.js')
|
|
14
|
+
)
|
|
15
|
+
.setDescription(
|
|
16
|
+
'Build a Fonto Document History 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 Document History instance is located. Defaults to the current working directory.',
|
|
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} ${
|
|
46
|
+
constants.COMMAND_PREFIX
|
|
47
|
+
} build`,
|
|
48
|
+
`Build production image "${constants.DEFAULT_IMAGE_NAME}:${constants.DEFAULT_IMAGE_NAME}" using the Fonto Document History instance located at the current working directory.`
|
|
49
|
+
)
|
|
50
|
+
.addExample(
|
|
51
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
52
|
+
constants.COMMAND_PREFIX
|
|
53
|
+
} build --image-name my-fdh-instance --image-tag 1.0.0 --location /opt/my-instance/`,
|
|
54
|
+
'Build production image "my-fdh-instance:1.0.0" using the Fonto Document History instance located at "/opt/my-instance/".'
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
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 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
|
+
'document-history'
|
|
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 document-history 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 Document History 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 FontoxmlFdhManifest(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
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
'init',
|
|
13
|
+
path.resolve(__dirname, 'command.init.controller.js')
|
|
14
|
+
)
|
|
15
|
+
.setDescription(
|
|
16
|
+
'Initialize a Fonto Document History instance in an empty or nonexistent directory.'
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
.addOption(
|
|
20
|
+
'location',
|
|
21
|
+
'l',
|
|
22
|
+
'The directory where to initialize the instance. If not set this defaults to the current working directory. Note that the directory has to be empty or nonexistent.',
|
|
23
|
+
false
|
|
24
|
+
)
|
|
25
|
+
.addOption(
|
|
26
|
+
'version',
|
|
27
|
+
null,
|
|
28
|
+
'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.',
|
|
29
|
+
true
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
.addExample(
|
|
33
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
34
|
+
constants.COMMAND_PREFIX
|
|
35
|
+
} init --version x.x.x`,
|
|
36
|
+
'Initialize a new Fonto Document History instance located at the current working directory.'
|
|
37
|
+
)
|
|
38
|
+
.addExample(
|
|
39
|
+
`${moduleRegistration.getAppInfo().name} ${
|
|
40
|
+
constants.COMMAND_PREFIX
|
|
41
|
+
} init --location /opt/my-instance/ --version x.x.x`,
|
|
42
|
+
'Initialize a new Fonto Document History instance located at "/opt/my-instance/".'
|
|
43
|
+
);
|
|
44
|
+
};
|