Skip to content

Webpack #1971

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

Merged
merged 54 commits into from
Jun 20, 2016
Merged

Webpack #1971

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f9e64e2
feat(gen:app): remove bower, initial webpack support
Awk34 May 7, 2016
0f73fac
refactor(gen/test): use gulp for all tests
Awk34 Jun 6, 2016
5151127
test(gen:pre): remove bower pre-tests
Awk34 Jun 6, 2016
af7a6e6
test(gen:get-expected-files): fix expected files
Awk34 Jun 6, 2016
97cc341
refactor(gen:test): don't symlink `bower_components` anymore
Awk34 Jun 6, 2016
1327d0b
fix(e2e): get e2e tests running
Awk34 Jun 6, 2016
445435e
fix(jscs):
Awk34 Jun 6, 2016
dd73e59
fix(gulp): uncomment `open(...)`
Awk34 Jun 6, 2016
f7cae15
fix(e2e): fix some webpack config for e2e
Awk34 Jun 10, 2016
536e9a1
fix(webpack): fix ng-annotate for e2e
Awk34 Jun 10, 2016
4e3f59f
fix(e2e): fix some async quirks
Awk34 Jun 10, 2016
c94f5f2
fix(gen:test): index.html -> _index.html
Awk34 Jun 10, 2016
da9a1ee
chore(package): add jade-loader
Awk34 Jun 11, 2016
e1b2b7e
fix(gen:app): don't run bower after scaffold
Awk34 Jun 11, 2016
f5302a7
chore(package): replace jade-loader with pug-html-loader
Awk34 Jun 11, 2016
ee1a4b1
fix(jade): fix navbar jade template
Awk34 Jun 11, 2016
57a16dd
fix(client): fix template requires
Awk34 Jun 11, 2016
3e65d90
fix(webpack): fix jade/html config
Awk34 Jun 11, 2016
0f4abd9
fix(gulp-protractor): throw on error
Awk34 Jun 11, 2016
1e2311e
fix(client): exclude oauthButtons import if !oauth
Awk34 Jun 11, 2016
e3047a8
chore(circle): remove grunt-cli, wiredep; add sauce-connect
Awk34 Jun 11, 2016
b45af55
test(gen): comment e2e for now
Awk34 Jun 12, 2016
c67572e
chore(package): remove wiredep things
Awk34 Jun 16, 2016
881d170
fix(test:client): fix client tests for TS
Awk34 Jun 16, 2016
03d1c95
fix(gulp): process.exit on karma errors, remove wiredep import
Awk34 Jun 16, 2016
2274545
fix(client): fix ngRoute imports
Koslun Jun 16, 2016
9d95083
fix(client): fix css/font paths
Awk34 Jun 16, 2016
c3b41ef
fix(webpack): use raw loader with jade
Awk34 Jun 16, 2016
718bbd6
feat(client:karma): add karma-sourcemap-loader
Awk34 Jun 16, 2016
523abf4
fix(test:client): require angular in mocks
Awk34 Jun 16, 2016
7960c35
fix(test:client): fix for ts + sprint-js
Awk34 Jun 16, 2016
2dd7987
fix(webpack): don't use `exclude` in ts
Awk34 Jun 16, 2016
edf5524
feat(gulp): separate reg and coverage server tests
Awk34 Jun 16, 2016
e59864e
chore(package): add version numbers for less-loader, stylus-loader
Awk34 Jun 16, 2016
8fa3e0a
fix(server): exclude session code if noModels
Awk34 Jun 16, 2016
34dd31e
fix(webpack): fix some conditionals
Awk34 Jun 16, 2016
86a8fa3
fix(stylus): use bootstrap-styl, font-awesome-stylus
Awk34 Jun 16, 2016
9df7265
refactor(client): `~` in css-loader requires will find `node_modules`…
Awk34 Jun 16, 2016
8bce0f2
fix(webpack): fix style `include`s
Awk34 Jun 16, 2016
b152a77
fix(webpack): fix file-loader regex for versioned font imports
Awk34 Jun 16, 2016
ce0533f
fix(gulp): always use `{bootstrap,font-awesome}`
Awk34 Jun 16, 2016
51e8c6b
fix(tsconfig): fix loading of typings
Koslun Jun 16, 2016
93eea9e
fix(routerDecorator): fix lodash import
Koslun Jun 17, 2016
8f47652
feat(typings): add angular-resource typings
Koslun Jun 17, 2016
98add1d
feat(polyfills): set type for Error
Koslun Jun 17, 2016
d8346f9
fix(webpack): we don't need the raw loader with the pug-html loader
Awk34 Jun 18, 2016
7db19e2
feat(flow): add Flow support
Awk34 Jun 20, 2016
e44cb04
feat(package): refactor EJS, add `flow` command
Awk34 Jun 20, 2016
5b00977
feat(webpack): improve comment stripping config
Awk34 Jun 20, 2016
fd99da8
test(gen): add `.flowconfig` file expectation
Awk34 Jun 20, 2016
7f0e1c8
fix(gen): fix flow regex
Awk34 Jun 20, 2016
4350dc3
feat(gen): default flow to false
Awk34 Jun 20, 2016
4da3072
Merge remote-tracking branch 'origin/canary' into webpack
Awk34 Jun 20, 2016
869acf1
Merge branch 'canary' of https://github.com/angular-fullstack/generat…
Awk34 Jun 20, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ machine:
node:
version: 5.11.1
post:
- npm install -g gulp-cli grunt-cli bower
- npm install -g gulp-cli

## Customize checkout
checkout:
Expand All @@ -17,6 +17,9 @@ dependencies:
# builds. If you need to, you can add custom paths to cache:
cache_directories:
- "test/fixtures/node_modules"
post:
- wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
- tar -xzf sc-latest-linux.tar.gz

## Custom notifications
#notify:
Expand All @@ -25,3 +28,12 @@ notify:
# A list of hook hashes, containing the url field
# gitter hook
- url: https://webhooks.gitter.im/e/ac3980c61cb722b9e789

test:
pre:
- cd sc-*-linux && ./bin/sc --user $SAUCE_USERNAME --api-key $SAUCE_ACCESS_KEY --readyfile ~/sauce_is_ready:
background: true
# Wait for tunnel to be ready
- while [ ! -e ~/sauce_is_ready ]; do sleep 1; done
post:
- killall --wait sc # wait for Sauce Connect to close the tunnel
14 changes: 4 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const transpile = lazypipe()
.pipe(babel);

gulp.task('clean', () => {
return del(['generators/**/*', './test/(**|!fixtures/node_modules|!fixtures/bower_components)/*']);
return del(['generators/**/*', './test/(**|!fixtures/node_modules)/*']);
});

gulp.task('babel', () => {
Expand Down Expand Up @@ -113,10 +113,7 @@ function updateFixtures(target) {
const dest = __dirname + (deps ? '/angular-fullstack-deps/' : '/test/fixtures/');
const appName = deps ? 'angular-fullstack-deps' : 'tempApp';

return Promise.all([
processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps, test: test}),
processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !deps, test: test})
]);
return processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps, test: test});
}

gulp.task('updateFixtures', cb => {
Expand All @@ -143,16 +140,13 @@ function execAsync(cmd, opt) {
}

gulp.task('installFixtures', function() {
gutil.log('installing npm & bower dependencies for generated app');
gutil.log('installing npm dependencies for generated app');
let progress = setInterval(() => {
process.stdout.write('.');
}, 1 * 1000);
shell.cd('test/fixtures');

return Promise.all([
execAsync('npm install --quiet', {cwd: '../fixtures'}),
execAsync('bower install', {cwd: '../fixtures'})
]).then(() => {
execAsync('npm install --quiet', {cwd: '../fixtures'}).then(() => {
process.stdout.write('\n');
if(!process.env.SAUCE_USERNAME) {
gutil.log('running npm run-script update-webdriver');
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-angular-fullstack",
"version": "3.7.5",
"version": "4.0.0-beta",
"description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node",
"keywords": [
"yeoman-generator",
Expand Down Expand Up @@ -45,6 +45,7 @@
"gulp-babel": "^6.1.2",
"gulp-beautify": "^2.0.0",
"gulp-filter": "^4.0.0",
"gulp-tap": "^0.1.3",
"insight": "~0.8.1",
"lodash": "^4.13.1",
"semver": "^5.1.0",
Expand Down
82 changes: 63 additions & 19 deletions src/generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ import insight from '../insight-init';
import {exec} from 'child_process';
import babelStream from 'gulp-babel';
import beaufityStream from 'gulp-beautify';
import tap from 'gulp-tap';
import filter from 'gulp-filter';
import semver from 'semver';

export class Generator extends Base {
constructor(...args) {
super(...args);

this.env.alias('angular-fullstack', 'afs');
this.env.alias('afs', 'angular-fullstack');

this.argument('name', { type: String, required: false });

this.option('skip-install', {
Expand Down Expand Up @@ -126,12 +130,12 @@ export class Generator extends Base {
}[val];
}
}, {
// TODO: enable once Babel setup supports Flow
// type: 'confirm',
// name: 'flow',
// message: 'Would you like to use Flow types with Babel?',
// when: answers => answers.transpiler === 'babel'
// }, {
type: 'confirm',
name: 'flow',
default: false,
message: 'Would you like to use Flow types with Babel?',
when: answers => answers.transpiler === 'babel'
}, {
type: 'list',
name: 'markup',
message: 'What would you like to write markup with?',
Expand Down Expand Up @@ -449,24 +453,32 @@ export class Generator extends Base {
]);
*/

const flow = this.filters.flow;

let babelPlugins = [
'babel-plugin-syntax-flow',
'babel-plugin-syntax-class-properties'
];

// TODO: enable once Babel setup supports Flow
// if(this.filters.babel && !this.filters.flow) {
if(this.filters.babel && !flow) {
babelPlugins.push('babel-plugin-transform-flow-strip-types');
// }
}

const jsFilter = filter(['client/**/*.js'], {restore: true});
let jsFilter = filter(['client/**/*.js'], {restore: true});
this.registerTransformStream([
jsFilter,
babelStream({
plugins: babelPlugins.map(require.resolve),
/* Babel get's confused about these if you're using an `npm link`ed
generator-angular-fullstack, thus the `require.resolve` */
// retainLines: true,
shouldPrintComment(commentContents) {
if(flow) {
return true;
} else {
// strip `// @flow` comments if not using flow
return !(/@flow/.test(commentContents));
}
},
babelrc: false // don't grab the generator's `.babelrc`
}),
beaufityStream({
Expand All @@ -493,6 +505,42 @@ export class Generator extends Base {
jsFilter.restore
]);

/**
* TypeScript doesn't play nicely with things that don't have a default export
*/
if(this.filters.ts) {
const modulesToFix = [
['angular', 'angular'],
['ngCookies', 'angular-cookies'],
['ngResource', 'angular-resource'],
['ngSanitize', 'angular-sanitize'],
['uiRouter', 'angular-ui-router'],
['uiBootstrap', 'angular-ui-bootstrap'],
['ngMessages', 'angular-messages'],
['io', 'socket.io-client']
];
function replacer(contents) {
modulesToFix.forEach(([moduleName, importName]) => {
contents = contents.replace(
`import ${moduleName} from '${importName}'`,
`const ${moduleName} = require('${importName}')`
);
});
return contents;
}

let tsFilter = filter(['client/**/*.ts'], {restore: true});
this.registerTransformStream([
tsFilter,
tap(function(file, t) {
var contents = file.contents.toString();
contents = replacer(contents);
file.contents = new Buffer(contents);
}),
tsFilter.restore
]);
}

let self = this;
this.sourceRoot(path.join(__dirname, '../../templates/app'));
this.processDirectory('.', '.');
Expand All @@ -515,14 +563,10 @@ export class Generator extends Base {
};
}

get install() {
return {
installDeps: function() {
this.installDependencies({
skipInstall: this.options['skip-install']
});
}
};
install() {
if(!this.options['skip-install']) {
this.spawnCommand('npm', ['install']);
}
}

get end() {
Expand Down
10 changes: 3 additions & 7 deletions src/test/endpoint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@ function runEndpointGen(name, opt={}) {
dir = _dir;

// symlink our dependency directories
return Promise.all([
fs.mkdirAsync(dir + '/client').then(() => {
return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components');
}),
fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules')
]).then(done);
return fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules')
.then(done);
})
.withOptions(options)
.withArguments([name])
Expand Down Expand Up @@ -250,4 +246,4 @@ describe('angular-fullstack:endpoint', function() {
return jshintDir(dir, 'foo-bar').should.be.fulfilled();
});
});
});
});
3 changes: 0 additions & 3 deletions src/test/fixtures/.bowerrc

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/fixtures/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"models": true,
"mongooseModels": true,
"mongoose": true,
"grunt": true,
"gulp": true,
"mocha": true,
"jasmine": false,
"expect": true
Expand Down
45 changes: 29 additions & 16 deletions src/test/get-expected-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,22 @@ export function app(options) {
'client/.htaccess',
'client/favicon.ico',
'client/robots.txt',
'client/index.html',
'client/_index.html',
`client/polyfills.${script}`,
'client/app/app.' + script,
'client/app/app.config.' + script,
'client/app/app.' + stylesheet,
'client/app/main/main.' + script,
'client/app/main/main.component.' + script,
'client/app/main/main.component.spec.' + script,
'client/app/main/main.routes.' + script,
'client/app/main/main.' + markup,
'client/app/main/main.' + stylesheet,
'client/app/main/main.controller.' + script,
'client/app/main/main.controller.spec.' + script,
'client/assets/images/yeoman.png',
'client/components/footer/footer.' + stylesheet,
'client/components/footer/footer.' + markup,
'client/components/footer/footer.directive.' + script,
'client/components/footer/footer.component.' + script,
'client/components/navbar/navbar.' + markup,
'client/components/navbar/navbar.controller.' + script,
'client/components/navbar/navbar.directive.' + script,
'client/components/navbar/navbar.component.' + script,
'client/components/util/util.module.' + script,
'client/components/util/util.service.' + script,
'server/.jshintrc',
Expand All @@ -89,21 +90,25 @@ export function app(options) {
'e2e/main/main.spec.js',
'e2e/components/navbar/navbar.po.js',
'.babelrc',
'.bowerrc',
'.buildignore',
'.editorconfig',
'.gitattributes',
'.gitignore',
'.travis.yml',
'.jscsrc',
'.yo-rc.json',
'Gruntfile.js',
'gulpfile.babel.js',
'package.json',
'bower.json',
'karma.conf.js',
'mocha.conf.js',
'mocha.global.js',
'protractor.conf.js',
'README.md'
'README.md',
'spec.js',
'webpack.build.js',
'webpack.dev.js',
'webpack.test.js',
'webpack.make.js'
]);

/* TypeScript */
Expand All @@ -120,6 +125,11 @@ export function app(options) {
]);
}

/* Flow */
if(options.flow) {
files.push('.flowconfig');
}

/* Ui-Router */
if (options.router === 'uirouter') {
files = files.concat([
Expand Down Expand Up @@ -155,18 +165,22 @@ export function app(options) {
/* Authentication */
if (options.auth) {
files = files.concat([
'client/app/account/account.' + script,
'client/app/account/index.' + script,
'client/app/account/account.routes.' + script,
'client/app/account/login/login.' + markup,
'client/app/account/login/index.' + script,
'client/app/account/login/login.controller.' + script,
'client/app/account/settings/settings.' + markup,
'client/app/account/settings/index.' + script,
'client/app/account/settings/settings.controller.' + script,
'client/app/account/signup/signup.' + markup,
'client/app/account/signup/index.' + script,
'client/app/account/signup/signup.controller.' + script,
'client/app/admin/index.' + script,
'client/app/admin/admin.' + markup,
'client/app/admin/admin.' + stylesheet,
'client/app/admin/admin.module.' + script,
'client/app/admin/admin.router.' + script,
'client/app/admin/admin.controller.' + script,
'client/app/admin/admin.routes.' + script,
'client/components/auth/auth.module.' + script,
'client/components/auth/auth.service.' + script,
'client/components/auth/interceptor.service.' + script,
Expand Down Expand Up @@ -200,11 +214,10 @@ export function app(options) {


files = files.concat([
'client/components/oauth-buttons/index.' + script,
'client/components/oauth-buttons/oauth-buttons.' + stylesheet,
'client/components/oauth-buttons/oauth-buttons.' + markup,
'client/components/oauth-buttons/oauth-buttons.controller.' + script,
'client/components/oauth-buttons/oauth-buttons.controller.spec.' + script,
'client/components/oauth-buttons/oauth-buttons.directive.' + script,
'client/components/oauth-buttons/oauth-buttons.directive.spec.' + script,
'e2e/components/oauth-buttons/oauth-buttons.po.js'
]);
Expand Down
Loading