magny-react v0.3.1
Setup
run the magny-backend repo and the magny-dashboard repo to create a new project and get a project id.
rename sample.env to
.env
and put the project id inside it.run
npm i
run
npm run start
to start developing
Testing Npm package locally
Assuming the target application you want to test Magny
with is in a sibling folder called dummy
like ../dummy/
- run
npm link ../dummy/node_modules/react
to link the target react installation to this package. - run
npm run build:lib
to build the library - switch into the target application folder with
cd ../dummy/
- install magny with a relative path like
npm i '../magny-frontend'
- somewhere high up in your project like src/App.jsx, import the library and the css for it and use the
Magny
component:
...
import { Magny } from 'magny';
import 'magny/style.css';
...
function App() {
return (
<div className="App">
<Magny projectId="<project id from dashboard>" />
...
</div>
);
}
- now you should be able to use your local builds as if they were downloaded from npm
Available Scripts
In the project directory, you can run:
npm run start
Runs the app in the development mode.\ Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.\ You may also see any lint errors in the console.\
This command runs the index.js file which includes a demo application with react-router
and Magny
already setup.
npm run build:lib
- Builds the npm library for
Magny
\ - Uses Npm.jsx as the Entry point\
- Outputs files to lib/ folder\
- Bundle does not include any external dependencies.
npm run build:browser
- Builds the browser distributable files for
Magny
\ - Uses Browser.jsx as the Entry point\
- Outputs files to dist/ folder\
- Bundle includes all dependencies required to run
Magny
npm run build
Builds both the npm library and the browser distributable for Magny
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago