@c4i/dataset-preview
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

To develop a package locally without publishing to NPM:

Use npm link to develop with hot reloading of the main application:

For the following directory structure:

|- c4i-frontend (main application) |- c4i-frontend-dataset-preview (the package / submodule)

In the main application (c4i-frontend), do: rm -rf node_modules package-lock.json && npm install

In the package (which you want to develop using the main application with hot reloading) do: rm -rf node_modules package-lock.json && npm install npm link ../c4i-frontend/node_modules/react/ ../c4i-frontend/node_modules/react-dom

If your package can't resolve react you need to specify the following in webpack: (https://webpack.js.org/configuration/resolve/#resolve-symlinks)

module.exports = {
    resolve: {
        symlinks: false
    }
};

This will link react and react-dom from the main application back to this package. This ensures that there are not two react instances active during development.

Then in the main application (c4i-frontend) do: npm link ../c4i-frontend-dataset-preview/

This enables hot reloading of the package inside the main application.

Caveats: When using redux the store property is lost, causing connect to fail. Solution: The main application binds the store to the window object, you can pass this to the component as a property.

    <MapPreview store={window.store} dataset={dataset} backendUrls={backendUrls} className="h-100"/> 

Connect inside MapPreview will now work properly.

Alternative, create a package locally:

https://medium.com/@vcarl/problems-with-npm-link-and-an-alternative-4dbdd3e66811

To publish (Under discussion)

Developing should be done in a branch. When ready, update the version number in the package.json and create a merge request to master. When your branch is merged, a tag needs to be created with the version number corresponding to the version in the package.json. Publishing needs to be done from the master branch which is up to date with the origin. This ensures that it is clear what code is published npm.

To publish to npm do:

rm -rf node_modules package-lock.json # Clean
npm install 
npm run build
npm login
npm publish

To disable tracking of package-lock.json, while keeping it in the repository:

git update-index --skip-worktree package-lock.json

Readme

Keywords

none

Package Sidebar

Install

npm i @c4i/dataset-preview

Weekly Downloads

0

Version

0.1.6

License

none

Unpacked Size

1.57 MB

Total Files

41

Last publish

Collaborators

  • christiaanko
  • janmouwes
  • maartenplieger
  • martschilt
  • roccoturtolo
  • sikkema