Skip to content

Commit

Permalink
Fix install vendor for static vendors
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed Aug 14, 2024
1 parent a86710c commit 14a207f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions assets/core/src/install-vendors.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,23 @@ export async function installVendors(npmVendors = [], legacyComposerVendors = []
});

// Install local saved vendors
console.log(`[${action} Local] resources/assets/vendor/**/* => ${root}/`);
doInstall('resources/assets/vendor/*', `${root}/`);
const staticVendorDir = 'resources/assets/vendor/';
const staticVendors = fs.readdirSync(staticVendorDir);

for (const staticVendor of staticVendors) {
if (staticVendor.startsWith('@')) {
const subVendors = fs.readdirSync(staticVendorDir + staticVendor);

for (const subVendor of subVendors) {
const subVendorName = staticVendor + '/' + subVendor;
console.log(`[${action} Local] resources/assets/vendor/${subVendorName}/ => ${root}/${subVendorName}/`);
doInstall(staticVendorDir + subVendorName, `${root}/${subVendorName}/`);
}
} else {
console.log(`[${action} Local] resources/assets/vendor/${staticVendor}/ => ${root}/${staticVendor}/`);
doInstall(staticVendorDir + staticVendor, `${root}/${staticVendor}/`);
}
}
}

function doInstall(source, dest) {
Expand Down Expand Up @@ -115,7 +130,7 @@ function injectNpmPackages(composerVendors = []) {
function getInstalledComposerVendors() {
const composerFile = path.resolve(process.cwd(), 'composer.json');
const composerJson = loadJson(composerFile);

return [
...new Set(
Object.keys(composerJson['require'] || {})
Expand Down

0 comments on commit 14a207f

Please sign in to comment.