Skip to content

Commit

Permalink
add base code for builds
Browse files Browse the repository at this point in the history
  • Loading branch information
amcdnl committed Oct 24, 2022
1 parent 0cfd14c commit a2df8a6
Show file tree
Hide file tree
Showing 12 changed files with 12,456 additions and 46 deletions.
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# EditorConfig: http://EditorConfig.org
# EditorConfig Properties: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties

# top-most EditorConfig file
root = true

### defaults
[*]
charset = utf-8

# Unix-style newlines with
end_of_line = lf

# 2 space indentation
indent_size = 2
indent_style = space

# remove any whitespace characters preceding newline characters
trim_trailing_whitespace = true

# newline ending every file
insert_final_newline = true

# Forces hard line wrapping after the amount of characters specified
max_line_length = off

### custom for markdown
[*.md]
# do not remove any whitespace characters preceding newline characters
trim_trailing_whitespace = false
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
dist/
types/
docs/
demo/
.storybook/
coverage/
src/**/*.story.tsx
src/**/*.test.ts
40 changes: 40 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-env node */
module.exports = {
env: {
browser: true,
es2021: true
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
'plugin:storybook/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
'ecmaFeatures': {
'jsx': true
},
'ecmaVersion': 12,
'sourceType': 'module'
},
plugins: [
'react',
'@typescript-eslint'
],
overrides: [{
files: ['*.test.*'],
env: {
jest: true
}
}],
'rules': {
'no-unused-vars': [0],
'indent': ['error', 2],
'react/prop-types': [0],
'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single'],
'semi': ['error', 'always']
}
};
54 changes: 9 additions & 45 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
pkg/
.rpt2_cache/
dist/
storybook-static/

# Runtime data
pids
Expand All @@ -20,12 +20,11 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

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

# Bower dependency directory (https://bower.io/)
Expand All @@ -44,21 +43,12 @@ jspm_packages/
# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

Expand All @@ -70,35 +60,9 @@ typings/

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
# next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
.DS_Store
src/**/*.scss.d.ts
src/**/*.css.d.ts
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://github.com/prettier/prettier#configuration-file
semi: true
singleQuote: true
overrides:
- files: ".prettierrc"
options:
parser: json
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# reablocks
# reatree
🌴 Tree Component for React
27 changes: 27 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = function(api) {
api.cache.forever();

const presets = [
['@babel/preset-env',
{
targets: {
esmodules: true
}
}],
'@babel/preset-react',
['@babel/typescript', { isTSX: true, allExtensions: true }]
];

const plugins = [
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining'
];

return {
presets,
plugins
};
};
104 changes: 104 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"name": "reablocks",
"version": "1.0.0",
"description": "Low level component building blocks for React",
"scripts": {
"build": "rollup -c",
"prettier": "prettier --loglevel warn --write 'src/**/*.{ts,tsx,js,jsx}'",
"start": "start-storybook -p 9009",
"build-storybook": "build-storybook",
"lint": "eslint --ext js,ts,tsx",
"lint:fix": "eslint --ext js,ts,tsx --fix src",
"lint:prettier": "prettier --loglevel warn --write 'src/**/*.{ts,tsx,js,jsx}'"
},
"source": "src/index.ts",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"browser": "dist/index.js",
"style": "dist/index.css",
"typings": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/reaviz/reablocks.git"
},
"files": [
"dist"
],
"keywords": [
"react",
"reactjs",
"tree"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/reaviz/reablocks/issues"
},
"homepage": "https://github.com/reaviz/reablocks#readme",
"dependencies": {
"classnames": "^2.3.1",
"framer-motion": "^6.2.8"
},
"peerDependencies": {
"react": ">=16",
"react-dom": ">=16"
},
"devDependencies": {
"@storybook/addon-essentials": "6.4.20",
"@storybook/addon-storysource": "^6.4.20",
"@storybook/addons": "6.4.20",
"@storybook/react": "6.4.20",
"@storybook/theming": "6.4.20",
"@types/classnames": "^2.3.1",
"@types/lodash": "^4.14.178",
"@types/react": "^17.0.43",
"@types/react-dom": "^17.0.14",
"@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.32.0",
"autoprefixer": "^9",
"chromatic": "^6.5.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-storybook": "^0.5.7",
"framer-motion": "^4.1.17",
"husky": "^4.2.5",
"lint-staged": "^10.5.4",
"postcss-nested": "^4",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.6.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"rollup": "^2.29.0",
"rollup-plugin-commonjs": "10.1.0",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-peer-deps-external": "2.2.3",
"rollup-plugin-postcss": "3.1.3",
"rollup-plugin-postcss-modules": "2.0.1",
"rollup-plugin-sourcemaps": "0.6.3",
"rollup-plugin-typescript2": "0.26.0",
"storybook-css-modules-preset": "^1.1.1",
"storybook-dark-mode": "^1.0.9",
"typescript": "^4.1.3"
},
"prettier": {
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"printWidth": 80
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
7 changes: 7 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
plugins: [
require('postcss-nested'),
require('postcss-preset-env')({ stage: 1 }),
require('autoprefixer')
]
};
60 changes: 60 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import resolve from 'rollup-plugin-node-resolve';
import sourceMaps from 'rollup-plugin-sourcemaps';
import typescript from 'rollup-plugin-typescript2';
import external from 'rollup-plugin-peer-deps-external';
import postcss from 'rollup-plugin-postcss-modules';
import commonjs from 'rollup-plugin-commonjs';
import pkg from './package.json';

export default [
{
input: pkg.source,
output: [
{
file: pkg.browser,
format: 'umd',
name: 'reaselect'
},
{
file: pkg.main,
format: 'cjs',
name: 'reaselect'
},
{
file: pkg.module,
format: 'esm'
}
],
plugins: [
external({
includeDependencies: true
}),
postcss({
// extract: true,
modules: true,
// writeDefinitions: true,
plugins: [
require('postcss-nested'),
require('postcss-preset-env')({ stage: 1 }),
require('autoprefixer')
]
}),
typescript({
clean: true,
exclude: [
'*.scss',
'*.css',
'*.test.js',
'*.test.ts',
'*.test.tsx',
'*.d.ts',
'**/*.d.ts',
'**/*.story.tsx'
]
}),
resolve(),
commonjs(),
sourceMaps()
]
}
];
Loading

0 comments on commit a2df8a6

Please sign in to comment.