
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
dyna-ts-react-module-boilerplate
Advanced tools
This is Webpack 4 configuration for ES5/ES6 React components written in Typescript to be used as a module in other apps or modules.
Develop, debug, test and distribute react component(s) easy.
Replace the my-awesome-react-component
with the name of you new module. A new folder will be created with this name from the point you will call it.
git clone http://github.com/aneldev/dyna-ts-react-module-boilerplate my-awesome-react-component
cd my-awesome-react-component
yarn run create
That's it.
create-react-app
different?It is different because create-react-app
creates react applications and includes everything an application needs.
The dyna-ts-react-module-boilerplate
creates modules, it creates react components that will be used in react applications or in other modules.
Tip: Instead of create-react-app
use the create-react-app-typescript
where forks the create-react-app
and supports Typescript.
For React 15 use the tag v4.1.5 of this repo.
*.module.less/scss
filename pattern)undefined
or null
values)This boilerplate runs only under Linux.
Scripts of this package are not designed for windows command line!
For windows users there are multiple ways:
The source code of your project is under the /src/
folder only. What will be distributed is what it is exported from the /src/index.tsc
.
There are loaders for various files, like: .less
, .scss
, .svg
, .jpg
, etc.
. Loaders are loaded in /webpack.loaders.js
, where you can add your own loaders that will be used for all tasks (npm scripts).
Under the /dev/app/
folder there is a small web application that uses this component in different ways. This way you can develop, debug and make a showcase to demonstrate of how your component(s) can be used.
Under the /dev/public/
folder is the http folder of the application, you should not do anything there because this is not distributed.
yarn start
or, if you want to start it to different port
yarn start-to -- 3232
to start in port 3232.
This is useful if you want to run other Component Demos at the same time.
The app is always exposed to 127.0.0.1
by default.
This boilerplate uses the dyna-showcase to show how your module is rendered under different props. The concept is the same as the StoryBook but it is much lighter and without styles and some tools that help the debugging and development.
src/
dev/showcase/index.tsx
yarn start
If you don't want to use the dyna-showcase
for any reason you should do this:
dyna-showcase
, with yarn remove --dev dyna-showcase
./dev
, except the ./dev/index.tsx
./dev
folder./dev/index.tsx
The yarn start
will launch your app.
For tests this boilerplate uses the Jest.
Test files can be anywhere but they should have a name *.(test|spec).(ts|tsx|js|jsx)
. There is a tests/
folder if you want to use it but this is not mandatory.
Call yarn test
to run your tests and coverage.
Call yarn test-watch
to run your tests after any change, with no coverage.
yarn build
Build creates your distributable version of your component under ./dist
. Typescripts declaration will be created there too.
You don't really need to use the build
, since the release
script is calling the build
.
You will need this is if you have linked this package with another local package (like yarn link or so).
yarn release
The output is not compressed, while it is intended to be used in other apps where it will be bundled and compressed. This also makes your component debuggable.
For private packages, where you don't want to expose them to yarn
, remove the yarn pulish
call from the publish-push
script.
You can exclude dependencies from the distributed bundle by declaring them in the /webpack.dist.config.hs
. By default, all dependencies are declared there.
In case that the yarn link
doesn't work correctly this boilerplate offers a ready sync unidirectional mechanism.
./syncExternalsList.sample.js
to ./syncExternalsList.js
once only../syncExternalsList.js
list with external apps you want to keep them sync.yarn sync-externals
If you use the Ubuntu shell of Win10, in the ./syncExternalsList.js
you can add a windows path prefixing it with the *tus*
, which stands for to ubuntu shell
.
Example, check the 2nd line of ./syncExternalsList.sample.js
.
Note: the ./syncExternalsList.js
is git ignored!
Forks are welcome!
If you are interested in a typescript module, with other words if you want to implement everything like we do here but without any react components, check this out this dyna-ts-module-boilerplate repo.
FAQs
React Component / Module boilerplate
The npm package dyna-ts-react-module-boilerplate receives a total of 2 weekly downloads. As such, dyna-ts-react-module-boilerplate popularity was classified as not popular.
We found that dyna-ts-react-module-boilerplate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.