Skip to content

Commit

Permalink
bugfixes, updated (simplified) project templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshikinoko committed Jan 7, 2019
1 parent da9c9b0 commit 7a1bc35
Show file tree
Hide file tree
Showing 40 changed files with 8,179 additions and 8,227 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Expand Down
196 changes: 96 additions & 100 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,113 +27,109 @@ const plain = `Plugin with dialog by plain javascript`;
const react = `Plugin with dialog by React`;

module.exports = class extends Generator {
_copyAllFiles(params, templateDir) {
this.fs.copyTpl(
this.templatePath(path.join(templateDir, './**')),
this.destinationPath(this.destinationRoot()),
params,
undefined,
{ globOptions: { dot: true } }
);
}
_copyAllFiles(params, templateDir) {
this.fs.copyTpl(
this.templatePath(path.join(templateDir, './**')),
this.destinationPath(this.destinationRoot()),
params,
undefined,
{ globOptions: { dot: true } }
);
}

prompting() {
// Have Yeoman greet the user.
this.log(
yosay(
`Welcome to the ${chalk.rgb(235, 38, 190).bold('XD')} plugin generator!`
)
);
prompting() {
// Have Yeoman greet the user.
this.log(
yosay(`Welcome to the ${chalk.rgb(235, 38, 190).bold('XD')} plugin generator!`)
);

const prompts = [
{
type: 'input',
name: 'name',
message: 'What is Your XD plugin name?',
default: 'My Adobe XD Plug-in'
},
{
type: 'list',
name: 'scriptType',
message: 'Choose type of the plugin:',
choices: [react, plain, noui],
default: react
}
];
const prompts = [
{
type: 'input',
name: 'name',
message: 'What is Your XD plugin name?',
default: 'My Adobe XD Plug-in'
},
{
type: 'list',
name: 'scriptType',
message: 'Choose type of the plugin:',
choices: [react, plain, noui],
default: react
}
];

return this.prompt(prompts).then(props => {
// To access props later use this.props.someAnswer;
this.props = props;
});
}
return this.prompt(prompts).then(props => {
// To access props later use this.props.someAnswer;
this.props = props;
});
}

writing() {
let projectPath = this.props.name;
this.destinationRoot(projectPath);
writing() {
let projectPath = this.props.name;
this.destinationRoot(projectPath);

const params = {
name: this.props.name,
id: uuid().substr(0, 8),
packageName: _.snakeCase(this.props.name)
};
const params = {
name: this.props.name,
id: uuid().substr(0, 8),
packageName: _.snakeCase(this.props.name)
};

switch (this.props.scriptType) {
case noui:
this._copyAllFiles(params, 'no-dialog');
break;
case plain:
this._copyAllFiles(params, 'dialog-plain-js');
break;
case react:
this._copyAllFiles(params, 'dialog-react');
break;
default:
break;
}
switch (this.props.scriptType) {
case noui:
this._copyAllFiles(params, 'no-dialog');
break;
case plain:
this._copyAllFiles(params, 'dialog-plain-js-simple');
break;
case react:
this._copyAllFiles(params, 'dialog-react-simple');
break;
default:
break;
}
}

install() {
this.installDependencies({
npm: true,
bower: false,
yarn: false
});
}
install() {
this.installDependencies({
npm: true,
bower: false,
yarn: false
});
}

end() {
let name = this.props.name;
this.log(
`-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-`
);
this.log(``);
this.log(` Congratulations! Your plugin has been created! and next steps are`);
this.log(``);
this.log(
` 1. Visit ${chalk.underline(
'https://console.adobe.io/plugins'
)} and get a new plugin ID.`
);
this.log(` 2. Open static/manifest.json and paste your new plugin ID.`);
this.log(
` 3. Install your plugin to Adobe XD via ${chalk.inverse('npm start')}.`
);
this.log(
` 4. Launch Adobe XD or press [cmd/ctrl+R] to reload your Plugin to Adobe XD.`
);
this.log(
` 5. Run your plugin from menu item ${chalk.inverse(
'Plugins'
)} > ${chalk.inverse(name)}`
);
this.log(``);
this.log(
` Please visit ${chalk
.rgb(235, 38, 190)
.underline('https://adobexdplatform.com/')} for more information.`
);
this.log(``);
this.log(
`-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-`
);
}
end() {
let name = this.props.name;
this.log(
`-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-`
);
this.log(``);
this.log(` Congratulations! Your plugin has been created! and next steps are`);
this.log(``);
this.log(
` 1. Visit ${chalk.underline(
'https://console.adobe.io/plugins'
)} and get a new plugin ID.`
);
this.log(` 2. Open static/manifest.json and paste your new plugin ID.`);
this.log(` 3. Install your plugin to Adobe XD via ${chalk.inverse('npm start')}.`);
this.log(
` 4. Launch Adobe XD or press [cmd/ctrl+R] to reload your Plugin to Adobe XD.`
);
this.log(
` 5. Run your plugin from menu item ${chalk.inverse(
'Plugins'
)} > ${chalk.inverse(name)}`
);
this.log(``);
this.log(
` Please visit ${chalk
.rgb(235, 38, 190)
.underline('https://adobexdplatform.com/')} for more information.`
);
this.log(``);
this.log(
`-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-`
);
}
};
11 changes: 11 additions & 0 deletions generators/app/templates/dialog-plain-js-simple/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
35 changes: 35 additions & 0 deletions generators/app/templates/dialog-plain-js-simple/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"extends": [
"airbnb"
],
"plugins": [],
"parserOptions": {},
"env": {
"browser": true
},
"globals": {},
"rules": {
"indent": ["error", 2],
"no-unused-vars": "off",
"no-console": "off",
"import/no-unresolved": ["warn",
{
"ignore": [
"application",
"clipboard",
"commands",
"secenegraph",
"uxp"
]
}
],
"no-param-reassign": ["error",
{
"props": true,
"ignorePropertyModificationsFor": [
"selection"
]
}
]
}
}
Loading

0 comments on commit 7a1bc35

Please sign in to comment.