Skip to content

Commit

Permalink
buildStylesheet fixes (#1557)
Browse files Browse the repository at this point in the history
- Create the destination directory if it's missing
- Catch writeFile errors
- Also added the npm login part in the release process check list
  • Loading branch information
nstepien committed Apr 4, 2019
1 parent a206ab8 commit 0836ce0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/CONTRIBUTING.md
Expand Up @@ -111,6 +111,8 @@ For maintainers only.
- `npm run docs`
- Update the changelog, if necessary.
- Commit your changes, if any.
- Login to the `adazzle` npm account if you haven't already done so:
- `npm login`
- Publish the update with lerna:
- On the `master` branch: `npx lerna publish`
- On the `next` branch: `npx lerna publish --dist-tag next`
Expand Down
6 changes: 4 additions & 2 deletions tools/buildStylesheets.js
@@ -1,6 +1,7 @@
'use strict'
'use strict';

const fs = require('fs').promises;
const { dirname } = require('path');
const less = require('less');
const CleanCSS = require('clean-css');

Expand All @@ -21,7 +22,8 @@ async function buildStylesheet(path) {
const { css } = await less.render(buf.toString(), { filename: path });
const { styles } = await cleanCSS.minify(css);
const dest = path.replace('/style/', '/dist/').replace('.less', '.css');
fs.writeFile(dest, styles);
await fs.mkdir(dirname(dest), { recursive: true });
await fs.writeFile(dest, styles);
} catch (err) {
console.error(err.message || err);
process.exitCode = 1;
Expand Down

0 comments on commit 0836ce0

Please sign in to comment.