Skip to content

feat: Use JSON file to create a NEW project and to GENERATE components, routes, directives, etc. #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from

Conversation

kenhansen01
Copy link

@kenhansen01 kenhansen01 commented Jun 7, 2016

I created a new command in the ng2 commands folder. It looks for a file named ng-project.json, then sychronously goes through and creates the project and as many routes, components, directives, etc as are set up in the json file.

These are executed through child_process.execSync,

To use the command. Save a JSON file and run:

ng newfromjson

There is also a model for the json file (a Typescript interface) that shows all the options. It should be set up like this (options with '?' are optional):

{
  package: {
    name: string,
    blueprint?: string,
    dryRun?: boolean,
    verbose?: boolean,
    skipNpm?: boolean,
    skipGit?: boolean,
    directory?: string
  },
  routes?: {
    name: string,
    flat?: boolean,
    default?: boolean,
    lazy?: boolean,
    skipRouterGeneration?: boolean,
    route?: string
  }[],
  components?: {
    name: string,
    flat?: boolean,
    route?: string
  }[],
  pipes?: {
    name: string,
    flat?: boolean
  }[],
  services?: {
    name: string,
    flat?: boolean
  }[],
  directives?: {
    name: string,
    flat?: boolean
  }[],
  classes?: {
    name: string,
    flat?: boolean
  }[],
  enums?: {
    name: string,
    flat?: boolean
  }[]
}

I am working on a way to skip existing items and only add new ones if the json is changed.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@kenhansen01 kenhansen01 changed the title Cli json parse feat: Use JSON file to create a NEW project and to GENERATE components, routes, directives, etc. Jun 8, 2016
@googlebot
Copy link

CLAs look good, thanks!

@filipesilva filipesilva added the feature Issue that requests a new feature label Jul 27, 2016
@filipesilva
Copy link
Contributor

Heya, we've made some massive changes in the build system in #1455, you might want to rebase to make sure your PR still works!

@esinek
Copy link

esinek commented Oct 7, 2016

@kenhansen01 - any plans to rebase and continue this? Would also be great to have option to generate interfaces & modules and have various generate items contained within the modules. If you want to get crazy, add option to specify json file for different modules! Great idea. Thx.

@Brocco
Copy link
Contributor

Brocco commented Oct 14, 2016

@kenhansen01 I appreciate your efforts with the work you have put into this, but I feel like this is outside the current scope of the CLI. The current approach for this would be to create an external script to automate the CLI.

The idea itself is sound and will be considered in the future.

Thanks again for your efforts.

@Brocco Brocco closed this Oct 14, 2016
@kenhansen01 kenhansen01 deleted the cli-json-parse branch October 14, 2016 18:51
@kenhansen01
Copy link
Author

Fair enough. I was having trouble finding the time to rework and rebase with all of the changes since I started work on this was started.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature state: WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants