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

Create AL Project from Template - Improvements #275

Open
4 tasks done
jwikman opened this issue Feb 4, 2022 · 13 comments
Open
4 tasks done

Create AL Project from Template - Improvements #275

jwikman opened this issue Feb 4, 2022 · 13 comments
Assignees

Comments

@jwikman
Copy link
Owner

jwikman commented Feb 4, 2022

@fvet
Copy link
Contributor

fvet commented Feb 20, 2022

Would it be possible to provide some templates / samples on how to configure the mappings for the new 'Create AL Project from Template' command?

I'm looking forward to this a lot and would like to know how to configure e.g. following scenarios and run some tests with it.


  • Settings.json
"CRS.ObjectNamePrefix": "ESC",  << needs to receive a new prefix
"alVarHelper.ignoreALPrefix": "ESC",  << needs to receive a new prefix

  • App.json
"id": "00000001-0000-0000-0000-000000000000",         << needs to receive a random GUID
"name": "Dynavision Template",  << needs to receive a new name
"idRanges": [
    {
      "from": 1,  << needs to receive a new from range
      "to": 1      << needs to receive a new to range
    }


  • AppSourceCop.json

"mandatoryPrefix": "ESC" << needs to receive a new prefix


  • template.code-Workspace << needs to be renamed to 'AppName'.code-workspace
{    
    "folders": [        
        {
            "path": "../ESC 365 Core/App",
            "name": "Core"
        },        
        {
            "path": "./App",
            "name": "New App Name"   << needs to receive a new name
        }
    ]
}

@jwikman
Copy link
Owner Author

jwikman commented Feb 20, 2022

Hi @fvet,

Yeah, I'm aware that a sample could be needed to understand how to use this. The template project we use internally has too much internal stuff in it so I cannot publish that template, and I just haven't had the time to mock up another template sample.

If you zip a template project and attach here, I can configure an al.template.json file for that. Maybe that could be used as a starting point of a sample, possibly published on a wiki page in this repo, if you're fine with that?

@jwikman
Copy link
Owner Author

jwikman commented Feb 20, 2022

@fvet, I forgot to mention: All above should be possible to do with this command.

@fvet
Copy link
Contributor

fvet commented Feb 20, 2022

Hi, enclosed a template I'm currently creating.
Template.zip

Some additional things that need to be added:

  • If the (main) app receive a new app id, this should be added in the dependencies of the test app (if test app is required)
  • If the test app receive a new app id, this should be added in the internalsVisibleTo of the main app (if test app is required)
  • Test app will not always be added. (especially for PTE apps) This should result in the above steps to be conditional. (and maybe delete the \Test folder)

The above will be covered by maintaining an 'All-In' project and let the user remove unwanted features (e.g. test app)

  • Add default (installer / internal module framework) codeunits with some boilerplate code. These will be named "Codeunit 50000 ESCX Installer" and should be renamed (prefix) + renumbered upon by the command.
  • Add default enum with a new module value. This will be named "Enum 50000 ESCX Module" and should be renamed (prefix) + receive an enum value (from range) and enum name (short app name / module name) upon by the command.
  • (Later) Add default pipeline (yaml). This will contain a reference to an external yaml template (separate repo) that will contain a dedicated pipeline for this repo (including any specific dependencies)
  • (Nice to Have) Run some tasks after the app has been created. E.g. Authorize app with AL Object ID Ninja, Synchronize objects (after they have been renamed) with AL Object ID Ninja, ...

Based on your instructions / feedback above topics, I'll update the sample.

@fvet
Copy link
Contributor

fvet commented Feb 20, 2022

Update template with some (dummy) objects containing some boilerplate code.
Template.zip

@jwikman
Copy link
Owner Author

jwikman commented Feb 20, 2022

@fvet I updated your (first) template files with a sample al.template.json:
fvet_Template_sample.zip

With that sample, you might be able to continue to improve that template yourself?

I'll have to leave computer now, I will look at your new template later.

A lot of interesting ideas you have with improvements of the template feature, I'll look into them later as well. 👍

Just let me know if my sample wasn't enough!

@fvet
Copy link
Contributor

fvet commented Feb 20, 2022

@jwikman Thanks for your input, I was able to update my template. First results look promising !
Latest version : Template.zip

Some additional feedback:

  • Maybe a Visible or Editable property could be added to a mapping entity. This would prevent a user from seeing / changing the app id's. (These 'technical' mappings are of less importance for the user creating a new project)

image

image

  • For some unknown reason, the [APP_PREFIX] is not applied on my settings.json file?
"CRS.ObjectNamePrefix": "[APP_PREFIX]",
"alVarHelper.ignoreALPrefix": "[APP_PREFIX]",

  • (Nice to Have) Run some tasks after the app has been created. Would be good if we can run the 'CRS : Rename - All Files' at the end.

@theschitz
Copy link
Collaborator

@jwikman I can't remember where we landed on this this topic but I think we pretty much agreed on that having a template-app in the repo would be nice. May I suggest that @fvet submits the template app as PR with the template when you two deem it "good enough"?

Suggested location: ./template-app

@jwikman
Copy link
Owner Author

jwikman commented Feb 20, 2022

@fvet I'm glad you could move forward on this.

  • Maybe a Visible or Editable property could be added to a mapping entity. This would prevent a user from seeing / changing the app id's. (These 'technical' mappings are of less importance for the user creating a new project)

Very good idea, I added this to the initial comment in this issue.

  • For some unknown reason, the [APP_PREFIX] is not applied on my settings.json file?

Hmm... This was strange. I can see that I have a repro on this, let me investigate some more...

  • (Nice to Have) Run some tasks after the app has been created. Would be good if we can run the 'CRS : Rename - All Files' at the end.

I see that @theschitz picked this idea directly! Let's see what he comes up with on this topic. 🙂
I understand that it needs some effort to accomplish this with the use of several renameFiles settings in al.template.json, but it should be possible as well, don't you think?

@jwikman
Copy link
Owner Author

jwikman commented Feb 20, 2022

@jwikman I can't remember where we landed on this this topic but I think we pretty much agreed on that having a template-app in the repo would be nice. May I suggest that @fvet submits the template app as PR with the template when you two deem it "good enough"?

Suggested location: ./template-app

@theschitz, I think it's a very good idea. That would be easier to pick up on, compared to a wiki page.
What do you say about that @fvet?

@jwikman
Copy link
Owner Author

jwikman commented Feb 20, 2022

@fvet, this thread might already be hard to follow, but I'll try to address each of your suggestions here anyway

  • If the (main) app receive a new app id, this should be added in the dependencies of the test app (if test app is required)
  • If the test app receive a new app id, this should be added in the internalsVisibleTo of the main app (if test app is required)
  • Test app will not always be added. (especially for PTE apps) This should result in the above steps to be conditional. (and maybe delete the \Test folder)

We do not have any support for conditions (yet?).
In our company, we currently solve this by:

  1. Using different templates for PTEs and AppSource apps (having Test app in both 😉)
  2. Both above templates are as 'complete" as possible (including internalsVisibleTo etc). If there are something that is, for some reason, not needed for a particular app we just remove that from the app after converted from template.
  • Add default (installer / internal module framework) codeunits with some boilerplate code. These will be named "Codeunit 50000 ESCX Installer" and should be renamed (prefix) + renumbered upon by the command.
  • Add default enum with a new module value. This will be named "Enum 50000 ESCX Module" and should be renamed (prefix) + receive an enum value (from range) and enum name (short app name / module name) upon by the command.

It seems as you're happy with these already. 👍

  • (Later) Add default pipeline (yaml). This will contain a reference to an external yaml template (separate repo) that will contain a dedicated pipeline for this repo (including any specific dependencies)

We include a yaml template file in our template, with settings replaced as any other placeholderSubstitutions.

  • (Nice to Have) Run some tasks after the app has been created. E.g. Authorize app with AL Object ID Ninja, Synchronize objects (after they have been renamed) with AL Object ID Ninja, ...

Tracked in #302

@fvet
Copy link
Contributor

fvet commented Feb 20, 2022

@jwikman If I've any new suggestions, I'll open separate new issues to ease tracking ;)

For the template, I'll await the fix for the settings file and will duplicate my project and anonymize the settings (or add 'NAB' as publisher instead).

@jwikman
Copy link
Owner Author

jwikman commented Feb 20, 2022

@jwikman If I've any new suggestions, I'll open separate new issues to ease tracking ;)

Might be a good idea! 😅

For the template, I'll await the fix for the settings file and will duplicate my project and anonymize the settings (or add 'NAB' as publisher instead).

Super!

The settings fix should be available by now, does it not turn up for you if you select the "Install another Pre-Release version"?
image
image

And a hidden property is soon available in a new pre-release 🙂

@fvet fvet mentioned this issue Feb 20, 2022
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

No branches or pull requests

3 participants