From 62b4d9104452e3b218aff0fc8d4657777fa7d195 Mon Sep 17 00:00:00 2001 From: armaniferrante Date: Sun, 16 May 2021 17:53:57 -0700 Subject: [PATCH] Build for npm and add readme --- .gitignore | 2 ++ README.md | 36 +++++++++++++++++++++++++++++++++--- package.json | 14 +++++++++----- tsconfig.json | 2 +- tsconfig.npm.json | 28 ++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 tsconfig.npm.json diff --git a/.gitignore b/.gitignore index 4d29575..3466330 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +/dist \ No newline at end of file diff --git a/README.md b/README.md index a705b5d..98e557b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,34 @@ -# Swap UI +# `@project-serum/swap-ui` -An example UI for the swap frontend to the Serum DEX. The Solana program can be -found [here](https://github.com/project-serum/swap). +[![Build Status](https://travis-ci.com/project-serum/swap-ui.svg?branch=master)](https://travis-ci.com/project-serum/swap-ui) +[![npm](https://img.shields.io/npm/v/@project-serum/swap-ui.svg)](https://www.npmjs.com/package/@project-serum/swap-ui) + +A reusable React component for swapping on the Serum DEX. The Solana program can be +found [here](https://github.com/project-serum/swap). An example application is also +provided in this repository. + +## Developing + +#### Install dependencies + +``` +yarn +``` + +#### Run the example app + +``` +yarn start +``` + +#### Build the `@project-serum/swap-ui` package for npm + +``` +yarn build:npm +``` + +#### Build the example app for GitHub pages + +``` +yarn build +``` diff --git a/package.json b/package.json index 03de14c..15e5b18 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "swap-ui", - "version": "0.1.0", - "private": true, + "name": "@project-serum/swap-ui", + "version": "0.1.0-alpha.1", + "main": "dist/index.js", "homepage": ".", "dependencies": { "@material-ui/core": "^4.11.4", @@ -38,7 +38,8 @@ "eject": "react-scripts eject", "lint": "prettier src/** --check", "lint:fix": "prettier src/** -w", - "deploy": "gh-pages -d build/" + "deploy": "gh-pages -d build/", + "build:npm": "rm -rf dist && tsc --build tsconfig.npm.json" }, "eslintConfig": { "extends": [ @@ -61,5 +62,8 @@ "devDependencies": { "gh-pages": "^3.1.0", "prettier": "^2.3.0" - } + }, + "files": [ + "dist" + ] } diff --git a/tsconfig.json b/tsconfig.json index 284c82b..9210ca7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,7 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx", + "jsx": "react-jsx", "typeRoots": ["types/", "node_modules/@types"] }, "include": [ diff --git a/tsconfig.npm.json b/tsconfig.npm.json new file mode 100644 index 0000000..779a51a --- /dev/null +++ b/tsconfig.npm.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": false, + "jsx": "react-jsx", + "typeRoots": ["types/", "node_modules/@types"], + "outDir": "dist" + }, + "include": [ + "src/swap/" + ] +}