Most of what we were scripting could be done without emulating the shell
capabilities of Bash, so we did not use shelljs. We merely used the Child
Process <https://nodejs.org/api/child_process.html> module to invoke
individual command lines.
Example:
> import * as ChildProcess from 'child-process';
function exec(cmdLine: string): Promise<void> {
> return new Promise<void>((resolve, reject) => {
> ChildProcess.exec(cmdLine, (err) => {
> if (err !== 0) {
> reject(err);
> } else {
> resolve();
> }
> });
> });
> }
>
exec(
> `
> ng new
> ${appl}
> `
> )
>
> .then(() => {
>
> process.chdir(
> `
> ${appl}
> /src/app
> `
> );
>
> return exec('ng g component admin');
>
> })
>
> .then(() => {
>
> return exec('ng g component reports');
>
> })
> ...
>
On Tue, Jul 19, 2016 at 2:48 PM, Ed Sinek <[email protected]> wrote:
> Thanks Lucas, looking into it now. shelljs[1] looks pretty good. Do you
> use something like this?
>
> [1] https://github.com/shelljs/shelljs
>
>
> On Tuesday, July 19, 2016 at 10:56:43 AM UTC-7, Lucas Lacroix wrote:
>>
>> Why not use node? That is what we've switched over to.
>>
>> On Tue, Jul 19, 2016 at 1:52 PM, Ed Sinek <[email protected]> wrote:
>>
>>> I'm playing around with Angular CLI (on Windows 7) and want to create a
>>> script to generate the app, several components, routes, etc. Since I'm in
>>> Windows, the low hanging fruit is a simple batch file, but I found that not
>>> all of the ng commands are executed (not sure why).
>>>
>>> What is the community recommendation for a script file in Win7?
>>> PowerShell?
>>> FYI, I do not have bash installed, but can if that is the recommendation.
>>>
>>> Thanks,
>>> --Ed
>>>
>>> Current batch file is something like this:
>>>
>>> ng new MyApp
>>> cd MyApp
>>> cd src
>>> cd app
>>> REM ** when ng g route is working again, replace the following **
>>> ng g component admin
>>> ng g component reports
>>> ren admin +admin
>>> ren reports +reports
>>> cd +admin
>>> ng g component addUser
>>> ng g component editUser
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "AngularJS" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/angular.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Lucas Lacroix
>> Computer Scientist
>> System Technology Division, MEDITECH <http://ehr.meditech.com>
>> 781-774-2293
>>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
Lucas Lacroix
Computer Scientist
System Technology Division, MEDITECH <http://ehr.meditech.com>
781-774-2293
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.