Skip to content

Commit 6d7f495

Browse files
committedFeb 27, 2016
Added optional directive to the input example
1 parent 705c60d commit 6d7f495

File tree

8 files changed

+19
-34
lines changed

8 files changed

+19
-34
lines changed
 

‎.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
index.js
2+
node_modules

‎app/templates/base/demo/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<script src="../bower_components/objectpath/lib/ObjectPath.js"></script>
77
<script src="../bower_components/angular-schema-form/dist/schema-form.min.js"></script>
88
<script src="../bower_components/angular-schema-form-bootstrap/bootstrap-decorator.min.js"></script>
9-
<script src="../dist/asf-addon.js"></script>
9+
<script src="../dist/<%= paramName %>.js"></script>
1010

1111
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
1212
<link rel="stylesheet" href="main.css">

‎app/templates/base/gulpfile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ gulp.task('minify', function () {
3333
})),
3434
gulp.src(files)
3535
)
36-
.pipe(concat('asf-addon.js'))
36+
.pipe(concat('<%= paramName %>.js'))
3737
.pipe(gulp.dest('./dist'))
3838
.pipe(uglify())
39-
.pipe(rename('asf-addon.min.js'))
39+
.pipe(rename('<%= paramName %>.min.js'))
4040
.pipe(gulp.dest('./dist'));
4141

4242
return stream;

‎app/templates/directives/input/update-on-blur-directive.html

-1
This file was deleted.

‎app/templates/directives/input/update-on-blur.js

-19
This file was deleted.

‎index.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ class asfAddOnGenerator extends Base {
7979
this.addon.files.base = read(`${this.templatePath()}/base`);
8080
this.addon.files[this.addon.type] = read(`${this.templatePath()}/${this.addon.type}/src`);
8181

82+
if (!this.addon.useDirective) {
83+
this.addon.files[this.addon.type] = this.addon.files[this.addon.type].filter(dir => !dir.includes('directives'))
84+
}
85+
8286
}
8387

8488
writing() {
@@ -93,21 +97,19 @@ class asfAddOnGenerator extends Base {
9397
form[0].type = this.addon.formType;
9498
}
9599

100+
const sources = [];
101+
const testModule = ['schemaForm'];
102+
103+
if (this.addon.type !== 'empty') {
104+
testModule.push(this.addon.module);
105+
sources.push('src/module.js', 'src/**/*.js');
106+
}
107+
96108
this.addon.files.base.forEach((file) => {
97109
/* What to inject in the test controller
98110
*/
99-
const testModule = ['schemaForm'];
100-
const sources = [];
101111
const dest = file.replace('_', '.');
102112

103-
if (this.addon.type !== 'empty') {
104-
testModule.push(this.addon.module);
105-
106-
/* This needs to reflect files inside the chosen types folder.
107-
*/
108-
sources.push('src/module.js');
109-
}
110-
111113
/* Base files */
112114
this.fs.copyTpl(
113115
this.templatePath(this.templatePath('base/') + file),
@@ -129,7 +131,8 @@ class asfAddOnGenerator extends Base {
129131
/* Type files */
130132
this.addon.files[this.addon.type].forEach((file) => {
131133
const dest = file.replace('_', '.')
132-
.replace('template.html', `${this.addon.paramName}.html`);
134+
.replace('template.html', `${this.addon.paramName}.html`)
135+
.replace('template.js', `${this.addon.paramName}.js`);
133136

134137
this.fs.copyTpl(
135138
this.templatePath(this.templatePath(`${this.addon.type}/src/`) + file),

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"repository": "json-schema-form/generator-angular-schema-form-add-on",
2323
"dependencies": {
2424
"babel-polyfill": "^6.5.0",
25+
"babel-preset-es2015": "^6.5.0",
2526
"camelcase": "^1.2.1",
2627
"chalk": "^1.1.1",
2728
"fs-promise": "^0.3.1",

0 commit comments

Comments
 (0)