forked from nebrelbug/npm-to-yarn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
200 lines (177 loc) · 4.61 KB
/
test.html
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
<!--Based on @olado's excellent tester from doT.js-->
<!--Modified by Ben Gubler-->
<!--NOTE: You have to serve this file if you want to see the sourcemaps. NPM Package 'serve' works-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
/>
<meta name="description" content="Test out Squirrelly code in the browser here" />
<script src="./dist/npm-to-yarn.umd.js"></script>
<style>
body {
background-color: #f4f4f4;
color: #555;
max-width: 800px;
padding: 20px;
font-size: 16px;
font-weight: 200;
margin: 0 auto;
font-family: Helvetica Neue, arial, verdana;
}
h2 {
text-shadow: 0 1px 2px #fff;
margin: 0;
}
h2 span {
font-weight: 200;
font-size: 14px;
}
a {
color: #2b80ff;
}
.smaller {
font-size: 0.8em;
}
h4 {
margin: 4px 0;
font-weight: 400;
font-size: 20px;
}
textarea {
border: 1px solid lightgrey;
outline: none;
font-size: 14px;
width: 96%;
height: 210px;
padding: 10px;
text-align: left;
resize: vertical;
}
.templategroup,
.datagroup,
.functiongroup,
.resultgroup {
width: 48%;
margin: 4px 2% 4px 0;
float: left;
min-width: 300px;
}
#function,
#result {
background: #ddd;
height: 212px;
padding: 10px;
font-size: 14px;
overflow-y: auto;
}
#result {
white-space: pre;
}
.definegroup {
display: none;
}
.templategroup.withdefs .definegroup {
display: block;
}
.templategroup.withdefs #template {
height: 90px;
}
textarea.defines {
height: 60px;
}
.stripgroup {
padding-top: 8px;
width: 160px;
float: left;
}
#sampletabs {
list-style: none;
margin: 0;
padding: 0;
}
#sampletabs li {
float: left;
margin: 4px;
padding: 4px 8px;
background: #ddd;
cursor: pointer;
}
#sampletabs li.active {
background: #2b80ff;
color: #fff;
}
@media all and (max-width: 740px) {
.templategroup,
.datagroup,
.functiongroup,
.resultgroup {
width: 100%;
margin-right: 0;
}
pre {
overflow-x: scroll;
}
}
</style>
<title>NPM-to-Yarn Playground</title>
</head>
<body>
<h2>
Playground
<span
>Based on the excellent
<a href="http://olado.github.io/doT/index.html">DoT.js</a> website</span
>
</h2>
<div id="samples">
<div style="clear: both; height: 10px"></div>
<div class="templategroup">
<h4>NPM</h4>
<textarea autocomplete="off" id="npm-text">
npm install squirrelly --global
npm install squirrelly --save-dev
</textarea
>
</div>
<div class="resultgroup">
<h4>Yarn</h4>
<textarea autocomplete="off" id="yarn-text"> </textarea>
</div>
<div class="resultgroup">
<h4>PNPM</h4>
<textarea readonly autocomplete="off" id="pnpm-text"> </textarea>
</div>
<div class="resultgroup">
<h4>Bun</h4>
<textarea readonly autocomplete="off" id="bun-text"> </textarea>
</div>
</div>
<script>
/* global Sqrl */
window.onload = function () {
function npmToYarn () {
console.clear()
var npmText = document.getElementById('npm-text').value
document.getElementById('yarn-text').value = n2y(npmText, 'yarn')
document.getElementById('pnpm-text').value = n2y(npmText, 'pnpm')
document.getElementById('bun-text').value = n2y(npmText, 'bun')
}
function yarnToNpm () {
console.clear()
var yarnText = document.getElementById('yarn-text').value
var npmText = n2y(yarnText, 'npm')
document.getElementById('npm-text').value = npmText
document.getElementById('pnpm-text').value = n2y(npmText, 'pnpm')
document.getElementById('bun-text').value = n2y(npmText, 'bun')
}
npmToYarn()
document.getElementById('npm-text').addEventListener('input', npmToYarn)
document.getElementById('yarn-text').addEventListener('input', yarnToNpm)
}
</script>
</body>
</html>