@fontoxml/fontoxml-development-tools 3.11.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 +3841 -8329
- 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/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,3 +1,4 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
1
2
|
import inquirer from 'inquirer';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
|
|
@@ -11,6 +12,29 @@ import schemaZipHelpers from './api/schema/zipHelpers.js';
|
|
|
11
12
|
const SCHEMA_COMPILE_DOCUMENTATION_URL =
|
|
12
13
|
'https://documentation.fontoxml.com/latest/create-a-schema-bundle-d186eeb79200';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Helper function to test whether to use TypeScript conditionally.
|
|
17
|
+
*
|
|
18
|
+
* @param {boolean} isEditorRepositoryPath Whether the command is run from an editor repo
|
|
19
|
+
* @param {boolean} editorSupportsTypeScript Whether the editor platform directory contains tsconfig.json
|
|
20
|
+
* @param {boolean} hasSchemaLocationsJs Whether there are existing SCHEMA_LOCATIONS.js files
|
|
21
|
+
* @param {boolean} hasSchemaLocationsTs Whether there are existing SCHEMA_LOCATIONS.ts files
|
|
22
|
+
*
|
|
23
|
+
* @return {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export function shouldUseTypeScriptForSchemaPackages(
|
|
26
|
+
isEditorRepositoryPath,
|
|
27
|
+
editorSupportsTypeScript,
|
|
28
|
+
hasSchemaLocationsJs,
|
|
29
|
+
hasSchemaLocationsTs
|
|
30
|
+
) {
|
|
31
|
+
// If editor supports TS or if not running in editor, default to TS unless there are existing JS files and no existing TS files
|
|
32
|
+
// If editor does not support TS, default to JS
|
|
33
|
+
return editorSupportsTypeScript || !isEditorRepositoryPath
|
|
34
|
+
? !(hasSchemaLocationsJs && !hasSchemaLocationsTs)
|
|
35
|
+
: false;
|
|
36
|
+
}
|
|
37
|
+
|
|
14
38
|
export default async function schemaCompileCommand(req, res) {
|
|
15
39
|
res.caption(req.command.getLongName());
|
|
16
40
|
|
|
@@ -96,7 +120,7 @@ export default async function schemaCompileCommand(req, res) {
|
|
|
96
120
|
res.list(schemaCompileResult.error.details, '-');
|
|
97
121
|
}
|
|
98
122
|
res.outdent();
|
|
99
|
-
throw new Error('The schema(s) failed to
|
|
123
|
+
throw new Error('The schema(s) failed to compile.');
|
|
100
124
|
}
|
|
101
125
|
|
|
102
126
|
// Output schema warnings.
|
|
@@ -122,7 +146,20 @@ export default async function schemaCompileCommand(req, res) {
|
|
|
122
146
|
fontoJson.rootSchemas,
|
|
123
147
|
false
|
|
124
148
|
);
|
|
149
|
+
|
|
150
|
+
let hasSchemaLocationsJs = false;
|
|
151
|
+
let hasSchemaLocationsTs = false;
|
|
152
|
+
|
|
125
153
|
if (schemaPackagesWithExistingFiles.length) {
|
|
154
|
+
for (const file of schemaPackagesWithExistingFiles) {
|
|
155
|
+
if (path.basename(file) === 'SCHEMA_LOCATIONS.js') {
|
|
156
|
+
hasSchemaLocationsJs = true;
|
|
157
|
+
}
|
|
158
|
+
if (path.basename(file) === 'SCHEMA_LOCATIONS.ts') {
|
|
159
|
+
hasSchemaLocationsTs = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
126
163
|
res.caption('Existing files to be overwritten');
|
|
127
164
|
res.log(
|
|
128
165
|
`In${isEditorRepositoryPath ? ' editor' : ''} path "${outputPath}".`
|
|
@@ -161,6 +198,17 @@ export default async function schemaCompileCommand(req, res) {
|
|
|
161
198
|
}
|
|
162
199
|
}
|
|
163
200
|
|
|
201
|
+
const hasTsConfig = await fs.pathExists(
|
|
202
|
+
path.join(outputPath, 'platform', 'tsconfig.json')
|
|
203
|
+
);
|
|
204
|
+
const platformHasTsConfig = isEditorRepositoryPath && hasTsConfig;
|
|
205
|
+
const useTypeScript = shouldUseTypeScriptForSchemaPackages(
|
|
206
|
+
isEditorRepositoryPath,
|
|
207
|
+
platformHasTsConfig,
|
|
208
|
+
hasSchemaLocationsJs,
|
|
209
|
+
hasSchemaLocationsTs
|
|
210
|
+
);
|
|
211
|
+
|
|
164
212
|
// Create schema packages.
|
|
165
213
|
destroySpinner = res.spinner(
|
|
166
214
|
'Creating package(s) for the compiled schema(s)...'
|
|
@@ -169,7 +217,8 @@ export default async function schemaCompileCommand(req, res) {
|
|
|
169
217
|
await createSchemaPackages(
|
|
170
218
|
outputPath,
|
|
171
219
|
fontoJson.rootSchemas,
|
|
172
|
-
schemaCompileResult
|
|
220
|
+
schemaCompileResult,
|
|
221
|
+
useTypeScript
|
|
173
222
|
);
|
|
174
223
|
} catch (error) {
|
|
175
224
|
throw new res.ErrorWithInnerError(
|
package/src/modules/editor-pre-7-7-0/test/api/schema/buildSchemaExperienceConfigurationModel.test.js
CHANGED
|
@@ -505,93 +505,84 @@ describe('api/schema/buildSchemaExperienceConfigurationModel', () => {
|
|
|
505
505
|
throw new Error('No fixtures found.');
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
-
const fixturesBlacklist = [];
|
|
508
|
+
const fixturesBlacklist = ['invalid-fonto-json'];
|
|
509
509
|
fixtures.forEach((fixture) => {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
testFunction(
|
|
515
|
-
`can build model for fixture "${fixture}"`,
|
|
516
|
-
async function () {
|
|
517
|
-
this.slow(500);
|
|
518
|
-
|
|
519
|
-
const fixturePath = path.join(fixturesPath, fixture);
|
|
520
|
-
const compiledSchemaFilePath = path.join(
|
|
521
|
-
fixturePath,
|
|
522
|
-
'compiledSchema.json'
|
|
523
|
-
);
|
|
524
|
-
const fontoJsonFilePath = path.join(
|
|
525
|
-
fixturePath,
|
|
526
|
-
'fonto.json'
|
|
527
|
-
);
|
|
510
|
+
if (fixturesBlacklist.includes(fixture)) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
528
513
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
UPDATE_SNAPSHOTS &&
|
|
532
|
-
!(await fs
|
|
533
|
-
.access(compiledSchemaFilePath)
|
|
534
|
-
.then(() => true)
|
|
535
|
-
.catch(() => false))
|
|
536
|
-
) {
|
|
537
|
-
this.timeout(120000);
|
|
538
|
-
this.slow(60000);
|
|
539
|
-
console.warn(
|
|
540
|
-
mochaColoring(
|
|
541
|
-
'error stack',
|
|
542
|
-
` - Compiling schema for fixture "${fixture}"...`
|
|
543
|
-
)
|
|
544
|
-
);
|
|
545
|
-
const schemaCompileResults = await compileSchema(
|
|
546
|
-
fixturePath
|
|
547
|
-
);
|
|
548
|
-
await fs.writeJson(
|
|
549
|
-
compiledSchemaFilePath,
|
|
550
|
-
schemaCompileResults
|
|
551
|
-
);
|
|
552
|
-
}
|
|
514
|
+
it(`can build model for fixture "${fixture}"`, async function () {
|
|
515
|
+
this.slow(500);
|
|
553
516
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
const prefixByNamespaceUri = getprefixByNamespaceUri(
|
|
561
|
-
compiledSchemaResultsByXsdPath
|
|
562
|
-
);
|
|
563
|
-
const result = buildSchemaExperienceConfigurationModel(
|
|
564
|
-
schemaPackagesByXsdPath,
|
|
565
|
-
compiledSchemaResultsByXsdPath,
|
|
566
|
-
prefixByNamespaceUri
|
|
567
|
-
);
|
|
517
|
+
const fixturePath = path.join(fixturesPath, fixture);
|
|
518
|
+
const compiledSchemaFilePath = path.join(
|
|
519
|
+
fixturePath,
|
|
520
|
+
'compiledSchema.json'
|
|
521
|
+
);
|
|
522
|
+
const fontoJsonFilePath = path.join(fixturePath, 'fonto.json');
|
|
568
523
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
524
|
+
// Recompile the schema using the schema compiler when updating snapshots and the compiled schema does NOT exist.
|
|
525
|
+
if (
|
|
526
|
+
UPDATE_SNAPSHOTS &&
|
|
527
|
+
!(await fs
|
|
528
|
+
.access(compiledSchemaFilePath)
|
|
529
|
+
.then(() => true)
|
|
530
|
+
.catch(() => false))
|
|
531
|
+
) {
|
|
532
|
+
this.timeout(120000);
|
|
533
|
+
this.slow(60000);
|
|
534
|
+
console.warn(
|
|
535
|
+
mochaColoring(
|
|
536
|
+
'error stack',
|
|
537
|
+
` - Compiling schema for fixture "${fixture}"...`
|
|
538
|
+
)
|
|
574
539
|
);
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
const serializedResult = JSON.stringify(
|
|
578
|
-
result,
|
|
579
|
-
(_key, value) => {
|
|
580
|
-
return value instanceof Map
|
|
581
|
-
? Array.from(value.entries())
|
|
582
|
-
: value instanceof Set
|
|
583
|
-
? Array.from(value)
|
|
584
|
-
: value;
|
|
585
|
-
},
|
|
586
|
-
'\t'
|
|
540
|
+
const schemaCompileResults = await compileSchema(
|
|
541
|
+
fixturePath
|
|
587
542
|
);
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
543
|
+
await fs.writeJson(
|
|
544
|
+
compiledSchemaFilePath,
|
|
545
|
+
schemaCompileResults
|
|
591
546
|
);
|
|
592
|
-
await assertFixtureSnapshot(serializedResult, snapshotPath);
|
|
593
547
|
}
|
|
594
|
-
|
|
548
|
+
|
|
549
|
+
// Build the schema model.
|
|
550
|
+
const fontoJson = await fs.readJson(fontoJsonFilePath);
|
|
551
|
+
const schemaPackagesByXsdPath = fontoJson.rootSchemas;
|
|
552
|
+
const compiledSchemaResultsByXsdPath = await fs.readJson(
|
|
553
|
+
compiledSchemaFilePath
|
|
554
|
+
);
|
|
555
|
+
const prefixByNamespaceUri = getprefixByNamespaceUri(
|
|
556
|
+
compiledSchemaResultsByXsdPath
|
|
557
|
+
);
|
|
558
|
+
const result = buildSchemaExperienceConfigurationModel(
|
|
559
|
+
schemaPackagesByXsdPath,
|
|
560
|
+
compiledSchemaResultsByXsdPath,
|
|
561
|
+
prefixByNamespaceUri
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
// Sanity check.
|
|
565
|
+
sanityCheckResult(
|
|
566
|
+
result,
|
|
567
|
+
schemaPackagesByXsdPath,
|
|
568
|
+
compiledSchemaResultsByXsdPath
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
// Assert against snapshot, and optionally update the snapshot.
|
|
572
|
+
const serializedResult = JSON.stringify(
|
|
573
|
+
result,
|
|
574
|
+
(_key, value) => {
|
|
575
|
+
return value instanceof Map
|
|
576
|
+
? Array.from(value.entries())
|
|
577
|
+
: value instanceof Set
|
|
578
|
+
? Array.from(value)
|
|
579
|
+
: value;
|
|
580
|
+
},
|
|
581
|
+
'\t'
|
|
582
|
+
);
|
|
583
|
+
const snapshotPath = path.join(fixturePath, 'model.out.json');
|
|
584
|
+
await assertFixtureSnapshot(serializedResult, snapshotPath);
|
|
585
|
+
});
|
|
595
586
|
});
|
|
596
587
|
});
|
|
597
588
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This is not a JSON file.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
import getSchemaFontoJson, {
|
|
6
|
+
validateSchemaFontoJson,
|
|
7
|
+
} from '../../../src/api/schema/getSchemaFontoJson.js';
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
|
|
12
|
+
describe('api/schema/getSchemaFontoJson', () => {
|
|
13
|
+
it('can get a schema fonto.json', async () => {
|
|
14
|
+
const fixturePath = path.join(__dirname, 'fixtures', 'abstract-test');
|
|
15
|
+
const fontoJson = await getSchemaFontoJson(fixturePath);
|
|
16
|
+
assert.deepEqual(fontoJson, {
|
|
17
|
+
rootSchemas: {
|
|
18
|
+
'abstractTest.xsd': {
|
|
19
|
+
packageName: 'abstract-test-sx-shell',
|
|
20
|
+
locations: ['urn:fonto:abstract:test'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('throws when the directory does not exist', async () => {
|
|
27
|
+
const fixturePath = path.join(__dirname, 'fixtures', 'non-existing');
|
|
28
|
+
await getSchemaFontoJson(fixturePath)
|
|
29
|
+
.then(() => {
|
|
30
|
+
throw new Error('Should have thrown.');
|
|
31
|
+
})
|
|
32
|
+
.catch((error) => {
|
|
33
|
+
assert.ok(error);
|
|
34
|
+
assert.ok(
|
|
35
|
+
error.message.match(/Schema source path does not exist/)
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('throws when the fonto.json file does not exist', async () => {
|
|
41
|
+
const fixturePath = path.join(__dirname, 'fixtures');
|
|
42
|
+
await getSchemaFontoJson(fixturePath)
|
|
43
|
+
.then(() => {
|
|
44
|
+
throw new Error('Should have thrown.');
|
|
45
|
+
})
|
|
46
|
+
.catch((error) => {
|
|
47
|
+
assert.ok(error);
|
|
48
|
+
assert.ok(
|
|
49
|
+
error.message.match(/schema source path does not exist/)
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('throws when the fonto.json could not be parsed', async () => {
|
|
55
|
+
const fixturePath = path.join(
|
|
56
|
+
__dirname,
|
|
57
|
+
'fixtures',
|
|
58
|
+
'invalid-fonto-json'
|
|
59
|
+
);
|
|
60
|
+
await getSchemaFontoJson(fixturePath)
|
|
61
|
+
.then(() => {
|
|
62
|
+
throw new Error('Should have thrown.');
|
|
63
|
+
})
|
|
64
|
+
.catch((error) => {
|
|
65
|
+
assert.ok(error);
|
|
66
|
+
assert.ok(error.message.match(/could not be parsed/));
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('validateSchemaFontoJson', () => {
|
|
71
|
+
it('throws when there is no rootSchemas property', () => {
|
|
72
|
+
assert.throws(() => {
|
|
73
|
+
validateSchemaFontoJson({});
|
|
74
|
+
}, /Missing "rootSchemas" property/);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('throws when a rootSchemas property is not an object', () => {
|
|
78
|
+
assert.throws(() => {
|
|
79
|
+
validateSchemaFontoJson({ rootSchemas: [] });
|
|
80
|
+
}, /The "rootSchemas" property is not an object/);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('throws when a root schema is not an object', () => {
|
|
84
|
+
assert.throws(() => {
|
|
85
|
+
validateSchemaFontoJson({ rootSchemas: { 'test.xsd': [] } });
|
|
86
|
+
}, /Root schema "test.xsd" is not an object/);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('throws when a root schema is missing the packageName property', () => {
|
|
90
|
+
assert.throws(() => {
|
|
91
|
+
validateSchemaFontoJson({ rootSchemas: { 'test.xsd': {} } });
|
|
92
|
+
}, /Root schema "test.xsd" does not have a valid "packageName" property/);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('throws when a root schema has an invalid location property', () => {
|
|
96
|
+
// Non array.
|
|
97
|
+
assert.throws(() => {
|
|
98
|
+
validateSchemaFontoJson({
|
|
99
|
+
rootSchemas: {
|
|
100
|
+
'test.xsd': {
|
|
101
|
+
packageName: 'test-package',
|
|
102
|
+
locations: {},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}, /Root schema "test.xsd" has an invalid "locations" property/);
|
|
107
|
+
|
|
108
|
+
// Non string value.
|
|
109
|
+
assert.throws(() => {
|
|
110
|
+
validateSchemaFontoJson({
|
|
111
|
+
rootSchemas: {
|
|
112
|
+
'test.xsd': {
|
|
113
|
+
packageName: 'test-package',
|
|
114
|
+
locations: [false],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
}, /Root schema "test.xsd" has an invalid "locations" property/);
|
|
119
|
+
|
|
120
|
+
// Empty string value.
|
|
121
|
+
assert.throws(() => {
|
|
122
|
+
validateSchemaFontoJson({
|
|
123
|
+
rootSchemas: {
|
|
124
|
+
'test.xsd': {
|
|
125
|
+
packageName: 'test-package',
|
|
126
|
+
locations: [''],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}, /Root schema "test.xsd" has an invalid "locations" property/);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('throws when there are multiple root schemas but one is missing the location property', () => {
|
|
134
|
+
// Missing locations property.
|
|
135
|
+
assert.throws(() => {
|
|
136
|
+
validateSchemaFontoJson({
|
|
137
|
+
rootSchemas: {
|
|
138
|
+
'test1.xsd': {
|
|
139
|
+
packageName: 'test-package',
|
|
140
|
+
locations: ['urn:test1'],
|
|
141
|
+
},
|
|
142
|
+
'test2.xsd': {
|
|
143
|
+
packageName: 'test-package',
|
|
144
|
+
},
|
|
145
|
+
'test3.xsd': {
|
|
146
|
+
packageName: 'test-package',
|
|
147
|
+
locations: ['urn:test1'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}, /Root schema "test2.xsd" is missing the "locations" property/);
|
|
152
|
+
|
|
153
|
+
// Empty locations property.
|
|
154
|
+
assert.throws(() => {
|
|
155
|
+
validateSchemaFontoJson({
|
|
156
|
+
rootSchemas: {
|
|
157
|
+
'test1.xsd': {
|
|
158
|
+
packageName: 'test-package',
|
|
159
|
+
locations: ['urn:test1'],
|
|
160
|
+
},
|
|
161
|
+
'test2.xsd': {
|
|
162
|
+
packageName: 'test-package',
|
|
163
|
+
locations: [],
|
|
164
|
+
},
|
|
165
|
+
'test3.xsd': {
|
|
166
|
+
packageName: 'test-package',
|
|
167
|
+
locations: ['urn:test1'],
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
}, /Root schema "test2.xsd" has an empty "locations" property/);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
});
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
|
|
3
|
+
import { shouldUseTypeScriptForSchemaPackages } from '../src/command.schema.compile.controller.js';
|
|
4
|
+
|
|
5
|
+
describe('src/modules/editor-pre-7-7-0/src/command.schema.compile.controller.js', () => {
|
|
6
|
+
describe('shouldUseTypeScriptForSchemaPackages', () => {
|
|
7
|
+
describe('for editors that support TypeScript', () => {
|
|
8
|
+
it('uses TypeScript when there are no pre-existing SCHEMA_LOCATIONS file(s)', () => {
|
|
9
|
+
const isEditorRepositoryPath = true;
|
|
10
|
+
const editorSupportsTypeScript = true;
|
|
11
|
+
const hasSchemaLocationsJs = false;
|
|
12
|
+
const hasSchemaLocationsTs = false;
|
|
13
|
+
|
|
14
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
15
|
+
isEditorRepositoryPath,
|
|
16
|
+
editorSupportsTypeScript,
|
|
17
|
+
hasSchemaLocationsJs,
|
|
18
|
+
hasSchemaLocationsTs
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
assert.strictEqual(result, true);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('uses TypeScript when there are both pre-existing SCHEMA_LOCATIONS.js and SCHEMA_LOCATIONS.ts file(s)', () => {
|
|
25
|
+
const isEditorRepositoryPath = true;
|
|
26
|
+
const editorSupportsTypeScript = true;
|
|
27
|
+
const hasSchemaLocationsJs = true;
|
|
28
|
+
const hasSchemaLocationsTs = true;
|
|
29
|
+
|
|
30
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
31
|
+
isEditorRepositoryPath,
|
|
32
|
+
editorSupportsTypeScript,
|
|
33
|
+
hasSchemaLocationsJs,
|
|
34
|
+
hasSchemaLocationsTs
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
assert.strictEqual(result, true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('does not use TypeScript when there are only pre-existing SCHEMA_LOCATIONS.js file(s)', () => {
|
|
41
|
+
const isEditorRepositoryPath = true;
|
|
42
|
+
const editorSupportsTypeScript = true;
|
|
43
|
+
const hasSchemaLocationsJs = true;
|
|
44
|
+
const hasSchemaLocationsTs = false;
|
|
45
|
+
|
|
46
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
47
|
+
isEditorRepositoryPath,
|
|
48
|
+
editorSupportsTypeScript,
|
|
49
|
+
hasSchemaLocationsJs,
|
|
50
|
+
hasSchemaLocationsTs
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
assert.strictEqual(result, false);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('uses TypeScript when there are only pre-existing SCHEMA_LOCATIONS.ts file(s)', () => {
|
|
57
|
+
const isEditorRepositoryPath = true;
|
|
58
|
+
const editorSupportsTypeScript = true;
|
|
59
|
+
const hasSchemaLocationsJs = false;
|
|
60
|
+
const hasSchemaLocationsTs = true;
|
|
61
|
+
|
|
62
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
63
|
+
isEditorRepositoryPath,
|
|
64
|
+
editorSupportsTypeScript,
|
|
65
|
+
hasSchemaLocationsJs,
|
|
66
|
+
hasSchemaLocationsTs
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
assert.strictEqual(result, true);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('for editors that do not support TypeScript', () => {
|
|
74
|
+
it('does not use TypeScript when there are no pre-existing SCHEMA_LOCATIONS file(s)', () => {
|
|
75
|
+
const isEditorRepositoryPath = true;
|
|
76
|
+
const editorSupportsTypeScript = false;
|
|
77
|
+
const hasSchemaLocationsJs = false;
|
|
78
|
+
const hasSchemaLocationsTs = false;
|
|
79
|
+
|
|
80
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
81
|
+
isEditorRepositoryPath,
|
|
82
|
+
editorSupportsTypeScript,
|
|
83
|
+
hasSchemaLocationsJs,
|
|
84
|
+
hasSchemaLocationsTs
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
assert.strictEqual(result, false);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('does not use TypeScript when there are both pre-existing SCHEMA_LOCATIONS.js and SCHEMA_LOCATIONS.ts file(s)', () => {
|
|
91
|
+
const isEditorRepositoryPath = true;
|
|
92
|
+
const editorSupportsTypeScript = false;
|
|
93
|
+
const hasSchemaLocationsJs = true;
|
|
94
|
+
const hasSchemaLocationsTs = true;
|
|
95
|
+
|
|
96
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
97
|
+
isEditorRepositoryPath,
|
|
98
|
+
editorSupportsTypeScript,
|
|
99
|
+
hasSchemaLocationsJs,
|
|
100
|
+
hasSchemaLocationsTs
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
assert.strictEqual(result, false);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('does not use TypeScript when there are only pre-existing SCHEMA_LOCATIONS.js file(s)', () => {
|
|
107
|
+
const isEditorRepositoryPath = true;
|
|
108
|
+
const editorSupportsTypeScript = false;
|
|
109
|
+
const hasSchemaLocationsJs = true;
|
|
110
|
+
const hasSchemaLocationsTs = false;
|
|
111
|
+
|
|
112
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
113
|
+
isEditorRepositoryPath,
|
|
114
|
+
editorSupportsTypeScript,
|
|
115
|
+
hasSchemaLocationsJs,
|
|
116
|
+
hasSchemaLocationsTs
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
assert.strictEqual(result, false);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('does not use TypeScript when there are only pre-existing SCHEMA_LOCATIONS.ts file(s)', () => {
|
|
123
|
+
const isEditorRepositoryPath = true;
|
|
124
|
+
const editorSupportsTypeScript = false;
|
|
125
|
+
const hasSchemaLocationsJs = false;
|
|
126
|
+
const hasSchemaLocationsTs = true;
|
|
127
|
+
|
|
128
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
129
|
+
isEditorRepositoryPath,
|
|
130
|
+
editorSupportsTypeScript,
|
|
131
|
+
hasSchemaLocationsJs,
|
|
132
|
+
hasSchemaLocationsTs
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
assert.strictEqual(result, false);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
describe('when running outside of an editor or editor repo', () => {
|
|
140
|
+
it('uses TypeScript when there are no pre-existing SCHEMA_LOCATIONS file(s)', () => {
|
|
141
|
+
const isEditorRepositoryPath = false;
|
|
142
|
+
const editorSupportsTypeScript = false;
|
|
143
|
+
const hasSchemaLocationsJs = false;
|
|
144
|
+
const hasSchemaLocationsTs = false;
|
|
145
|
+
|
|
146
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
147
|
+
isEditorRepositoryPath,
|
|
148
|
+
editorSupportsTypeScript,
|
|
149
|
+
hasSchemaLocationsJs,
|
|
150
|
+
hasSchemaLocationsTs
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
assert.strictEqual(result, true);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('uses TypeScript when there are both pre-existing SCHEMA_LOCATIONS.js and SCHEMA_LOCATIONS.ts file(s)', () => {
|
|
157
|
+
const isEditorRepositoryPath = false;
|
|
158
|
+
const editorSupportsTypeScript = false;
|
|
159
|
+
const hasSchemaLocationsJs = true;
|
|
160
|
+
const hasSchemaLocationsTs = true;
|
|
161
|
+
|
|
162
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
163
|
+
isEditorRepositoryPath,
|
|
164
|
+
editorSupportsTypeScript,
|
|
165
|
+
hasSchemaLocationsJs,
|
|
166
|
+
hasSchemaLocationsTs
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
assert.strictEqual(result, true);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('does not use TypeScript when there are only pre-existing SCHEMA_LOCATIONS.js file(s)', () => {
|
|
173
|
+
const isEditorRepositoryPath = false;
|
|
174
|
+
const editorSupportsTypeScript = false;
|
|
175
|
+
const hasSchemaLocationsJs = true;
|
|
176
|
+
const hasSchemaLocationsTs = false;
|
|
177
|
+
|
|
178
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
179
|
+
isEditorRepositoryPath,
|
|
180
|
+
editorSupportsTypeScript,
|
|
181
|
+
hasSchemaLocationsJs,
|
|
182
|
+
hasSchemaLocationsTs
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
assert.strictEqual(result, false);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('uses TypeScript when there are only pre-existing SCHEMA_LOCATIONS.ts file(s)', () => {
|
|
189
|
+
const isEditorRepositoryPath = false;
|
|
190
|
+
const editorSupportsTypeScript = false;
|
|
191
|
+
const hasSchemaLocationsJs = false;
|
|
192
|
+
const hasSchemaLocationsTs = true;
|
|
193
|
+
|
|
194
|
+
const result = shouldUseTypeScriptForSchemaPackages(
|
|
195
|
+
isEditorRepositoryPath,
|
|
196
|
+
editorSupportsTypeScript,
|
|
197
|
+
hasSchemaLocationsJs,
|
|
198
|
+
hasSchemaLocationsTs
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
assert.strictEqual(result, true);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import fastGlob from 'fast-glob';
|
|
1
2
|
import fs from 'fs';
|
|
2
|
-
import glob from 'globby';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
5
|
import commandExtract from './src/command.extract.js';
|
|
@@ -14,7 +14,7 @@ export default (moduleRegistration) => {
|
|
|
14
14
|
let messageBundles;
|
|
15
15
|
|
|
16
16
|
if (req.fdt.editorRepository.path) {
|
|
17
|
-
messageBundles =
|
|
17
|
+
messageBundles = fastGlob.sync(
|
|
18
18
|
[
|
|
19
19
|
'packages/**/messages.*.json',
|
|
20
20
|
'packages-shared/**/messages.*.json',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import fastGlob from 'fast-glob';
|
|
1
2
|
import fs from 'fs';
|
|
2
|
-
import glob from 'globby';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
5
|
export default function getOperations(workingDirectory, roots, ignoreSymlinks) {
|
|
6
|
-
return
|
|
6
|
+
return fastGlob(
|
|
7
7
|
Array.isArray(roots)
|
|
8
8
|
? roots.map((root) => path.join(root, '**', 'operations?(-*).json'))
|
|
9
9
|
: [
|
|
@@ -14,7 +14,7 @@ export default function getOperations(workingDirectory, roots, ignoreSymlinks) {
|
|
|
14
14
|
],
|
|
15
15
|
{
|
|
16
16
|
cwd: workingDirectory,
|
|
17
|
-
|
|
17
|
+
followSymbolicLinks: !ignoreSymlinks,
|
|
18
18
|
}
|
|
19
19
|
).then((operationsJsons) => {
|
|
20
20
|
return operationsJsons.reduce((allOps, operationsJson) => {
|