Skip to content
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

Questions on affected npm scripts #212

Closed
dereklin opened this issue Jan 18, 2018 · 3 comments
Closed

Questions on affected npm scripts #212

dereklin opened this issue Jan 18, 2018 · 3 comments
Labels

Comments

@dereklin
Copy link

dereklin commented Jan 18, 2018

I am following this blog and trying out the affected npm scripts:
https://blog.nrwl.io/smarter-faster-builds-with-nrwl-nx-c2fd0d1a3277

I have some questions:

  1. It seems like affected:apps and apps:affected are the same. This is true for build and e2e. Why provide two names of the same thing?

  2. for affected:build. It runs this internally:

child_process_1.execSync("ng build " + rest.join(' ') + " -a=" + app, { stdio: [0, 1, 2] });

How can I run a totally different script? Let's say I have a script:

"build:app1:prerender": "npm run build:app1:client-and-server-bundles && npm run webpack:app1:server && npm run generate:app1:prerender",

I want to run build:app1:prerender to build my app1 instead of the standard build. How can I do that?

Same question for affected:e2e. If I have different protractor setup's and I don't want to run the standard ng e2e, but instead I want to run protractor directly. How can I do that?

  1. I gave affected:apps a try. On a repo with apps set up like this: https://github.com/dereklin/nx-demo-jest/blob/lazy-5/.angular-cli.json
    I made a html change inside apps/app1/src
    It reports that the affected app is app1-ngu-app-shell only
    I expected it to show both app1 and app1-ngu-app-shell
@dereklin
Copy link
Author

For #3, I think showing only app1 should make more sense since app1-ngu-app-shell is server platform. Given the fact that nx doesn't officially support angular universal, this issue is understandable.

For now, I am use affected:apps to get the apps, use some regex to parse out the correct apps, and use them to run my custom scripts.

@vsavkin
Copy link
Member

vsavkin commented Jan 21, 2018

You should use affected:apps. apps:affected will be removed in the future.

I gave affected:apps a try. On a repo
Official support for universal is coming in the next couple of weeks. So the issue should be resolved.

For now, I am use affected:apps to get the apps, use some regex to parse out the correct apps, and use them to run my custom scripts.

Yup. This is a good way to do it. affected:build and affected:e2e basically do that. We aren't planning to allow to customize :build and :e2e.

@vsavkin vsavkin closed this as completed Jan 21, 2018
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants