-
Notifications
You must be signed in to change notification settings - Fork 1
/
file_content.go
79 lines (69 loc) · 1.62 KB
/
file_content.go
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
package main
const dispatcherFileContent string = "" +
`var Dispatcher = require('flux').Dispatcher;
module.exports = new Dispatcher();`
const appJSFileContent string = "" +
`var React = require('react');
var App = React.createClass({
render(){
return (
<div>
<h1>A Demo Page Generated By Flux Generator</h1>
<p>Start to develop your own app now !</p>
</div>
);
}
});
module.exports = App;`
const mainJSFileContent string = "" +
`var React = require('react');
var App = require('./components/App.js');
React.render(<App />, document.getElementById('container'));`
const webpackConfigFileContent string = "" +
`module.exports = {
entry: "./src/scripts/main.js",
output: {
path: "./build",
filename: "bundle.js"
},
module: {
loaders: [
{ test: /\.jsx?$/, loader: "react-hot!babel"}
]
}
};`
const indexHTMLFileContent string = "" +
`<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Index</title>
<body>
<div id="container"></div>
<script src="./bundle.js"></script>
</body>
</head>
</html>
`
func packageJSONFileContent(appName string, authorName string) string {
fileContent := "" +
`{
"name": "` + appName + `",
"version": "1.0.0",
"description": "",
"main": "./build/bundle.js",
"author": "` + authorName + `",
"license": "ISC",
"dependencies": {
"babel-core": "*",
"babel-loader": "*",
"flux": "*",
"object-assign": "*",
"react": "*",
"react-hot-loader": "*",
"webpack": "*"
}
}`
return fileContent
}