-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working on Filesystem API integration
- Loading branch information
1 parent
c107b30
commit a28e57f
Showing
15 changed files
with
1,109 additions
and
572 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,11 +1,27 @@ | ||
// create all required dist files | ||
const fs = require('fs') | ||
const execSync = require('child_process').execSync | ||
|
||
let esbuildCmd = __dirname + '/../node_modules/.bin/esbuild' | ||
if (fs.existsSync(esbuildCmd + '.cmd')) esbuildCmd += '.cmd' | ||
|
||
const packageJson = require('../package.json') | ||
const srcFile = __dirname + '/../docs/scripts/browstorjs.js' | ||
let contents = fs.readFileSync(srcFile).toString() | ||
const workerFile = __dirname + '/../src/browstorjs-filesystem-worker.js' | ||
const tmpFile = __dirname + '/tmp.js' | ||
const distFile = __dirname + '/../docs/scripts/browstorjs.js' | ||
const minFile = __dirname + '/../docs/scripts/browstorjs.min.js' | ||
|
||
execSync(esbuildCmd + ' ' + workerFile + ' --minify --outfile=' + tmpFile) | ||
|
||
let contents = fs.readFileSync(distFile).toString() | ||
contents = contents.replace('source:browstorjs-filesystem-worker.js', fs.readFileSync(tmpFile).toString().trim().replace("`", "\`")) | ||
fs.unlinkSync(tmpFile) | ||
|
||
contents = '// BrowstorJS v' + packageJson.version + ' @ ' + packageJson.homepage + '\n' + contents | ||
contents = contents.replace(/export default class BrowstorJS/, 'class BrowstorJS') | ||
fs.writeFileSync(srcFile, contents) | ||
fs.writeFileSync(distFile, contents) | ||
|
||
execSync(esbuildCmd + ' ' + distFile + ' --minify --outfile=' + minFile) | ||
|
||
fs.copyFileSync(__dirname + '/../docs/scripts/browstorjs.js', __dirname + '/../dist/browstorjs.js') | ||
fs.copyFileSync(distFile, __dirname + '/../dist/browstorjs.js') | ||
fs.copyFileSync(minFile, __dirname + '/../dist/browstorjs.min.js') |
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.