-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: configure build for windows (#77)
- Loading branch information
Showing
5 changed files
with
86 additions
and
27 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,7 @@ | ||
const { copy } = require('fs-extra'); | ||
|
||
const postBuildCopyFiles = async () => { | ||
await copy('./README.md', './dist/README.md'); | ||
}; | ||
|
||
postBuildCopyFiles(); |
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,44 @@ | ||
const { Command, flags } = require('@oclif/command'); | ||
const logSymbols = require('log-symbols'); | ||
const { remove } = require('fs-extra'); | ||
|
||
class GenerateCommand extends Command { | ||
async safeInvokeHook(hook) { | ||
if (hook !== undefined) { | ||
if (typeof hook === 'function') { | ||
this.log(`start executing ${hook.name}`); | ||
await hook(); | ||
this.log(`finish executing ${hook.name}`); | ||
} else { | ||
this.error(`${hook.name} should be function!`); | ||
} | ||
} | ||
} | ||
|
||
async run() { | ||
const hrstart = process.hrtime(); | ||
const { flags } = this.parse(GenerateCommand); | ||
|
||
try { | ||
await remove(flags.path); | ||
} catch (err) { | ||
this.error(err); | ||
} | ||
|
||
const hrend = process.hrtime(hrstart); | ||
|
||
this.log(logSymbols.success, `${flags.path} is removed!🗑️`); | ||
this.log(`Execution time: ${hrend[0]}s`); | ||
} | ||
} | ||
|
||
GenerateCommand.flags = { | ||
path: flags.string({ | ||
description: 'The path to a build config file.', | ||
default: undefined, | ||
}), | ||
}; | ||
|
||
GenerateCommand.description = 'removing file...'; | ||
|
||
GenerateCommand.run(); |
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