모든 bower 패키지를 어떻게 제거합니까?
때로는 전체 사이트를 다시 빌드하고 bower가 bower.json에있는 모든 패키지의 새 버전을 다시 설치하도록 강제하는 것이 유용합니다.
그러나 그렇게하는 방법은없는 것 같습니다.
시도 # 1 :
$ bower uninstall
bower not-installed 0
아니요, 깨끗한 '보우 어 설치'가 bower.json을 사용하더라도 패키지별로 만 작동합니다.
시도 # 2 :
$ bower install -f -l 0
$
아니요, '-f'에도 불구하고 종속성이 충족되면 전혀 작동하지 않습니다.
시도 # 3 :
$ rm -r bower_components
$
! 아 승리! ... 잠깐,이게 뭐야?
rm: bower_components: No such file or directory
오 젠장,이 프로젝트에는 설치할 디렉토리를 설정하는 .bowrc가 있습니다.
나의 현재 끔찍한 해결책 :
다음과 같은 사용자 지정 스크립트를 실행합니다.
- Parse .bowerrc if one exists
- Load the directory if one is specified in the json block
- If the directory currently exists...
- ...recursively delete the directory.
작동하지만 반복적으로 설정해야하는 것은 꽤 성가신 일입니다.
내가 뭔가를 놓치고 있습니까?
로컬에 설치된 모듈을 삭제하는 간단한 bower 명령이 있습니까?
정말 기본적인 기능처럼 보입니다.
(이것은 실제로 자바 스크립트 질문은 아니지만 간단한 노드 스크립트에서 어떻게 든 이것이 일어나도록 bower 모듈에 연결되는 것을 기꺼이 받아 들일 것입니다)
문맥
편집 : 그러한 작업에 대한 '동기 부여'를 원한다면 다음과 같습니다. 프로젝트를 빌드하고 테스트를 실행하는 젠킨스 서버가 있습니다. 그러나 명백한 이유없이 주기적으로 실패합니다. 거의이다, 조사 항상 젠킨스가 구축하고 테스트를 실행하기 전에 최신 버전으로 업데이트 단지 자식 풀과 저장소의 이전 복사본을 사용하고 있기 때문에, 결과적으로 이전 bower_components 디렉토리가 있으며 다양한 구성 요소의 캐시 된 복사본으로 가득 차 있습니다.
다음은 # @ $ @ # $ 'd이고 강제 설치로 bower를 다시 실행해야하는 몇 가지 예입니다.
1) 일부 바보 (> _> fitvids)는 프로젝트의 이전 태그 릴리스를 삭제합니다.
2) 일부 프로젝트가 바우어에서 떨어지거나 github 페이지를 이동했습니다.
3) 일부 프로젝트 (> _> jquery)가 비주 버전 개정판에서 파일이 배치되는 방식을 변경했습니다.
이 문제에 대한 '올바른'해결책은 젠킨스를 수정하여 각 빌드에 대해 새 임시 디렉토리를 생성한다는 것을 알고 있습니다. ...하지만 그건 내 통제권이 아닙니다.
따라서 빌드 단계에서 bower 구성 요소를 삭제하고 모두 강제로 다시 설치하는 방법을 자동화해야합니다. grunt 작업 (빌드의 일부) 또는 jenkins 빌드 단계로. 그러나 위의 (3)에서 우리의 프로젝트는 .bowerrc를 사용하므로 단순히 폴더를 삭제하는 것만 큼 간단하지 않습니다.
이 작업을 수행하기위한 사전 빌드 단계로 기존의 모든 bower 구성 요소를 제거 할 수 있다면 좋을 것입니다.
그래서 ... 다시 질문으로 돌아갑니다. 이것이 bower로 할 수 있습니까?
업데이트 된 답변
모든 패키지를 업데이트하려는 경우
$ bower update
원래 답변
bower.json 파일로 이동하여 devDependencies에서 제거 할 모든 구성 요소 또는 라이브러리를 제거합니다.
원하는 항목을 제거한 후 다음을 실행하십시오.
$ bower prune
시작-
"devDependencies": { "angular": "~1.2.15", "angular-ui-router": "~0.2.10", "moment": "~2.5.1" }
파일에서 각도 참조 제거-
"devDependencies": { "moment": "~2.5.1" }
실행하다
$ bower prune
각도 의존성이 제거되는 것을 지켜보십시오.
어때
- bower.json 편집
- 'rm -Rf bower_components / *'
- 정자 설치
I was trying to upgrade to polymer 0.2.4 from 0.2.3. I can't seem to find a quick way to uninstall a set of dependencies. So I just manually removed those polymer* dir under bower_components. But for some reason bower kept remembering I had 0.2.3 installed event with bower.json modified. A 'rm -Rf bower_component/*' seems to do the tricks.
Actually I do something a little bit tricky but it works for me:
for package in $(ls your_bower_components_folder); do bower uninstall "$package"; done;
bower install
Uninstalling Packages
To remove a package you can use the uninstall command followed by the name of the package you wish to remove.
bower uninstall
It’s possible to remove multiple packages at once by listing the package names.
bower uninstall jquery modernizr sass-bootstrap
Adapting Jumar Polanco's answer to use it in Powershell, it is possible to programmatically uninstall bower components in the following way:
In the Powershell interface, navigate to the location where bower.json and the bower_components folder is located. Usually is the root app folder.
Then you can run:
foreach($package in ls bower_components){bower uninstall $package}
Depending on what the packages dependencies are, it may be required to pay extra attention to the process, as some prompts which require extra input (Y/n) to continue the process may arise (such as dependency conflicts).
I don't know what build tools you use, but if it includes Grunt with grunt-bowercopy, you could use the clean
option. It removes the bower_components folder (or whatever you've configured it to use) after copying out the required files.
Ideally, I'd prefer something that didn't require me to re-download all the dependencies with each build, but just the ones where doing a fresh install would find a newer version.
I'm looking for a better solution to this as well, so I'll update if I find one.
I've been using nombom
to do this (as a bonus, it also re-installs your npm packages from scratch):
https://www.npmjs.com/package/nombom
This is what ended up working for me via Windows cmd prompt:
forfiles /p .\bower_components /c "cmd /c cd .. && bower uninstall @fname"
참고URL : https://stackoverflow.com/questions/22927370/how-do-you-uninstall-all-your-bower-packages
'programing tip' 카테고리의 다른 글
web.xml을 사용하여 Spring에서 컨텍스트로드 (0) | 2020.11.07 |
---|---|
initWithRootViewController 이외의 메소드로 UINavigationController의 rootViewController 설정 (0) | 2020.11.07 |
Variadic 템플릿 팩 확장 (0) | 2020.11.07 |
Spyder 편집기 배경을 어둡게 변경하는 방법은 무엇입니까? (0) | 2020.11.07 |
ASP.NET Development Server 대신 IIS에 디버거를 연결하려면 어떻게합니까? (0) | 2020.11.07 |