-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.py
61 lines (51 loc) · 1.57 KB
/
template.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
import shutil
from pathlib import Path
from youwol.pipelines.pipeline_typescript_weback_npm import Template, PackageType, Dependencies, \
RunTimeDeps, generate_template, DevServer, Bundles, MainModule
from youwol.utils import parse_json
folder_path = Path(__file__).parent
pkg_json = parse_json(folder_path / 'package.json')
load_dependencies = {
'@youwol/os-core': '^0.1.12',
'@youwol/os-asset': '^0.1.3',
'@youwol/os-explorer': '^0.1.4',
'@youwol/os-top-banner': '^0.1.2',
'@youwol/cdn-client': '^2.1.0',
'@youwol/flux-view': '^1.0.3',
'rxjs': '^6.5.5',
}
template = Template(
path=folder_path,
type=PackageType.APPLICATION,
name=pkg_json['name'],
version=pkg_json['version'],
shortDescription=pkg_json['description'],
author=pkg_json['author'],
dependencies=Dependencies(
runTime=RunTimeDeps(
externals=load_dependencies
),
devTime={}
),
userGuide=True,
bundles=Bundles(
mainModule=MainModule(
entryFile='./index.ts',
loadDependencies=list(load_dependencies.keys())
)
),
devServer=DevServer(
port=3008
)
)
generate_template(template)
shutil.copyfile(
src=folder_path / '.template' / 'src' / 'auto-generated.ts',
dst=folder_path / 'src' / 'auto-generated.ts'
)
for file in ['README.md', '.gitignore', '.npmignore', '.prettierignore', 'LICENSE', 'package.json',
'tsconfig.json', 'webpack.config.ts']:
shutil.copyfile(
src=folder_path / '.template' / file,
dst=folder_path / file
)