Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
rca-precursor
Advanced tools
## Quick start guide Precursor is designed to take the pain away from webpack configurations and isomorphic complexities, leaving you with a super simple source folder with only the files you need. The chosen tech stack has been tried and tested at RCA, a
Precursor is designed to take the pain away from webpack configurations and isomorphic complexities, leaving you with a super simple source folder with only the files you need. The chosen tech stack has been tried and tested at RCA, and is extensible and highly configurable, whilst having a small footprint in your codebase.
Grab the latest seed project from the RCA-Seed-app repository.
$ git clone git@git.realestate.com.au:craig-collie/rca-seed-app.git
Since rca-precursor
is already a dependency in the seed project, you should only need to:
$ yarn
$ yarn start
And finally visit http://localhost:3000 in your browser.
If you're feeling game enough to migrate, then simply add rca-precursor
as a dependency, and follow the
migration documentation (that hasn't been written yet).
$ yarn add rca-precursor
The name of your application.
Configure your webpack bundles using the entry
configuration.
{
entry: {
main: './utils/client.js',
}
}
Default: ./src/App.js
The root application component. By default, this component receives serverProps
which is any resolved route data.
import React from 'react';
const App = serverProps => (
<div>
//...
</div>
);
export default App;
An collection of routes that both the server and client will both used. Routes follow the standard react-router
guidelines for defining a route. These rounds should be exported as an array.
export default [
{
path: '/',
exact: true,
component: //...,
},
{
path: '/pages/:pageId',
component: //...,
},
{
path: null,
component: //...,
},
];
_Default: _process.env.NODE_ENV
Sets a flag against the current NODE_ENV
allowing for both express
and webpack
to run in production mode.
Default: <root>/src/
The contextual path of your application source folder.
Default: /public
The output folder that is created and published to when building and deploying your application.
Default: /js
The output folder for all bundled javascript.
Default: /css
The output folder for all bundled CSS.
Default: /
A prefix that is added to all outputted assets, generally used when you need to configure a CDN.
Default: index.html
The index filename of your application
The className output for CSS-Modules
Routes are the pages of your application, and usually require a few properties to ensure they work correctly. Each Route should contain the path
property, which defines the URL
path. For example, consider http://www.myapp.com/admin
, to ensure your admin
route is visible when the user visits that URL
, the following route would need to be created:
{
path: '/admin',
exact: true,
component: AdminContainer,
},
In this route definition, the path
and exact
properties ensure that when the user visits http://www.myapp.com/admin
this route is visible, and that the AdminContainer
component is rendered.
Route components, or Containers are the components that render routes for your application. Containers are the components that connect to your external API's and provide data to any components that live inside them. Each Container you create comes with some additional static methods and properties that allow you to express how data is requests and cached.
Consider the below example:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
// Any service that performs an ajax request
import fetchService from './fetchService';
class RouteContainer extends Component {
static getInitialProps = () => fetchService()
static cache = true
render() {
const { data } = this.props;
return (
<div>
// ...
</div>
);
}
}
export default RouteContainer;
This Container is a standard, stateful React Component with the addition of the static getInitialProps
method, which requests the fetchService()
. This fetchService is completely made up at this state, and we don't need to know how it connects to an API, rather, we just need to know that it does.
When defining your Container, including this static method will ensure that whatever request is required to be called, it is called and the response is returned BEFORE the rendering of this route. This means that if your Route requires things to be rendered based on some data that comes back from fetchService()
then all of the rendering will be done first, before it is visually available to your user.
Why is this a good thing?
You don't necessarily need to do this in your application, however if you prefer to present visually complete pages to your user, or have concerns around SEO, it can usually be a good idea request first, and present later.
After making this initial request, the data returned from that initial call will yield this.props.data
in your Container.
Every single time a Route is rendered, it will refresh it's data, and call the static getInitialProps
method. If this is something you want to avoid, in which case stale data isn't a concern to you, then add the static cache = true
property to your Container.
Tech | Description |
---|---|
Node | JavaScript runtime build on Chrome's V8 JavaScript engine. |
Express | Fast, un-opinionated, minimalist web framework for Node.js |
Webpack | Asset bundling |
Babel | Use next generation JavaScript today |
React | A JavaScript library for building user interfaces |
CSS-Modules | Locally scoped interoperable CSS |
PostCSS | CSS Pre-processing (using SASS syntax) and autoprefixing |
FAQs
## Quick start guide Precursor is designed to take the pain away from webpack configurations and isomorphic complexities, leaving you with a super simple source folder with only the files you need. The chosen tech stack has been tried and tested at RCA, a
The npm package rca-precursor receives a total of 4 weekly downloads. As such, rca-precursor popularity was classified as not popular.
We found that rca-precursor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.