-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): Generator support async (#3897)
- Loading branch information
1 parent
42ecd08
commit 74f629e
Showing
7 changed files
with
97 additions
and
21 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
17 changes: 17 additions & 0 deletions
17
packages/@vue/cli/__tests__/mock-preset-with-async-generator/generator/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const sleep = n => new Promise(resolve => setTimeout(resolve, n)) | ||
|
||
module.exports = async (api, options) => { | ||
api.render('./template', options) | ||
|
||
// add asynchronous code test | ||
await sleep(1000) | ||
|
||
api.extendPackage({ | ||
scripts: { | ||
testasync: 'this is the test' | ||
}, | ||
devDependencies: { | ||
'vue-cli-plugin-async-generator': 'v0.0.1' | ||
} | ||
}) | ||
} |
1 change: 1 addition & 0 deletions
1
packages/@vue/cli/__tests__/mock-preset-with-async-generator/generator/template/test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= ok %> |
5 changes: 5 additions & 0 deletions
5
packages/@vue/cli/__tests__/mock-preset-with-async-generator/preset.json
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,5 @@ | ||
{ | ||
"plugins": { | ||
"@vue/cli-plugin-babel": {} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/@vue/cli/__tests__/mock-preset-with-async-generator/prompts.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = [{ | ||
type: 'confirm', | ||
name: 'ok', | ||
message: 'Are you ok?' | ||
}] |
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