Skip to content

Commit

Permalink
Merge pull request plotly#2 from plotly/fix-manifest-metadata-path
Browse files Browse the repository at this point in the history
Fix manifest metadata path
  • Loading branch information
coopy committed Jul 7, 2016
1 parent 2c2aca4 commit 3ea31b9
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 14 deletions.
1 change: 0 additions & 1 deletion packages/dash-html-components/MANIFEST.in

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import os
import dash as _dash
import sys as _sys

current_path = os.path.dirname(os.path.abspath(__file__))

_dash.development.component_loader.load_components(
'../lib/metadata.json',
os.path.join(current_path, '../lib/metadata.json'),
['content', 'id', 'key', 'className', 'style', 'dependencies'],
globals(),
_sys._getframe(1).f_globals.get('__name__', '__main__')
Expand Down
5 changes: 3 additions & 2 deletions packages/dash-html-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"homepage": "https://github.com/plotly/dash-html-components",
"scripts": {
"generate-components": "cd scripts && sh generate-all.sh && cd -",
"prepublish": "npm test && builder run transpile-dev",
"prepublish": "npm run generate-components && npm test && builder run transpile-dev",
"publish-pypi": "npm run prepublish && python setup.py sdist upload",
"start": "builder run transpile-dev-watch",
"test": "builder run check"
Expand All @@ -27,6 +27,7 @@
"devDependencies": {
"cheerio": "^0.20.0",
"dash-components-archetype-dev": "^0.1.3",
"request": "^2.72.0"
"request": "^2.72.0",
"string": "^3.3.1"
}
}
2 changes: 1 addition & 1 deletion packages/dash-html-components/scripts/data/attributes.json

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions packages/dash-html-components/scripts/extract-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const fs = require('fs');
const cheerio = require('cheerio');
const request = require('request');
const S = require('string');

const htmlURL = 'https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes';
const dataPath = './data/attributes.json';
Expand Down Expand Up @@ -32,12 +33,17 @@ function extractAttributes($) {
return true;
}

let attributeName = attribute;

// Rename `class` to `className`
if (attributeName === 'class') {
attributeName = 'className';
}
// Trim attribute, and convert e.g. `accept-charset` to `acceptCharset`.
let attributeName = S(attribute)
.trim()
.camelize()
.toString();

attributeName = attributeName
// Rename `class` to `className`
.replace(/^class$/, 'className')
// Rename `for` to `htmlFor`
.replace(/^for$/, 'htmlFor');

attributes[attributeName] = {
elements,
Expand Down
1 change: 1 addition & 0 deletions packages/dash-html-components/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
version='0.1.1',
author='plotly',
packages=['dash_html_components'],
package_data={'dash_html_components': ['../lib/metadata.json']},
license='MIT',
description='Dash UI component suite',
install_requires=['flask', 'plotly', 'flask-cors', 'dash.ly']
Expand Down
2 changes: 1 addition & 1 deletion packages/dash-html-components/src/components/Form.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Form.propTypes = {
/**
* List of supported charsets.
*/
'accept-charset': PropTypes.string,
'acceptCharset': PropTypes.string,


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Label.propTypes = {
/**
* Describes elements which belongs to this one.
*/
'for': PropTypes.string,
'htmlFor': PropTypes.string,


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Output.propTypes = {
/**
* Describes elements which belongs to this one.
*/
'for': PropTypes.string,
'htmlFor': PropTypes.string,


/**
Expand Down

0 comments on commit 3ea31b9

Please sign in to comment.