Skip to content

Commit 07b6474

Browse files
author
benholloway
committed
Merge remote-tracking branch 'remotes/origin/master' into test-standards-bundled
2 parents 30d7fe1 + 00c14d7 commit 07b6474

File tree

7 files changed

+101
-70
lines changed

7 files changed

+101
-70
lines changed

README.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
1-
# angularity
1+
# Angularity
2+
23
![Angularity Logo](http://angularity.github.io/assets/logo.png)
34

4-
[![Build Status](https://travis-ci.org/angularity/node-angularity.svg?branch=master)](https://travis-ci.org/angularity/node-angularity) [![Build status](https://ci.appveyor.com/api/projects/status/6b1xir7y1j0wm64a/branch/master?svg=true)](https://ci.appveyor.com/project/impaler/node-angularity/branch/master)
5+
[![NPM](https://nodei.co/npm/angularity.png)](http://angularity.github.io)
6+
7+
[![Build Status](https://travis-ci.org/angularity/node-angularity.svg?branch=master)](https://travis-ci.org/angularity/node-angularity)
8+
[![Build status](https://ci.appveyor.com/api/projects/status/6b1xir7y1j0wm64a/branch/master?svg=true)](https://ci.appveyor.com/project/impaler/node-angularity/branch/master)
9+
10+
Build projects, not build systems.
11+
12+
- Hand picked and industry proven front end technologies.
13+
- A complete and scalable single page application workflow.
14+
15+
![AngularJs, Browserify, BabelJs, NodeJs](angularity-library-logos.png)
16+
17+
## Features
18+
19+
A complete frontend development solution for:
20+
modules, minification, source maps, linting, testing, live reloading, release and workflow tooling
21+
22+
- No complicated build files per project
23+
- Kickstart your workflow with IDE integration and command line interface
24+
- Write with the latest ES6 Javascript features
25+
- Use CommonJs/NodeJs syntax
26+
- In-built support for Karma tests
27+
- Build with minification and source-map safe bundles
28+
- Use both Bower and NPM for your vendor dependencies
29+
- Convenient CI integration with custom reporters
30+
- Plugin system to create your own tasks
31+
32+
## Documentation
533

6-
An opinionated node.js build system for ECMAScript 6 AngularJS projects
34+
[angularity.github.io](http://angularity.github.io)
735

8-
Angularity is a philosophy of development.
36+
## Maintained by
937

10-
Our focus is maintaining uniformity of development across groups of developers with varying experience levels.
38+
Ben Holloway, Chris Decoster, Brendan Graetz
1139

12-
Our contributors hold a collective vision of best-practice AngularJS development and have condensed this into a set of tools and resources known as Angularity.
40+
## Licence
1341

14-
Documentation: [http://angularity.github.io](http://angularity.github.io)
42+
MIT

angularity-library-logos.png

113 KB
Loading

index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,15 @@ pluginRegistry
4949
.add(defaultTaskPlugins)
5050
.add(configTaskPlugins);
5151

52-
var taskPlugins = pluginRegistry
52+
pluginRegistry
5353
.get('angularity')
54-
.getAllOfCategory('task');
55-
56-
taskPlugins
57-
.forEach(function eachTaskPlugin(pluginDefinition) {
58-
var plugin = require(pluginDefinition.requirePath);
54+
.getAllOfCategory('task')
55+
.forEach(function eachTaskPlugin(definition) {
56+
var plugin = definition.plugin;
5957

6058
// Task plugins are expected to export a function which should be called with an instance of taskYargsRun
6159
if (typeof plugin !== 'function') {
62-
throw new Error('Plugin named ' + pluginDefinition.name + ' does not export a function');
60+
throw new Error('Plugin named ' + definition.name + ' does not export a function');
6361
}
6462

6563
var taskDefinition = plugin({

npm-shrinkwrap.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angularity",
33
"description": "An opinionated NodeJs build system for ECMAScript 6 AngularJs projects",
4-
"version": "0.1.2",
4+
"version": "0.2.0",
55
"tags": [
66
"build",
77
"system",

tasks/init.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ function setUpInitTask(context) {
3434
{
3535
key: 'defaults',
3636
value: {
37-
describe: 'Set defaults',
38-
alias : 'z',
39-
boolean : true,
40-
isOptional: true
37+
describe : 'Set defaults',
38+
alias : 'z',
39+
isOptional: true,
40+
default : false
4141
}
4242
},
4343
{
@@ -151,7 +151,7 @@ function setUpInitTask(context) {
151151
if (tyRun.checkFlagMissing(opt, key, value)) {
152152
return;
153153
}
154-
if (key !== 'port') {
154+
if ((key !== 'port') && (key !== 'defaults')) {
155155
// skip the valid types test for port, as will be done later
156156
// ensure options correspond to the types that they were defined as belonging to
157157
tyRun.checkFlagType(opt, key, value);
@@ -174,6 +174,11 @@ function setUpInitTask(context) {
174174
throw new Error('Port must be an integer, or "random"');
175175
}
176176
}
177+
else if (key === 'defaults') {
178+
if (!(/^(true|false|reset)$/.test(String(argv.defaults)))) {
179+
throw new Error('Unrecognised value for defaults flag, expected true|false|reset.');
180+
}
181+
}
177182
});
178183
return true;
179184
}
@@ -226,8 +231,8 @@ function setUpInitTask(context) {
226231
template = require('lodash.template'),
227232
merge = require('lodash.merge');
228233

229-
var hr = require('../lib/util/hr'),
230-
streams = require('../lib/config/streams');
234+
var hr = require('../lib/util/hr'),
235+
streams = require('../lib/config/streams');
231236

232237
var TEMPLATE_PATH = path.join(__dirname, '..', 'templates', 'angularity');
233238

tasks/webstorm.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ function setUpWebStormTask(context) {
88
throw new Error('Context must specify run-sequence instance');
99
}
1010

11-
var fs = require('fs'),
12-
path = require('path'),
13-
ideTemplate = require('ide-template'),
14-
defaults = require('../lib/config/defaults'),
15-
platform = require('../lib/config/platform');
11+
var fs = require('fs'),
12+
path = require('path'),
13+
ideTemplate = require('ide-template'),
14+
defaults = require('../lib/config/defaults'),
15+
platform = require('../lib/config/platform');
1616

1717
var config = defaults
1818
.getInstance('webstorm')
@@ -30,20 +30,20 @@ function setUpWebStormTask(context) {
3030
{
3131
key: 'defaults',
3232
value: {
33-
describe: 'Set defaults',
34-
alias : 'z',
35-
boolean : true,
36-
isOptional: true
33+
describe : 'Set defaults',
34+
alias : 'z',
35+
isOptional: true,
36+
default : false
3737
}
3838
},
3939
{
4040
key: 'subdir',
4141
value: {
42-
describe: 'Navigate to the sub-directory specified',
43-
alias : 's',
44-
string : true,
42+
describe : 'Navigate to the sub-directory specified',
43+
alias : 's',
44+
string : true,
4545
isOptional: true,
46-
default : config.get('subdir')
46+
default : config.get('subdir')
4747
}
4848
},
4949
{
@@ -87,10 +87,9 @@ function setUpWebStormTask(context) {
8787
value: {
8888
describe: 'Launch the IDE following setup',
8989
alias : 'l',
90-
boolean : true,
9190
default : config.get('launch')
9291
}
93-
},
92+
}
9493
];
9594

9695
function checkWebstormFlags(argv) {
@@ -108,7 +107,9 @@ function setUpWebStormTask(context) {
108107
}
109108

110109
// ensure options correspond to the types that they were defined as belonging to
111-
tyRun.checkFlagType(opt, key, value);
110+
if ((key !== 'defaults') && (key !== 'launch')) {
111+
tyRun.checkFlagType(opt, key, value);
112+
}
112113

113114
if (key === 'subdir') {
114115
var subdir = path.resolve(value);
@@ -117,6 +118,29 @@ function setUpWebStormTask(context) {
117118
throw new Error('The specified subdirectory does not exist.');
118119
}
119120
}
121+
else if (key === 'defaults') {
122+
if (!(/^(true|false|reset)$/.test(String(argv.defaults)))) {
123+
throw new Error('Unrecognised value for defaults flag, expected true|false|reset.');
124+
}
125+
}
126+
else if (key === 'launch') {
127+
switch (String(argv.launch)) {
128+
case 'false':
129+
break;
130+
case 'true':
131+
if (!ideTemplate.webStorm.validateExecutable()) {
132+
throw new Error('Cannot find Webstorm executable, you will have to specify it explicitly.');
133+
}
134+
break;
135+
default:
136+
var customPath = path.normalize(argv.launch);
137+
if (fs.existsSync(customPath)) {
138+
ideTemplate.webStorm.customExecutable = customPath;
139+
} else {
140+
throw new Error('Launch path is not valid or does not exist.');
141+
}
142+
}
143+
}
120144
});
121145
if (!argv.defaults) {
122146
// when defaults are not present, check whether angularity project is present
@@ -129,33 +153,6 @@ function setUpWebStormTask(context) {
129153
return true;
130154
}
131155

132-
/**
133-
* yargs check for a valid --launch parameter
134-
* Additionally parses true|false strings to boolean literals
135-
* @param argv
136-
*/
137-
function validateLaunchPath(argv) {
138-
switch (argv.launch) {
139-
case false:
140-
case 'false':
141-
argv.launch = false;
142-
break;
143-
case true:
144-
case 'true':
145-
if (ideTemplate.webStorm.validateExecutable()) {
146-
argv.launch = true;
147-
} else {
148-
return 'Cannot find Webstorm executable, you will have to specify it explicitly.';
149-
}
150-
break;
151-
default:
152-
if (!fs.existsSync(path.normalize(argv.launch))) {
153-
return 'Launch path is not valid or does not exist.';
154-
}
155-
}
156-
return argv;
157-
}
158-
159156
var taskDefinition = {
160157
name: 'webstorm',
161158
description: [
@@ -180,7 +177,7 @@ function setUpWebStormTask(context) {
180177
'angularity webstorm --defaults reset Reset defaults'
181178
].join('\n'),
182179
prerequisiteTasks: ['help'],
183-
checks: [validateLaunchPath, checkWebstormFlags],
180+
checks: [checkWebstormFlags],
184181
options: webstormOptionDefinitions,
185182
onInit: function onInitWebstormTask(yargsInstance) {
186183
var gulp = context.gulp,
@@ -198,6 +195,9 @@ function setUpWebStormTask(context) {
198195
.wrap(80);
199196
cliArgs = yargsInstance.argv;
200197

198+
// launch parameter should be boolean for consistency with defaults
199+
cliArgs.launch = (cliArgs.launch === 'true') ? true : (cliArgs.launch === 'false') ? false : cliArgs.launch;
200+
201201
gulp.task('webstorm', function (done) {
202202
console.log(hr('-', 80, 'webstorm'));
203203

0 commit comments

Comments
 (0)