This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(commands): Update to Gluegun 2-style commands
BREAKING CHANGE: Updates to Gluegun 2-style commands which are only supported by Ignite CLI 3.0+
- Loading branch information
Showing
3 changed files
with
73 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
// @cliDescription Generates a map callout component. | ||
// @cliExample ignite generate map-callout StoreCallout | ||
// Generates a map callout component that can be inserted into any map. | ||
// ---------------------------------------------------------------------------- | ||
module.exports = async function (context) { | ||
const { parameters, strings, print, ignite } = context | ||
const { pascalCase, isBlank } = strings | ||
module.exports = { | ||
description: 'Generates a map callout component.', | ||
run: async function (context) { | ||
const { parameters, strings, print, ignite } = context | ||
const { pascalCase, isBlank } = strings | ||
|
||
// validation | ||
if (isBlank(parameters.first)) { | ||
print.info(`ignite generate map-callout <name>\n`) | ||
print.info('A name is required.') | ||
return | ||
} | ||
// validation | ||
if (isBlank(parameters.first)) { | ||
print.info(`ignite generate map-callout <name>\n`) | ||
print.info('A name is required.') | ||
return | ||
} | ||
|
||
const name = pascalCase(parameters.first) | ||
const name = pascalCase(parameters.first) | ||
|
||
// Copies the callout template | ||
// into App/Components/${name}.js. | ||
const copyJobs = [{ | ||
template: 'map-callout-component.js.ejs', | ||
target: `App/Components/${name}.js` | ||
}, { | ||
template: 'map-callout-styles.js.ejs', | ||
target: `App/Components/Styles/${name}Styles.js` | ||
}] | ||
// Copies the callout template | ||
// into App/Components/${name}.js. | ||
const copyJobs = [{ | ||
template: 'map-callout-component.js.ejs', | ||
target: `App/Components/${name}.js` | ||
}, { | ||
template: 'map-callout-styles.js.ejs', | ||
target: `App/Components/Styles/${name}Styles.js` | ||
}] | ||
|
||
// make the templates and pass in props with the third argument here | ||
await ignite.copyBatch(context, copyJobs, { calloutName: name }) | ||
} | ||
// make the templates and pass in props with the third argument here | ||
await ignite.copyBatch(context, copyJobs, { calloutName: name }) | ||
} | ||
} |
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,20 +1,19 @@ | ||
// @cliDescription Generates map utility functions. | ||
// @cliExample ignite generate map-utilities | ||
// Generates a map utilities file in App/Lib | ||
// ---------------------------------------------------------------------------- | ||
module.exports = async function (context) { | ||
const { ignite } = context | ||
module.exports = { | ||
description: 'Generates map utility functions.', | ||
run: async function (context) { | ||
const { ignite } = context | ||
|
||
// TODO: Detect if Ramda is not installed and error | ||
// or install for them? | ||
// TODO: Detect if Ramda is not installed and error | ||
// or install for them? | ||
|
||
// Copies the `MapHelpers.js.ejs` in the templates folder | ||
// into App/Lib/MapHelpers.js. | ||
const copyJobs = [{ | ||
template: 'MapHelpers.js.ejs', | ||
target: `App/Lib/MapHelpers.js` | ||
}] | ||
// Copies the `MapHelpers.js.ejs` in the templates folder | ||
// into App/Lib/MapHelpers.js. | ||
const copyJobs = [{ | ||
template: 'MapHelpers.js.ejs', | ||
target: `App/Lib/MapHelpers.js` | ||
}] | ||
|
||
// make the templates and pass in props with the third argument here | ||
await ignite.copyBatch(context, copyJobs, {}) | ||
} | ||
// make the templates and pass in props with the third argument here | ||
await ignite.copyBatch(context, copyJobs, {}) | ||
} | ||
} |
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,37 +1,36 @@ | ||
// @cliDescription Generates a map component. | ||
// @cliExample ignite generate map StoreLocator | ||
// Generates a map component that can be inserted into any screen. | ||
// ---------------------------------------------------------------------------- | ||
module.exports = async function (context) { | ||
const { parameters, strings, print, ignite } = context | ||
const { pascalCase, isBlank } = strings | ||
module.exports = { | ||
description: 'Generates a map component.', | ||
run: async function (context) { | ||
const { parameters, strings, print, ignite } = context | ||
const { pascalCase, isBlank } = strings | ||
|
||
// validation | ||
if (isBlank(parameters.first)) { | ||
print.info(`ignite generate map <name>\n`) | ||
print.info('A name is required.') | ||
return | ||
} | ||
// validation | ||
if (isBlank(parameters.first)) { | ||
print.info(`ignite generate map <name>\n`) | ||
print.info('A name is required.') | ||
return | ||
} | ||
|
||
const name = pascalCase(parameters.first) | ||
const calloutName = `${name}Callout` | ||
const name = pascalCase(parameters.first) | ||
const calloutName = `${name}Callout` | ||
|
||
// Copies the `map.js.ejs` in the templates folder | ||
// into App/Components/${name}.js. | ||
const copyJobs = [{ | ||
template: 'map-component.js.ejs', | ||
target: `App/Components/${name}.js` | ||
}, { | ||
template: 'map-styles.js.ejs', | ||
target: `App/Components/Styles/${name}Styles.js` | ||
}, { | ||
template: 'map-callout-component.js.ejs', | ||
target: `App/Components/${calloutName}.js` | ||
}, { | ||
template: 'map-callout-styles.js.ejs', | ||
target: `App/Components/Styles/${calloutName}Styles.js` | ||
}] | ||
// Copies the `map.js.ejs` in the templates folder | ||
// into App/Components/${name}.js. | ||
const copyJobs = [{ | ||
template: 'map-component.js.ejs', | ||
target: `App/Components/${name}.js` | ||
}, { | ||
template: 'map-styles.js.ejs', | ||
target: `App/Components/Styles/${name}Styles.js` | ||
}, { | ||
template: 'map-callout-component.js.ejs', | ||
target: `App/Components/${calloutName}.js` | ||
}, { | ||
template: 'map-callout-styles.js.ejs', | ||
target: `App/Components/Styles/${calloutName}Styles.js` | ||
}] | ||
|
||
// make the templates and pass in props with the third argument here | ||
await ignite.copyBatch(context, copyJobs, { name: name, calloutName: calloutName }) | ||
} | ||
// make the templates and pass in props with the third argument here | ||
await ignite.copyBatch(context, copyJobs, { name: name, calloutName: calloutName }) | ||
} | ||
} |