Repo initialization

This commit is contained in:
Szymon 2021-08-06 14:50:36 +02:00
commit bce7cf74f0
39 changed files with 7833 additions and 0 deletions

27
.eslintrc.json Normal file
View File

@ -0,0 +1,27 @@
{
"env": {
"es6": true,
"node": true,
"mocha": true,
"browser": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
"eslint:recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module"
},
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-redeclare": "off",
"no-unused-vars": "off",
"prefer-const": ["error", {"destructuring": "all"}],
"semi": ["error", "never"],
"no-extra-semi": "off",
"@typescript-eslint/no-extra-semi": "off"
}
}

20
.github/workflows/CI.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: CI
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn build
- run: yarn test

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
node_modules
dist
yarn-error.log
.DS_Store
build
cache
.vscode

1
.node-version Normal file
View File

@ -0,0 +1 @@
v14.15.5

6
.prettierrc.json Normal file
View File

@ -0,0 +1,6 @@
{
"singleQuote": true,
"printWidth": 120,
"bracketSpacing": true,
"semi": false
}

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# status-waku-voting
Repository for decentralised voting over waku

7
netlify.toml Normal file
View File

@ -0,0 +1,7 @@
[build]
command = "CI= npm run build"
[[redirects]]
from = "/*"
to = "/"
status = 200

24
package.json Normal file
View File

@ -0,0 +1,24 @@
{
"name": "status-waku-voting",
"private": true,
"license": "MIT",
"engines": {
"node": ">=14"
},
"workspaces": {
"packages": [
"packages/*"
]
},
"scripts": {
"start": "yarn --cwd ./packages/example start",
"lint": "wsrun -c -s lint",
"lint:fix": "wsrun -c -s lint:fix",
"build": "wsrun -e -c -s build",
"test": "wsrun -e -c -s --exclude-missing test"
},
"dependencies": {
"prettier": "^2.3.1",
"wsrun": "^5.2.4"
}
}

View File

@ -0,0 +1,5 @@
{
"extends": [
"../../.eslintrc.json"
]
}

View File

@ -0,0 +1,8 @@
{
"spec": "test/**/*.test.{ts,tsx}",
"require": "ts-node/register",
"watchExtensions": "ts",
"extension": "ts",
"timeout": 3000,
"file": "./test/setup.ts"
}

0
packages/core/README.md Normal file
View File

View File

@ -0,0 +1,32 @@
{
"name": "@status-waku-voting/core",
"main": "dist/cjs/src/index.js",
"module": "dist/esm/src/index.js",
"types": "dist/esm/src/index.d.ts",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"build": "yarn run build:esm && yarn run build:cjs",
"build:esm": "tsc --module es2020 --target es2017 --outDir dist/esm",
"build:cjs": "tsc --outDir dist/cjs",
"test": "mocha -r jsdom-global/register",
"lint": "yarn lint:prettier --check && yarn lint:eslint",
"lint:fix": "yarn lint:prettier --write && yarn lint:eslint --fix",
"lint:eslint": "eslint './{src,test}/**/*.{ts,tsx}'",
"lint:prettier": "yarn prettier './{src,test}/**/*.{ts,tsx}'"
},
"devDependencies": {
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"jsdom": "^16.7.0",
"jsdom-global": "^3.0.2",
"mocha": "^9.0.3",
"ts-node": "^10.1.0",
"typescript": "^4.3.5"
},
"dependencies": {}
}

View File

@ -0,0 +1 @@
module.exports = require('../../.prettierrc.json')

View File

@ -0,0 +1,5 @@
function foo() {
return 'Hello world'
}
export { foo }

View File

@ -0,0 +1,11 @@
import { expect } from 'chai'
import { foo } from '../src'
describe('test', () => {
it('foo', async () => {
expect(foo()).to.eq('Hello world')
})
it('not foo', async () => {
expect(foo()).to.not.eq('asdas')
})
})

View File

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"outDir": "dist",
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"skipLibCheck": true,
"downlevelIteration": true,
"strict": true,
"composite": true,
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"target": "es6",
"typeRoots": [ "./types", "./node_modules/@types", "../../node_modules/@types"]
},
"include": [
"src",
"src/**/*.json",
"test"
]
}

View File

@ -0,0 +1,5 @@
{
"extends": [
"../../.eslintrc.json"
]
}

View File

@ -0,0 +1,8 @@
{
"spec": "test/**/*.test.{ts,tsx}",
"require": "ts-node/register",
"watchExtensions": "ts",
"extension": "ts",
"timeout": 3000,
"file": "./test/setup.ts"
}

View File

@ -0,0 +1,2 @@
# status-community-dapp
Community directory curator dApp for Status

View File

@ -0,0 +1,61 @@
{
"name": "@status-waku-voting/example",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "rm -rf dist && webpack --mode=production --env ENV=production",
"start": "webpack serve --mode=development --env ENV=development --https",
"test": "mocha -r jsdom-global/register",
"lint": "yarn lint:prettier --check && yarn lint:eslint",
"lint:fix": "yarn lint:prettier --write && yarn lint:eslint --fix",
"lint:eslint": "eslint './{src,test}/**/*.{ts,tsx}'",
"lint:prettier": "yarn prettier './{src,test}/**/*.{ts,tsx}'"
},
"dependencies": {
"@status-waku-voting/react-components": "link:../react-components",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"prettier": "^2.3.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"stream-browserify": "^3.0.0",
"styled-components": "^5.3.0"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@testing-library/react-hooks": "^7.0.1",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@types/node": "^16.4.12",
"@types/react": "^17.0.15",
"@types/react-dom": "^17.0.9",
"@types/react-router": "^5.1.16",
"@types/react-router-dom": "^5.1.8",
"@types/styled-components": "^5.1.12",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"babel-loader": "^8.2.2",
"babel-preset-minify": "^0.5.1",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"eslint-plugin-hooks": "^0.2.0",
"eslint-plugin-react": "^7.24.0",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^6.3.1",
"html-webpack-plugin": "^5.3.2",
"jsdom": "^16.7.0",
"jsdom-global": "^3.0.2",
"mocha": "^9.0.3",
"source-map-loader": "^3.0.0",
"ts-node": "^10.1.0",
"typescript": "^4.3.5",
"webpack": "^5.48.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.2"
}
}

View File

@ -0,0 +1 @@
module.exports = require('../../.prettierrc.json')

View File

@ -0,0 +1 @@
/* /index.html 200

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/svg+xml" sizes="any" href="/favicon.ico" />
<title>waku voting example</title>
</head>
<body>
<div id="root"></div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="/dist/index.js"></script>
</body>
</html>

View File

@ -0,0 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { Example } from '@status-waku-voting/react-components'
ReactDOM.render(
<div>
<Example />
</div>,
document.getElementById('root')
)

View File

@ -0,0 +1,7 @@
import { expect } from 'chai'
describe('test', () => {
it('true', async () => {
expect(true).to.be.eq(true)
})
})

View File

View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"outDir": "dist",
"jsx":"react",
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"skipLibCheck": true,
"downlevelIteration": true,
"strict": true,
"composite": true,
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"target": "es6",
"typeRoots": [ "./types", "./node_modules/@types", "../../node_modules/@types"]
},
"include": [
"src",
"src/**/*.json",
"test"
]
}

View File

@ -0,0 +1,85 @@
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const webpack = require('webpack')
module.exports = (env) => {
let environment = 'development'
if(env.ENV){
environment = env.ENV
}
return {
entry: './src/index.tsx',
output: {
filename: 'index.[fullhash].js',
path: path.join(__dirname, 'dist'),
publicPath: "/",
},
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
fallback: {
"buffer": require.resolve("buffer/"),
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify")
}
},
module: {
rules: [
{
test: /\.[jt]sx?$/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true,
babelrc: false,
presets: [
'@babel/preset-typescript',
[
'@babel/preset-env',
{ targets: { browsers: '> 0.25%, not dead' } },
],
'@babel/preset-react',
],
plugins: [
'babel-plugin-styled-components',
],
},
},
},
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: 'source-map-loader'
},
{
test: /\.(png|svg|jpg|gif|woff|woff2|eot|ttf|otf|ico)$/,
use: ['file-loader'],
},
],
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
new HtmlWebpackPlugin({
template: 'src/index.html',
}),
new webpack.DefinePlugin({
'process.env.ENV': JSON.stringify(environment),
}),
new webpack.ProvidePlugin({
process: 'process/browser.js',
Buffer: ['buffer', 'Buffer'],
}),
],
devServer: {
historyApiFallback: true,
host: '0.0.0.0',
stats: 'errors-only',
overlay: true,
hot: true,
},
stats: 'minimal'
}
}

View File

@ -0,0 +1,5 @@
{
"extends": [
"../../.eslintrc.json"
]
}

View File

@ -0,0 +1,8 @@
{
"spec": "test/**/*.test.{ts,tsx}",
"require": "ts-node/register",
"watchExtensions": "ts",
"extension": "ts",
"timeout": 3000,
"file": "./test/setup.ts"
}

View File

View File

@ -0,0 +1,38 @@
{
"name": "@status-waku-voting/react-components",
"main": "dist/cjs/src/index.js",
"module": "dist/esm/src/index.js",
"types": "dist/esm/src/index.d.ts",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"build": "yarn run build:esm && yarn run build:cjs",
"build:esm": "tsc --module es2020 --target es2017 --outDir dist/esm",
"build:cjs": "tsc --outDir dist/cjs",
"test": "mocha -r jsdom-global/register",
"lint": "yarn lint:prettier --check && yarn lint:eslint",
"lint:fix": "yarn lint:prettier --write && yarn lint:eslint --fix",
"lint:eslint": "eslint './{src,test}/**/*.{ts,tsx}'",
"lint:prettier": "yarn prettier './{src,test}/**/*.{ts,tsx}'"
},
"dependencies": {
"@status-waku-voting/core": "link:../core",
"react": "^17.0.2",
"react-components": "^0.5.1"
},
"devDependencies": {
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@types/react": "^17.0.16",
"@types/styled-components": "^5.1.12",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"jsdom": "^16.7.0",
"jsdom-global": "^3.0.2",
"mocha": "^9.0.3",
"ts-node": "^10.1.0",
"typescript": "^4.3.5"
}
}

View File

@ -0,0 +1 @@
module.exports = require('../../.prettierrc.json')

View File

@ -0,0 +1,13 @@
import React from 'react'
import { foo } from '@status-waku-voting/core'
function Example() {
return (
<div>
This is example components
{foo()}
</div>
)
}
export { Example }

View File

@ -0,0 +1,8 @@
import { expect } from 'chai'
import { foo } from '@status-waku-voting/core'
describe('test react-components', () => {
it('foo', async () => {
expect(foo()).to.eq('Hello world')
})
})

View File

View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"outDir": "dist",
"jsx":"react",
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"skipLibCheck": true,
"downlevelIteration": true,
"strict": true,
"composite": true,
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"target": "es6",
"typeRoots": [ "./types", "./node_modules/@types", "../../node_modules/@types"]
},
"include": [
"src",
"src/**/*.json",
"test"
]
}

7335
yarn.lock Normal file

File diff suppressed because it is too large Load Diff