Skip to content

Commit

Permalink
Merge 577d9f3 into b4226ad
Browse files Browse the repository at this point in the history
  • Loading branch information
adamszalapski authored Jan 8, 2019
2 parents b4226ad + 577d9f3 commit 80fcf36
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs-site/.incache

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions packages/components/bolt-icon/icon.schema.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$schema: http://json-schema.org/draft-04/schema#
$schema: 'http://json-schema.org/draft-04/schema#'
title: Icon
type: object
required:
Expand All @@ -8,7 +8,6 @@ properties:
type: string
description: Icon name.
enum:
#todo: dynamically generate or reference these
- academy
- add-open
- add-solid
Expand All @@ -30,16 +29,16 @@ properties:
- calendar
- careers
- case-management
- check
- check-circle
- check-solid
- check
- chevron-down
- chevron-left
- chevron-right
- chevron-up
- close
- close-open
- close-solid
- close
- cloud
- co-browse
- communications
Expand All @@ -53,14 +52,14 @@ properties:
- email
- energy
- entertainment
- exit-full screen
- exit-full-screen
- external-link
- eye-off
- eye
- facebook-solid
- eye-off
- facebook
- field-service-gray
- facebook-solid
- field-service
- field-service-gray
- filter
- financial
- full-screen
Expand All @@ -79,14 +78,14 @@ properties:
- knowledgebase
- launchpad
- life-sciences
- linkedin-solid
- linkedin
- linkedin-solid
- lock
- manufacturing
- map-pin-solid
- map-pin
- marketing-gray
- map-pin-solid
- marketing
- marketing-gray
- menu
- minus-open
- minus-solid
Expand All @@ -113,8 +112,8 @@ properties:
- system-admin
- training
- transportation
- twitter-solid
- twitter
- twitter-solid
- unlock
- upload
- user
Expand Down
18 changes: 18 additions & 0 deletions packages/components/bolt-icons/build-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const path = require('path');
const cheerio = require('cheerio');
const prettier = require('prettier');
const SVGO = require('svgo');
const yaml = require('js-yaml');

const svgo = new SVGO({
plugins: [
Expand Down Expand Up @@ -260,6 +261,7 @@ async function build() {
allExports.join('\n'),
'utf-8',
);
generateYAML(icons);
console.log(`Built ${iconPaths.length} icons.`);
} catch (error) {
console.error(error);
Expand All @@ -270,4 +272,20 @@ async function build() {
}
}

async function generateYAML(icons) {
try{
const names = icons.map(icon => icon.id);
const schema = yaml.safeLoad(fs.readFileSync('../bolt-icon/icon.schema.yml', 'utf8'));
schema.properties.name.enum = names;
fs.writeFileSync('../bolt-icon/icon.schema.yml',yaml.safeDump(schema));
console.log(`Icon Schema Updated`);
} catch (error) {
console.error(error);
console.error(
'Error trying to generate Icon YAML document for "@bolt/components-icon".',
);
process.exitCode = 1;
}
}

build();
1 change: 1 addition & 0 deletions packages/components/bolt-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"cheerio": "^1.0.0-rc.2",
"fs-extra": "^5.0.0",
"globby": "^8.0.1",
"js-yaml": "^3.12.1",
"nodemon": "^1.15.1",
"prettier": "^1.7.4",
"svgo": "^1.0.5",
Expand Down
12 changes: 10 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,9 @@
sleep-promise "^8.0.1"

"@bolt/components-page-footer@file:packages/components/bolt-page-footer":
version "2.2.1"
version "2.2.2"
dependencies:
"@bolt/core" "^2.2.1"
"@bolt/core" "^2.2.2"

"@ckeditor/ckeditor5-build-classic@^11.1.1":
version "11.2.0"
Expand Down Expand Up @@ -8592,6 +8592,14 @@ js-yaml@^3.10.0, js-yaml@^3.12.0, js-yaml@^3.4.3, js-yaml@^3.5.2, js-yaml@^3.7.0
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^3.12.1:
version "3.12.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.1.tgz#295c8632a18a23e054cf5c9d3cecafe678167600"
integrity sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"

jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
Expand Down

0 comments on commit 80fcf36

Please sign in to comment.