1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-13 17:25:34 +01:00

Extract the library from reforis.

This commit is contained in:
Bogdan Bodnar 2019-08-21 17:04:26 +02:00
commit 02ca27e49c
No known key found for this signature in database
GPG Key ID: 49E4169AD3CA42B0
8 changed files with 12891 additions and 0 deletions

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
**/__tests__/*
src/testUtils/

62
.eslintrc.js Normal file
View File

@ -0,0 +1,62 @@
const path = require("path");
module.exports = {
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},
"extends": [
"airbnb",
"airbnb/hooks"
],
"globals": {
"_": "readonly",
"babel": "readonly",
"ForisTranslations": "readonly",
"ngettext": "readonly",
"ForisPlugins": "readonly"
},
"parser": "babel-eslint",
"rules": {
"quotes": ["error", "double"],
"indent": ["error", 4],
"react/jsx-indent": ["error", 4],
"react/jsx-indent-props": ["error", 4],
"react/prop-types": "warn",
"react/no-array-index-key": "warn",
"react/button-has-type": "warn",
"import/no-unresolved": [
"error",
// Ignore imports used only in tests
{ignore: ["mockWS", "customTestRender"]}
],
"import/no-cycle": "warn",
"no-console": "error",
"no-use-before-define": ["error", { functions: false, classes: true, variables: true }],
"no-restricted-syntax": "warn",
// Should be enabled in the future
"camelcase": "off",
"no-param-reassign": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"react/default-props-match-prop-types": "off",
"react/forbid-prop-types": "off",
// Permanently disabled
"react/jsx-filename-extension": "off",
"no-plusplus": "off",
"consistent-return": "off",
"radix": "off",
"no-continue": "off",
"react/no-danger": "off",
},
"settings": {
"import/resolver": {
"webpack": {
"env": {"lighttpd": true},
"config": path.resolve(__dirname, "webpack.config.js")
}
}
}
}

48
.gitignore vendored Normal file
View File

@ -0,0 +1,48 @@
# Common
.cache
## Logs
logs
*.log
# NodeJS
## Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
## Runtime data
pids
*.pid
*.seed
*.pid.lock
## node-waf configuration
.lock-wscript
## Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
## Dependency directories
node_modules/
## Optional npm cache directory
.npm
## Unit test / coverage reports
coverage/
htmlcov/
.tox/
.coverage
.coverage.*
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
## Translations
*.mo
/js/styleguide/
.gitignore
src/

9
babel.config.js Normal file
View File

@ -0,0 +1,9 @@
module.exports = {
presets: [
'@babel/preset-env',
'@babel/preset-react',
],
plugins: [
'@babel/plugin-transform-runtime'
]
};

27
jest.config.js Normal file
View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
*/
// https://jestjs.io/docs/en/configuration.html
module.exports = {
moduleDirectories: [
'node_modules',
'<rootDir>/src/testUtils',
'<rootDir>/src/',
],
clearMocks: true,
collectCoverageFrom: ['src/**/*.{js,jsx}'],
coverageDirectory: 'coverage',
testPathIgnorePatterns: ['/node_modules/', '/__fixtures__/'],
verbose: false,
setupFilesAfterEnv: [
'@testing-library/react/cleanup-after-each',
'<rootDir>/src/testUtils/setupTest',
],
globals: {
TZ: 'utc',
},
};

12644
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

65
package.json Normal file
View File

@ -0,0 +1,65 @@
{
"name": "foris",
"author": "CZ.NIC, z.s.p.o.",
"repository": {
"type": "git",
"url": "https://gitlab.labs.nic.cz/turris/reforis/forisjs.git"
},
"keywords": [
"foris",
"reforis"
],
"license": "GPL-3.0",
"version": "0.0.1",
"description": "Set of components and utils for Foris and its plugins.",
"main": "./dist/foris.js",
"dependencies": {
"axios": "^0.19.0",
"immutability-helper": "^3.0.1",
"prop-types": "^15.7.2",
"react": "^16.9.0-alpha.0",
"react-datetime": "^2.16.3",
"react-dom": "^16.9.0-alpha.0",
"react-router": "^5.0.1",
"react-uid": "^2.2.0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@testing-library/react": "^8.0.1",
"babel-eslint": "^9.0.0",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.6",
"babel-plugin-react-transform": "^3.0.0",
"babel-polyfill": "^6.26.0",
"css-loader": "^3.0.0",
"eslint": "^5.16.0",
"eslint-config-react-app": "^4.0.1",
"eslint-plugin-flowtype": "^2.50.3",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-react-hooks": "^1.6.0",
"file-loader": "^4.0.0",
"jest": "^24.8.0",
"jest-mock-axios": "^3.0.0",
"moment-timezone": "^0.5.25",
"react-styleguidist": "^9.1.11",
"snapshot-diff": "^0.5.1",
"style-loader": "^0.23.1",
"webpack": "^4.33.0",
"webpack-cli": "^3.3.4"
},
"scripts": {
"watch": "webpack --watch --mode=development --env.lighttpd",
"build": "webpack --mode=production --env.lighttpd",
"lint": "eslint src",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage --colors"
}
}

34
webpack.config.js Normal file
View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
*/
const path = require('path');
module.exports = () => ({
mode: 'development',
entry: './src/index.js',
resolve: {
modules: [
path.resolve(__dirname, './src'),
path.resolve(__dirname, './node_modules')
],
extensions: [".js", ".json"],
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}]
},
output: {
filename: 'foris.js',
path: path.join(__dirname, 'dist/'),
libraryTarget: 'umd',
}
});