npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-web3-dapp

v1.0.2

Published

Build your contracts with solidity and develop with truffle, create dapps with webpack and preact. By prod3v3loper

Downloads

13

Readme

📦 Generator Web3 Dapp

Language NPM Version NPM Donwloads Github Latest Release Version Github Downloads Commits License Issues Languages Minified Gzipped

This scaffold creates in seconds for you a professional environment to develop with

Web3 Contracts & dApps

MetaMask button ready template on start

Deploy your coin ready

OVERVIEW

Create solidity contracts and call it with web3.

CONTRACTS

You have here two workdirs, first the created project root dir after install. Also in the created folder with the scaffold. And in the frontend dir you can use npm.

In the root dir you can use the truffle and npm commands.

In the frontend dir you can use npm, npx (Webpack executes), tsc (TypeScript executes).

FRONTEND

Frontend packages, code a application in HTML (5), SASS (CSS), TS (X) and JS (X).

More information about the frontend: generator-webpack-preact.

INSTALL

  1. Install Node.js to use the NPM (Node Package Manager), if not installed.
  • Additional you can install NVM (Node Version Manager) https://github.com/nvm-sh/nvm to change version.
  1. You can use yo (Yeoman) to install the scaffold and start with it.
  • Also install yeoman global npm install -g yo.

LOCAL

Switch to your projects folder.

username$ cd /Users/username/projects/
projects$ npm i generator-web3-dapp
projects$ yo

If promt a call

? 'Allo prod3v3loper,! What would you like to do? (Use arrow keys)
  Run a generator
> Web3 Dapp

or directly

projects$ yo web3-dapp

Enter and create your project

GLOBAL

To use it from everywhere install the generator global.

projects$ sudo npm i -g generator-web3-dapp

Type password and now run in everywhere in your project folders, no local install need anymore.

projects$ yo

If promt a call

? 'Allo prod3v3loper,! What would you like to do? (Use arrow keys)
  Run a generator
> Web3 Dapp

or directly

projects$ yo web3-dapp

Enter and create your project.

Promt for the solution

And we become a promt ;).

? Customer name? (customer)
? Project year? (2019)
? Project name? (newsletter)
? Components you want to use? (type comma seperated) (counter)
? Want you install all dependencies? Y/n

After answer all questions start the create.

   create contracts/MYCOIN.sol
   create migrations/1_deploy_contracts.js
   create test/my_coin.js
   create src/index.tsx
   create src/scss/style.scss
   create public/index.html
   create package.json
   create global.config.json
   create tsconfig.json
   create webpack.config.js
   create webpack.dev.js
   create webpack.pro.js
   create src/components/counter/actions.js
   create src/components/counter/counter.js
   create src/components/counter/store.js

What this do

The following structure is created after the prompt input. With the typed data.

Projects
|
├── customer/ (prompt: project name)
|   └── year/ (prompt: 2019)
|       └── project/ (prompt: newsletter)
|           └── contracts/
|           |   └── MYCOIN.sol
|           └── frontend/
|           |   └── components/
|           |   |   └── counter/
|           |   |       └── actions.js
|           |   |       └── counter.js
|           |   |       └── store.js
|           |   └── public/
|           |   |   └── index.html
|           |   └── src/
|           |       └── index.jsx
|           |       └── scss/
|           |           └── style.scss
|           └── migration/
|               └── 1_deploy_contracts.js

But the idea behind it is to collect and manage all our contracts and dapps in our projects folder. So every time we call the generator in our projects folder and create a new project with customer name, it will be added to the others.

Projects
|
├── customer/ (prompt: project name)
|   └── year/ (prompt: 2019)
|       └── project/ (prompt: newsletter)
|           └── contracts/
|           |   └── MYCOIN.sol
|           └── frontend/
|           |   └── components/
|           |   |   └── counter/
|           |   |       └── actions.js
|           |   |       └── counter.js
|           |   |       └── store.js
|           |   └── public/
|           |   |   └── index.html
|           |   └── src/
|           |       └── index.jsx
|           |       └── scss/
|           |           └── style.scss
|           └── migration/
|               └── 1_deploy_contracts.js
|
├── another-customer/
|   └── 2018/
|   |   └── project1/
|   |   |   └── ...
|   |   └── project2/
|           └── contracts/
|           |   └── MYCOIN.sol
|           └── frontend/
|           |   └── components/
|           |   |   └── counter/
|           |   |       └── actions.js
|           |   |       └── counter.js
|           |   |       └── store.js
|           |   └── public/
|           |   |   └── index.html
|           |   └── src/
|           |       └── index.jsx
|           |       └── scss/
|           |           └── style.scss
|           └── migration/
|               └── 1_deploy_contracts.js
|   └── 2019/
|       └── project1/
|       |   └── ...
|       └── project2/
|           └── contracts/
|           |   └── MYCOIN.sol
|           └── frontend/
|           |   └── components/
|           |   |   └── counter/
|           |   |       └── actions.js
|           |   |       └── counter.js
|           |   |       └── store.js
|           |   └── public/
|           |   |   └── index.html
|           |   └── src/
|           |       └── index.jsx
|           |       └── scss/
|           |           └── style.scss
|           └── migration/
|               └── 1_deploy_contracts.js

USAGE

Now run and see the Magic :) This is only for the frontend.

Frontend folder is only for frontend not for contracts, link below for contracts and solidity with truffle.

Switch to the new project folder we have created. (You typed in the prompt default as example newsletter/frontend).

projects$ cd /Users/username/projects/customer/year/newsletter/frontend

If you NOT installed dependencies in the prompts, then install first.

frontend$ npm install

This command start the Server with the hotmodule.

frontend$ npm run dev
> [email protected] dev
> webpack serve --open --config webpack.dev.js

<w> [webpack-dev-server] "hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/
<i> [webpack-dev-server] On Your Network (IPv4): http://xxx.xxx.xxx.xx:8080/
<i> [webpack-dev-server] On Your Network (IPv6): http://[xxxx::x]:8080/
<i> [webpack-dev-server] Content not from webpack is served from '/Users/username/Sites/testing/example/2023/newsletter/frontend/public' directory
<i> [webpack-dev-middleware] wait until bundle finished: /
asset index.bundle.js 782 KiB [emitted] (name: index)
asset index.html 294 bytes [emitted]

This command build the dist folder with the end product.

frontend$ npm run prod

To close (stop the localhost server) the NPM run type in console (Terminal): Ctrl + C.

Create contract, migration or test with truffle.

Change to root in project if you in frontend folder.

projects$ cd /Users/username/projects/customer/year/newsletter/
newsletter$ truffle create contract YourNewCoin
newsletter$ truffle create migration YourNewCoin
newsletter$ truffle create test YourNewCoin

Build contracts created contract.

newsletter$ truffle compile
Compiling your contracts...
===========================
> Compiling ./contracts/MYCOIN.sol
> Artifacts written to /Users/username/Sites/testing/example/2023/newsletter/build/contracts
> Compiled successfully using:
   - solc: 0.8.13+commit.abaa5c0e.Emscripten.clang

Start developing with truffle

newsletter$ truffle develop

Look for more here.

UNINSTALL

NPM

Local

projects$ npm uninstall generator-web3-dapp

Global

projects$ npm uninstall -g generator-web3-dapp

PACKAGE

You find generator-web3-dapp in Yeoman generator, NPM and on Github.

NPM - generator-web3-dapp

GitHub - generator-web3-dapp

Github Theme - generator-web3-dapp

ToDos

  • [ ] Routing

Contribute

Please read the contributing.

Authors

Samet Tarim - All works

Support

Hyperly

License

MIT - prod3v3loper