-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate a manifest, set PUBLIC_URL, and output a compliant zip (…
…#36) * feat: generate a manifest, set PUBLIC_URL, and output a compliant zip * chore: remove unnecessary duplicate directory removal * chore: remove test command * chore: remove superfluous comments * chore: update local deps in yarn.lock * chore: remove superfluous manifest, fix author parsing
- Loading branch information
Showing
12 changed files
with
634 additions
and
73 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require('fs-extra') | ||
const chalk = require('chalk') | ||
const path = require('path') | ||
const archiver = require('archiver') | ||
const { reporter } = require('@dhis2/cli-helpers-engine') | ||
|
||
module.exports = (inDir, outFile) => { | ||
return new Promise((resolve, reject) => { | ||
fs.ensureDirSync(path.dirname(outFile)) | ||
const output = fs.createWriteStream(outFile) | ||
|
||
const archive = archiver('zip', { | ||
zlib: { level: 9 }, | ||
}) | ||
|
||
output.on('close', function() { | ||
reporter.print(chalk.dim(`Total size: ${archive.pointer()} bytes`)) | ||
resolve() | ||
}) | ||
|
||
archive.on('warning', function(err) { | ||
if (err.code === 'ENOENT') { | ||
reporter.warn('[bundler]', err) | ||
} else { | ||
reject(err) | ||
} | ||
}) | ||
|
||
archive.on('error', function(err) { | ||
reject(err) | ||
}) | ||
|
||
archive.pipe(output) | ||
archive.directory(inDir, false) | ||
archive.finalize() | ||
}) | ||
} |
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,36 @@ | ||
const { reporter } = require('@dhis2/cli-helpers-engine') | ||
const fs = require('fs-extra') | ||
|
||
module.exports = (paths, config, publicUrl) => { | ||
const manifest = { | ||
appType: 'APP', | ||
short_name: config.name, | ||
name: config.title, | ||
description: config.description, | ||
version: config.version, | ||
launch_path: 'index.html', | ||
default_locale: 'en', | ||
activities: { | ||
dhis: { | ||
href: '*', | ||
}, | ||
}, | ||
icons: { | ||
'48': 'favicon-48x48.png', | ||
}, | ||
developer: config.author, | ||
|
||
manifest_generated_at: String(new Date()), | ||
|
||
display: 'standalone', | ||
theme_color: '#ffffff', | ||
background_color: '#ffffff', | ||
display: 'standalone', | ||
|
||
scope: publicUrl, | ||
} | ||
|
||
reporter.debug('Generated manifest', manifest) | ||
|
||
fs.writeJsonSync(paths.buildAppManifest, manifest, { spaces: 2 }) | ||
} |
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
Oops, something went wrong.