-
Notifications
You must be signed in to change notification settings - Fork 6.9k
chore(*): switch from bower
to npm
for frontend dependencies
#389
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
logs/* | ||
!.gitkeep | ||
node_modules/ | ||
bower_components/ | ||
app/lib/ | ||
tmp | ||
.DS_Store | ||
.idea |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ dist: trusty | |
|
||
language: node_js | ||
node_js: | ||
- '4.5' | ||
- 6 | ||
|
||
install: | ||
- export DISPLAY=:99.0 | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,15 @@ | |
"description": "A starter project for AngularJS", | ||
"repository": "https://github.com/angular/angular-seed", | ||
"license": "MIT", | ||
"dependencies": { | ||
"angular": "^1.5.9", | ||
"angular-loader": "^1.5.9", | ||
"angular-route": "^1.5.9", | ||
"html5-boilerplate": "0.0.1", | ||
"shelljs": "^0.7.5" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently it is necessary in production, because we are not committing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need grunt in the angular 1 project to generate the production distribution but that doesn't stop grunt from being a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, since we copy every frontend asset to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, not true (afaict). Because Also, using git for deployment (especially for small to medium apps) is a viable approach (and one I've used several times). It is handy to be able to Anyway, I don't feel too strongly about it (although I do think it is better to have them as |
||
}, | ||
"devDependencies": { | ||
"angular-mocks": "^1.5.9", | ||
"bower": "^1.7.7", | ||
"http-server": "^0.9.0", | ||
"jasmine-core": "^2.4.1", | ||
|
@@ -17,15 +25,17 @@ | |
"protractor": "^4.0.9" | ||
}, | ||
"scripts": { | ||
"postinstall": "bower install", | ||
"postinstall": "npm run copy-libs", | ||
|
||
"update-deps": "npm update", | ||
"postupdate-deps": "bower update", | ||
"postupdate-deps": "npm run copy-libs", | ||
|
||
"copy-libs": "node scripts/copy-libs.js", | ||
|
||
"prestart": "npm install", | ||
"start": "http-server -a localhost -p 8000 -c-1 ./app", | ||
|
||
"pretest": "npm install", | ||
|
||
"test": "karma start karma.conf.js", | ||
"test-single-run": "karma start karma.conf.js --single-run", | ||
|
||
|
@@ -35,6 +45,6 @@ | |
"preprotractor": "npm run update-webdriver", | ||
"protractor": "protractor e2e-tests/protractor.conf.js", | ||
|
||
"update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/).join('//@@NG_LOADER_START@@\\n'+loaderText+' //@@NG_LOADER_END@@');fs.writeFileSync(indexFile,indexText);\"" | ||
"update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/lib/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=lib/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/).join('//@@NG_LOADER_START@@\\n'+loaderText+' //@@NG_LOADER_END@@');fs.writeFileSync(indexFile,indexText);\"" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
// Constants | ||
const baseSrcDir = 'node_modules'; | ||
const baseDstDir = 'app/lib'; | ||
const files = [ | ||
'html5-boilerplate/dist/css/main.css', | ||
'html5-boilerplate/dist/css/normalize.css', | ||
'html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js', | ||
'angular/angular.js', | ||
'angular/angular.min.js', | ||
'angular/angular.min.js.map', | ||
'angular-route/angular-route.js', | ||
'angular-route/angular-route.min.js', | ||
'angular-route/angular-route.min.js.map', | ||
'angular-loader/angular-loader.js', | ||
'angular-loader/angular-loader.min.js', | ||
'angular-loader/angular-loader.min.js.map' | ||
]; | ||
|
||
// Imports | ||
const path = require('path'); | ||
const shx = require('shelljs'); | ||
|
||
// Copy lib files | ||
shx.rm('-rf', baseDstDir); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If all you need is a cross-platform There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also need a cross-platform There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://www.npmjs.com/package/mkdirp ;) But I see your point now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect it would be easier to ditch this file and use https://www.npmjs.com/package/cpx or something similar. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't we need another pretty long npm script for that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could save some space in the part that iterates over |
||
|
||
files.forEach(relPath => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd use |
||
const srcPath = path.join(baseSrcDir, relPath); | ||
const dstPath = path.join(baseDstDir, relPath); | ||
const dstDir = path.dirname(dstPath); | ||
|
||
shx.mkdir('-p', dstDir); | ||
shx.cp(srcPath, dstDir); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I know! Why don't we switch this to yarn :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm is not "Node Package Manager", it's just "npm". The name should be changed.