Skip to content

Commit

Permalink
Small build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyounghive authored and alsiola committed Jan 27, 2018
1 parent 8c85c68 commit fa62857
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Another issue is that of form validation. As a fan of functional programming, I

Many modern applications need to be internationalized, and this can be an issue in form libraries. I18n has been considered from the start in the design of the API, with the aim of seamless integration with existing solutions.

In modern JavaScript development bundle size is always a concern - currently form-and-function weights in at just 3.54KB gzipped (14.87KB uncompressed).

## Examples

There are several examples in the `demo` folder of this repository. They can be run locally by cloning this repository, installing dependencies and running `yarn start`. If anything is unclear then raise an issue, or tweet me @bigalreturns
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-and-function",
"version": "0.0.3",
"version": "0.1.0",
"main": "dist/form-and-function.cjs.js",
"module": "dist/form-and-function.esm.js",
"browser": "dist/form-and-function.umd.js",
Expand All @@ -25,6 +25,7 @@
"rimraf": "^2.6.2",
"rollup": "^0.55.0",
"rollup-plugin-typescript": "^0.8.1",
"rollup-plugin-uglify": "^3.0.0",
"semantic-ui-css": "^2.2.12",
"semantic-ui-react": "^0.77.2",
"typescript": "^2.8.2"
Expand All @@ -37,8 +38,7 @@
"build-demo": "react-scripts-ts build",
"test": "react-scripts-ts test --env=jsdom",
"eject": "react-scripts-ts eject",
"remove-rollup-ts":
"rimraf node_modules/rollup-plugin-typescript/node_modules/typescript",
"remove-rollup-ts": "rimraf node_modules/rollup-plugin-typescript/node_modules/typescript",
"prepublish": "yarn build"
}
}
10 changes: 7 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pkg from "./package.json";
import typescript from "rollup-plugin-typescript";
import ts from "typescript";
import uglify from "rollup-plugin-uglify";

export default [
{
Expand All @@ -18,8 +19,11 @@ export default [
}
}
],
plugins: typescript({
typescript: ts
})
plugins: [
typescript({
typescript: ts
}),
uglify()
]
}
];
2 changes: 1 addition & 1 deletion src/lib/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";
import { EventHandler, SyntheticEvent } from "react";
import { FormState } from "./Form";
import { StateEngine } from "./stateEngine";
import { FieldResult, isInvalidResult } from "./validation";
import { FieldResult, isInvalidResult } from "./validation/index";
import { FieldValue } from "./Form";

/**
Expand Down
3 changes: 1 addition & 2 deletions src/lib/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import {
isInvalidResult,
Validator,
isCovalidateResult,
invalidFn,
CovalidatedFieldResult,
InvalidFieldResult
} from "./validation";
} from "./validation/index";

export type FieldValue = string | boolean | number;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as validation from "./validation";
import * as validation from "./validation/index";

export * from "./Field";
export * from "./Form";
Expand Down
3 changes: 1 addition & 2 deletions src/lib/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"outDir": "../../dist/modules",
"module": "es2015",
"module": "esnext",
"target": "es5",
"lib": ["es2017", "dom"],
"sourceMap": true,
Expand All @@ -14,7 +14,6 @@
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"declaration": true
},
"exclude": [
Expand Down
15 changes: 14 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4847,6 +4847,12 @@ rollup-plugin-typescript@^0.8.1:
tippex "^2.1.1"
typescript "^1.8.9"

rollup-plugin-uglify@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-3.0.0.tgz#a34eca24617709c6bf1778e9653baafa06099b86"
dependencies:
uglify-es "^3.3.7"

rollup-pluginutils@^1.3.1:
version "1.5.2"
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408"
Expand Down Expand Up @@ -5546,14 +5552,21 @@ typescript@^1.8.9:
version "1.8.10"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-1.8.10.tgz#b475d6e0dff0bf50f296e5ca6ef9fbb5c7320f1e"

typescript@^2.6.2:
typescript@^2.6.2, typescript@^2.8.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4"

ua-parser-js@^0.7.9:
version "0.7.17"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac"

uglify-es@^3.3.7:
version "3.3.9"
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"
dependencies:
commander "~2.13.0"
source-map "~0.6.1"

[email protected], uglify-js@^3.0.13:
version "3.3.7"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.7.tgz#28463e7c7451f89061d2b235e30925bf5625e14d"
Expand Down

0 comments on commit fa62857

Please sign in to comment.