Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
foryuki committed Oct 12, 2018
0 parents commit 4a0cd9e
Show file tree
Hide file tree
Showing 38 changed files with 823 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const presets = [
[
'@babel/preset-env',
{
modules: process.env.NODE_ENV === 'es' ? false : 'commonjs'
}
],
'@babel/preset-react',
'@babel/preset-typescript'
]

const plugins = [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread'
]

if (process.env.NODE_ENV === 'test') {
plugins.push('@babel/plugin-transform-modules-commonjs')
}

module.exports = { presets, plugins }
38 changes: 38 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:10.11

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: yarn install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# run tests!
- run: yarn test

15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# bundle dir
lib
es

package-lock.json
20 changes: 20 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.gitignore
.editorconfig

node_modules/
npm-debug.log

src/
tests/
examples/
coverage/
.circleci
.vscode

.babelrc.js
.travis.yml
*.config.js
tslint.json
tsconfig.json
.prettierrc
commitlint.config.js
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"semi": false
}
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
sudo: false
language: node_js
cache:
directories:
- ~/.npm
- node_modules
notifications:
email: false
node_js:
- '10'
- '9'
- '8'
before_script:
- PATH=${PATH//:\.\/node_modules\/\.bin/}
after_success:
- npm run build
- npm run coverage
- npm install -g travis-deploy-once
- travis-deploy-once "npm run semantic-release"
branches:
only:
- master
- dev
- /^greenkeeper/.*$/
before_deploy:
- cd examples
- npm install
- npm run build
deploy:
provider: pages
skip-cleanup: true
github-token: $GH_TOKEN
keep-history: false
local-dir: examples/site
on:
branch: master
node: '10'
27 changes: 27 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"${relativeFile}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017-present foryuki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-angular']}
1 change: 1 addition & 0 deletions examples/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
2 changes: 2 additions & 0 deletions examples/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@storybook/addon-options/register'
import '@storybook/addon-actions/register'
18 changes: 18 additions & 0 deletions examples/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { configure } from '@storybook/react'
import { withOptions } from '@storybook/addon-options'

withOptions({
name: 'One React',
url: 'https://github.com/one-react/menu',
goFullScreen: false,
showAddonPanel: true,
addonPanelInRight: true,
})

// automatically import all files ending with *.story.tsx
const req = require.context('../stories', true, /.story.tsx$/)
function loadStories() {
req.keys().forEach(filename => req(filename))
}

configure(loadStories, module)
4 changes: 4 additions & 0 deletions examples/.storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<script>
document.title = "One React"
</script>
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/one-react/assets/2a4f10b4/logo.png">
37 changes: 37 additions & 0 deletions examples/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const path = require('path')

module.exports = (baseConfig, env, defaultConfig) => {
defaultConfig.module.rules.push({
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve('babel-loader'),
options: {
cacheDirectory: true,
...require('../../.babelrc')
}
},
require.resolve('react-docgen-typescript-loader')
]
}, {
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
})

defaultConfig.resolve.alias['or-menu'] = path.resolve(__dirname, '../../src')

defaultConfig.resolve.extensions.push('.ts', '.tsx')

defaultConfig.resolve.modules.push(
path.resolve(__dirname, '../node_modules'),
path.resolve(__dirname, '../../node_modules')
)

defaultConfig.devServer = {
inline: true,
hot: true
}

return defaultConfig
}
36 changes: 36 additions & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "examples",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "start-storybook -s public -p 9001 -c .storybook",
"build": "build-storybook -s public -o site"
},
"author": "foryuki <foryuki@outlook.com>",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.0.1",
"@storybook/addon-actions": "^4.0.0-alpha.23",
"@storybook/addon-info": "^4.0.0-alpha.23",
"@storybook/addon-options": "^4.0.0-alpha.23",
"@storybook/react": "^4.0.0-alpha.23",
"@types/storybook__addon-actions": "^3.4.1",
"@types/storybook__addon-info": "^3.4.2",
"@types/storybook__react": "^3.0.9",
"babel-loader": "^8.0.2",
"css-loader": "^1.0.0",
"node-sass": "^4.7.2",
"or-code-previewer": "^1.0.0",
"raw-loader": "^0.5.1",
"react-docgen-typescript-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.0",
"typescript": "^3.0.3"
},
"dependencies": {
"react": "^16.1.1",
"react-dom": "^16.1.1",
"react-scripts": "^2.0.3"
}
}
Empty file added examples/public/.gitkeep
Empty file.
23 changes: 23 additions & 0 deletions examples/stories/example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Menu, MenuItem } from 'or-menu'
import React, { PureComponent } from 'react'

const subNav = (
<div className="">
<div>123</div>
<div>345</div>
<div>2345</div>
</div>
)
export default class Example extends PureComponent<{}, {}> {
render() {
return (
<div>
<Menu>
<MenuItem subNav={subNav}>MAKEUP</MenuItem>
<MenuItem subNav={subNav}>CLOTHING</MenuItem>
<MenuItem subNav={subNav}>HANDBAGS</MenuItem>
</Menu>
</div>
)
}
}
Loading

0 comments on commit 4a0cd9e

Please sign in to comment.