Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add one step samples for Word and Excel in Yeoman #794

Closed
wants to merge 8 commits into from

Conversation

richard6094
Copy link

Thank you for your pull request. Please provide the following information.


  1. Do these changes impact User Experience? (e.g., how the user interacts with Yo Office and/or the files and folders the user sees in the project that Yo Office creates)

    • [ -] Yes
    • No

    If Yes, briefly describe what is impacted.
    There will be 2 more options for users' choices:
    image
    Users could 1-step to get the sample add-in code, edit it and automatically launch.

  2. Do these changes impact documentation? (e.g., a tutorial on https://learn.microsoft.com/en-us/office/dev/add-ins/overview/office-add-ins)

    • [- ] Yes
    • No

    If Yes, briefly describe what is impacted.
    There will be an one-line command added for users to use the scripts in yeoman.

  3. Validation/testing performed:
    We have tested the parameters, options and error handlings

  4. Platforms tested:

    • [ - ] Windows
    • Mac

@richard6094 richard6094 requested a review from a team as a code owner November 28, 2023 09:11
Copy link
Contributor

@millerds millerds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to diverge quite a bit from the design and intent of this plugin. I samples case seems to do a lot of special casing to get unique behavior and experience and as a result we get mix of yeoman functionality and a custom cmd experience. You've introdued the use of git, cloning instead of copying the source code, and extra user prompts . . . all of with are similar to but the the same as existing behavior.

You also have a lot of code that looks like it is mostly the same, but is different in only a few simple ways. This should be made generic and parameterized instead of trying to maintain multiple copies of the same thing.

The basic idea of generating samples vs. blank projects needs to be thought of more thoroughly to come up with a long term design.

package.json Outdated
@@ -69,6 +77,7 @@
"typescript": "^4.8.2",
"yeoman-assert": "^3.1.1",
"yeoman-environment": "^3.13.0",
"yeoman-test": "^6.3.0"
"yeoman-test": "^6.3.0",
"yo": "^4.3.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we importing 'yo' . . . it's not used by the generator.

@@ -158,5 +184,16 @@
"word": {
"displayname": "Word"
}
},
"sampleOptions": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this used?

return this.m_projectJsonData.projectTypes[_.toLower(projectType)].displayname;
let displayName = this.m_projectJsonData.projectTypes[_.toLower(projectType)].displayname;

if (projectType === 'excel_sample' || projectType === 'word_sample' || projectType === 'excel_hello_world' || projectType === 'word_hello_world') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be highlighting one project over another.

return displayName;
}

getProjectDisplayNames() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this used?

src/app/index.ts Outdated
@@ -96,6 +111,16 @@ module.exports = class extends yo {
type: Boolean,
description: 'Get more details on Yo Office arguments.'
});

this.option('excel_sample', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these new options?

const crt_path = '.office-addin-dev-certs\\localhost.crt';
const key_path = '.office-addin-dev-certs\\localhost.key';
const full_path_crt = homeDirectory + '\\' + crt_path;
const full_path_key = homeDirectory + '\\' + key_path;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these being used for?

const full_path_key = homeDirectory + '\\' + key_path;

shell.cd('./Samples/hello-world/excel-hello-world');
shell.exec('npm install -g office-addin-debugging', {async:true}, (code, stdout, stderr) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be part of the project and not installed seperately.

We also should not be installing things globally . . . we're targeted at a project and not modifying the general user environment.

spinner.setSpinnerString('|/-\\');
spinner.start();

shell.exec('git clone https://github.com/OfficeDev/Excel-Scenario-based-Add-in-Samples.git', {async:true}, (code, stdout, stderr) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By cloning the project you are keeping a user connection with the original template/sample repo . . . which is not what we're trying to do here. We're creating a new project that is not connected back to a template repo. We also already have code in this plugin that accomplishes that . . . this is taking a completely divergent path.

@@ -362,6 +451,13 @@ module.exports = class extends yo {
});
}

_postOpenSampleHints(): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to special case general information.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to special case general information.

Can we just put the special case here temporarily for sample add-ins?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is shipping code. Even "temporary" things need to be ship quality.

tsconfig.json Outdated
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"allowJs": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

@millerds
Copy link
Contributor

millerds commented Dec 4, 2023

If you want to experiment with a yeoman generator in ways that are very different from the established patterns here than maybe you should consider a separate yeoman plug-in (possibly forked from this code).

On top of that . . . if it is something that doesn't use the generator option, then why are you using yeoman in the first place? The same thing could be accomplished with through other means (like doing more in the bath file).

@millerds millerds closed this May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants