Giter Club home page Giter Club logo

blockstack-app-generator's Introduction

Blockstack App Generator CircleCI NPM version Slack

Installation

  1. If not already installed, install Node.js v10 or higher (minimum required version is Node.js v8).

  2. Create a new directory and cd into it:

    mkdir hello-blockstack
    cd hello-blockstack
  3. Generate a Blockstack app, you can specify the framework.

    Framework Use this command to install
    Plain Javascript npx generator-blockstack --plain
    React npx generator-blockstack --react
    Vue npx generator-blockstack --vue

    For additional options run npx generator-blockstack --help.

    Alternatively, global package installation can be used. Try this if running into problems:

    npm install -g yo generator-blockstack
    yo blockstack
    
  4. Start the development server:

    npm run start

Testing the generated app

The single tests works for all generators:

npm run test

Testing the generator project

Within the repo directory, run npm run test. This command will generate the variants of Blockstack apps in folders called .app-gen-test, .webpack-gen-test, .react-gen-test, and .vue-gen-test. The test asserts that all expected files were actually created. It also runs the npm run test command within each app. For the React, Webpack, and Vue generators, npm run test currently builds the app, but that command can be changed. (For a React app, the typical test command is react-scripts test.)

License

MIT © Blockstack

blockstack-app-generator's People

Contributors

agraebe avatar cdadityang avatar estermer avatar hstove avatar joshuakarjala avatar kantai avatar larrysalibra avatar marcelrobitaille avatar njordhov avatar pstan26 avatar sahana-srinivasan avatar shea256 avatar siddhantgoel avatar thinkverse avatar yknl avatar zone117x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockstack-app-generator's Issues

script issue

"scripts": {
"start": "npm-run-all --parallel reactstart webservice",
"reactstart": "react-scripts start",
"webservice": "node server.js",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},

when i have confgured a script as above and i try to start npm start. i have found error as this.
D:\App\sportsstore>npm start

[email protected] start D:\App\sportsstore
npm-run-all --parallel reactstart webservice

[email protected] webservice D:\App\sportsstore
node server.js

[email protected] reactstart D:\App\sportsstore
react-scripts start

internal/modules/cjs/loader.js:582
throw err;
^

Error: Cannot find module 'D:\App\sportsstore\server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] webservice: node server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] webservice script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pao.y\AppData\Roaming\npm-cache_logs\2019-05-17T03_55_04_955Z-debug.log
ERROR: "webservice" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: npm-run-all --parallel reactstart webservice
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pao.y\AppData\Roaming\npm-cache_logs\2019-05-17T03_55_05_197Z-debug.log

this is log file message.
info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\pao.y\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]
6 info lifecycle [email protected]
start: [email protected]
7 verbose lifecycle [email protected]start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
start: PATH: C:\Users\pao.y\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\App\sportsstore\node_modules.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio;C:\Program Files\Git\cmd;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\Brackets\command;C:\Program Files\nodejs;C:\Program Files\Microsoft VS Code\bin;C:\Users\pao.y\AppData\Local\Microsoft\WindowsApps;C:\Users\pao.y\AppData\Roaming\npm
9 verbose lifecycle [email protected]start: CWD: D:\App\sportsstore
10 silly lifecycle [email protected]
start: Args: [ '/d /s /c', 'npm-run-all --parallel reactstart webservice' ]
11 silly lifecycle [email protected]start: Returned: code: 1 signal: null
12 info lifecycle [email protected]
start: Failed to exec start script
13 verbose stack Error: [email protected] start: npm-run-all --parallel reactstart webservice
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Users\pao.y\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess. (C:\Users\pao.y\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid [email protected]
15 verbose cwd D:\App\sportsstore
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\pao.y\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start"
18 verbose node v10.14.1
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: npm-run-all --parallel reactstart webservice
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

any advice from all you experts is really appreciated.

best wishes,
Pao

generator blockstack:react doesnt exist

$ npm install -g generator-blockstack      
+ [email protected]
updated 1 package in 14.015s
$ yo blockstack:react                      
Error blockstack:react 

You don't seem to have a generator with the name “blockstack:react” installed.
But help is on the way:

You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/. 
Install them with npm install generator-blockstack:react.

To see all your installed generators run yo without any arguments. Adding the --help option will also show subgenerators. 

If yo cannot find the generator, run yo doctor to troubleshoot your system.

Blocker - Failed to compile

Followed instructions, installed yo and blockstack-generator, and was hit with this...

Failed to compile

./node_modules/@blockstack/connect/dist/connect.cjs.development.js
Module not found: Can't resolve '@blockstack/stacks-transactions' in '/home/user/Projects/Blockstack/node_modules/@blockstack/connect/dist'

This error occurred during the build time and cannot be dismissed.
``

npm --version
6.14.6
node --version
v10.22.1


Add support for app manifests

Current versions of blockstack.js & portal require an app manifest is provided as part of a valid authentication request

Create a Vue.JS generator

Another popular framework that is growing and from what I have heard is nicer than React.

It is a light weight, component based, client side framework that would be nice to have a generator for.

Error upon "npm run start"

So I'm trying to test out the Hello Blockstack tutorial on Windows 10 (perhaps thats the problem LOL)

I get stuck at $ npm run start
here is the cli output (see below for debug)

$ npm run start

> [email protected] start C:\Users\ty.george\Desktop\hello-blockstack
> npm run browserify; node server.js

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\                                                                                              node_modules\\npm\\bin\\npm-cli.js" "run" "browserify;" "node" "server.js"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10

npm ERR! missing script: browserify;
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\user\Desktop\hello-blockstack\npm-debug.log

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\                                                                                              node_modules\\npm\\bin\\npm-cli.js" "run" "start"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `npm run browserify; node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'npm run browserify;                                                                                               node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hello-blockstack pack                                                                                              age,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run browserify; node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs hello-blockstack
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hello-blockstack
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\user\Desktop\hello-blockstack\npm-debug.log

Here is the debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\user\Desktop\hello-blockstack\node_modules\.bin;C:\Users\user\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\user\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs;C:\Program Files\PuTTY;C:\Program Files\Git\cmd;C:\Program Files (x86)\Microsoft Emulator Manager\1.0;%USERPROFILE%\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle [email protected]~start: CWD: C:\Users\user\Desktop\hello-blockstack
11 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'npm run browserify; node server.js' ]
12 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `npm run browserify; node server.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\Users\user\Desktop\hello-blockstack
17 error Windows_NT 10.0.14393
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
19 error node v6.10.0
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error [email protected] start: `npm run browserify; node server.js`
22 error Exit status 1
23 error Failed at the [email protected] start script 'npm run browserify; node server.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the hello-blockstack package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     npm run browserify; node server.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs hello-blockstack
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls hello-blockstack
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Clean url with replaceState

After authentication, cleaning the browser location by setting window.location results in untimely refreshing of the page:

window.location = window.location.origin

Instead, the window location can be cleaned using:

window.history.replaceState({}, document.title, "/")

The current implementation still requires a refresh unless there are more substantial refactoring of the signin flow. Here is a suggested replacement for the offending componentWillMount implementations in App.js that also resolves issue #25 :

componentDidMount() {
   if (userSession.isSignInPending()) {
     userSession.handlePendingSignIn().then((userData) => {
       // window.location = window.location.origin;
       window.history.replaceState({}, document.title, "/")
       this.setState({ userData: userData})
     });
   }
 }

Eliminate yeoman installation

The steps can be simplified by not requiring installation of yeoman but instead specify it in npm project creation:

npm init yo blockstack

Assuming npm >=v6.1.0 which introduced use of a custom package with npm init to scaffold a project.

Issues with Generator cause downstream problems in the hello-world

novus-sanguis [6:17 AM]
Hey! I have just started with the blockstack. But I m unable to run the hello-world app.
-> Can anyone help me by sharing resources on how to set up local development environment?
-> Is it necessary to run a server on hosted domain?

Thanks in advance. (edited)

Ferruccio Balestreri [7:34 AM]
2) is not

  1. check my app’s source, you can use it as a boilerplate: https://github.com/ferrucc-io/kit-crm
    I had trouble too when starting from the blockstack base project and had to update and add a bunch of libraries to make it usable, let me know if something isn’t clear. setup should be really straightforward as these apps have all the logic client side, so are basically static sites with content hosted on blockstack
    I just updated the readme for you @novus-sanguis

moxiegirl [8:00 AM]
Thanks @ferruccio Balestreri for a quick response. If y'all can slack me the project link you are having problem with, we can see about cleaning that up. Or even better, file an issue on our repo. That way we can fix it at the source and hopefully help out the next person.
Or, if you don't mind, @ferruccio Balestreri I'll see what I can update based on your repo?

Ferruccio Balestreri [8:02 AM]
add the new version of webpack & babel
oh and react too

moxiegirl [8:04 AM]
✔️🙏

Hank [8:05 AM]
just version bumps? we can definitely update the app generator with that

Ferruccio Balestreri [8:05 AM]
it’s a little bit of a pain as the babel files all changed and the webpack confit changed too
version bumps that had breaking changes for config
for version bumps i'd suggest you added https://dependabot.com to the repo
dependabot.com
Dependabot
Automated dependency updates for your Ruby, Python, JavaScript, PHP, .NET, Go, Elixir, Rust, Java and Elm.

Generated package.json reference non-existent repo

The generated .package.json references some repositories that do not exist, namely hello-world:

{
  "name": "hello-blockstack",
  "version": "0.0.0",
  "description": "A simple Blockstack app",
  "main": "index.js",
  "scripts": {
    "browserify": "browserify requires.js -o public/bundle.js",
    "start": "npm run browserify && node server.js"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/blockstack/hello-blockstack.git"
  },
  "author": "",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/blockstack/hello-blockstack/issues"
  },
  "homepage": "https://github.com/blockstack/hello-blockstack#readme",
  "devDependencies": {
    "browserify": "^14.1.0",
    "express": "^4.15.2",
    "opn": "^4.0.2"
  },
  "dependencies": {
    "blockstack": "^18.0.4"
  }
}

Update NPM Versions

The current Github master does not match our NPM builds. This means old bugs are still showing up on a fresh install from NPM (like #5)

Create different framework generators

I Just created a generator for React.JS #6, but there are a couple nice frameworks out there that would be cool to get a generator for:

  • jQuery
  • Angular.JS 1 & 2
  • Vue.JS
  • Ember.JS
  • Backbone.JS
  • Polymer.JS

Just to name a few.

I would like to work on some of these over time but I don't know ember, backbone, or polymer so if someone could take up the task.

Create an Angular2 generator

Obviously the best way to reach more developers is to make a quick start in as many languages and frameworks as we can. Angular2 is a popular framework so it would be nice to have a generator for this framework.

React code to get name contains an error

    <h1>Hello, <span id="heading-name">{ person.name() ? person.name() : 'Nameless Person' }</span>!</h1>

This code never resolves properly. Always comes back as nameless even if the username is available.

Error when when trying to go to "quick sign in"

At this point in the Hello Blockstack tutorial, the developer has not installed Blockstack and is supposed to be navigated to the quick sign in page after clicking "Sign In with Blockstack"

An error pops up..

screen shot 2017-05-20 at 4 06 54 pm
screen shot 2017-05-20 at 4 06 06 pm

blockstack generator builds app, even if you select 'No' to build

When selecting 'n' to the question "Are you ready to build a Blockstack app?", an app is built anyway.

$ yo blockstack

     _-----_     ╭──────────────────────────╮
    |       |    │      Welcome to the      │
    |--(o)--|    │      Blockstack app      │
   `---------´   │        generator!        │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

? Are you ready to build a Blockstack app? No
   create package.json
   create .editorconfig
   create .gitignore
   create requires.js
   create firebase.json
   create server.js
   create public/app.css
   create public/bootstrap.min.css
   create public/app.js
   create public/icon-192x192.png
   create public/index.html
   create public/robots.txt
   create public/manifest.json


I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.


^C

Blockstack has a dependency that causes a vulnerability?


                       === npm audit security report ===

# Run  npm install [email protected]  to resolve 1 vulnerability
SEMVER WARNING: Recommended action is a potentially breaking change

  High            Regular Expression Denial of Service

  Package         minimatch

  Dependency of   blockstack

  Path            blockstack > hasprop > tape > glob > minimatch

  More info       https://nodesecurity.io/advisories/118

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.