kopia lustrzana https://github.com/shoelace-style/shoelace
don't swallow errors
rodzic
c37e4ba6b5
commit
ca8ba2d16b
|
@ -16,7 +16,6 @@ const iconDir = path.join(outdir, '/assets/icons');
|
|||
|
||||
const iconPackageData = JSON.parse(await fs.readFile('./node_modules/bootstrap-icons/package.json', 'utf8'));
|
||||
|
||||
try {
|
||||
const version = iconPackageData.version;
|
||||
const srcPath = `./.cache/icons/icons-${version}`;
|
||||
const url = `https://github.com/twbs/icons/archive/v${version}.zip`;
|
||||
|
@ -25,12 +24,10 @@ try {
|
|||
await fs.stat(`${srcPath}/LICENSE.md`);
|
||||
} catch {
|
||||
// Download the source from GitHub (since not everything is published to NPM)
|
||||
console.log(`Downloading and extracting Bootstrap Icons ${version}...`);
|
||||
await download(url, './.cache/icons', { extract: true });
|
||||
}
|
||||
|
||||
// Copy icons
|
||||
console.log(`Copying icons and license...`);
|
||||
await deleteAsync([iconDir]);
|
||||
await fs.mkdir(iconDir, { recursive: true });
|
||||
await Promise.all([
|
||||
|
@ -41,9 +38,6 @@ try {
|
|||
|
||||
// Generate metadata
|
||||
const files = await globby(`${srcPath}/docs/content/icons/**/*.md`);
|
||||
|
||||
console.log(`Generating metadata for ${files.length} icons...`);
|
||||
|
||||
const metadata = await Promise.all(
|
||||
files.map(async file => {
|
||||
const name = path.basename(file, path.extname(file));
|
||||
|
@ -59,6 +53,3 @@ try {
|
|||
);
|
||||
|
||||
await fs.writeFile(path.join(iconDir, 'icons.json'), JSON.stringify(metadata, null, 2), 'utf8');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ const embeds = {};
|
|||
|
||||
mkdirSync(themesDir, { recursive: true });
|
||||
|
||||
try {
|
||||
// Gather an object containing the source of all files named "_filename.css" so we can embed them later
|
||||
filesToEmbed.forEach(file => {
|
||||
embeds[path.basename(file)] = fs.readFileSync(file, 'utf8');
|
||||
|
@ -54,7 +53,3 @@ try {
|
|||
fs.writeFileSync(cssFile, css, 'utf8');
|
||||
fs.writeFileSync(jsFile, js, 'utf8');
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(chalk.red('Error generating stylesheets!'));
|
||||
console.error(err);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue