Skip to content
Snippets Groups Projects

rename folders and files

Merged Brooke Stevens requested to merge issue/kinetic-3380744:project-naming into main
79 files
+ 129
10828
Compare changes
  • Side-by-side
  • Inline
Files
79
@@ -8,7 +8,7 @@ const fs = require('fs');
const { libraryGlobList, excludedDirs } = require('../kinetic.config');
/**
* Contsruct library definition for partials.yml
* Construct library definition for partials.yml
* @param {string} chunkName
* @param {string} importName
* @returns {{}}
@@ -54,6 +54,8 @@ function generatePartialsEntries() {
const entryPoints = {};
libraryGlobList.forEach((directory) => {
const globRoot = path.resolve(__dirname, `../${directory}`);
// Collect all scss, js files from the configured directory.
// Add in any other file extensions (jsx, vue) here too.
glob.sync('**/*.{scss,js}', {
cwd: globRoot
})
@@ -66,12 +68,14 @@ function generatePartialsEntries() {
}
const filename = pathArr[pathArr.length - 1].split('.');
const absFilePath = path.resolve(globRoot, filePath);
let ext = filename.pop();
if (ext === 'scss') {
let fileExtension = filename.pop();
// Add an entry point for scss files.
if (fileExtension === 'scss') {
entryPoints[`dist/css/${filename[0]}`] = absFilePath;
}
// If using react or vue, check for jsx or vue ext.
if (ext === 'js' && filename[0] !== 'config') {
// If using react or vue, check for jsx or vue file extension.
// Ignore config becasue of config.js files that may also appear.
if (fileExtension === 'js' && filename[0] !== 'config') {
entryPoints[`dist/js/${filename[0]}`] = absFilePath;
}
});
@@ -86,9 +90,10 @@ function generatePartialsEntries() {
function createPartialsYaml(entryPoints) {
let libraries = {};
Object.keys(entryPoints).forEach((entry) => {
let t = generateLibraryFromEntryPoint(entry, entryPoints[entry]);
const libName = Object.keys(t)[0];
libraries[libName] = merge(libraries[libName], t[libName]);
// Create the drupal library definition from the webpack entry point.
const lib = generateLibraryFromEntryPoint(entry, entryPoints[entry]);
const libName = Object.keys(lib)[0];
libraries[libName] = merge(libraries[libName], lib[libName]);
});
// Write out file.
write_yaml('partials.yml', libraries, (err) => {
Loading