fix(cli): better support for external modules and toolGroups in templates (#3364)

* choe(modes, components): improved readability

This commit includes changes to improve performance in the basic-dev-mode and Thumbnail components.
Additionally, a change in the webpack configuration file was made to ignore ".min.js.map" files.
The defaultDataSourceName was also added to several configuration files, and whiteLabeling code was removed
from the local_orthanc configuration file.

* fix(cli): better path management and add dependencies

* better docs

* add default tool group to the templates

* add review comments

* apply review comments

* try to fix test

* fix thumbnail in tests
This commit is contained in:
Alireza authored and GitHub committed 2023-05-08 15:49:28 -04:00
1 parent 187e6b5f30
commit 2f355fa158
26 files changed
+193 -142

No files matched your search

+29 -1
View File
@@ -41,9 +41,37 @@ async function linkPackage(packageDir, options, addToConfig, keyword) {
results = await execa(`yarn`, ['link', packageName]);
console.log(results.stdout);
// Add the node_modules of the linked package so that webpack
// can find the linked package externals if there are
const webpackPwaPath = path.join(
viewerDirectory,
'.webpack',
'webpack.pwa.js'
);
async function updateWebpackConfig(webpackConfigPath, packageDir) {
const packageNodeModules = path.join(packageDir, 'node_modules');
const fileContent = await fs.promises.readFile(webpackConfigPath, 'utf8');
const newLine = `path.resolve(__dirname, '${packageNodeModules}'),`;
const modifiedFileContent = fileContent.replace(
/(modules:\s*\[)([\s\S]*?)(\])/,
`$1$2 ${newLine}$3`
);
await fs.promises.writeFile(webpackConfigPath, modifiedFileContent);
}
await updateWebpackConfig(webpackPwaPath, packageDir);
// change directory to viewer packages and add the config item
process.chdir(viewerDirectory);
addToConfig(packageName, { version });
addToConfig(packageName, {
version,
});
// run prettier on the webpack config
results = await execa(`yarn`, ['prettier', '--write', webpackPwaPath]);
}
function linkExtension(packageDir, options) {