Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 557d2fd

Browse files
authored
Merge pull request #270 from plotly/update-circle
Update circle.
2 parents 5cccfd3 + 13f8d6e commit 557d2fd

34 files changed

+12968
-4913
lines changed

.circleci/config.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
version: 2
2+
3+
jobs:
4+
"python-2.7": &test-template
5+
docker:
6+
- image: circleci/python:2.7-stretch-node-browsers
7+
environment:
8+
PYTHON_VERSION: py27
9+
10+
steps:
11+
- checkout
12+
13+
- run:
14+
name: Create virtual env
15+
command: python -m venv || virtualenv venv
16+
17+
- run:
18+
name: Write job name
19+
command: echo $CIRCLE_JOB > circlejob.txt
20+
21+
- restore_cache:
22+
key: deps1-{{ .Branch }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "circlejob.txt" }}
23+
24+
- run:
25+
name: Install dependencies
26+
command: |
27+
sudo pip install virtualenv --upgrade
28+
. venv/bin/activate
29+
pip install -r requirements-dev.txt
30+
npm install --ignore-scripts
31+
32+
- save_cache:
33+
key: deps1-{{ .Branch }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "circlejob.txt" }}
34+
paths:
35+
- "venv"
36+
- "node_modules"
37+
- run:
38+
name: Build
39+
command: |
40+
. venv/bin/activate
41+
npm run build:js
42+
npm run build:py
43+
44+
- run:
45+
name: npm test
46+
command: npm test
47+
48+
- run:
49+
name: Run tests
50+
command: |
51+
. venv/bin/activate
52+
python --version
53+
python -m unittest test.test_integration
54+
python -m unittest test.test_dash_import
55+
56+
"python-3.6":
57+
<<: *test-template
58+
docker:
59+
- image: circleci/python:3.6-stretch-node-browsers
60+
environment:
61+
PYTHON_VERSION: py36
62+
63+
"python-3.7":
64+
<<: *test-template
65+
docker:
66+
- image: circleci/python:3.7-stretch-node-browsers
67+
environment:
68+
PYTHON_VERSION: py37
69+
70+
71+
workflows:
72+
version: 2
73+
build:
74+
jobs:
75+
- "python-2.7"
76+
- "python-3.6"
77+
- "python-3.7"

.eslintrc

Lines changed: 127 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,127 @@
1-
---
2-
extends: ./node_modules/dash-components-archetype/config/eslint/eslintrc-react.json
1+
{
2+
"extends": ["eslint:recommended", "prettier"],
3+
"parser": "babel-eslint",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module",
7+
"ecmaFeatures": {
8+
"arrowFunctions": true,
9+
"blockBindings": true,
10+
"classes": true,
11+
"defaultParams": true,
12+
"destructuring": true,
13+
"forOf": true,
14+
"generators": true,
15+
"modules": true,
16+
"templateStrings": true,
17+
"jsx": true
18+
}
19+
},
20+
"env": {
21+
"browser": true,
22+
"es6": true,
23+
"jasmine": true,
24+
"jest": true,
25+
"node": true
26+
},
27+
"globals": {
28+
"jest": true
29+
},
30+
"plugins": [
31+
"react",
32+
"import"
33+
],
34+
"rules": {
35+
"accessor-pairs": ["error"],
36+
"block-scoped-var": ["error"],
37+
"consistent-return": ["error"],
38+
"curly": ["error", "all"],
39+
"default-case": ["error"],
40+
"dot-location": ["off"],
41+
"dot-notation": ["error"],
42+
"eqeqeq": ["error"],
43+
"guard-for-in": ["off"],
44+
"import/export": "error",
45+
"import/named": ["off"],
46+
"import/namespace": ["off"],
47+
"import/no-duplicates": ["error"],
48+
"import/no-named-as-default": ["error"],
49+
"import/no-unresolved": ["off"],
50+
"new-cap": ["error", {
51+
"capIsNewExceptionPattern": "Immutable\\.*"
52+
}],
53+
"no-alert": ["off"],
54+
"no-caller": ["error"],
55+
"no-case-declarations": ["error"],
56+
"no-console": ["error"],
57+
"no-div-regex": ["error"],
58+
"no-dupe-keys": ["error"],
59+
"no-else-return": ["error"],
60+
"no-empty-pattern": ["error"],
61+
"no-eq-null": ["error"],
62+
"no-eval": ["error"],
63+
"no-extend-native": ["error"],
64+
"no-extra-bind": ["error"],
65+
"no-extra-boolean-cast": ["error"],
66+
"no-inline-comments": ["error"],
67+
"no-implicit-coercion": ["error"],
68+
"no-implied-eval": ["error"],
69+
"no-inner-declarations": ["off"],
70+
"no-invalid-this": ["error"],
71+
"no-iterator": ["error"],
72+
"no-labels": ["error"],
73+
"no-lone-blocks": ["error"],
74+
"no-loop-func": ["error"],
75+
"no-multi-str": ["error"],
76+
"no-native-reassign": ["error"],
77+
"no-new": ["error"],
78+
"no-new-func": ["error"],
79+
"no-new-wrappers": ["error"],
80+
"no-param-reassign": ["error"],
81+
"no-process-env": ["warn"],
82+
"no-proto": ["error"],
83+
"no-redeclare": ["error"],
84+
"no-return-assign": ["error"],
85+
"no-script-url": ["error"],
86+
"no-self-compare": ["error"],
87+
"no-sequences": ["error"],
88+
"no-shadow": ["off"],
89+
"no-throw-literal": ["error"],
90+
"no-undefined": ["error"],
91+
"no-unused-expressions": ["error"],
92+
"no-use-before-define": ["error", "nofunc"],
93+
"no-useless-call": ["error"],
94+
"no-useless-concat": ["error"],
95+
"no-with": ["error"],
96+
"prefer-const": ["error"],
97+
"radix": ["error"],
98+
"react/jsx-no-duplicate-props": ["error"],
99+
"react/jsx-no-undef": ["error"],
100+
"react/jsx-uses-react": ["error"],
101+
"react/jsx-uses-vars": ["error"],
102+
"react/no-did-update-set-state": ["error"],
103+
"react/no-direct-mutation-state": ["error"],
104+
"react/no-is-mounted": ["error"],
105+
"react/no-unknown-property": ["error"],
106+
"react/prefer-es6-class": ["error", "always"],
107+
"react/prop-types": "error",
108+
"valid-jsdoc": ["error"],
109+
"yoda": ["error"],
110+
"spaced-comment": ["error", "always", {
111+
"block": {
112+
"exceptions": ["*"]
113+
}
114+
}],
115+
"no-unused-vars": ["error", {
116+
"args": "after-used",
117+
"argsIgnorePattern": "^_",
118+
"caughtErrorsIgnorePattern": "^e$"
119+
}],
120+
"no-magic-numbers": ["error", {
121+
"ignoreArrayIndexes": true,
122+
"ignore": [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 10, 16, 0.5, 25]
123+
}],
124+
"no-underscore-dangle": ["off"],
125+
"no-useless-escape": ["off"]
126+
}
127+
}

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"tabWidth": 4,
3+
"singleQuote": true,
4+
"bracketSpacing": false,
5+
"trailingComma": "es5"
6+
}

circle.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

extract-meta

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
const reactDocs = require('react-docgen');
6+
7+
const componentPaths = process.argv.slice(2);
8+
if (!componentPaths.length) {
9+
help();
10+
process.exit(1);
11+
}
12+
13+
const metadata = Object.create(null);
14+
componentPaths.forEach(componentPath =>
15+
collectMetadataRecursively(componentPath)
16+
);
17+
writeOut(metadata);
18+
19+
function help() {
20+
console.error('usage: ');
21+
console.error(
22+
'extract-meta path/to/component(s) ' +
23+
' [path/to/more/component(s), ...] > metadata.json'
24+
);
25+
}
26+
27+
function writeError(msg, filePath) {
28+
if (filePath) {
29+
process.stderr.write(`Error with path ${filePath}`);
30+
}
31+
32+
process.stderr.write(msg + '\n');
33+
if (msg instanceof Error) {
34+
process.stderr.write(msg.stack + '\n');
35+
}
36+
}
37+
38+
function parseFile(filepath) {
39+
const urlpath = filepath.split(path.sep).join('/');
40+
let src;
41+
42+
if (!['.jsx', '.js'].includes(path.extname(filepath))) {
43+
return;
44+
}
45+
46+
try {
47+
src = fs.readFileSync(filepath);
48+
metadata[urlpath] = reactDocs.parse(src);
49+
} catch (error) {
50+
writeError(error, filepath);
51+
}
52+
}
53+
54+
function collectMetadataRecursively(componentPath) {
55+
if (fs.lstatSync(componentPath).isDirectory()) {
56+
let dirs;
57+
try {
58+
dirs = fs.readdirSync(componentPath);
59+
} catch (error) {
60+
writeError(error, componentPath);
61+
}
62+
dirs.forEach(filename => {
63+
const filepath = path.join(componentPath, filename);
64+
if (fs.lstatSync(filepath).isDirectory()) {
65+
collectMetadataRecursively(filepath);
66+
} else {
67+
parseFile(filepath);
68+
}
69+
});
70+
} else {
71+
parseFile(componentPath);
72+
}
73+
}
74+
75+
function writeOut(result) {
76+
console.log(JSON.stringify(result, '\t', 2));
77+
}

0 commit comments

Comments
 (0)