mean-expert-official / fireloop.io

Modern Real-Time Platform by MEAN Expert
Other
172 stars 36 forks source link

Integration of Ionic to `fireloop serve` + Ideas for future integrations. #110

Closed tohagan closed 6 years ago

tohagan commented 7 years ago

What type of issue are you creating?

What version of this module are you using?

Write other if any:

Please add a description for your issue:

Currently Ionic apps are not support by the fireloop serve command.

Solutions:

I've just got ionic serve spawning for when you run fireloop serve.

You just need to add the following to spawns { ... } in generator-fireloop/generators/serve/index.js

    ng2ionic: {
        cmd: cmd: require.resolve('ionic').replace(/\b(ionic[(\/)(\\\\)]dist[(\/)(\\\\)]index.js)\b/g, '.bin/ionic'),,
        argv: ['serve']
    }

Simpler is just this ... that assumes you've already run npm install -g ionic .

    ng2ionic: {
        cmd: 'ionic',
        argv: ['serve']
    }

Happy to send you a PR for either of these solutions. Just thought I should consult with you first.

The first approach is used by the other spawn code in generator-fireloop/generators/serve/index.js however it only works if you add ionic as a dependency in the top level fireloop-cli/package.json (like "@angular/cli": "1.0.0" already is).

If we follow this pattern ... I think we'd end up having dependencies for each framework (React, Ionic, Angular, Angular Mobile etc etc) .. most of which you'd never use. Granted it does help in specifying the framework CLI version dependency but IMHO it's too large a dependency and in practice most users will already have the global command installed on their execution path I think a full path is not required.

The CLI dependency can be documented as part of the installation process of fireloop. I think this allows the developer the freedom to select the frameworks and version they need to use for their project with no "surprise" global installs.

I'm sure you had some good reasons for coding it this way so I'd be delighted to hear your thoughts.

Another idea I had might be to add the serve spawn command to .yo-rc.json so that it's much more visible and easily configurable or fixed by developers in case the CLI interface changes between framework versions (like the Ionic one I fixed recently).

   "clients": {
      "api": {
        "path": "./api",
        "type": "server",
        "serve": "nodemod ."
      },
      "app": {
        "path": "./app",
        "type": "ng2ionic",
        "name": "app",
        "sdkPath": "app/src/app/shared/sdk"
        "serve": "ionic serve"
      }
    },

Starting to get my head around how Fireloop all works. Awesome stuff! Thanks!!

jonathan-casarrubias commented 7 years ago

Hi @tohagan thanks for reaching out, and sorry for the late response..

Hey so, I'm not sure at what point we removed the ionic serve, but your proposal is correct... I will try to add it and publish it as soon as possible, also the nativescript one is missing, I'll add that