-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSfdxtension.js
34 lines (30 loc) · 1.02 KB
/
Sfdxtension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const Generator = require('yeoman-generator');
/**
* @typedef {import('@salesforce/command').SfdxCommand} SfdxCommand
*/
/**
* @typedef {object} SfdxtensionConfig
* @param {object} config oclif/sfdx runtime configs
* @param {SfdxCommand} command the sfdx command to which this extension is currently attached
* @param {string} lifecycle 'before' or 'after' which indicates when this extension is running in relation to the sfdxCommand
*/
class Sfdxtension extends Generator{
/**
* constructor
* @param {Array<string>} args yeoman args
* @param {SfdxtensionConfig} config
*/
constructor(yoArgs, sfdxContext){
super(yoArgs, sfdxContext);
// default desintationRoot to process.cwd()
this.destinationRoot(process.cwd());
// set sfdxContext
let { config, Command, lifecycle } = sfdxContext;
this.sfdxContext = {
config,
Command,
lifecycle: lifecycle ? lifecycle : 'after'
};
}
}
module.exports = Sfdxtension;