-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
3,121 additions
and
11,339 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { Readable } = require('stream'); | ||
|
||
const browserify = require('browserify'); | ||
const { minify } = require('uglify-es'); | ||
|
||
const targetDir = path.join(__dirname, '..', 'client'); | ||
|
||
// browserify accepts either a stream or a file path | ||
const glue = new Readable({ | ||
read() { | ||
console.log('read'); | ||
this.push("window.AppsEngineUIClient = require('./AppsEngineUIClient').AppsEngineUIClient;"); | ||
this.push(null); | ||
}, | ||
}); | ||
|
||
async function main() { | ||
const bundle = await new Promise((resolve, reject) => | ||
browserify(glue, { | ||
basedir: targetDir, | ||
}).bundle((err, bundle) => { | ||
if (err) return reject(err); | ||
|
||
resolve(bundle.toString()); | ||
}), | ||
); | ||
|
||
const result = minify(bundle); | ||
|
||
fs.writeFileSync(path.join(targetDir, 'AppsEngineUIClient.min.js'), result.code); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.