Skip to content

Commit 6218f16

Browse files
committed
Merge pull request #2 from plotly/fix-manifest-metadata-path
Fix manifest metadata path
1 parent db0b6f9 commit 6218f16

File tree

9 files changed

+24
-14
lines changed

9 files changed

+24
-14
lines changed

Diff for: packages/dash-html-components/MANIFEST.in

-1
This file was deleted.

Diff for: packages/dash-html-components/dash_html_components/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import os
12
import dash as _dash
23
import sys as _sys
34

5+
current_path = os.path.dirname(os.path.abspath(__file__))
6+
47
_dash.development.component_loader.load_components(
5-
'../lib/metadata.json',
8+
os.path.join(current_path, '../lib/metadata.json'),
69
['content', 'id', 'key', 'className', 'style', 'dependencies'],
710
globals(),
811
_sys._getframe(1).f_globals.get('__name__', '__main__')

Diff for: packages/dash-html-components/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"homepage": "https://github.com/plotly/dash-html-components",
1515
"scripts": {
1616
"generate-components": "cd scripts && sh generate-all.sh && cd -",
17-
"prepublish": "npm test && builder run transpile-dev",
17+
"prepublish": "npm run generate-components && npm test && builder run transpile-dev",
1818
"publish-pypi": "npm run prepublish && python setup.py sdist upload",
1919
"start": "builder run transpile-dev-watch",
2020
"test": "builder run check"
@@ -27,6 +27,7 @@
2727
"devDependencies": {
2828
"cheerio": "^0.20.0",
2929
"dash-components-archetype-dev": "^0.1.3",
30-
"request": "^2.72.0"
30+
"request": "^2.72.0",
31+
"string": "^3.3.1"
3132
}
3233
}

Diff for: packages/dash-html-components/scripts/data/attributes.json

+1-1
Large diffs are not rendered by default.

Diff for: packages/dash-html-components/scripts/extract-attributes.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const fs = require('fs');
44
const cheerio = require('cheerio');
55
const request = require('request');
6+
const S = require('string');
67

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

35-
let attributeName = attribute;
36-
37-
// Rename `class` to `className`
38-
if (attributeName === 'class') {
39-
attributeName = 'className';
40-
}
36+
// Trim attribute, and convert e.g. `accept-charset` to `acceptCharset`.
37+
let attributeName = S(attribute)
38+
.trim()
39+
.camelize()
40+
.toString();
41+
42+
attributeName = attributeName
43+
// Rename `class` to `className`
44+
.replace(/^class$/, 'className')
45+
// Rename `for` to `htmlFor`
46+
.replace(/^for$/, 'htmlFor');
4147

4248
attributes[attributeName] = {
4349
elements,

Diff for: packages/dash-html-components/setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
version='0.1.1',
66
author='plotly',
77
packages=['dash_html_components'],
8+
package_data={'dash_html_components': ['../lib/metadata.json']},
89
license='MIT',
910
description='Dash UI component suite',
1011
install_requires=['flask', 'plotly', 'flask-cors', 'dash.ly']

Diff for: packages/dash-html-components/src/components/Form.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Form.propTypes = {
1818
/**
1919
* List of supported charsets.
2020
*/
21-
'accept-charset': PropTypes.string,
21+
'acceptCharset': PropTypes.string,
2222

2323

2424
/**

Diff for: packages/dash-html-components/src/components/Label.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Label.propTypes = {
1212
/**
1313
* Describes elements which belongs to this one.
1414
*/
15-
'for': PropTypes.string,
15+
'htmlFor': PropTypes.string,
1616

1717

1818
/**

Diff for: packages/dash-html-components/src/components/Output.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Output.propTypes = {
1212
/**
1313
* Describes elements which belongs to this one.
1414
*/
15-
'for': PropTypes.string,
15+
'htmlFor': PropTypes.string,
1616

1717

1818
/**

0 commit comments

Comments
 (0)