-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkproj_types.py
281 lines (266 loc) · 9.06 KB
/
mkproj_types.py
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
import textwrap
types = {
'html5': {
'files': {
'index.html': {
"contents": textwrap.dedent("""\
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel='stylesheet' href='style.css'>
</head>
<body>
</body>
</html>
""")
},
"style.css": {
"contents": ""
},
},
},
'webapp': {
'files': {
'index.html': {
"contents": textwrap.dedent("""\
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel='stylesheet' href='style.css'>
</head>
<body>
<script defer src='main.js'></script>
</body>
</html>
"""),
},
"style.css": {
"contents": ""
},
"main.js": {
"contents": ""
}
}
},
'py': {
'files': {
"main.py": {
"contents": textwrap.dedent("""\
if __name__ == "__main__":
pass
"""),
"shebang": "#!/usr/bin/env python3"
},
}
},
'c': {
'files': {
"main.c": {
"contents": textwrap.dedent("""\
#include <stdio.h>
#include <stdlib.h>
int main() {
return 0;
}
""")
},
"Makefile": {
"contents": textwrap.dedent("""\
# filename of the file containing main()
NAME = main
# C compiler
CC ?= gcc
# Compiler flags we want to use
CFLAGS = -Wall -Wextra -Wunreachable-code -g -ggdb
# DEPENDS = dep.o # dependency name, uncomment to use (object files only)
# DEPEND_HEADER_FILES = dep.h # header files for dependency building, uncomment to use
OUTPUT_FILE = a.out # Filename of the final, compiled executable
default: $(NAME)
$(NAME): $(NAME).o # $(DEPENDS)
$(CC) -o $(OUTPUT_FILE) $(CFLAGS) $(NAME).o
$(NAME).o: $(NAME).c # $(DEPEND_HEADER_FILES)
$(CC) -c $(NAME).c
# Add each dependency like this:
# dep.o: dep.h dep.c
# $(CC) $(CFLAGS) -c dep.c
run: $(NAME)
./$(OUTPUT_FILE)
""")
}
}
},
'node': {
'commands': [['npm', 'init']]
},
'ts_node': {
'commands': [['npm', 'init'], ['npm', 'install', 'tsc']],
"files": {
".gitignore": {
"contents": textwrap.dedent("""\
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
node_modules
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
pids
*.pid
*.seed
*.pid.lock
node_modules/
*.npm
*.tsbuildinfo
*.tgz
.env
.env.test
.env.production
""")
}
}
},
'ts_web': {
'commands': [['npm', 'install', '--save-dev', 'tsc', 'esbuild']],
'files': {
'index.html': {
"contents": textwrap.dedent("""\
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel='stylesheet' href='style.css'>
</head>
<body>
<script defer src='dist/main.js'></script>
</body>
</html>
"""),
},
"style.css": {
"contents": ""
},
"src/main.ts": {
"contents": ""
},
"tsconfig.json": {
"contents": textwrap.dedent("""\
{
"compilerOptions": {
"outDir": "./dist",
"allowJs": true,
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"lib": ["ES2020", "DOM"],
"module":"ES6",
"moduleResolution": "node",
},
"include": [
"./src/**/*"
]
}
""")
},
'esbuild.config.js': {
'contents': textwrap.dedent("""\
require('esbuild').build({
entryPoints: ['src/main.ts'],
bundle: true,
minify: true,
outfile: 'dist/main.js'
}).catch((err) => {
console.error(err)
process.exit(1)
})
""")
},
"dist/": {},
'.gitignore': {
'contents': textwrap.dedent("""\
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
node_modules
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
pids
*.pid
*.seed
*.pid.lock
node_modules/
*.npm
*.tsbuildinfo
*.tgz
.env
.env.test
.env.production
""")
}
},
'message': 'Run `node esbuild.config.js` to develop.'
},
'deno': {
'files': {
'main.ts': {
'contents': ''
},
'Makefile': {
'contents': textwrap.dedent("""\
MAKE_OPTIONS = --unstable
PERMS = --allow-env --allow-read --allow-write # Deno permissions
ENTRYPOINT = main.ts
DENO_NAME ?= mkproj_deno_app # install with DENO_NAME=foo to install under a different name
# set DENO_MAKE_EXTRA_OPTIONS in environment to supply extra build options.
OPTIONS = $(MAKE_OPTIONS) $(DENO_MAKE_EXTRA_OPTIONS)
default: compile
dev:
deno run $(PERMS) $(OPTIONS) --watch $(ENTRYPOINT) $(DENO_RUN_OPTIONS)
bundle:
deno bundle $(OPTIONS) $(ENTRYPOINT) $(DENO_NAME)
compile:
deno compile --output $(DENO_NAME) $(PERMS) $(OPTIONS) $(ENTRYPOINT)
install:
deno install $(PERMS) $(OPTIONS) -n $(DENO_NAME)
run:
deno run $(PERMS) $(OPTIONS) $(ENTRYPOINT) $(DENO_RUN_OPTIONS)
""")
}
}
},
'rs': {
'commands': [['cargo', 'init', '--vcs', 'none']],
"files": {
".gitignore": {
"contents": textwrap.dedent("""\
target/
""")
}
}
},
'rs_lib': {
'commands': [['cargo', 'init', '--lib', '--vcs', 'none']],
"files": {
".gitignore": {
"contents": textwrap.dedent("""\
target/
""")
}
}
}
}