aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/utils/format-scripts.js
blob: cfa11bc7c0efc4aafffe20e693f81f3273c0fc3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module.exports.formatScripts = scripts => {
	const _scripts = {};

	for (const scriptType in scripts) {
		const currentScripts = scripts[scriptType];
		for (const scriptName in currentScripts) {
			const scriptPath = currentScripts[scriptName];
			_scripts[scriptPath] = _scripts[scriptPath] || {};
			_scripts[scriptPath][scriptType] = _scripts[scriptPath][scriptType] || [];
			_scripts[scriptPath][scriptType].push(scriptName);
		}
	}



	return _scripts;
};