Skip to content

Commit

Permalink
Merge 1e08ae9 into 3b10a74
Browse files Browse the repository at this point in the history
  • Loading branch information
r3wt committed Apr 10, 2021
2 parents 3b10a74 + 1e08ae9 commit 4201298
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 34 deletions.
28 changes: 27 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
language: node_js
node_js:
- 12
- 10
env:
- COVERALLS_REPO_TOKEN=2SwwqC8QDQVmE6FkT71w2DgLmd0kc5Dh3
jobs:
include:
- stage: ci
script:
- npm install
- npm run test:coverage
- npm run build
after_success: 'npm run coveralls'
stages:
- name: ci
if: type = pull_request
- name: cd
if: branch = master AND commit_message =~ /^[0-9]*\.[0-9]*\.[0-9]*$/
before_deploy:
- npm install
- npm run test:coverage
- npm run build
deploy:
edge: true
provider: npm
email: "$NPM_EMAIL"
api_key: "$NPM_TOKEN"
cleanup: true
after_success:
- npm run coveralls
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# use-models

> advanced form model hooks for your functional react components. build huge, complex forms with validation using minimal boilerplate code.
[![NPM](https://img.shields.io/npm/v/use-models.svg)](https://www.npmjs.com/package/use-models) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Build Status](https://travis-ci.com/r3wt/use-models.svg?branch=master)](https://travis-ci.com/r3wt/use-models) [![Coverage Status](https://coveralls.io/repos/github/r3wt/use-models/badge.svg)](https://coveralls.io/github/r3wt/use-models)

advanced form model hooks for your functional react components. build huge, complex forms with validation using minimal boilerplate code.


[![NPM](https://img.shields.io/npm/v/use-models.svg)](https://www.npmjs.com/package/use-models) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

Expand Down
37 changes: 9 additions & 28 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
const { build } = require('esbuild');
const pkg = require('./package.json');

// build esnext
build({
const modulesToBuild = [pkg.module,pkg.main];

Promise.all(modulesToBuild.map(moduleName=>build({
entryPoints: [pkg.source],
format: 'esm',
outfile: pkg.module,
outfile: moduleName,
tsconfig: './tsconfig.build.json',
minify: true,
bundle: true,
logLevel: 'info',
sourcemap: true,
external: ['react', 'react-dom']
})
}).then(()=>console.log('`%s` built successfully',moduleName))))
.then(() => {
console.log('build succeeded');
console.log('all modules built successfully');
})
.catch((err) => {
console.warn('build failed', err);
.catch((errors) => {
console.warn('one or more module builds failed', errors);
process.exit(1);
});

// build commonjs
build({
entryPoints: [pkg.source],
format: 'cjs',
outfile: pkg.main,
tsconfig: './tsconfig.json',
minify: true,
bundle: true,
logLevel: 'info',
sourcemap: true,
external: ['react', 'react-dom']
})
.then(() => {
console.log('build succeeded');
})
.catch((err) => {
console.warn('build failed', err);
process.exit(1)
});
});
27 changes: 26 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "use-models",
"homepage": "https://r3wt.github.io/use-models",
"version": "1.2.1",
"version": "1.2.2",
"private": false,
"publishConfig": {
"access": "public"
},
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -24,7 +27,8 @@
"test:watch": "npm test -- --watchAll=true",
"example": "cd example && npm start",
"predeploy": "cd example && npm install && npm run build",
"deploy": "gh-pages -d example/build"
"deploy": "gh-pages -d example/build",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"peerDependencies": {
"react": "^16.0.0",
Expand All @@ -42,6 +46,7 @@
"@types/react": "^16.9.50",
"@types/react-dom": "^16.9.8",
"@types/react-syntax-highlighter": "^11.0.5",
"coveralls": "^3.1.0",
"cross-env": "^7.0.2",
"esbuild": "^0.7.8",
"gh-pages": "^2.2.0",
Expand Down

0 comments on commit 4201298

Please sign in to comment.