-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.js
103 lines (92 loc) · 4.06 KB
/
template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
'use strict';
// Basic template description.
exports.description = 'Initialize a Webpack project template.';
// Template-specific notes to be displayed after question prompts.
exports.after = 'You should now install build dependencies with _npm ' +
'install_. After that, you may execute project tasks with _npm run build|build-dev|watch_ and ' +
'install javascript packages with _bower install_ (must be initialized first via _bower init_). For ' +
'more information about installing and configuring Webpack, please see ' +
'the Getting Started guide:' +
'\n\n' +
'http://webpack.github.io/docs/tutorials/getting-started/';
// Any existing file or directory matching this wildcard will cause a warning.
exports.warnOn = '*';
// The actual init template.
exports.template = function(grunt, init, done) {
init.process({
type: 'project'
}, [
// Prompt for these values.
init.prompt('name'),
init.prompt('title'),
init.prompt('author_name'),
init.prompt('repository', function (value, data, done) {
done(null, '[email protected]:ibarsi/' + data.name);
}),
init.prompt('homepage')
], function(err, props) {
props.version = '0.1.0';
// Files to copy (and process).
var files = init.filesToCopy(props);
// Actually copy (and process) files.
init.copyAndProcess(files, props, { noProcess: 'libs/**' });
// NOTE: Must be matched up manually with package.json in /root (it gets overwritten).
props["pre-commit"] = [
"precommit-msg",
"test",
"lint"
];
// NOTE: Must be matched up manually with package.json in /root (it gets overwritten).
props.scripts = {
"precommit-msg": "echo 'Pre-commit checks...' && exit 0",
"lint": "eslint ./ --cache",
"test": "NODE_ENV=test nyc mocha --colors --reporter spec --compilers js:babel-register --require ignore-styles static/src/**/*.test.js",
"build": "npm test && flow && npm run build:dev && npm run build:prod",
"build:dev": "webpack --config webpack-dev.config.js --progress --colors",
"build:prod": "webpack --config webpack-prod.config.js --progress --colors -p",
"watch": "npm run watch:dev | npm run watch:prod",
"watch:dev": "npm run build:dev -- --watch",
"watch:prod": "npm run build:prod -- --watch"
};
// NOTE: Must be matched up manually with package.json in /root (it gets overwritten).
props.devDependencies = {
"babel-core": "^6.14.0",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.5",
"babel-plugin-transform-flow-strip-types": "^6.14.0",
"babel-plugin-transform-require-ignore": "0.0.2",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.14.0",
"babel-register": "^6.18.0",
"bower": "^1.7.9",
"chai": "^3.5.0",
"css-loader": "^0.25.0",
"eslint": "^3.12.2",
"eslint-loader": "^1.5.0",
"eslint-plugin-compat": "^0.1.3",
"eslint-plugin-flowtype": "^2.19.0",
"eslint-plugin-react": "^6.5.0",
"extract-loader": "^0.1.0",
"extract-text-webpack-plugin": "^2.0.0-beta.5",
"flow-bin": "^0.32.0",
"flow-status-webpack-plugin": "^0.1.7",
"html-loader": "^0.4.4",
"ignore-styles": "^5.0.1",
"image-webpack-loader": "^3.1.0",
"mocha": "^3.1.2",
"nyc": "^8.4.0",
"postcss-assets": "^4.1.0",
"postcss-cssnext": "^2.8.0",
"postcss-import": "8.1.0",
"postcss-loader": "^0.13.0",
"strip-loader": "^0.1.2",
"style-loader": "^0.13.1",
"webpack": "^2.2.0",
"webpack-merge": "^0.14.1"
};
// Generate package.json file, used by npm and grunt.
init.writePackageJSON('package.json', props);
// All done!
done();
});
};