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

Updated Artifacts Folder Structure #1843

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

mehsaandev
Copy link
Contributor

@mehsaandev mehsaandev commented Jan 21, 2025

New folder structure for Local ensemble Apps:-

inside ensemble/apps/yourAppName, you should have the following structure for your app data:

asset
config
internal_script
internal_widget
screen
theme
.manifest.json

Currently Working Items:

  • Screens
  • widgets
  • scripts
  • themes
  • Assets
  • Env and Secret

Please change the following files in order to run this new structure:

Update pubspec.yaml of starter App:

Add all your apps folder in the assets section at the very bottom. For example if the name of your app is helloApp then add the following under assets

 - ensemble/apps/helloApp/
 - ensemble/apps/helloApp/.manifest.json
 - ensemble/apps/helloApp/asset/
 - ensemble/apps/helloApp/screen/
 - ensemble/apps/helloApp/internal_widget/
 - ensemble/apps/helloApp/internal_script/
 - ensemble/apps/helloApp/theme/
 - ensemble/apps/helloApp/config/appConfig.json
 - ensemble/apps/helloApp/secret/secrets.json

CC: @amin-nas

@mehsaandev mehsaandev requested a review from kmahmood74 January 26, 2025 12:51
@mehsaandev mehsaandev changed the title [WIP] Updated Artifacts Folder Structure Updated Artifacts Folder Structure Jan 27, 2025
@sharjeelyunus
Copy link
Member

sharjeelyunus commented Jan 27, 2025

Why do we still have these internal_script and internal_widget? We've been criticizing the Firebase structure for having these collections, and now we're expanding it to new features?

Shouldn't the folder structure for both Electron and the starter be something like this?

  • assets
  • fonts
  • scripts
  • widgets
  • screens
  • i8n
  • theme.yaml

CC: @kmahmood74 @evshi

@mehsaandev mehsaandev self-assigned this Jan 28, 2025
@sharjeelyunus
Copy link
Member

Why do we still have these internal_script and internal_widget? We've been criticizing the Firebase structure for having these collections, and now we're expanding it to new features?

Shouldn't the folder structure for both Electron and the starter be something like this?

  • assets
  • fonts
  • scripts
  • widgets
  • screens
  • i8n
  • theme.yaml

CC: @kmahmood74 @evshi

Just a had a convo with @evshi we will be renaming these to proper structure
@mehsaandev please discuss the latest structure with evan for consistency

@mehsaandev
Copy link
Contributor Author

Why do we still have these internal_script and internal_widget? We've been criticizing the Firebase structure for having these collections, and now we're expanding it to new features?
Shouldn't the folder structure for both Electron and the starter be something like this?

  • assets
  • fonts
  • scripts
  • widgets
  • screens
  • i8n
  • theme.yaml

CC: @kmahmood74 @evshi

Just a had a convo with @evshi we will be renaming these to proper structure @mehsaandev please discuss the latest structure with evan for consistency

Sure

@mehsaandev mehsaandev requested review from sharjeelyunus and removed request for kmahmood74 February 4, 2025 20:17
Comment on lines +87 to +89
final manifestContent =
await rootBundle.loadString(path + '.manifest.json');
final Map<String, dynamic> manifestMap = json.decode(manifestContent);
Copy link
Member

Choose a reason for hiding this comment

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

Hi @evshi,

This function is taking a lot amount of time to load and decode. Its whole job is to extract widget/script names, which are needed to fetch the content. But, the manifest file, for apps with around 100 screens and 100 widgets, can go up to 4-5 MB in size and takes 3-5 seconds to load and decode.

Why are we storing the YAML directly in the manifest file. When we remove the content keys/values from it, it works fine. The large content data is really slowing things down.

From the Electron app, could we either:

  • Remove the content keys/values from the manifest file, or
  • Provide a separate file containing only the widget and scripts names, which we can use here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, we should not include the YAML in the manifest. @anserwaseem we discussed this previously can you address this now since it is causing this performance issue?

@amin-nas
Copy link
Contributor

amin-nas commented Feb 5, 2025

@mehsaandev @sharjeelyunus - is this ready to be merged?

@sharjeelyunus
Copy link
Member

@mehsaandev @sharjeelyunus - is this ready to be merged?

this needs a lil bit of cleanup

Copy link
Member

@sharjeelyunus sharjeelyunus left a comment

Choose a reason for hiding this comment

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

please make sure this is not breaking the ensemble or server provider. Also update the example helloApp structure with the updated structure.

Comment on lines 928 to 929
String path = EnsembleConfigService.config["definitions"]?['local']?["path"];
return '${path}/asset/${stripQueryParamsFromAsset(asset)}';
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be assets? instead of asset?

also the assets are stored locally in ensemble/assets folder in case of ensemble provider. wouldn't this break the assets for ensemble provider?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it should be assets

and for Ensemble provider, No it won't because for ensemble provider source of each assets is cloud-based. we are not storing assets locally in case of ensemble provider, so in case of ensemble provider this function will not be called to create a local path

Copy link
Member

@sharjeelyunus sharjeelyunus Feb 6, 2025

Choose a reason for hiding this comment

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

NO, we are storing local assets in ensemble provider as well, for studio yes we provide the cloud-based urls, but when user creates a build, we store the assets in the old assets folder for ensemble provider

final secretsString =
await rootBundle.loadString('${path}/config/secrets.json');
final Map<String, dynamic> appSecretsMap = json.decode(secretsString);
// await dotenv.load();
Copy link
Member

@sharjeelyunus sharjeelyunus Feb 5, 2025

Choose a reason for hiding this comment

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

remove this unnecessary comment

Comment on lines 31 to 38
String path =
EnsembleConfigService.config["definitions"]?['local']?["path"];
final secretsString =
await rootBundle.loadString('${path}/config/secrets.json');
final Map<String, dynamic> appSecretsMap = json.decode(secretsString);
appSecretsMap["secrets"].forEach((key, value) {
secrets![key] = value;
});
Copy link
Member

Choose a reason for hiding this comment

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

how this will work for ensemble provider? why is this static to local only?

Comment on lines 1 to 14
function sayHello(name) {
console.log('sayHello:'+name);
}

function saveName(first,last) {
ensemble.storage.helloApp = {name: {first: first, last: last}};
}

function getName() {
if ( ensemble.storage.helloApp != null ) {
return ensemble.storage.helloApp.name;
}
return null;
}
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be a JS file??? why scripts files are .yaml files?

@mehsaandev
Copy link
Contributor Author

@sharjeelyunus Updated scripts extension to js, PTAL

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.

Update local definition provide to work with folder structured artifacts
4 participants