@fontoxml/fontoxml-development-tools 3.8.1 → 3.9.0-beta.3
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/bitbucket-pipelines.yml +7 -0
- package/npm-shrinkwrap.json +14865 -23377
- package/package.json +14 -16
- package/src/addModulesToApp.js +1 -1
- package/src/editorVersions.js +23 -0
- package/src/modules/connectors/index.js +1 -1
- package/src/modules/core/src/command.module.js +1 -1
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureAssetPostRouteHandler.js +0 -11
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureConnectorsCmsStandardAssetRouter.js +0 -3
- package/src/modules/editor/index.js +1 -1
- package/src/modules/editor/src/commands/command.run.controller.js +12 -7
- package/src/modules/editor/src/getWebpackConfig.js +160 -446
- package/src/modules/editor/src/getWebpackDevMiddlewareConfig.js +9 -16
- package/src/modules/editor/src/helpers/getNamesAndPaths.js +167 -0
- package/src/modules/editor/src/helpers/normalisePath.js +2 -2
- package/src/modules/editor/src/templates/app-entry.ts +66 -0
- package/src/modules/editor/src/templates/package.json +3 -0
- package/src/modules/editor/src/webpackLoaders/generatedLoader.cjs +88 -65
- package/src/modules/editor/src/webpackLoaders/platformSourceMapLoader.cjs +8 -10
- package/src/modules/editor/src/webpackLoaders/symbolLoader.cjs +7 -7
- package/src/modules/editor/src/webpackLoaders/vendorsSourceMapLoader.cjs +3 -5
- package/src/modules/editor/src/webpackPlugins/CopyPlugin.js +237 -171
- package/src/modules/editor/src/webpackPlugins/DependenciesInLoadOrderPlugin.js +12 -4
- package/src/modules/editor/src/webpackPlugins/FdtOutputPlugin.js +95 -102
- package/src/modules/editor/src/webpackPlugins/RemoveExplicitExtensionResolvePlugin.js +32 -21
- package/src/modules/editor/src/webpackPlugins/ResolveImportAliasPlugin.js +18 -10
- package/src/modules/editor/src/webpackPlugins/UnitTestPlugin.js +24 -15
- package/src/modules/editor/test/fixtures.test.js +0 -3
- package/src/modules/editor-pre-7-7-0/instanceTemplate/packages/editor-masthead/src/Masthead.jsx +30 -33
- package/src/modules/editor-pre-7-7-0/instanceTemplate/packages/editor-masthead/src/install.js +2 -2
- package/src/modules/editor-pre-7-7-0/instanceTemplate/packages/editor-masthead/src/toolbars/ExampleToolbar.jsx +4 -4
- package/src/modules/{editor/test/fixtures/dependencyWatching/newPackage/canAddANewEmptyAppPackage/generatedSetdefaultconfiguration.out.js → editor-pre-7-7-0/instanceTemplateTypeScript/config/.gitkeep} +0 -0
- package/src/modules/editor-pre-7-7-0/instanceTemplateTypeScript/config.js +12 -0
- package/src/modules/{editor/test/fixtures/dependencyWatching/newPackage/canAddANewEmptyAppPackage/generatedStyles.out.js → editor-pre-7-7-0/instanceTemplateTypeScript/dev-cms/files/.gitkeep} +0 -0
- package/src/modules/editor-pre-7-7-0/instanceTemplateTypeScript/packages/editor-masthead/src/Masthead.tsx +39 -0
- package/src/modules/editor-pre-7-7-0/instanceTemplateTypeScript/packages/editor-masthead/src/install.ts +7 -0
- package/src/modules/editor-pre-7-7-0/instanceTemplateTypeScript/packages/editor-masthead/src/toolbars/ExampleToolbar.tsx +20 -0
- package/src/modules/{editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveAllSpecialFilesFromPackage/generatedSetDefaultConfiguration.out.js → editor-pre-7-7-0/instanceTemplateTypeScript/platform/.gitkeep} +0 -0
- package/src/modules/editor-pre-7-7-0/instanceTemplateTypeScript/tsconfig.json +6 -0
- package/src/modules/editor-pre-7-7-0/src/api/init/checkEditorDestination.js +1 -0
- package/src/modules/editor-pre-7-7-0/src/api/init/createConfigConfiguration.js +42 -18
- package/src/modules/editor-pre-7-7-0/src/api/init/createSchemaExperienceResolver.js +19 -15
- package/src/modules/editor-pre-7-7-0/src/api/schema/buildElementConfigurations.js +70 -0
- package/src/modules/editor-pre-7-7-0/src/api/schema/checkIfCompiledSchemaOverwritesFiles.js +5 -5
- package/src/modules/editor-pre-7-7-0/src/api/schema/createSchemaExperiencePackages.js +122 -86
- package/src/modules/editor-pre-7-7-0/src/api/schema/createSchemaPackages.js +32 -26
- package/src/modules/editor-pre-7-7-0/src/command.init.controller.js +20 -13
- package/src/modules/editor-pre-7-7-0/src/command.init.js +6 -0
- package/src/modules/editor-pre-7-7-0/src/command.upgrade.controller.js +25 -0
- package/src/modules/editor-pre-7-7-0/test/api/init/createConfigConfiguration.test.js +47 -0
- package/src/modules/editor-pre-7-7-0/test/api/schema/buildElementConfigurations.test.js +119 -0
- package/src/modules/editor-pre-7-7-0/test/api/schema/zipSchemaSource.test.js +20 -1
- package/src/modules/editor/dev-cms/connectors-cms-standard/configureAssetGetRouteHandler.js +0 -29
- package/src/modules/editor/src/templates/app-entry.cjs +0 -69
- package/src/modules/editor/test/apps/minimal/config/configuration.js +0 -5
- package/src/modules/editor/test/apps/minimal/config/fonto-manifest.json +0 -6
- package/src/modules/editor/test/apps/minimal/config/schemaExperienceResolver.js +0 -15
- package/src/modules/editor/test/apps/minimal/packages/app-test/src/SCHEMA_LOCATIONS.js +0 -1
- package/src/modules/editor/test/apps/minimal/packages/app-test/src/install.js +0 -3
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-configuration/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-configuration/src/configurationManager.js +0 -11
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-editor/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-editor/src/editor/Router.jsx +0 -1
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-editor/src/renderApp.js +0 -5
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-localization/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-localization/src/localizationManager.js +0 -3
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-modular-schema-experience/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-modular-schema-experience/src/sxManager.js +0 -13
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-operations/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-operations/src/operationsManager.js +0 -3
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-platform-base/fonto-manifest.json +0 -7
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-platform-base/src/configureSxModule.js +0 -3
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-platform-package/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-platform-package/src/install.js +0 -3
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-selectors/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-selectors/src/registerXQueryModule.js +0 -1
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-shims/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-shims/src/main.js +0 -1
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-utils/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-utils/src/getQueryParameterByName.js +0 -1
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-vendors/fonto-manifest.json +0 -4
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-vendors/src/glamor.js +0 -12
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-vendors/src/react-dom.js +0 -6
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-vendors/src/react-dom.min.js +0 -6
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-vendors/src/react.js +0 -1
- package/src/modules/editor/test/apps/minimal/platform/fontoxml-vendors/src/react.min.js +0 -1
- package/src/modules/editor/test/dependecyWatching.test.js +0 -741
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddAllSpecialFilesToPackage/generatedConfigureSxModule.out.js +0 -26
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddAllSpecialFilesToPackage/generatedInstall.out.js +0 -13
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddAllSpecialFilesToPackage/generatedMessages.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddAllSpecialFilesToPackage/generatedSetDefaultConfiguration.out.js +0 -3
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddAllSpecialFilesToPackage/generatedStyles.out.js +0 -1
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddConfiguresxmoduleToPackage/generatedConfigureSxModule.out.js +0 -26
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddInstallToPackage/generatedInstall.out.js +0 -9
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddMessagesEoToPackage/generatedMessages.out.js +0 -5
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddMessagesToPackage/generatedMessages.out.js +0 -5
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddOperationsToPackage/generatedInstall.out.js +0 -9
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddOperationsWildcardToPackage/generatedInstall.out.js +0 -9
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddSetdefaultconfigurationToPackage/generatedSetDefaultConfiguration.out.js +0 -3
- package/src/modules/editor/test/fixtures/dependencyWatching/addSpecialFileToExistingPackage/canAddStylesToPackage/generatedStyles.out.js +0 -1
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewEmptyAppPackage/generatedConfigureSxModule.out.js +0 -20
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewEmptyAppPackage/generatedInstall.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewEmptyAppPackage/generatedMessages.out.js +0 -1
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageAsConfigDependency/generatedInstall.out.js +0 -9
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageAsConfigDependency/generatedInstallBefore.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageAsOtherPackageDependency/generatedInstall.out.js +0 -9
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageAsOtherPackageDependency/generatedInstallBefore.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageWithSpecialFiles/generatedConfigureSxModule.out.js +0 -26
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageWithSpecialFiles/generatedInstall.out.js +0 -13
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageWithSpecialFiles/generatedMessages.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageWithSpecialFiles/generatedSetDefaultConfiguration.out.js +0 -3
- package/src/modules/editor/test/fixtures/dependencyWatching/newPackage/canAddANewPackageWithSpecialFiles/generatedStyles.out.js +0 -1
- package/src/modules/editor/test/fixtures/dependencyWatching/overridePackage/canAddANewOverridePackage/overrideRenderApp.out.js +0 -3
- package/src/modules/editor/test/fixtures/dependencyWatching/overridePackage/canRemoveAnOverridePackage/overrideRenderApp.out.js +0 -3
- package/src/modules/editor/test/fixtures/dependencyWatching/overridePackage/canRemoveAnOverridePackage/renderApp.out.js +0 -3
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/beforeEachHook/generatedConfigureSxModule.out.js +0 -26
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/beforeEachHook/generatedInstall.out.js +0 -13
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/beforeEachHook/generatedMessages.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/beforeEachHook/generatedSetDefaultConfiguration.out.js +0 -3
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/beforeEachHook/generatedStyles.out.js +0 -1
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveAllSpecialFilesFromPackage/generatedConfigureSxModule.out.js +0 -23
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveAllSpecialFilesFromPackage/generatedInstall.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveAllSpecialFilesFromPackage/generatedMessages.out.js +0 -1
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveAllSpecialFilesFromPackage/generatedStyles.out.js +0 -0
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveConfiguresxmoduleFromPackage/generatedConfigureSxModule.out.js +0 -23
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveInstallFromPackage/generatedInstall.out.js +0 -11
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveMessagesEoFromPackage/generatedMessages.out.js +0 -5
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveMessagesFromPackage/generatedMessages.out.js +0 -5
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveOperationsFromPackage/generatedInstall.out.js +0 -11
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveOperationsWildcardFromPackage/generatedInstall.out.js +0 -11
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveSetDefaultConfigurationFromPackage/generatedSetDefaultConfiguration.out.js +0 -0
- package/src/modules/editor/test/fixtures/dependencyWatching/removeSpecialFileFromExistingPackage/canRemoveStylesFromPackage/generatedStyles.out.js +0 -0
- package/src/modules/editor/test/fixtures/dependencyWatching/removedPackage/beforeEachHook/generatedInstall.out.js +0 -9
- package/src/modules/editor/test/fixtures/dependencyWatching/removedPackage/canRemoveAPackage/generatedInstall.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/removedPackage/canRemovePackageFromConfigManifest/generatedInstall.out.js +0 -7
- package/src/modules/editor/test/fixtures/dependencyWatching/removedPackage/canRemovePackageFromOtherPackageManifest/generatedInstall.out.js +0 -9
- package/src/modules/editor/test/fixtures/dependencyWatching/removedPackage/canRemovePackageFromOtherPackageManifest/generatedInstallBefore.out.js +0 -11
- package/src/modules/editor/test/helpers/appMutations/addFilesToPackage.js +0 -105
- package/src/modules/editor/test/helpers/appMutations/addFontoManifestToPackage.js +0 -46
- package/src/modules/editor/test/helpers/appMutations/addPackage.js +0 -53
- package/src/modules/editor/test/helpers/appMutations/generateSpecialFiles.js +0 -59
- package/src/modules/editor/test/helpers/appMutations/mutateConfigFontoManifest.js +0 -49
- package/src/modules/editor/test/helpers/appMutations/mutatePackageFontoManifest.js +0 -67
- package/src/modules/editor/test/helpers/appMutations/removeFilesFromPackage.js +0 -33
- package/src/modules/editor/test/helpers/appMutations/removePackage.js +0 -33
- package/src/modules/editor/test/helpers/createAppStructure.js +0 -17
- package/src/modules/editor/test/helpers/createTempDirectory.js +0 -20
- package/src/modules/editor/test/helpers/createWebpackWatch.js +0 -444
|
@@ -1,42 +1,62 @@
|
|
|
1
|
-
// @TODO: @TS: Remove file extensions from imports in generated files when
|
|
2
|
-
// supporting TS configuration.
|
|
3
|
-
|
|
4
1
|
import babel from '@babel/core';
|
|
5
2
|
import fs from 'fs-extra';
|
|
6
3
|
import os from 'os';
|
|
7
4
|
import path from 'path';
|
|
8
5
|
|
|
6
|
+
import { isPre7170Editor } from '../../../../../editorVersions.js';
|
|
9
7
|
import addCommentToAstNode from '../addCommentToAstNode.js';
|
|
10
8
|
import createPackageDirectoryPath from '../createPackageDirectoryPath.js';
|
|
11
9
|
import createPrettifiedCode from '../createPrettifiedCode.js';
|
|
12
10
|
import writeAstProgramToFile from '../writeAstProgramToFile.js';
|
|
11
|
+
import buildElementConfigurations from './buildElementConfigurations.js';
|
|
13
12
|
import buildSchemaExperienceConfigurationModel from './buildSchemaExperienceConfigurationModel.js';
|
|
14
|
-
import createCommentsForElement from './createCommentsForElement.js';
|
|
15
13
|
|
|
16
14
|
const t = babel.types;
|
|
17
15
|
const template = babel.template;
|
|
18
16
|
|
|
19
|
-
// Babel templates.
|
|
20
|
-
const buildConfigureAsRemoved = template(
|
|
21
|
-
'configureAsRemoved(sxModule, SELECTOR);'
|
|
22
|
-
);
|
|
23
17
|
const buildConfigureAsRemovedImport = template(
|
|
24
|
-
`import configureAsRemoved from 'fontoxml-families/src/configureAsRemoved
|
|
18
|
+
`import configureAsRemoved from 'fontoxml-families/src/configureAsRemoved';`
|
|
25
19
|
);
|
|
20
|
+
|
|
26
21
|
const buildDefaultExportConfigureSxModule = template(
|
|
27
|
-
|
|
22
|
+
`export default function configureSxModule(sxModule) {SX_CONFIGURATION}`
|
|
28
23
|
);
|
|
24
|
+
const buildDefaultExportConfigureSxModuleTS = template(
|
|
25
|
+
`export default function configureSxModule(sxModule: SxModule): void {SX_CONFIGURATION}`,
|
|
26
|
+
{
|
|
27
|
+
plugins: ['typescript'],
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
29
31
|
const buildDefaultExportInstall = template(
|
|
30
32
|
'export default function install() {}'
|
|
31
33
|
);
|
|
34
|
+
const buildDefaultExportInstallTS = template(
|
|
35
|
+
'export default function install(): void {}',
|
|
36
|
+
{
|
|
37
|
+
plugins: ['typescript'],
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
32
41
|
const buildMarkAsAddon = template(`sxModule.markAsAddon();`);
|
|
42
|
+
|
|
33
43
|
const buildPivotModelTransformerManagerImport = template(
|
|
34
|
-
`import pivotModelTransformerManager from 'fontoxml-pivot-model/src/pivotModelTransformerManager
|
|
44
|
+
`import pivotModelTransformerManager from 'fontoxml-pivot-model/src/pivotModelTransformerManager';`
|
|
35
45
|
);
|
|
46
|
+
|
|
36
47
|
const buildRegisterTransformers = template(
|
|
37
48
|
'pivotModelTransformerManager.registerTransformers(sxModule, []);'
|
|
38
49
|
);
|
|
39
50
|
|
|
51
|
+
const buildXqImport = template(`import xq from 'fontoxml-selectors/src/xq';`);
|
|
52
|
+
|
|
53
|
+
const buildSxModuleTypeImport = template(
|
|
54
|
+
`import type { SxModule } from 'fontoxml-modular-schema-experience/src/sxManager';`,
|
|
55
|
+
{
|
|
56
|
+
plugins: ['typescript'],
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
|
|
40
60
|
// Configuration constants.
|
|
41
61
|
const PIVOT_MODEL_TRANSLATION_PACKAGE_NAME = 'editor-clipboard-configuration';
|
|
42
62
|
|
|
@@ -50,61 +70,24 @@ const PIVOT_MODEL_TRANSLATION_PACKAGE_NAME = 'editor-clipboard-configuration';
|
|
|
50
70
|
*/
|
|
51
71
|
async function addPackageToManifestFile(manifestFilePath, packageName) {
|
|
52
72
|
const content = await fs.readJson(manifestFilePath);
|
|
73
|
+
|
|
53
74
|
content.dependencies[packageName] = path.posix.join(
|
|
54
75
|
'packages',
|
|
55
76
|
packageName
|
|
56
77
|
);
|
|
57
|
-
await fs.outputJson(manifestFilePath, content, { spaces: '\t' });
|
|
58
|
-
}
|
|
59
78
|
|
|
60
|
-
|
|
61
|
-
* Builds an array of Babel templates containing the schema experience configuration for the given elements.
|
|
62
|
-
*
|
|
63
|
-
* @param {Object} elements The sx configuration elements for which to create Babel templates.
|
|
64
|
-
* @param {Object} prefixByNamespaceUri The namespace URIs with their prefix.
|
|
65
|
-
*
|
|
66
|
-
* @return {Object}
|
|
67
|
-
*/
|
|
68
|
-
function buildElementConfigurations(elements, prefixByNamespaceUri) {
|
|
69
|
-
return (
|
|
70
|
-
elements
|
|
71
|
-
// Sort the elements ascending by the localName property.
|
|
72
|
-
.sort((a, b) =>
|
|
73
|
-
a.localName < b.localName
|
|
74
|
-
? -1
|
|
75
|
-
: a.localName > b.localName
|
|
76
|
-
? 1
|
|
77
|
-
: 0
|
|
78
|
-
)
|
|
79
|
-
.map((element) => {
|
|
80
|
-
const elementSelector = element.namespacePrefix
|
|
81
|
-
? `self::${element.namespacePrefix}:${element.localName}`
|
|
82
|
-
: `self::${element.localName}`;
|
|
83
|
-
|
|
84
|
-
const elementConfiguration = buildConfigureAsRemoved({
|
|
85
|
-
SELECTOR: t.stringLiteral(elementSelector),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const comments = createCommentsForElement(
|
|
89
|
-
element,
|
|
90
|
-
prefixByNamespaceUri
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
// Add preceding comments to the element configuration.
|
|
94
|
-
addCommentToAstNode(elementConfiguration, comments);
|
|
95
|
-
|
|
96
|
-
return elementConfiguration;
|
|
97
|
-
})
|
|
98
|
-
);
|
|
79
|
+
await fs.outputJson(manifestFilePath, content, { spaces: '\t' });
|
|
99
80
|
}
|
|
100
81
|
|
|
101
82
|
/**
|
|
102
|
-
* Creates a configureSxModule.js file for a schema experience package.
|
|
83
|
+
* Creates a configureSxModule.ts/js file for a schema experience package.
|
|
103
84
|
*
|
|
104
85
|
* @param {string} sxPackagePath The schema experience package path.
|
|
105
86
|
* @param {Object} elements The elements to configure.
|
|
106
87
|
* @param {Object} prefixByNamespaceUri The namespace URIs with their prefix.
|
|
107
88
|
* @param {string[]} addons The addons to include in the manifest file.
|
|
89
|
+
* @param {string} version The SDK version used to configure.
|
|
90
|
+
* @param {boolean} useTypeScript Output TypeScript instead of JavaScript.
|
|
108
91
|
*
|
|
109
92
|
* @return {Promise}
|
|
110
93
|
*/
|
|
@@ -112,16 +95,23 @@ async function createConfigureSxModuleJS(
|
|
|
112
95
|
sxPackagePath,
|
|
113
96
|
elements,
|
|
114
97
|
prefixByNamespaceUri,
|
|
115
|
-
addons
|
|
98
|
+
addons,
|
|
99
|
+
version,
|
|
100
|
+
useTypeScript
|
|
116
101
|
) {
|
|
117
102
|
const elementConfigurations = buildElementConfigurations(
|
|
118
103
|
elements,
|
|
119
|
-
prefixByNamespaceUri
|
|
104
|
+
prefixByNamespaceUri,
|
|
105
|
+
version
|
|
120
106
|
);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
107
|
+
|
|
108
|
+
const defaultExportConfigureSxModuleStatement = useTypeScript
|
|
109
|
+
? buildDefaultExportConfigureSxModuleTS({
|
|
110
|
+
SX_CONFIGURATION: elementConfigurations,
|
|
111
|
+
})
|
|
112
|
+
: buildDefaultExportConfigureSxModule({
|
|
113
|
+
SX_CONFIGURATION: elementConfigurations,
|
|
114
|
+
});
|
|
125
115
|
|
|
126
116
|
addCommentToAstNode(defaultExportConfigureSxModuleStatement, [
|
|
127
117
|
'configureSxModule is meant for registering configuration for one or more schemas, such as element',
|
|
@@ -133,7 +123,18 @@ async function createConfigureSxModuleJS(
|
|
|
133
123
|
'https://documentation.fontoxml.com/latest/family-71e1eb7b5cab',
|
|
134
124
|
]);
|
|
135
125
|
|
|
136
|
-
const
|
|
126
|
+
const importStatements = [];
|
|
127
|
+
|
|
128
|
+
if (useTypeScript) {
|
|
129
|
+
const configureSxModuleImport = buildSxModuleTypeImport();
|
|
130
|
+
importStatements.push(configureSxModuleImport);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
importStatements.push(buildConfigureAsRemovedImport());
|
|
134
|
+
|
|
135
|
+
if (!isPre7170Editor(version)) {
|
|
136
|
+
importStatements.push(buildXqImport());
|
|
137
|
+
}
|
|
137
138
|
|
|
138
139
|
const isMathMLPackage = elements.every(
|
|
139
140
|
(el) => el.namespaceUri === 'http://www.w3.org/1998/Math/MathML'
|
|
@@ -142,7 +143,7 @@ async function createConfigureSxModuleJS(
|
|
|
142
143
|
if (isMathMLPackage) {
|
|
143
144
|
if (!addons.includes('fontoxml-mathml')) {
|
|
144
145
|
addCommentToAstNode(
|
|
145
|
-
|
|
146
|
+
importStatements[importStatements.length - 1],
|
|
146
147
|
[
|
|
147
148
|
'TODO 👉: Configure the MathML addon.',
|
|
148
149
|
'For more information:',
|
|
@@ -165,16 +166,18 @@ async function createConfigureSxModuleJS(
|
|
|
165
166
|
);
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
// Generate the AST for the schema experience configureSxModule.js file.
|
|
169
|
+
// Generate the AST for the schema experience configureSxModule.ts/js file.
|
|
169
170
|
const configureSxModuleJsFilePath = path.join(
|
|
170
171
|
sxPackagePath,
|
|
171
172
|
'src',
|
|
172
|
-
'
|
|
173
|
+
`configureSxModule${useTypeScript ? '.ts' : '.js'}`
|
|
173
174
|
);
|
|
175
|
+
|
|
174
176
|
const configureSxModuleJsAst = t.program([
|
|
175
|
-
|
|
177
|
+
...importStatements,
|
|
176
178
|
defaultExportConfigureSxModuleStatement,
|
|
177
179
|
]);
|
|
180
|
+
|
|
178
181
|
await writeAstProgramToFile(
|
|
179
182
|
configureSxModuleJsFilePath,
|
|
180
183
|
configureSxModuleJsAst
|
|
@@ -182,14 +185,18 @@ async function createConfigureSxModuleJS(
|
|
|
182
185
|
}
|
|
183
186
|
|
|
184
187
|
/**
|
|
185
|
-
* Creates
|
|
188
|
+
* Creates an install.ts/js file for a schema experience package.
|
|
186
189
|
*
|
|
187
|
-
* @param {string}
|
|
190
|
+
* @param {string} sxPackagePath The schema experience package path.
|
|
191
|
+
* @param {boolean} useTypeScript Output TypeScript instead of JavaScript.
|
|
188
192
|
*
|
|
189
193
|
* @return {Promise}
|
|
190
194
|
*/
|
|
191
|
-
async function createInstallJS(sxPackagePath) {
|
|
192
|
-
const defaultExportInstallStatement =
|
|
195
|
+
async function createInstallJS(sxPackagePath, useTypeScript) {
|
|
196
|
+
const defaultExportInstallStatement = useTypeScript
|
|
197
|
+
? buildDefaultExportInstallTS()
|
|
198
|
+
: buildDefaultExportInstall();
|
|
199
|
+
|
|
193
200
|
addCommentToAstNode(defaultExportInstallStatement, [
|
|
194
201
|
'install is meant for registering custom functionality, such as custom operation steps and UI',
|
|
195
202
|
'components. Any set-up for the package involving managers, such as setting up notifier callbacks,',
|
|
@@ -209,9 +216,15 @@ async function createInstallJS(sxPackagePath) {
|
|
|
209
216
|
'Your custom configuration code goes here.'
|
|
210
217
|
);
|
|
211
218
|
|
|
212
|
-
// Generate the AST for the schema experience install.js file.
|
|
213
|
-
const installJsFilePath = path.join(
|
|
219
|
+
// Generate the AST for the schema experience install.ts/js file.
|
|
220
|
+
const installJsFilePath = path.join(
|
|
221
|
+
sxPackagePath,
|
|
222
|
+
'src',
|
|
223
|
+
`install${useTypeScript ? '.ts' : '.js'}`
|
|
224
|
+
);
|
|
225
|
+
|
|
214
226
|
const installJsAst = t.program([defaultExportInstallStatement]);
|
|
227
|
+
|
|
215
228
|
await writeAstProgramToFile(installJsFilePath, installJsAst);
|
|
216
229
|
}
|
|
217
230
|
|
|
@@ -222,6 +235,8 @@ async function createInstallJS(sxPackagePath) {
|
|
|
222
235
|
* @param {Object} schemaExperiencePackage The schema experience model for the package to create.
|
|
223
236
|
* @param {Object} prefixByNamespaceUri The namespace URIs with their prefix.
|
|
224
237
|
* @param {string[]} addons The addons to include in the manifest file.
|
|
238
|
+
* @param {string} version The sdk version used to configure.
|
|
239
|
+
* @param {boolean} useTypeScript Output TypeScript instead of JavaScript.
|
|
225
240
|
*
|
|
226
241
|
* @return {Promise}
|
|
227
242
|
*/
|
|
@@ -229,7 +244,9 @@ async function createSchemaExperiencePackage(
|
|
|
229
244
|
outputPath,
|
|
230
245
|
schemaExperiencePackage,
|
|
231
246
|
prefixByNamespaceUri,
|
|
232
|
-
addons
|
|
247
|
+
addons,
|
|
248
|
+
version,
|
|
249
|
+
useTypeScript
|
|
233
250
|
) {
|
|
234
251
|
// Create the sx package directory.
|
|
235
252
|
const sxPackageName = schemaExperiencePackage.sxPackageName;
|
|
@@ -261,22 +278,26 @@ async function createSchemaExperiencePackage(
|
|
|
261
278
|
sxPackagePath,
|
|
262
279
|
schemaExperiencePackage.elements,
|
|
263
280
|
prefixByNamespaceUri,
|
|
264
|
-
addons
|
|
281
|
+
addons,
|
|
282
|
+
version,
|
|
283
|
+
useTypeScript
|
|
265
284
|
);
|
|
266
|
-
await createInstallJS(sxPackagePath);
|
|
285
|
+
await createInstallJS(sxPackagePath, useTypeScript);
|
|
267
286
|
}
|
|
268
287
|
|
|
269
288
|
/**
|
|
270
289
|
* Creates the schema experience pivot model translation package.
|
|
271
290
|
*
|
|
272
|
-
* @param {string}
|
|
273
|
-
* @param {string}
|
|
291
|
+
* @param {string} outputPath The path of the Fonto Editor, or the schema source directory.
|
|
292
|
+
* @param {string} packageName The name of the pivot model translation package.
|
|
293
|
+
* @param {boolean} useTypeScript Output TypeScript instead of JavaScript.
|
|
274
294
|
*
|
|
275
295
|
* @return {Promise}
|
|
276
296
|
*/
|
|
277
297
|
async function createSchemaExperiencePivotModelTranslationPackage(
|
|
278
298
|
outputPath,
|
|
279
|
-
packageName
|
|
299
|
+
packageName,
|
|
300
|
+
useTypeScript
|
|
280
301
|
) {
|
|
281
302
|
// Create the package directory.
|
|
282
303
|
const pivotModelPackagePath = await createPackageDirectoryPath(
|
|
@@ -313,18 +334,26 @@ async function createSchemaExperiencePivotModelTranslationPackage(
|
|
|
313
334
|
true
|
|
314
335
|
);
|
|
315
336
|
|
|
316
|
-
const configureSxModuleJsAst = t.program(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
337
|
+
const configureSxModuleJsAst = t.program(
|
|
338
|
+
[
|
|
339
|
+
useTypeScript ? buildSxModuleTypeImport() : null,
|
|
340
|
+
buildPivotModelTransformerManagerImport(),
|
|
341
|
+
useTypeScript
|
|
342
|
+
? buildDefaultExportConfigureSxModuleTS({
|
|
343
|
+
SX_CONFIGURATION: markAsAddonStatement,
|
|
344
|
+
})
|
|
345
|
+
: buildDefaultExportConfigureSxModule({
|
|
346
|
+
SX_CONFIGURATION: markAsAddonStatement,
|
|
347
|
+
}),
|
|
348
|
+
].filter(Boolean)
|
|
349
|
+
);
|
|
322
350
|
|
|
323
351
|
const configureSxModuleJsFilePath = path.join(
|
|
324
352
|
pivotModelPackagePath,
|
|
325
353
|
'src',
|
|
326
|
-
'
|
|
354
|
+
`configureSxModule${useTypeScript ? '.ts' : '.js'}`
|
|
327
355
|
);
|
|
356
|
+
|
|
328
357
|
await writeAstProgramToFile(
|
|
329
358
|
configureSxModuleJsFilePath,
|
|
330
359
|
configureSxModuleJsAst
|
|
@@ -339,6 +368,8 @@ async function createSchemaExperiencePivotModelTranslationPackage(
|
|
|
339
368
|
* @param {Object} compiledSchemaResultsByXsdPath The compiled schema for a package by xsd path.
|
|
340
369
|
* @param {Object} prefixByNamespaceUri The namespace URIs with their prefix.
|
|
341
370
|
* @param {string[]} addons The addons to include in the manifest file.
|
|
371
|
+
* @param {string} version The SDK version used to configure.
|
|
372
|
+
* @param {boolean} useTypeScript Output TypeScript instead of JavaScript.
|
|
342
373
|
*
|
|
343
374
|
* @return {Promise}
|
|
344
375
|
*/
|
|
@@ -347,11 +378,14 @@ export default async function createSchemaExperiencePackages(
|
|
|
347
378
|
schemaPackagesByXsdPath,
|
|
348
379
|
compiledSchemaResultsByXsdPath,
|
|
349
380
|
prefixByNamespaceUri,
|
|
350
|
-
addons
|
|
381
|
+
addons,
|
|
382
|
+
version,
|
|
383
|
+
useTypeScript
|
|
351
384
|
) {
|
|
352
385
|
await createSchemaExperiencePivotModelTranslationPackage(
|
|
353
386
|
outputPath,
|
|
354
|
-
PIVOT_MODEL_TRANSLATION_PACKAGE_NAME
|
|
387
|
+
PIVOT_MODEL_TRANSLATION_PACKAGE_NAME,
|
|
388
|
+
useTypeScript
|
|
355
389
|
);
|
|
356
390
|
|
|
357
391
|
const schemaExperiencePackages = buildSchemaExperienceConfigurationModel(
|
|
@@ -365,7 +399,9 @@ export default async function createSchemaExperiencePackages(
|
|
|
365
399
|
outputPath,
|
|
366
400
|
schemaExperiencePackage,
|
|
367
401
|
prefixByNamespaceUri,
|
|
368
|
-
addons
|
|
402
|
+
addons,
|
|
403
|
+
version,
|
|
404
|
+
useTypeScript
|
|
369
405
|
);
|
|
370
406
|
}
|
|
371
407
|
|
|
@@ -36,8 +36,8 @@ async function createPackageManifestJsonFile(packageDirectoryPath) {
|
|
|
36
36
|
* Create the schema file for a specific package.
|
|
37
37
|
*
|
|
38
38
|
* @param {string} packageDirectoryPath The path to a single package directory.
|
|
39
|
-
* @param {string} packageName
|
|
40
|
-
* @param {Object} schemaData
|
|
39
|
+
* @param {string} packageName The package name.
|
|
40
|
+
* @param {Object} schemaData The schema data for this package.
|
|
41
41
|
*
|
|
42
42
|
* @return {Promise}
|
|
43
43
|
*/
|
|
@@ -58,25 +58,27 @@ async function createPackageSchemaJsonFile(
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* Create the SCHEMA_LOCATIONS.js file for a specific package.
|
|
61
|
+
* Create the SCHEMA_LOCATIONS.ts/js file for a specific package.
|
|
62
62
|
*
|
|
63
|
-
* @param {string}
|
|
64
|
-
* @param {Array<string>} schemaLocations
|
|
63
|
+
* @param {string} packageDirectoryPath The path to a single package directory.
|
|
64
|
+
* @param {Array<string>} schemaLocations An array of schema locations for this package.
|
|
65
|
+
* @param {boolean} useTypeScript Output TypeScript instead of JavaScript.
|
|
65
66
|
*
|
|
66
67
|
* @return {Promise}
|
|
67
68
|
*/
|
|
68
69
|
async function createPackageSchemaLocationsJsFile(
|
|
69
70
|
packageDirectoryPath,
|
|
70
|
-
schemaLocations = []
|
|
71
|
+
schemaLocations = [],
|
|
72
|
+
useTypeScript
|
|
71
73
|
) {
|
|
72
|
-
const t = babel
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const schemaLocationsJsFilePath = path.join(
|
|
74
|
+
const { types: t } = babel;
|
|
75
|
+
|
|
76
|
+
const schemaLocationsFilePath = path.join(
|
|
76
77
|
packageDirectoryPath,
|
|
77
78
|
'src',
|
|
78
|
-
'
|
|
79
|
+
`SCHEMA_LOCATIONS${useTypeScript ? '.ts' : '.js'}`
|
|
79
80
|
);
|
|
81
|
+
|
|
80
82
|
const schemaLocationsJsAst = t.program([
|
|
81
83
|
t.exportDefaultDeclaration(
|
|
82
84
|
t.arrayExpression(
|
|
@@ -86,19 +88,18 @@ async function createPackageSchemaLocationsJsFile(
|
|
|
86
88
|
)
|
|
87
89
|
),
|
|
88
90
|
]);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
schemaLocationsJsAst
|
|
92
|
-
);
|
|
91
|
+
|
|
92
|
+
await writeAstProgramToFile(schemaLocationsFilePath, schemaLocationsJsAst);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Create a schema package from a compiled schema.
|
|
97
97
|
*
|
|
98
|
-
* @param {string}
|
|
99
|
-
* @param {Object}
|
|
100
|
-
* @param {Object}
|
|
101
|
-
* @param {string}
|
|
98
|
+
* @param {string} outputPath The path of the Fonto Editor, or the schema source directory.
|
|
99
|
+
* @param {Object} schemaPackagesByXsdPath The package information by xsd path.
|
|
100
|
+
* @param {Object} compiledSchemaResultsByXsdPath The compiled schema for a package by xsd path.
|
|
101
|
+
* @param {string} xsdPath The path of the xsd file for this package.
|
|
102
|
+
* @param {boolean} useTypeScript Output TypeScript instead of JavaScript.
|
|
102
103
|
*
|
|
103
104
|
* @return {Promise}
|
|
104
105
|
*/
|
|
@@ -106,7 +107,8 @@ async function createSchemaPackageFromCompiledSchemaResults(
|
|
|
106
107
|
outputPath,
|
|
107
108
|
schemaPackagesByXsdPath,
|
|
108
109
|
compiledSchemaResultsByXsdPath,
|
|
109
|
-
xsdPath
|
|
110
|
+
xsdPath,
|
|
111
|
+
useTypeScript
|
|
110
112
|
) {
|
|
111
113
|
// Resolve the schema package directory path.
|
|
112
114
|
const schemaPackage = schemaPackagesByXsdPath[xsdPath];
|
|
@@ -124,7 +126,8 @@ async function createSchemaPackageFromCompiledSchemaResults(
|
|
|
124
126
|
),
|
|
125
127
|
await createPackageSchemaLocationsJsFile(
|
|
126
128
|
schemaPackageDirectoryPath,
|
|
127
|
-
schemaPackage.locations
|
|
129
|
+
schemaPackage.locations,
|
|
130
|
+
useTypeScript
|
|
128
131
|
),
|
|
129
132
|
]);
|
|
130
133
|
}
|
|
@@ -133,16 +136,18 @@ async function createSchemaPackageFromCompiledSchemaResults(
|
|
|
133
136
|
* Create all schema packages, will also create the fonto-manifest.json file when the package
|
|
134
137
|
* directory does not yet exists.
|
|
135
138
|
*
|
|
136
|
-
* @param {string}
|
|
137
|
-
* @param {Object}
|
|
138
|
-
* @param {Object}
|
|
139
|
+
* @param {string} outputPath The path of the Fonto Editor, or the schema source directory.
|
|
140
|
+
* @param {Object} schemaPackagesByXsdPath The package information by xsd path.
|
|
141
|
+
* @param {Object} compiledSchemaResultsByXsdPath The compiled schema for a package by xsd path.
|
|
142
|
+
* @param {boolean} useTypeScript Output TypeScript instead of JavaScript.
|
|
139
143
|
*
|
|
140
144
|
* @return {Promise}
|
|
141
145
|
*/
|
|
142
146
|
export default async function createSchemaPackages(
|
|
143
147
|
outputPath,
|
|
144
148
|
schemaPackagesByXsdPath,
|
|
145
|
-
compiledSchemaResultsByXsdPath
|
|
149
|
+
compiledSchemaResultsByXsdPath,
|
|
150
|
+
useTypeScript
|
|
146
151
|
) {
|
|
147
152
|
await Promise.all(
|
|
148
153
|
Object.keys(schemaPackagesByXsdPath).map((xsdPath) => {
|
|
@@ -150,7 +155,8 @@ export default async function createSchemaPackages(
|
|
|
150
155
|
path.resolve(outputPath),
|
|
151
156
|
schemaPackagesByXsdPath,
|
|
152
157
|
compiledSchemaResultsByXsdPath,
|
|
153
|
-
xsdPath
|
|
158
|
+
xsdPath,
|
|
159
|
+
useTypeScript
|
|
154
160
|
);
|
|
155
161
|
})
|
|
156
162
|
);
|
|
@@ -49,6 +49,8 @@ export default async function editorInitCommand(req, res) {
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
const useTypeScript = !req.options['output-javascript'];
|
|
53
|
+
|
|
52
54
|
// Check if the required fonto.json path has been specified when running non-interactive.
|
|
53
55
|
if (req.options['non-interactive'] && !req.options['schema']) {
|
|
54
56
|
throw new res.InputError('Missing schema value.');
|
|
@@ -274,15 +276,12 @@ export default async function editorInitCommand(req, res) {
|
|
|
274
276
|
return;
|
|
275
277
|
}
|
|
276
278
|
|
|
277
|
-
// @TODO: @TS: Remove file extensions from imports in template files when
|
|
278
|
-
// supporting TS configuration.
|
|
279
|
-
|
|
280
279
|
// Copy the Fonto Editor instance template.
|
|
281
280
|
destroySpinner = res.spinner('Setting up a new Fonto Editor instance...');
|
|
282
281
|
const templateDirectoryPath = path.join(
|
|
283
282
|
__dirname,
|
|
284
283
|
'..',
|
|
285
|
-
'instanceTemplate'
|
|
284
|
+
useTypeScript ? 'instanceTemplateTypeScript' : 'instanceTemplate'
|
|
286
285
|
);
|
|
287
286
|
try {
|
|
288
287
|
await fs.copy(templateDirectoryPath, editorPath, {
|
|
@@ -308,7 +307,8 @@ export default async function editorInitCommand(req, res) {
|
|
|
308
307
|
await createSchemaPackages(
|
|
309
308
|
editorPath,
|
|
310
309
|
fontoJson.rootSchemas,
|
|
311
|
-
schemaCompileResults
|
|
310
|
+
schemaCompileResults,
|
|
311
|
+
useTypeScript
|
|
312
312
|
);
|
|
313
313
|
} catch (error) {
|
|
314
314
|
throw new res.ErrorWithInnerError(
|
|
@@ -346,7 +346,9 @@ export default async function editorInitCommand(req, res) {
|
|
|
346
346
|
fontoJson.rootSchemas,
|
|
347
347
|
schemaCompileResults,
|
|
348
348
|
prefixByNamespaceUri,
|
|
349
|
-
addons
|
|
349
|
+
addons,
|
|
350
|
+
sdkVersion,
|
|
351
|
+
useTypeScript
|
|
350
352
|
);
|
|
351
353
|
} catch (error) {
|
|
352
354
|
throw new res.ErrorWithInnerError(
|
|
@@ -379,37 +381,40 @@ export default async function editorInitCommand(req, res) {
|
|
|
379
381
|
destroySpinner();
|
|
380
382
|
}
|
|
381
383
|
|
|
382
|
-
// Creating config/configuration.js.
|
|
384
|
+
// Creating config/configuration.ts/js.
|
|
383
385
|
destroySpinner = res.spinner('Creating the config configuration file...');
|
|
384
386
|
const configConfigurationPath = path.join(
|
|
385
387
|
editorPath,
|
|
386
388
|
'config',
|
|
387
|
-
'
|
|
389
|
+
`configuration${useTypeScript ? '.ts' : '.js'}`
|
|
388
390
|
);
|
|
389
391
|
try {
|
|
390
392
|
await createConfigConfiguration(
|
|
391
393
|
configConfigurationPath,
|
|
392
394
|
prefixByNamespaceUri,
|
|
393
395
|
addons,
|
|
394
|
-
schemaCompileResults
|
|
396
|
+
schemaCompileResults,
|
|
397
|
+
sdkVersion
|
|
395
398
|
);
|
|
396
399
|
} catch (error) {
|
|
397
400
|
throw new res.ErrorWithInnerError(
|
|
398
|
-
|
|
401
|
+
`Could not create the config/configuration${
|
|
402
|
+
useTypeScript ? '.ts' : '.js'
|
|
403
|
+
} file.`,
|
|
399
404
|
error
|
|
400
405
|
);
|
|
401
406
|
} finally {
|
|
402
407
|
destroySpinner();
|
|
403
408
|
}
|
|
404
409
|
|
|
405
|
-
// Creating config/schemaExperienceResolver.js.
|
|
410
|
+
// Creating config/schemaExperienceResolver.ts/js.
|
|
406
411
|
destroySpinner = res.spinner(
|
|
407
412
|
'Creating the config schema experience resolver file...'
|
|
408
413
|
);
|
|
409
414
|
const schemaExperienceResolverPath = path.join(
|
|
410
415
|
editorPath,
|
|
411
416
|
'config',
|
|
412
|
-
'
|
|
417
|
+
`schemaExperienceResolver${useTypeScript ? '.ts' : '.js'}`
|
|
413
418
|
);
|
|
414
419
|
try {
|
|
415
420
|
await createSchemaExperienceResolver(
|
|
@@ -418,7 +423,9 @@ export default async function editorInitCommand(req, res) {
|
|
|
418
423
|
);
|
|
419
424
|
} catch (error) {
|
|
420
425
|
throw new res.ErrorWithInnerError(
|
|
421
|
-
|
|
426
|
+
`Could not create the config/schemaExperienceResolver${
|
|
427
|
+
useTypeScript ? '.ts' : '.js'
|
|
428
|
+
} file.`,
|
|
422
429
|
error
|
|
423
430
|
);
|
|
424
431
|
} finally {
|
|
@@ -56,6 +56,12 @@ export default (moduleRegistration, editorCommand) => {
|
|
|
56
56
|
'Specify the schema compiler backend base url.'
|
|
57
57
|
)
|
|
58
58
|
|
|
59
|
+
.addHiddenOption(
|
|
60
|
+
'output-javascript',
|
|
61
|
+
undefined,
|
|
62
|
+
'Generate JavaScript instead of TypeScript.'
|
|
63
|
+
)
|
|
64
|
+
|
|
59
65
|
.addOption(
|
|
60
66
|
'version',
|
|
61
67
|
undefined,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import unzipper from 'unzipper';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
4
5
|
|
|
5
6
|
import { isPre770Editor } from '../../../editorVersions.js';
|
|
6
7
|
import convertEditorWithOutput from '../../editor/src/commands/api/convertEditorWithOutput.js';
|
|
@@ -18,6 +19,9 @@ import updateConfigFontoManifest from './api/upgrade/updateConfigFontoManifest.j
|
|
|
18
19
|
import validateAddons from './api/validateAddons.js';
|
|
19
20
|
import validateManifest from './api/validateManifest.js';
|
|
20
21
|
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = path.dirname(__filename);
|
|
24
|
+
|
|
21
25
|
export default async function editorUpgradeCommand(req, res) {
|
|
22
26
|
if (req.options['remove-backup']) {
|
|
23
27
|
// DEV-9386
|
|
@@ -308,6 +312,27 @@ export default async function editorUpgradeCommand(req, res) {
|
|
|
308
312
|
);
|
|
309
313
|
}
|
|
310
314
|
|
|
315
|
+
// Set up code intelligence if there's a base tsconfig.json and it hasn't
|
|
316
|
+
// been set up yet.
|
|
317
|
+
const platformHasTsConfig = await fs.pathExists(
|
|
318
|
+
path.join(editorPath, 'platform', 'tsconfig.json')
|
|
319
|
+
);
|
|
320
|
+
if (platformHasTsConfig) {
|
|
321
|
+
await fs.copy(
|
|
322
|
+
path.resolve(
|
|
323
|
+
__dirname,
|
|
324
|
+
'..',
|
|
325
|
+
'instanceTemplateTypeScript',
|
|
326
|
+
'tsconfig.json'
|
|
327
|
+
),
|
|
328
|
+
path.resolve(editorPath, 'tsconfig.json'),
|
|
329
|
+
{
|
|
330
|
+
// Silently fail when target already exists.
|
|
331
|
+
overwrite: false,
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
311
336
|
await req.fdt.license.sendTelemetry({
|
|
312
337
|
product: req.command.parent.name,
|
|
313
338
|
type: 'selfContained',
|