Skip to content

[WIP] Website #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

26 changes: 25 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,28 @@ node_modules


# ignore yarn.locks generated in packages
packages/**/**/yarn.lock
packages/**/**/yarn.lock

# from create react app

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
80 changes: 65 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
},
"bolt": {
"workspaces": [
"packages/*"
"packages/*",
"website"
]
},
"dependencies": {
"@atlaskit/build-releases": "^3.0.3",
"@babel/core": "7.0.0-beta.56",
"@babel/types": "^7.0.0-beta.56",
"@babel/types": "^7.3.0",
"ast-pretty-print": "^2.0.1",
"babel-errors": "^1.1.1",
"babel-explode-module": "^3.0.0",
Expand All @@ -25,30 +25,80 @@
"babel-normalize-comments": "^1.0.1",
"babel-react-components": "^1.1.0",
"babel-type-scopes": "^1.1.0",
"babylon": "^7.0.0-beta.22",
"babylon-options": "^2.0.1",
"emotion": "^9.1.1",
"lz-string": "^1.4.4",
"react": "^16.3.1",
"react-codemirror": "^1.0.0",
"react-dom": "^16.3.1",
"react-markings": "^1.2.0",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.1",
"strip-indent": "^2.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-emotion": "^9.1.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.24.1",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-object-rest-spread": "^7.3.1",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@svgr/webpack": "2.4.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "9.0.0",
"babel-jest": "23.6.0",
"babel-loader": "^8.0.5",
"babel-plugin-named-asset-import": "^0.3.0",
"babel-preset-react-app": "^7.0.0",
"bfj": "6.1.1",
"case-sensitive-paths-webpack-plugin": "2.1.2",
"chalk": "2.4.1",
"css-loader": "^2.1.0",
"dotenv": "6.0.0",
"dotenv-expand": "4.2.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "5.6.0",
"eslint-config-react-app": "^3.0.6",
"eslint-loader": "2.1.1",
"eslint-plugin-flowtype": "2.50.1",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsx-a11y": "6.1.2",
"eslint-plugin-react": "7.11.1",
"file-loader": "2.0.0",
"flow-bin": "^0.69.0",
"fork-ts-checker-webpack-plugin-alt": "0.4.14",
"fs-extra": "7.0.0",
"html-webpack-plugin": "4.0.0-alpha.2",
"identity-obj-proxy": "3.0.0",
"jest": "^23.6.0",
"jest-pnp-resolver": "1.0.1",
"jest-resolve": "23.6.0",
"jsdom": "^11.7.0",
"mini-css-extract-plugin": "0.4.3",
"null-loader": "^0.1.1",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pnp-webpack-plugin": "1.1.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.3.1",
"postcss-safe-parser": "4.0.1",
"prettier": "^1.13.7",
"react": "^16.3.1",
"react-addons-test-utils": "^15.6.2",
"react-dom": "^16.3.1"
"react-app-polyfill": "^0.2.0",
"react-dev-utils": "^7.0.1",
"resolve": "1.8.1",
"sass-loader": "7.1.0",
"style-loader": "^0.23.1",
"terser-webpack-plugin": "1.1.0",
"url-loader": "1.1.1",
"webpack": "^4.29.0",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "3.6.3"
}
}
2 changes: 2 additions & 0 deletions packages/extract-react-types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as K from './kinds'
const nodePath = require('path');
const createBabelFile = require('babel-file');
const { loadFileSync, resolveImportFilePathSync } = require('babel-file-loader');
//const loadFileSync = () => {}
//const resolveImportFilePathSync = () => {}
const { isFlowIdentifier } = require('babel-flow-identifiers');
const { getTypeBinding } = require('babel-type-scopes');
const { getIdentifierKind } = require('babel-identifiers');
Expand Down
7 changes: 3 additions & 4 deletions packages/extract-react-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"documentation"
],
"dependencies": {
"@babel/core": "7.0.0-beta.56",
"@babel/types": "^7.0.0-beta.56",
"@babel/core": "^7.2.0",
"@babel/types": "^7.3.0",
"ast-pretty-print": "^2.0.1",
"babel-errors": "^1.1.1",
"babel-explode-module": "^3.0.0",
Expand All @@ -26,7 +26,6 @@
"babel-normalize-comments": "^1.0.1",
"babel-react-components": "^1.1.0",
"babel-type-scopes": "^1.1.0",
"babylon": "^7.0.0-beta.22",
"babylon-options": "^2.0.1",
"strip-indent": "^2.0.0"
},
Expand All @@ -35,4 +34,4 @@
"jest": "^23.6.0",
"prettier": "^1.13.7"
}
}
}
8 changes: 8 additions & 0 deletions packages/kind2string/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["@babel/env", "@babel/flow"],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import"
]
}
17 changes: 8 additions & 9 deletions packages/kind2string/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
"dist"
],
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-flow": "^6.23.0",
"@babel/cli": "^7.2.3",
"@babel/plugin-proposal-object-rest-spread": "^7.3.1",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"@babel/preset-flow": "^7.0.0",
"extract-react-types": "^0.15.1",
"flow-bin": "^0.69.0",
"jest": "^23.6.0",
"prettier": "^1.13.7"
},
"dependencies": {}
}
}
}
70 changes: 21 additions & 49 deletions packages/kind2string/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ const converters = {
*/
string: (type /*: K.String*/, mode /*: string */) /*:string*/ =>
type.value != null ? `"${type.value.toString()}"` : type.kind,
custom: (type /*:any*/, mode /*: string */) /*:string*/ =>
type.value.toString(),
custom: (type /*:any*/, mode /*: string */) /*:string*/ => type.value.toString(),
any: (type /*: K.Any*/, mode /*: string */) /*:string*/ => type.kind,
void: (type /*: K.Void */, mode /*: string */) /*: 'undefined' */ =>
'undefined',
void: (type /*: K.Void */, mode /*: string */) /*: 'undefined' */ => 'undefined',
literal: (type /*: any */, mode /*: string */) /*: string*/ => `${type.kind}`,
mixed: (type /*: K.Mixed*/, mode /*: string */) /*:string*/ => type.kind,
null: (type /*: K.Null */, mode /*: string */) /*: 'null' */ => 'null',
Expand All @@ -78,27 +76,18 @@ const converters = {
JSXExpressionContainer: (type /*:any*/, mode /*: string */) /*:string*/ => {
return `{${convert(type.expression)}}`;
},
JSXOpeningElement: (
type /*JSXOpeningElement*/,
mode /*: string */,
) /*:string*/ => {
JSXOpeningElement: (type /*JSXOpeningElement*/, mode /*: string */) /*:string*/ => {
return `${convert(type.name)} ${mapConvertAndJoin(type.attributes, ' ')}`;
},
JSXElement: (type /*: K.JSXElement */, mode /*: string */) /*:string*/ => {
return `<${convert(type.value)} />`;
},

JSXIdentifier: (
type /*: K.JSXIdentifier */,
mode /*: string */,
) /*:string*/ => {
JSXIdentifier: (type /*: K.JSXIdentifier */, mode /*: string */) /*:string*/ => {
return `${type.value}`;
},

JSXAttribute: (
type /*: K.JSXAttribute */,
mode /*: string */,
) /*:string*/ => {
JSXAttribute: (type /*: K.JSXAttribute */, mode /*: string */) /*:string*/ => {
return `${convert(type.name)}=${convert(type.value)}`;
},

Expand All @@ -117,10 +106,7 @@ const converters = {
TODO: Make this resolve members in a unique way that will allow us to
handle property keys with no assigned value
*/
objectPattern: (
type /*: K.ObjectPattern */,
mode /*: string */,
) /*: string */ => {
objectPattern: (type /*: K.ObjectPattern */, mode /*: string */) /*: string */ => {
// ({ a, b }) => undefined ({a: a, b: b}) => undefined
// ({ a = 2, b }) => undefined ({a: a = 2, b: b })=> undefined
return `{ ${mapConvertAndJoin(type.members)} }`;
Expand All @@ -130,10 +116,7 @@ const converters = {
return `...${convert(type.argument)}`;
},

assignmentPattern: (
type /*: K.AssignmentPattern */,
mode /*: string */,
) /*:string*/ => {
assignmentPattern: (type /*: K.AssignmentPattern */, mode /*: string */) /*:string*/ => {
return `${convert(type.left)} = ${convert(type.right)}`;
},

Expand All @@ -156,9 +139,7 @@ const converters = {

property: (type /*: K.Property */, mode /*: string */) /*:string*/ => {
const sameId =
type.key.kind === 'id' &&
type.value.kind === 'id' &&
type.key.name === type.value.name;
type.key.kind === 'id' && type.value.kind === 'id' && type.key.name === type.value.name;

const assignmentSameId =
type.value.kind === 'assignmentPattern' &&
Expand All @@ -182,10 +163,7 @@ const converters = {
return `{ ${mapConvertAndJoin(type.members)} }`;
},

memberExpression: (
type /*: K.MemberExpression*/,
mode /*: string */,
) /*:string*/ => {
memberExpression: (type /*: K.MemberExpression*/, mode /*: string */) /*:string*/ => {
const object = resolveToLast(type.object);
const property = convert(type.property);

Expand Down Expand Up @@ -248,17 +226,11 @@ const converters = {
return convert(val.id);
},

templateExpression: (
type /*: K.TemplateExpression */,
mode /*: string */,
) /*: string */ => {
templateExpression: (type /*: K.TemplateExpression */, mode /*: string */) /*: string */ => {
return `${convert(type.tag)}`;
},

templateLiteral: (
type /*: K.TemplateLiteral */,
mode /*: string */,
) /*: string */ => {
templateLiteral: (type /*: K.TemplateLiteral */, mode /*: string */) /*: string */ => {
let str = type.quasis.reduce(function(newStr, v, i) {
let quasi = convert(v);
newStr = `${newStr}${quasi}`;
Expand All @@ -271,10 +243,7 @@ const converters = {
return `\`${str}\``;
},

templateElement: (
type /*: K.TemplateElement */,
mode /*: string */,
) /*: string */ => {
templateElement: (type /*: K.TemplateElement */, mode /*: string */) /*: string */ => {
return type.value.cooked.toString();
},
class: (type /*: K.ClassKind */, mode /*: string */) /*: string */ => {
Expand All @@ -294,7 +263,8 @@ const converters = {
typeParam: (type /*: K.TypeParam */, mode /*: string */) /*: string*/ => `${type.name}`,
typeParams: (type /*: K.TypeParams */, mode /*: string */) /*: string*/ =>
`<${mapConvertAndJoin(type.params, ', ')}>`,
typeParamsDeclaration: (type /*: K.TypeParamsDeclaration */, mode /*: string */) /*: string*/ => `<${mapConvertAndJoin(type.params, ', ')}>`,
typeParamsDeclaration: (type /*: K.TypeParamsDeclaration */, mode /*: string */) /*: string*/ =>
`<${mapConvertAndJoin(type.params, ', ')}>`,
typeof: (type /*: K.Typeof */, mode /*: string */) /*: string*/ => {
return type.name ? `typeof ${type.name}` : `${type.type.kind}`;
},
Expand All @@ -313,10 +283,8 @@ const converters = {
} else {
console.warn(
`kind2string has received an export type with multiple exports, and have no way of printing this.
The exports we found were: ${type.exports
.map(xport => convert(xport, mode))
.join(', ')}
from file: ${convert(type.source, mode)}`,
The exports we found were: ${type.exports.map(xport => convert(xport, mode)).join(', ')}
from file: ${convert(type.source, mode)}`
);
return '';
}
Expand All @@ -325,10 +293,14 @@ from file: ${convert(type.source, mode)}`,

// TS
tuple: (type /*: K.Tuple */, mode /*: string */) /*: string*/ =>
`[${mapConvertAndJoin(type.types)}]`,
`[${mapConvertAndJoin(type.types)}]`
};

function convert(type /*: any */, mode /*: string*/ = 'value') {
console.log({
type,
mode
});
if (!type) {
console.error('No type argument has been passed in');
return '';
Expand Down
10 changes: 10 additions & 0 deletions packages/pretty-proptypes/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": ["@babel/env", "@babel/react", "@babel/flow"],
"plugins": [
"emotion",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-class-properties"
]
}
Loading