Skip to content

Commit

Permalink
fix: Add missing copy script; Promise.all in my.js (#43)(#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
nfreear committed Oct 18, 2023
1 parent c09926d commit acf34dd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion my.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const KLASS = ELEM.map((el) => {
return { el, klass, path };
});

await KLASS.forEach(async ({ path }) => await import(path));
const PR = KLASS.map(async ({ path }) => await import(path));
await Promise.all(PR);

console.debug('My.js:', KLASS, url);
24 changes: 24 additions & 0 deletions scripts/copy.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copy source files to individual packages.
*/

import { copyFile } from 'node:fs/promises';

const base = 'packages';
const PACKAGES = [
{
pkg: 'my-map',
paths: [
'src/MyElement.js',
'src/Options.js',
'src/components/MyMapElement.js',
'src/templates/my-map.tpl.html'
]
}
];

PACKAGES.forEach(async ({ pkg, paths }) => {
console.debug(`Copying ${paths.length} files for:`, pkg);

await paths.forEach(async (path) => await copyFile(path, `${base}/${pkg}/${path}`));
});

0 comments on commit acf34dd

Please sign in to comment.