Build typescript to JS for npm

This commit is contained in:
Roman Jaroš 2019-10-23 20:32:30 +02:00
parent 533ae9b183
commit c7cf6d1135
39 changed files with 260 additions and 109 deletions

View file

@ -4,3 +4,5 @@ e2e
node_modules
package-lock.json
lib/

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ node_modules/
dist/
package-lock.json
tsconfig.tsbuildinfo

5
Jenkinsfile vendored
View file

@ -20,7 +20,7 @@ node {
sh "npm run test"
}
stage("build") {
sh "npm run build"
sh "npm run build:doc"
}
stage("release") {
if (env.BRANCH_NAME.startsWith("release/") && !isReleaseCommit()) {
@ -40,7 +40,8 @@ node {
sh "git status"
sh "git commit -am 'RELEASE;New version $newVersion'"
sh "git log -1 --oneline"
sh "npx lerna exec --ignore documentation -- 'cp package.json src && cd src/ && npm publish && rm package.json'"
sh "npm run build:module"
sh "npx lerna exec --ignore documentation -- 'npm publish'"
sh "git push -u origin ${env.BRANCH_NAME} --force"
} else {
Utils.markStageSkippedForConditional("release:version")

View file

@ -1,6 +1,4 @@
{
"packages": [
"modules/*"
],
"version": "0.0.50"
"packages": ["modules/*"],
"version": "0.0.53"
}

View file

@ -1,6 +1,6 @@
{
"name": "documentation",
"version": "0.0.50",
"version": "0.0.53",
"description": "",
"author": "romanjaros <jarosr93@gmail.com>",
"license": "ISC",
@ -10,12 +10,12 @@
"build": "webpack --mode production"
},
"dependencies": {
"@romanjaros/treejs-api": "^0.0.50",
"@romanjaros/treejs-auth": "^0.0.50",
"@romanjaros/treejs-components": "^0.0.50",
"@romanjaros/treejs-constants": "^0.0.50",
"@romanjaros/treejs-forms": "^0.0.50",
"@romanjaros/treejs-types": "^0.0.50",
"@romanjaros/treejs-utils": "^0.0.50"
"@romanjaros/treejs-api": "^0.0.53",
"@romanjaros/treejs-auth": "^0.0.53",
"@romanjaros/treejs-components": "^0.0.53",
"@romanjaros/treejs-constants": "^0.0.53",
"@romanjaros/treejs-forms": "^0.0.53",
"@romanjaros/treejs-types": "^0.0.53",
"@romanjaros/treejs-utils": "^0.0.53"
}
}

View file

@ -1,20 +1,21 @@
import { combineReducers } from 'redux';
import { REDUCER_NAME as FETCH_REDUCER_NAME } from '../../FetchPage/constants';
import { MAIN_REDUCER_NAME } from '@romanjaros/treejs-constants/redux';
import {
MODAL_REDUCER_NAME,
TOASTER_REDUCER_NAME,
API_REDUCER_NAME,
AUTH_REDUCER_NAME,
MAIN_REDUCER_NAME,
} from '@romanjaros/treejs-constants/redux/reducers';
import apiReducer from '@romanjaros/treejs-api/reducer';
import { API_REDUCER_NAME } from '@romanjaros/treejs-api/constants';
import authReducer from '@romanjaros/treejs-auth/reducer';
import { AUTH_REDUCER_NAME } from '@romanjaros/treejs-auth/constants';
import modalReducer from '@romanjaros/treejs-components/Modal/reducer';
import { MODAL_REDUCER_NAME } from '@romanjaros/treejs-components/Modal/constants';
import toasterReducer from '@romanjaros/treejs-components/Toaster/reducer';
import { TOASTER_REDUCER_NAME } from '@romanjaros/treejs-components/Toaster/constants';
import demoFetch from '../../FetchPage/reducer';
import { REDUCER_NAME as FETCH_REDUCER_NAME } from '../../FetchPage/constants';
export default combineReducers({
[MAIN_REDUCER_NAME]: combineReducers({

View file

@ -1,14 +1,21 @@
{
"name": "@romanjaros/treejs-api",
"version": "0.0.50",
"version": "0.0.53",
"description": "",
"author": "romanjaros <jarosr93@gmail.com>",
"license": "ISC",
"scripts": {
"clean": "rm -rf dist/ && tsc --build --clean",
"build": "tsc --build"
},
"files": [
"package.json",
"dist/"
],
"dependencies": {
"@romanjaros/treejs-components": "^0.0.50",
"@romanjaros/treejs-constants": "^0.0.50",
"@romanjaros/treejs-types": "^0.0.50",
"@romanjaros/treejs-utils": "^0.0.50"
"@romanjaros/treejs-constants": "^0.0.53",
"@romanjaros/treejs-types": "^0.0.53",
"@romanjaros/treejs-utils": "^0.0.53"
},
"peerDependencies": {
"redux": "^4.0.1",

View file

@ -1,4 +1,4 @@
import { API_REDUCER_NAME } from '@romanjaros/treejs-constants/redux/reducers';
export const API_REDUCER_NAME = 'fetch';
export class FetchActions {
public static FETCH = `${API_REDUCER_NAME}/FETCH_ENDPOINT`;

View file

@ -1,10 +1,8 @@
import { Middleware } from 'redux';
import { is } from 'ramda';
import { addToaster } from '@romanjaros/treejs-components/Toaster/actions';
import { IAction } from '@romanjaros/treejs-types/redux/actions';
import { isNilOrEmpty, isJSON } from '@romanjaros/treejs-utils';
import { STATUS } from '@romanjaros/treejs-types/common';
import { IFetchConfig } from './types';
import { fetchStatusActions } from './actions';
@ -55,14 +53,6 @@ export const FetchEndpoint = (setting: ISettings): Middleware => store => next =
store.dispatch(fetchStatusActions.onError(action.payload));
if (is(Function, action.payload.onError)) {
action.payload.onError(error);
} else {
store.dispatch(
addToaster({
name: 'fetchUnexpectedError',
status: STATUS.error,
message: 'Nastala neočekávaná chyba při volání serveru',
}),
);
}
}
}

View file

@ -1,9 +1,11 @@
import { createSelector } from 'reselect';
import { pathOr, propOr } from 'ramda';
import { API_REDUCER_NAME, MAIN_REDUCER_NAME } from '@romanjaros/treejs-constants/redux/reducers';
import { MAIN_REDUCER_NAME } from '@romanjaros/treejs-constants/redux';
import { IFetchReducer } from '@romanjaros/treejs-api/types';
import { API_REDUCER_NAME } from '../constants';
const emptyObject = {};
const root = pathOr(emptyObject, [MAIN_REDUCER_NAME, API_REDUCER_NAME]);

View file

@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"composite": true,
},
"include": [
"./src"
],
"references": [
{
"path": "../treejs-constants"
},
{
"path": "../treejs-utils"
},
{
"path": "../treejs-types"
},
],
}

View file

@ -1,12 +1,20 @@
{
"name": "@romanjaros/treejs-auth",
"version": "0.0.50",
"version": "0.0.53",
"description": "",
"author": "romanjaros <jarosr93@gmail.com>",
"license": "ISC",
"scripts": {
"clean": "rm -rf dist/ && tsc --build --clean",
"build": "tsc --build"
},
"files": [
"package.json",
"dist/"
],
"dependencies": {
"@romanjaros/treejs-constants": "^0.0.50",
"@romanjaros/treejs-types": "^0.0.50"
"@romanjaros/treejs-constants": "^0.0.53",
"@romanjaros/treejs-types": "^0.0.53"
},
"peerDependencies": {
"react": "16.8.6",

View file

@ -1,4 +1,4 @@
import { AUTH_REDUCER_NAME } from '@romanjaros/treejs-constants/redux/reducers';
export const AUTH_REDUCER_NAME = 'auth';
export class AuthActions {
public static SET_AUTHENTICATE: string = `${AUTH_REDUCER_NAME}/SET_AUTHENTICATE`;

View file

@ -15,7 +15,10 @@ export interface IAuthOptions {
allowUnauthenticated?: boolean;
}
function authRequired(WrappedComponent: React.ComponentType<IAuthHOCInjectProps>, options: IAuthOptions = {}) {
export const authRequired = (
WrappedComponent: React.ComponentType<IAuthHOCInjectProps>,
options: IAuthOptions = {},
): any => {
class AuthComponent extends React.PureComponent<IAuthComponent> {
public render() {
if (this.props.isAuthenticate || options.allowUnauthenticated) {
@ -28,6 +31,6 @@ function authRequired(WrappedComponent: React.ComponentType<IAuthHOCInjectProps>
return connect(state => ({
isAuthenticate: isAuthenticated(state),
}))(AuthComponent);
}
};
export default authRequired;

View file

@ -1,9 +1,10 @@
import { createSelector } from 'reselect';
import { prop } from 'ramda';
import { MAIN_REDUCER_NAME, AUTH_REDUCER_NAME } from '@romanjaros/treejs-constants/redux/reducers';
import { MAIN_REDUCER_NAME } from '@romanjaros/treejs-constants/redux';
import { IAuthOption } from '../types';
import { AUTH_REDUCER_NAME } from '../constants';
export const getRoot = <P>(state: any): IAuthOption<P> => state[MAIN_REDUCER_NAME][AUTH_REDUCER_NAME];

View file

@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"composite": true,
"rootDir": "src",
},
"include": [
"./src"
],
"references": [
{
"path": "../treejs-constants"
},
{
"path": "../treejs-types"
},
],
}

View file

@ -1,13 +1,21 @@
{
"name": "@romanjaros/treejs-components",
"version": "0.0.50",
"version": "0.0.53",
"description": "",
"author": "romanjaros <jarosr93@gmail.com>",
"license": "ISC",
"scripts": {
"clean": "rm -rf dist/ && tsc --build --clean",
"build": "tsc --build"
},
"files": [
"package.json",
"dist/"
],
"dependencies": {
"@romanjaros/treejs-constants": "^0.0.50",
"@romanjaros/treejs-types": "^0.0.50",
"@romanjaros/treejs-utils": "^0.0.50"
"@romanjaros/treejs-constants": "^0.0.53",
"@romanjaros/treejs-types": "^0.0.53",
"@romanjaros/treejs-utils": "^0.0.53"
},
"devDependencies": {
"@types/react-outside-click-handler": "^1.2.0"

View file

@ -29,8 +29,8 @@ import MenuItem from './MenuItem';
import MenuDropdown from './MenuDropdown';
interface IProps {
enableLeftMenu: boolean;
enableUserMenu: boolean;
enableLeftMenu?: boolean;
enableUserMenu?: boolean;
history: History;
leftMenuItems?: IMenuItem[];
logo: React.ReactElement;

View file

@ -1,4 +1,4 @@
import { MODAL_REDUCER_NAME } from '@romanjaros/treejs-constants/redux/reducers';
export const MODAL_REDUCER_NAME = 'modals';
export class ModalActions {
public static ADD_MODAL: string = `${MODAL_REDUCER_NAME}/ADD_MODAL`;

View file

@ -1,5 +1,6 @@
import { MAIN_REDUCER_NAME, MODAL_REDUCER_NAME } from '@romanjaros/treejs-constants/redux/reducers';
import { MAIN_REDUCER_NAME } from '@romanjaros/treejs-constants/redux';
import { IModalReducer } from '../types';
import { MODAL_REDUCER_NAME } from '../constants';
export const modals = (state: any): IModalReducer => state[MAIN_REDUCER_NAME][MODAL_REDUCER_NAME];

View file

@ -115,7 +115,7 @@ class Modal extends React.Component<IProps, IState> {
<div>
{autoComplete && (
<Section>
<TextField name="search" title="Hledat" onChange={this.handleSearch} />
<TextField name="search" title="Hledat" onChange={this.handleSearch} autoFocus />
</Section>
)}
<Section>

View file

@ -7,6 +7,7 @@ import { IHTMLElement } from '@romanjaros/treejs-types/form';
import { StyledContainer, StyledTextField, StyledLabel, StyledTextFieldIcon } from './style';
export interface IProps<V = string> extends IHTMLElement<V> {
autoFocus?: boolean;
defaultValue?: string;
disabled?: boolean;
readonly?: boolean;
@ -92,7 +93,7 @@ class TextField extends React.PureComponent<IProps, IState> {
};
public render(): React.ReactElement {
const { name, title, type, disabled, readonly, rightIcon, status } = this.props;
const { name, title, type, disabled, readonly, rightIcon, status, autoFocus } = this.props;
return (
<StyledContainer>
@ -112,6 +113,7 @@ class TextField extends React.PureComponent<IProps, IState> {
onBlur={this.handleBlur}
onChange={this.handleChange}
status={status}
autoFocus={autoFocus}
/>
<StyledTextFieldIcon onClick={this.setFocus}>{rightIcon}</StyledTextFieldIcon>
</StyledContainer>

View file

@ -26,7 +26,6 @@ export const StyledTextField = styled.input.attrs({
border: none;
border-radius: 2px;
border-left: 3px solid ${p => p.theme.lightGray};
background-color: ${p => p.theme.lightGray};
padding: 10px;
@ -65,7 +64,7 @@ export const StyledTextField = styled.input.attrs({
`}
&:focus {
border-left-color: ${p => p.theme.focusBackgroundColor};
border-left: 3px solid ${p => p.theme.primaryColor};
}
&:disabled {

View file

@ -1,4 +1,4 @@
import { TOASTER_REDUCER_NAME } from '@romanjaros/treejs-constants/redux/reducers';
export const TOASTER_REDUCER_NAME = 'toasters';
export class ToasterActions {
public static ADD_TOASTER: string = `${TOASTER_REDUCER_NAME}/ADD_TOASTER`;

View file

@ -1,5 +1,6 @@
import { MAIN_REDUCER_NAME, TOASTER_REDUCER_NAME } from '@romanjaros/treejs-constants/redux/reducers';
import { MAIN_REDUCER_NAME } from '@romanjaros/treejs-constants/redux';
import { IToasterReducer } from '../types';
import { TOASTER_REDUCER_NAME } from '../constants';
export const toasters = (state: any): IToasterReducer => state[MAIN_REDUCER_NAME][TOASTER_REDUCER_NAME];

View file

@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"composite": true,
"rootDir": "src"
},
"include": [
"./src"
],
"references": [
{
"path": "../treejs-constants"
},
{
"path": "../treejs-utils"
},
{
"path": "../treejs-types"
},
],
}

View file

@ -1,7 +1,11 @@
{
"name": "@romanjaros/treejs-constants",
"version": "0.0.50",
"version": "0.0.53",
"description": "",
"author": "romanjaros <jarosr93@gmail.com>",
"license": "ISC"
"license": "ISC",
"scripts": {
"clean": "rm -rf dist/ && tsc --build --clean",
"build": "tsc --build"
}
}

View file

@ -0,0 +1 @@
export const MAIN_REDUCER_NAME = 'treejs';

View file

@ -1,6 +0,0 @@
export const MAIN_REDUCER_NAME = 'treejs';
export const API_REDUCER_NAME = 'fetch';
export const MODAL_REDUCER_NAME = 'modals';
export const TOASTER_REDUCER_NAME = 'toasters';
export const AUTH_REDUCER_NAME = 'auth';

View file

@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"composite": true,
"rootDir": "src"
},
"include": [
"./src"
],
}

View file

@ -1,13 +1,17 @@
{
"name": "@romanjaros/treejs-forms",
"version": "0.0.50",
"version": "0.0.53",
"description": "",
"author": "romanjaros <jarosr93@gmail.com>",
"license": "ISC",
"scripts": {
"clean": "rm -rf dist/ && tsc --build --clean",
"build": "tsc --build"
},
"dependencies": {
"@romanjaros/treejs-components": "^0.0.50",
"@romanjaros/treejs-types": "^0.0.50",
"@romanjaros/treejs-utils": "^0.0.50"
"@romanjaros/treejs-components": "^0.0.53",
"@romanjaros/treejs-types": "^0.0.53",
"@romanjaros/treejs-utils": "^0.0.53"
},
"peerDependencies": {
"formik": "^1.5.2"

View file

@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"composite": true,
"rootDir": "src"
},
"include": [
"./src"
],
"references": [
{
"path": "../treejs-constants"
},
{
"path": "../treejs-components"
},
{
"path": "../treejs-types"
},
],
}

View file

@ -1,9 +1,13 @@
{
"name": "@romanjaros/treejs-types",
"version": "0.0.50",
"version": "0.0.53",
"description": "",
"author": "romanjaros <jarosr93@gmail.com>",
"license": "ISC",
"scripts": {
"clean": "rm -rf dist/ && tsc --build --clean",
"build": "tsc --build"
},
"peerDependencies": {
"react": "16.8.6"
}

View file

@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"composite": true,
"rootDir": "src"
},
"include": [
"./src"
],
}

View file

@ -1,9 +1,13 @@
{
"name": "@romanjaros/treejs-utils",
"version": "0.0.50",
"version": "0.0.53",
"description": "",
"author": "romanjaros <jarosr93@gmail.com>",
"license": "ISC",
"scripts": {
"clean": "rm -rf dist/ && tsc --build --clean",
"build": "tsc --build"
},
"peerDependencies": {
"ramda": "^0.26.1"
},

View file

@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"composite": true,
"rootDir": "src"
},
"include": [
"./src"
],
}

View file

@ -9,10 +9,11 @@
"start": "lerna run --stream --scope documentation start",
"test": "jest",
"lint": "eslint -c .eslintrc modules/**/*.{ts,tsx} && stylelint modules/**/*.ts",
"build": "npm run generateDocumentation && lerna run --stream --scope documentation build",
"build:doc": "node genDoc.js && lerna run --stream --scope documentation build",
"build:module": "lerna run --ignore documentation build",
"clean:module": "lerna run --ignore documentation clean",
"serve": "http-server dist/client",
"postinstall": "lerna bootstrap",
"generateDocumentation": "node genDoc.js"
"postinstall": "lerna bootstrap"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.25",

View file

@ -1,28 +0,0 @@
{
"compilerOptions": {
"noImplicitAny": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"module": "commonjs",
"target": "es6",
"lib": [
"es6",
"es2015",
"dom"
],
"jsx": "react"
},
"include": [
"./**/*.ts",
"./**/*.tsx"
],
"exclude": [
"*node_modules*",
"./modules/**/node_modules",
"./**/__tests__/*.tsx",
".vscode"
]
}

View file

@ -1,6 +1,21 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"removeComments": true,
"noLib": false,
"noImplicitAny": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"module": "commonjs",
"target": "es6",
"lib": [
"es6",
"es2015",
"dom"
],
"jsx": "react",
"baseUrl": ".",
"paths": {
"documentation/*": [
@ -32,5 +47,14 @@
"node",
"jest"
]
}
},
"include": [
"./**/*.ts",
"./**/*.tsx"
],
"exclude": [
"node_modules",
"./**/__tests__/*.tsx",
".vscode"
]
}