chore(prettier): full repo linting and code reformatting once and for all (#3627)
This commit is contained in:
1 parent
01500a2d4c
commit
9045ddaedc
656 files changed
+21737
-20628
No files matched your search
@@ -12,7 +12,7 @@ function extractStyleChunks(isProdBuild) {
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
'postcss-loader'
|
||||
'postcss-loader',
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -54,7 +54,7 @@ module.exports = (env, argv) => {
|
||||
path: DIST_DIR,
|
||||
filename: isProdBuild ? '[name].bundle.[chunkhash].js' : '[name].js',
|
||||
publicPath: PUBLIC_URL, // Used by HtmlWebPackPlugin for asset prefix
|
||||
devtoolModuleFilenameTemplate: function(info) {
|
||||
devtoolModuleFilenameTemplate: function (info) {
|
||||
if (isProdBuild) {
|
||||
return `webpack:///${info.resourcePath}`;
|
||||
} else {
|
||||
@@ -102,8 +102,7 @@ module.exports = (env, argv) => {
|
||||
},
|
||||
// Copy Dicom Microscopy Viewer build files
|
||||
{
|
||||
from:
|
||||
'../../../node_modules/dicom-microscopy-viewer/dist/dynamic-import',
|
||||
from: '../../../node_modules/dicom-microscopy-viewer/dist/dynamic-import',
|
||||
to: DIST_DIR,
|
||||
globOptions: {
|
||||
ignore: ['**/*.min.js.map'],
|
||||
@@ -111,8 +110,7 @@ module.exports = (env, argv) => {
|
||||
},
|
||||
// Copy dicom-image-loader build files
|
||||
{
|
||||
from:
|
||||
'../../../node_modules/@cornerstonejs/dicom-image-loader/dist/dynamic-import',
|
||||
from: '../../../node_modules/@cornerstonejs/dicom-image-loader/dist/dynamic-import',
|
||||
to: DIST_DIR,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -7,7 +7,7 @@ const autogenerationDisclaimer = `
|
||||
// THIS FILE IS AUTOGENERATED AS PART OF THE EXTENSION AND MODE PLUGIN PROCESS.
|
||||
// IT SHOULD NOT BE MODIFIED MANUALLY \n`;
|
||||
|
||||
const extractName = (val) => (typeof val === 'string') ? val : val.packageName;
|
||||
const extractName = val => (typeof val === 'string' ? val : val.packageName);
|
||||
|
||||
function constructLines(input, categoryName) {
|
||||
let pluginCount = 0;
|
||||
@@ -24,9 +24,7 @@ function constructLines(input, categoryName) {
|
||||
|
||||
const packageName = extractName(entry);
|
||||
|
||||
lines.addToWindowLines.push(
|
||||
`${categoryName}.push("${packageName}");\n`
|
||||
);
|
||||
lines.addToWindowLines.push(`${categoryName}.push("${packageName}");\n`);
|
||||
|
||||
pluginCount++;
|
||||
});
|
||||
@@ -64,7 +62,8 @@ function getRuntimeLoadModesExtensions(modules) {
|
||||
dynamicLoad.push(
|
||||
'\n\n// Add a dynamic runtime loader',
|
||||
'async function loadModule(module) {',
|
||||
' if (typeof module !== \'string\') return module;');
|
||||
" if (typeof module !== 'string') return module;"
|
||||
);
|
||||
modules.forEach(module => {
|
||||
const packageName = extractName(module);
|
||||
dynamicLoad.push(
|
||||
@@ -73,7 +72,7 @@ function getRuntimeLoadModesExtensions(modules) {
|
||||
' return imported.default;',
|
||||
' }'
|
||||
);
|
||||
})
|
||||
});
|
||||
dynamicLoad.push(
|
||||
' return (await import(module)).default;',
|
||||
'}\n',
|
||||
@@ -82,7 +81,8 @@ function getRuntimeLoadModesExtensions(modules) {
|
||||
'export default function importItems(modules) {',
|
||||
' return Promise.all(modules.map(loadModule));',
|
||||
'}\n',
|
||||
'export { loadModule, modes, extensions, importItems };\n\n');
|
||||
'export { loadModule, modes, extensions, importItems };\n\n'
|
||||
);
|
||||
return dynamicLoad.join('\n');
|
||||
}
|
||||
|
||||
@@ -91,14 +91,9 @@ const fromDirectory = (srcDir, path) => {
|
||||
if (path[0] === '.') return srcDir + '/../../..' + path.substring(1);
|
||||
if (path[0] === '~') return os.homedir() + path.substring(1);
|
||||
return path;
|
||||
}
|
||||
};
|
||||
|
||||
const createCopyPluginToDistForLink = (
|
||||
srcDir,
|
||||
distDir,
|
||||
plugins,
|
||||
folderName
|
||||
) => {
|
||||
const createCopyPluginToDistForLink = (srcDir, distDir, plugins, folderName) => {
|
||||
return plugins
|
||||
.map(plugin => {
|
||||
const fromDir = fromDirectory(srcDir, plugin.directory);
|
||||
@@ -107,7 +102,7 @@ const createCopyPluginToDistForLink = (
|
||||
return exists
|
||||
? {
|
||||
from,
|
||||
to: distDir,
|
||||
to: distDir,
|
||||
toType: 'dir',
|
||||
}
|
||||
: undefined;
|
||||
@@ -115,12 +110,7 @@ const createCopyPluginToDistForLink = (
|
||||
.filter(x => !!x);
|
||||
};
|
||||
|
||||
const createCopyPluginToDistForBuild = (
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
plugins,
|
||||
folderName
|
||||
) => {
|
||||
const createCopyPluginToDistForBuild = (SRC_DIR, DIST_DIR, plugins, folderName) => {
|
||||
return plugins
|
||||
.map(plugin => {
|
||||
const from = `${SRC_DIR}/../../../node_modules/${plugin.packageName}/${folderName}/`;
|
||||
@@ -156,17 +146,12 @@ function writePluginImportsFile(SRC_DIR, DIST_DIR) {
|
||||
...pluginConfig.modes,
|
||||
]);
|
||||
|
||||
fs.writeFileSync(
|
||||
`${SRC_DIR}/pluginImports.js`,
|
||||
pluginImportsJsContent,
|
||||
{ flag: 'w+' },
|
||||
err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
fs.writeFileSync(`${SRC_DIR}/pluginImports.js`, pluginImportsJsContent, { flag: 'w+' }, err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Build packages using cli add-mode and add-extension
|
||||
// will get added to the root node_modules, but the linked packages
|
||||
@@ -175,21 +160,14 @@ function writePluginImportsFile(SRC_DIR, DIST_DIR) {
|
||||
const copyPluginPublicToDistBuild = createCopyPluginToDistForBuild(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
],
|
||||
[...pluginConfig.modes, ...pluginConfig.extensions],
|
||||
'public'
|
||||
);
|
||||
|
||||
const copyPluginPublicToDistLink = createCopyPluginToDistForLink(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
...pluginConfig.public,
|
||||
],
|
||||
[...pluginConfig.modes, ...pluginConfig.extensions, ...pluginConfig.public],
|
||||
'public'
|
||||
);
|
||||
|
||||
@@ -198,20 +176,14 @@ function writePluginImportsFile(SRC_DIR, DIST_DIR) {
|
||||
const copyPluginDistToDistBuild = createCopyPluginToDistForBuild(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
],
|
||||
[...pluginConfig.modes, ...pluginConfig.extensions],
|
||||
'dist'
|
||||
);
|
||||
|
||||
const copyPluginDistToDistLink = createCopyPluginToDistForLink(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
],
|
||||
[...pluginConfig.modes, ...pluginConfig.extensions],
|
||||
'dist'
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user