]>
git.proxmox.com Git - mirror_novnc.git/blob - utils/use_require_helpers.js
1 // writes helpers require for vnc.html (they should output app.js)
2 var fs
= require('fs');
3 var fse
= require('fs-extra');
4 var path
= require('path');
8 appWriter
: (base_out_path
, out_path
) => {
10 fs
.writeFile(out_path
, 'requirejs(["app/ui"], function (ui) {});', (err
) => { if (err
) throw err
; });
11 console
.log(`Please place RequireJS in ${path.join(base_out_path, 'require.js')}`);
12 return `<script src="require.js" data-main="${path.relative(base_out_path, out_path)}"></script>`;
14 noCopyOverride
: () => {},
17 optionsOverride
: (opts
) => {
18 // CommonJS supports properly shifting the default export to work as normal
19 opts
.plugins
.unshift("add-module-exports");
21 appWriter
: (base_out_path
, out_path
) => {
22 var browserify
= require('browserify');
23 var b
= browserify(path
.join(base_out_path
, 'app/ui.js'), {});
24 b
.bundle().pipe(fs
.createWriteStream(out_path
));
25 return `<script src="${path.relative(base_out_path, out_path)}"></script>`;
27 noCopyOverride
: () => {},
30 appWriter
: (base_out_path
, out_path
) => {
31 fs
.writeFile(out_path
, 'SystemJS.import("./app/ui.js");', (err
) => { if (err
) throw err
; });
32 console
.log(`Please place SystemJS in ${path.join(base_out_path, 'system-production.js')}`);
33 return `<script src="vendor/promise.js"></script>
34 <script src="system-production.js"></script>\n<script src="${path.relative(base_out_path, out_path)}"></script>`;
36 noCopyOverride
: (paths
, no_copy_files
) => {
37 no_copy_files
.delete(path
.join(paths
.vendor
, 'promise.js'));
41 optionsOverride
: (opts
) => {
42 // umd supports properly shifting the default export to work as normal
43 opts
.plugins
.unshift("add-module-exports");