Skip to content

Commit

Permalink
Merge 620f45d into 3b10a74
Browse files Browse the repository at this point in the history
  • Loading branch information
r3wt committed Mar 30, 2021
2 parents 3b10a74 + 620f45d commit 2cf58f8
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 32 deletions.
21 changes: 20 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
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'
- stage: cd
script:
- npm install
- npm run build
# todo - release with npm, then commit the result to github
stages:
- name: ci
if: type = pull_request
- name: cd
if: type = push AND branch = master
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)
});
});
25 changes: 25 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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 +43,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 2cf58f8

Please sign in to comment.