microsoft / powerapps-tooling Goto Github PK
View Code? Open in Web Editor NEWTooling support for PowerApps language and .msapp files
Home Page: https://make.powerapps.com
License: MIT License
Tooling support for PowerApps language and .msapp files
Home Page: https://make.powerapps.com
License: MIT License
Is there a PowerShell cmdlet to automate the download / upload of .msapp
files?
In data source, extract the “API Definitions” (ie, TableDefinition,Swagger,Wadl,etc) to a separate file. The API def for CDS Contacts is 1.6 MB.
Also need to consider whether these files can be optional (can they just be deleted?) - What happens when an API definition changes?
Remove the Console.WriteLines and use a proper error reporting callback.
The host (PAC CLI) can then implement this callback and show errors properly.
Template.json doesn't round-trip the Components information.
Template.json gets fully sharded to xml files in the \pkg dir, so it doesn't even appear in the source file.
That's losing the Components information.
We're also wrongfully excluding it from checksum because of the escaped xml. The checksum should cover everything.
better source span on yaml.
Do a duplicate control definition in pa.yaml and verify we get meaningful source locations..
When using -pack NewPathToApp.msapp PathToSourceFolder
It will be useful to create the NewPathToApp folder if it doesn't exist, instead of erroring out.
The basic problem is that we load the entire msapp into memory (CanvasDocument).
And then oom at places like this:
case FileKind.AppCheckerResult:
var appChecker = Encoding.UTF8.GetString(entry.ToBytes());
app._entropy.AppCheckerResult = appChecker;
break;
We should calculating this in a streaming way rather than ToBytes().
(sarif file can be huge)
We should scrutinize usage of FileEntry.ToBytes, and probably need to be lazier and have documents backed by disk.
For diagnostics, provide a checksum per-file.
Still keep the top-level msapp checksum for easy compare., But if that's different, then we can look at per-file checksums. This can help diagnose things like which Screen or Data source was changed.
The Sarif file is a noisy diff. It's 1-line json file, and changes each time we export.
Setup some backcompat tests to verify that the sources are stable.
Hello,
Having read the blog post at https://powerapps.microsoft.com/en-us/blog/source-code-files-for-canvas-apps/, I have some feedback for you to consider, in order of importance.
Thanks for your consideration.
Alan
Writing errors to Console.Error
instead of Console.Out
helps with logging when calling the tool from batches or from custom wrapper tools.
I have noticed this kind of "problematic" implementation in SolutionPackager.exe
from Microsoft.CrmSdk.CoreTools too.
When consuming a component via a libraries, in the Consumer, there’s this in propertiesJson:
"LibraryDependencies": "[{\"LibraryId\":\"737b973d-124d-4927-83a4-799e6b60c49b\",\"LibraryLogicalName\":\"\",\"OriginalComponentDefinitionTemplateId\":\"51d8f4a68c934385b451a1bedba9d8ed\",\"SourceLastTimeSaved\":\"2021-01-05T20:12:30.194+00:00\",\"RefusedSourceLastTimeSaved\":\"0001-01-01T00:00:00\",\"InstanceCount\":1}]",
[
{
"LibraryId": "737b973d-124d-4927-83a4-799e6b60c49b",
"LibraryLogicalName": "",
"OriginalComponentDefinitionTemplateId": "51d8f4a68c934385b451a1bedba9d8ed",
"SourceLastTimeSaved": "2021-01-05T20:12:30.194+00:00",
"RefusedSourceLastTimeSaved": "0001-01-01T00:00:00",
"InstanceCount": 1
}
]
This guid points back to Component1.json.
Action:
Using pasopa -unpack
outputs the error:
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
at PASopa.Program.Main(String[] args) in C:\repos\PASopa\PowerApps-Language-Tooling\src\PASopa\Program.cs:line 51
Expected output:
A required argument -unpack is missing.
Usage:
-unpack PathToApp.msapp PathToNewSourceFolder
-unpack PathToApp.msapp // infers source folder
Since this will eventually make its way into SolutionPackager - maybe this isn't a priority?!
The following code gives the error Error PA3003: Parse error: Missing ':'. If this is a multiline property, use | at Screen1.pa.yaml:2,18-2,18
Screen1 As screen:
# Some comment
sldSlider As slider:
# Another comment
Max: =sldSlider.Width
...
but this code packs ok:
Screen1 As screen:
# Some comment
sldSlider As slider:
# Another comment
Max: =sldSlider.Width
When I unpack after a pack with comments - the pa.yaml is missing all the detal after the comment and is just:
Screen1 As screen:
Are yaml comments supported in pa.yaml files?
In the bleow, CustomProperty1 is an Input property and CustomProperty2 is an Output property. Yet they show up the same way, which is very confusing.
Component1 As CanvasComponent:
CustomProperty1: ="Text, Modified"
CustomProperty2: ="Text, Modified"
It should be something closer to:
Component1 As CanvasComponent:
CustomProperty1:
InputDefault: ="Text, Modified"
CustomProperty2: ="Text, Modified"
In the future, we may be supporting separated Input and Output properties:
Component1 As CanvasComponent:
CustomProperty3:
InputDefault: ="Text, Modified"
Output: ="Text, Modified"
Not something blocking public preview, but we should look at this as we add the other metadata for property parameters.
I added a new control into a screen.pa.yaml (copied from an existing control but with a new Unique ID - and then packed.
# Existing control
img_1 As image:
Image: =powerapps
ZIndex: =2
Y: =162
X: =varImg2X
# New control
img_2 As image:
Image: =powerapps
ZIndex: =2
Y: =250
X: =varImg3X
The following error was thrown, but the app loads ok:
Error PA3007: MsApp is corrupted. Duplicate Control Unique Ids
Warning PA2001: Checksum mismatch. Sources have changed since when they were unpacked.
Warning PA2001: Checksum mismatch. File Controls\3.json checksum does not match on extract
Are there some additional steps I need to do when adding a new control via code - rather than via studio?
If I round-trip - I get a new entry in editorstate.json for the new control.
This line echos Pack
. Should be Make
Fixing this should help while debugging.
Determine what to do with .editorState files.
Maybe also split the .editorstate.json into a subfolder under /src/editorstate so it's less crowded.
This should not happen in well-behaved scenarios. But this can happen if somebody manually edits the files (such as trying a manual textual merge).
Our build infrastructure, /targets/Program.cs takes a hard dependeny on Git being on the path:
static string RootDir = Read("git", "rev-parse --show-toplevel", noEcho: true).Trim();
If it's not on the path, we get a cryptic error.
Should PASopa project be converted to a proper dotnet cli tool?
For reference : https://github.com/dotnet/command-line-api
fyi @MikeStall
YamlWriter test is failing on windows when download from Zip due to CRLF issues:
Expected:<P0: =abc\nObj1:\n P1a: |-\n =A#B\n P1b: =B\n Obj2:\n P2a: =A\n P1c: =C\n>.
Actual: <P0: =abc\r\nObj1:\r\n P1a: |-\r\n =A#B\r\n P1b: =B\r\n Obj2:\r\n P2a: =A\r\n P1c: =C\r\n>."}
There are open compliance tasks that need to be reviewed for your PowerApps-Language-Tooling repo.
To bring this repository to the standard required for 2021, we require administrators of this and all Microsoft GitHub repositories to complete a small set of tasks within the next 60 days. This is critical work to ensure the compliance and security of your microsoft GitHub organization.
Please take a few minutes to complete the tasks at: https://repos.opensource.microsoft.com/orgs/microsoft/repos/PowerApps-Language-Tooling/compliance
You can close this work item once you have completed the compliance tasks, or it will automatically close within a day of taking action.
If you no longer need this repository, it might be quickest to delete the repo, too.
More information about GitHub inside Microsoft and the new GitHub AE product can be found at https://aka.ms/gim or by contacting [email protected]
FYI: current admins at Microsoft include @MattB-msft, @JimDaly, @davidjenni, @MikeStall, @lajusp
Review the file format to ensure it plays well with source control and Pull Request merging. Ensure each Directory falls into the following category, where all files in the directory have the same rules:
# | Kind | Details | Examples |
---|---|---|---|
1 | Source | file should be checked in | pa.yaml |
2 | cache | file (in-theory) can be recreated, Still require checking in for now, but future version may have offline recovery. In theory, server could recover if missing | packages, ApiDef/Swagger |
3 | optional | file can be safely deleted. | editorstate.json, |
4 | config | org-specific data. | Connections |
Ensure we can round-trip components.
Improve the real .msapp format to make conversions easier.
As general principles:
Some specific things:
If a property is empty, then consider removing it from the pa.yaml
E.g Could HoverFill and HoverBorderColor be removed to lower verbosity?
imgBox As image:
Image: =box.img
ImagePosition: =ImagePosition.Stretch
X: =0
Y: =0
Width: =1024
Height: =32
HoverFill: =
HoverBorderColor: =
ZIndex: =1
YAML is like marmite - you either love it or hate it! I think there an opportunity here for an open community discussion around the use of YAML as the 'source code format' - possibly from the perspective of:
A number of starting points to discuss spring to mind:
imgControl As image:
Image: =If(varCurrentMode=ThisItem.ani,ThisItem.imgSel,ThisItem.imgOff)
ZIndex: =1
Width: =82
Height: =151
ImagePosition: =ImagePosition.Fill
OnSelect: |
// explode all lemmings
UpdateIf(colLemmings,ani<>"" && Not(ani in ["explode","explode_done","splut_done"]),{
countdown:10
});
In JSON the OnSelect value would look far more verbose with lots of escaping - this does make it harder to read.
{
"imgControl As image": {
"Image": "If(varCurrentMode=ThisItem.ani,ThisItem.imgSel,ThisItem.imgOff)",
"ZIndex": 1,
"Width": 82,
"Height": 151,
"ImagePosition": "ImagePosition.Fill",
"OnSelect": "// explode all lemmings\n UpdateIf(colLemmings,ani<>\"\" && Not(ani in [\"explode\",\"explode_done\",\"splut_done\"]),{\n countdown:10\n });"
}
}
What do folks think - is there a better option to YAML from this perspective?
imgControl As image:
Image: =If(varCurrentMode=ThisItem.ani,ThisItem.imgSel,ThisItem.imgOff)
ZIndex: =1
Width: =82
Height: =151
ImagePosition: =ImagePosition.Fill
OnSelect: |
=Set(varCurrentMode,ThisItem.ani);
If(ThisItem.ani="nuke",
but the following will throw the error Can't have empty multiline expressions.
or Missing ':'. If this is a multiline property, use | at ...
(because the =Set is not indented correctly).
imgControl As image:
Image: =If(varCurrentMode=ThisItem.ani,ThisItem.imgSel,ThisItem.imgOff)
ZIndex: =1
Width: =82
Height: =151
ImagePosition: =ImagePosition.Fill
OnSelect: |
=Set(varCurrentMode,ThisItem.ani);
If(ThisItem.ani="nuke",
This will make it difficult to copy/paste code between expressions - without some IDE tooling.
What do folks think about the alternatives to YAML from the perspective of indentation/escaping/newlines?
What do folks think - is consistency important?
We should strip LocalDataBaseReference and Local* from Properties.json (CanvasManifest.json). These are noisy diffs and already shared to other files.
If I change screen order, editorstate.json Index changes. What this means is that if I insert a screen into a 30 screen app, 29 editorstate json files will all change.
We should have a single place that lists the screen order (either separate file or an array in CanvasManifest.json)
We have some hacky cases where we use REgex.
To repro, run PASopa.exe from a CLI w/o any args
Expected: usage is shown
Actual: Crashes w/ a stacktrace
Adding a control to screen1 will change the PublishOrderIndex.editorstate for screen2.
What be the cause of the warning:
Warning PA2001: Checksum mismatch. File Controls\194.json checksum does not match on extract
I also get messages like the following:
FAIL: hash mismatch: Controls\145.json
FAIL: hash mismatch: Controls\194.json
FAIL: hash mismatch: Controls\22.json
FAIL: hash mismatch: Controls\3.json
FAIL: hash mismatch: Controls\88.json
FAIL: hash mismatch: Properties.json
FAIL: hash mismatch: References\Templates.json
FAIL!!
This happens on first extract where there were no existing files extracted.
I have noticed that the order of the controls in a screen yaml element are not ordered by zOrder (and hence the order shown in studio). This then results in very noise diffs when unpacking.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.