-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugins): Updates plugin generator and adds integration test (#1421…
… by @jamonholmgren) Fixes #1418.
- Loading branch information
1 parent
ed79e4c
commit 6c937e1
Showing
19 changed files
with
156 additions
and
131 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
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
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,5 @@ | ||
const test = require('ava') | ||
|
||
test('sample test', async t => { | ||
t.true(true) | ||
}) |
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,28 +1,37 @@ | ||
// @cliDescription Example <%= props.name %> command | ||
// Generates a "thing" (rename this to whatever -- component, model, anything). | ||
/** | ||
* This is an example Ignite plugin generator. You can run it when it's installed to | ||
* your project by doing `ignite generate <%= props.name %> foo`. | ||
* | ||
* You can rename this command to anything you'd like, or add others. | ||
* | ||
* For more information on plugins, check out https://github.com/infinitered/gluegun/blob/master/docs/plugins.md. | ||
*/ | ||
|
||
module.exports = async function (context) { | ||
// Learn more about context: https://infinitered.github.io/gluegun/#/context-api.md | ||
const { parameters, strings, print, ignite } = context | ||
const { pascalCase, isBlank } = strings | ||
module.exports = { | ||
description: "Example <%= props.name %> generator", | ||
run: async function (toolbox) { | ||
// Learn more about toolbox: https://infinitered.github.io/gluegun/#/toolbox-api.md | ||
const { parameters, strings, print, ignite } = toolbox | ||
const { pascalCase, isBlank } = strings | ||
|
||
// validation | ||
if (isBlank(parameters.first)) { | ||
print.info(`ignite generate thing <name>\n`) | ||
print.info('A name is required.') | ||
return | ||
} | ||
// validation | ||
if (isBlank(parameters.first)) { | ||
print.info(`ignite generate <%= props.name %> <name>\n`) | ||
print.info('A name is required.') | ||
return | ||
} | ||
|
||
const name = pascalCase(parameters.first) | ||
const props = { name } | ||
const name = pascalCase(parameters.first) | ||
const props = { name } | ||
|
||
// Copies the `thing.js.ejs` in your plugin's templates folder | ||
// into App/Things/${name}.js. | ||
const jobs = [{ | ||
template: 'thing.js.ejs', | ||
target: `App/Things/${name}.js` | ||
}] | ||
// Copies the `<%= props.name %>.js.ejs` in your plugin's templates folder | ||
// into App/Things/${name}.js. | ||
const jobs = [{ | ||
template: '<%= props.name %>.js.ejs', | ||
target: `app/${name}.js` | ||
}] | ||
|
||
// make the templates and pass in props with the third argument here | ||
await ignite.copyBatch(context, jobs, props) | ||
} | ||
// make the templates and pass in props with the third argument here | ||
await ignite.copyBatch(toolbox, jobs, props) | ||
} | ||
} |
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,3 +1,4 @@ | ||
node_modules | ||
npm-debug.log | ||
generated | ||
.vscode |
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 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
Oops, something went wrong.