Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

chore(install): put all install commands into a single script #1754

Merged
merged 1 commit into from
Jun 27, 2016

Conversation

chalin
Copy link
Contributor

@chalin chalin commented Jun 26, 2016

This PR makes it easier to get a local repo back into a sane state after a change in typings (something that a few of us have had some challenges with recently :). Specifically, this PR addresses two things.

(1) On June 18th, @filipesilva made the following comment on the docs-authoring slack channel:

in regards to setup, if you're ever uncertain just check travis.yml. It's the definite resource

I agree with this approach of relying on the travis config file. Furthermore, I think that it should be easy to manually create a clean repo (when cloning afresh isn't an option). This PR puts the 5 travis install commands into a single script: ./script/install.sh. Note that the angular team has a similarly named script that they also use for travis installs.

With this PR, one can get a refreshed repo by issuing the following commands from the repo dir:

git clean -xdf
./script/install.sh

(2) I changed two of the install commands as follows:

  npm install --no-optional
- npm install --prefix public/docs/_examples
- npm install --prefix public/docs/_examples/_protractor
+ (cd public/docs/_examples && npm install)
+ (cd public/docs/_examples/_protractor && npm install)
  npm run webdriver:update --prefix public/docs/_examples/_protractor
  gulp add-example-boilerplate

While travis builds seemed to be working, I'm a bit puzzled as to why the two npm install --prefix foo commands gave the desired effect. It is my understanding that such invocations of npm install would use the top-level package.json file (which I don't think is what we wanted). Anyhow, these two npm install --prefix foo commands did not work when run on a local repo. The adjusted commands work both locally and for travis.

This makes it easier to run manually, e.g., after having reset all
local typings.
@chalin
Copy link
Contributor Author

chalin commented Jun 26, 2016

@filipesilva @Foxandxss : as you may recall I had a broken local environment before I went away last week. Now things are back in order, after following the setup in the travis config file (thanks for the suggestion @filipesilva). This PR just makes it easier to do so (since I don't expect that we have seen the last of a change in typings :).

Btw, if you agree with the changes proposed in this PR, then maybe we should update the README.md to reflect this new way of setting up / refreshing a local repo. We could then also add that no PR should be submitted unless lint is happy and all e2e tests pass.

@Foxandxss
Copy link
Member

Yes, something like that should be done. We will talk about that tomorrow I guess.

@chalin
Copy link
Contributor Author

chalin commented Jun 26, 2016

Travis is all green.

Strangely, when I run the tests locally, I get two failures:

Suites failed:
  public/docs/_examples/pipes/ts
  public/docs/_examples/user-input/ts

But when I perform the failed test cases manually, I observe the desired behavior. Maybe the tests are failing because protractor isn't waiting for the actions to complete? (Btw, the same tests pass in Dart.) Any ideas why the tests are failing locally?

@Foxandxss
Copy link
Member

Those two failing tests are a known issue, completely unrelated to your changes. Forget about them for now, they are an issue on chrome and/or protractor.

@filipesilva
Copy link
Contributor

As far as I can tell, the --prefix command doesn't work on windows or something. I tried it a couple of times and really don't get how it works, but according to the npm docs it should.

But, on the other hand, neither do shell files work on windows (without git bash). So I'm not sure this PR helps much in that sense.

If it is to go in, then the webdriver:update command should also be changed to not use --prefix.

@chalin
Copy link
Contributor Author

chalin commented Jun 26, 2016

@Foxandxss : thanks for confirming that those are known failures (FMI, is there an issue open to track this)?

@filipesilva : thanks for clarifying the situation under Windows. Note that this PR does help macOS and linux folks :) ... without making things any worse under Windows, as far as I understand.

@chalin
Copy link
Contributor Author

chalin commented Jun 26, 2016

@filipesilva : FYI, --prefix is needed for the webdriver:update command.

@filipesilva
Copy link
Contributor

@chalin so the prefix thing doesn't work on osx and linux either? That I didn't expect.

For the webdriver command, why can't it be done in the same scheme as the others? Does it not work either? (cd public/docs/_examples/_protractor && npm run webdriver:update) --prefix

@chalin
Copy link
Contributor Author

chalin commented Jun 27, 2016

The webdriver:update can be set in the format of the others, but it doesn't need to.

When used with install, the "--prefixpath" causes node_modules to be output under path, but I think it still picks up the package.json from the local directory --- at least that is the behavior I saw under macOS ... and the reason why I changed the install commands.

@filipesilva
Copy link
Contributor

Got it. Didn't fully understand that before.

@kwalrath
Copy link
Contributor

fwiw, I just used this script, and now my repo is the happiest it's been in weeks (I'm able to deploy the docs again).

@Foxandxss
Copy link
Member

I agree. We do crazy changes to the repo and be able to restart it to brand new condition without losing the branches (the problem of a fresh copy) is 200% needed.

@filipesilva
Copy link
Contributor

Let's go for it then :D

@kwalrath kwalrath merged commit a7435c3 into angular:master Jun 27, 2016
@chalin chalin deleted the chalin-chore-install-script-0626 branch June 28, 2016 20:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants