Skip to content

Commit 0dfd96f

Browse files
committed
init 2
1 parent 0fa3197 commit 0dfd96f

File tree

6 files changed

+165
-163
lines changed

6 files changed

+165
-163
lines changed

.gitignore

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
node_modules
1+
2+
# Logs
3+
logs
4+
*.log
5+
6+
# Runtime data
7+
pids
8+
*.pid
9+
*.seed
10+
11+
# Directory for instrumented libs generated by jscoverage/JSCover
12+
lib-cov
13+
14+
# Coverage directory used by tools like istanbul
215
coverage
16+
17+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
18+
.grunt
19+
20+
# Compiled binary addons (http://nodejs.org/api/addons.html)
21+
build/Release
22+
23+
# Users Environment Variables
24+
.lock-wscript
25+
26+
# OS generated files #
27+
.DS_Store
28+
ehthumbs.db
29+
Icon?
30+
Thumbs.db
31+
32+
# Node Files #
33+
/node_modules/
34+
/bower_components/
35+
npm-debug.log
36+
/npm-debug.log.*

generators/app/index.js

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@ module.exports = Generator.extend({
1212
));
1313

1414
var prompts = [{
15-
type: 'input',
16-
name: 'name',
17-
message: 'What is your project name?',
18-
default: path.parse(process.cwd()).name, // Default to current folder name
19-
store: true
20-
},
21-
{
22-
type: 'input',
23-
name: 'description',
24-
message: 'Enter a short project description:',
25-
default: '',
26-
store: true
27-
},
28-
{
29-
type: 'input',
30-
name: 'version',
31-
message: 'What semver version should the project start on?',
32-
default: '0.0.0',
33-
store: true
34-
},
35-
{
36-
type: 'input',
37-
name: 'license',
38-
message: 'What license is the project distributed under?',
39-
default: 'UNLICENSED',
40-
store: true
41-
},
42-
{
43-
type: 'confirm',
44-
name: 'isprivate',
45-
message: 'Is this a private project?',
46-
default: true,
47-
store: true
48-
},
49-
{
50-
type: 'input',
51-
name: 'author',
52-
message: 'Who/what is the author of this project?',
53-
default: '',
54-
store: true
55-
},
56-
{
57-
type: 'input',
58-
name: 'username',
59-
message: 'What is your github user/organisation name?',
60-
store: true
61-
},
15+
type: 'input',
16+
name: 'name',
17+
message: 'What is your project name?',
18+
default: path.parse(process.cwd()).name, // Default to current folder name
19+
store: true
20+
},
21+
{
22+
type: 'input',
23+
name: 'description',
24+
message: 'Enter a short project description:',
25+
default: '',
26+
store: true
27+
},
28+
{
29+
type: 'input',
30+
name: 'version',
31+
message: 'What semver version should the project start on?',
32+
default: '0.0.0',
33+
store: true
34+
},
35+
{
36+
type: 'input',
37+
name: 'license',
38+
message: 'What license is the project distributed under?',
39+
default: 'UNLICENSED',
40+
store: true
41+
},
42+
{
43+
type: 'confirm',
44+
name: 'isprivate',
45+
message: 'Is this a private project?',
46+
default: true,
47+
store: true
48+
},
49+
{
50+
type: 'input',
51+
name: 'author',
52+
message: 'Who/what is the author of this project?',
53+
default: '',
54+
store: true
55+
},
56+
{
57+
type: 'input',
58+
name: 'username',
59+
message: 'What is your github user/organisation name?',
60+
store: true
61+
},
6262
// {
6363
// type: 'confirm',
6464
// name: 'cssprocessor',
@@ -81,23 +81,23 @@ module.exports = Generator.extend({
8181
// return val.toLowerCase();
8282
// }
8383
// },
84-
{
85-
type: 'confirm',
86-
name: 'jquery',
87-
message: 'Would you like to use jquery ?',
88-
default: true
89-
},
90-
{
91-
when: function (prompts) {
92-
// console.log(prompts);
84+
{
85+
type: 'confirm',
86+
name: 'jquery',
87+
message: 'Would you like to use jquery ?',
88+
default: true
89+
},
90+
{
91+
when: function (prompts) {
92+
// Console.log(prompts);
9393
prompts.bootstrap = false;
9494
return prompts.jquery;
95-
},
96-
type: 'confirm',
97-
name: 'bootstrap',
98-
message: 'Would you like to use bootstrap css 3.7 ?',
99-
default: true
100-
}
95+
},
96+
type: 'confirm',
97+
name: 'bootstrap',
98+
message: 'Would you like to use bootstrap css 3.7 ?',
99+
default: true
100+
}
101101
];
102102

103103
return this.prompt(prompts).then(function (props) {
@@ -107,8 +107,7 @@ module.exports = Generator.extend({
107107
},
108108

109109
writing: function () {
110-
111-
// console.log(this.props.cssstyle);
110+
// Console.log(this.props.cssstyle);
112111
// if (this.props.cssstyle === "less") {
113112

114113
// this.props.less = true;
@@ -117,7 +116,7 @@ module.exports = Generator.extend({
117116
// this.props.less = false;
118117
// this.props.scss = true;
119118
// }
120-
119+
121120
// copy sample file
122121
this.fs.copy(
123122
this.templatePath('_dummyfile.txt'),
@@ -184,7 +183,7 @@ module.exports = Generator.extend({
184183
this.destinationPath('webpack.config.js')
185184
);
186185

187-
//console.log(this.props);
186+
// Console.log(this.props);
188187
this.fs.copyTpl(
189188
this.templatePath('_package.json'),
190189
this.destinationPath('package.json'),
@@ -200,7 +199,7 @@ module.exports = Generator.extend({
200199
this.templatePath('./src'),
201200
this.destinationPath('./src')
202201
);
203-
// console.log(this.props);
202+
// Console.log(this.props);
204203
this.fs.copyTpl(
205204
this.templatePath('./src/app/app.module.ts'),
206205
this.destinationPath('./src/app/app.module.ts'),
@@ -213,8 +212,7 @@ module.exports = Generator.extend({
213212
this.props
214213
);
215214

216-
217-
// if (this.props.cssstyle === "less") {
215+
// If (this.props.cssstyle === "less") {
218216
// console.log("removing sccs file");
219217
// this.fs.delete(this.destinationPath('./src/*.scss'));
220218
// } else {
@@ -224,8 +222,8 @@ module.exports = Generator.extend({
224222
},
225223

226224
install: function () {
227-
// this.yarnInstall();
228-
225+
// This.yarnInstall();
226+
229227
this.installDependencies({
230228
yarn: true,
231229
npm: false,

generators/app/templates/_package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"github-deploy:prod": "webpack --config config/webpack.github-deploy.js --progress --profile --env.githubProd",
4747
"github-deploy": "npm run github-deploy:dev",
4848
"lint": "npm run tslint \"src/**/*.ts\"",
49-
//"precommit": "npm run lint",
50-
//"prepush": "npm run lint",
49+
"precommit": "npm run lint",
50+
"prepush": "npm run lint",
5151
"postinstall": "npm run webdriver:update",
5252
"postversion": "git push && git push --tags",
5353
"preclean:install": "npm run clean",

generators/component/index.js

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,17 @@ var Generator = require('yeoman-generator');
33
var chalk = require('chalk');
44
var yosay = require('yosay');
55
var path = require('path');
6-
var fs = require('fs')
6+
var fs = require('fs');
77

88
module.exports = class extends Generator {
9-
109
constructor(args, opts) {
11-
//Generator.Base.apply(this, args);
10+
// Generator.Base.apply(this, args);
1211
super(args, opts);
13-
//Generator.Base.apply(this, arguments);
14-
//console.log(args);
15-
//console.log(opts);
12+
// Generator.Base.apply(this, arguments);
13+
// console.log(args);
14+
// console.log(opts);
1615

1716
// set arguments here
18-
19-
20-
21-
2217
}
2318

2419
initializing() {
@@ -45,18 +40,13 @@ module.exports = class extends Generator {
4540
}.bind(this));
4641
}
4742

48-
49-
5043
writing() {
51-
52-
//console.log(this.props);
53-
44+
// Console.log(this.props);
5445

5546
this.props.customobject = {};
5647
this.props.customobject.componentname = this.props.componentname.replace(/component-/g, '');
5748
this.props.customobject.componentname = this.props.customobject.componentname.toLowerCase();
58-
//this.props.customobject.componentname = this.props.customobject.componentname.charAt(0).toUpperCase() + this.props.customobject.componentname.slice(1).toLowerCase();
59-
49+
// This.props.customobject.componentname = this.props.customobject.componentname.charAt(0).toUpperCase() + this.props.customobject.componentname.slice(1).toLowerCase();
6050

6151
this.fs.copyTpl(
6252
this.templatePath('_index.ts'),
@@ -106,38 +96,29 @@ module.exports = class extends Generator {
10696
this.props.customobject
10797
);
10898

99+
var someFile = './src/app/app.module.ts';
109100

110-
var someFile = "./src/app/app.module.ts";
111-
112-
var replacement_1 = "CMP-level component from generator\n";
113-
replacement_1 = replacement_1 + "import { " + this.props.customobject.componentname + "Component } from './components/" + this.props.customobject.componentname + "';"
101+
var replacement_1 = 'CMP-level component from generator\n';
102+
replacement_1 = replacement_1 + 'import { ' + this.props.customobject.componentname + 'Component } from \'./components/' + this.props.customobject.componentname + '\';';
114103

115-
var replacement_2 = "CMP-level component_declaration from generator\n\t\t";
116-
replacement_2 = replacement_2 + this.props.customobject.componentname + "Component,"
104+
var replacement_2 = 'CMP-level component_declaration from generator\n\t\t';
105+
replacement_2 = replacement_2 + this.props.customobject.componentname + 'Component,';
117106

118107
fs.readFile(someFile, 'utf8', function (err, data) {
119108
if (err) {
120109
return console.log(err);
121110
}
122-
//console.log(data);
111+
// Console.log(data);
123112
var result_1 = data.replace(/CMP-level component from generator/g, replacement_1);
124113

125-
126114
var result_2 = result_1.replace(/CMP-level component_declaration from generator/g, replacement_2);
127115

128-
//console.log(result);
116+
// Console.log(result);
129117
fs.writeFile(someFile, result_2, 'utf8', function (err) {
130-
if (err) return console.log(err);
118+
if (err) {
119+
return console.log(err);
120+
}
131121
});
132122
});
133-
134-
135-
136-
137-
138-
139-
140123
}
141-
142-
143-
}
124+
};

0 commit comments

Comments
 (0)