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

Fix application ID name #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jameshfisher
Copy link

@jameshfisher jameshfisher commented May 5, 2020

There's a lot of terminological/conceptual confusion in the current API. An .appx file should have an AppXManifest.xml which looks like the following, omitting unimportant elements:

<?xml version="1.0" encoding="utf-8"?>
<Package ...>
    <Identity Name="12345MyCompany.MyApp" ... />
    ...
    <Applications>
        <Application Id="MyApp" ...>
            ...
        </Application>
    </Applications>
</Package>

Notice that there are two separate identities: the Package Name, and the Application Id.

When you run electron-windows-store, it generates an AppXManifest.xml from the config you supply. The template is here and it looks like:

<?xml version="1.0" encoding="utf-8"?>
<Package ...>
  <Identity Name="${identityName}" ... />
  ...
  <Applications>
    <Application Id="${packageName}" ...>
      ...
    </Application>
  </Applications>
</Package>

Notice in the variable names: it calls the package name identityName, and calls the application id packageName. These template variables are subtituted by the user-supplied config like so:

lib/convert.js:      result = result.replace(/\${identityName}/g, program.identityName || program.packageName)
lib/convert.js:      result = result.replace(/\${packageName}/g, program.packageName)

This means, to create a correct AppXManifest.xml, you need to call it like so:

const convertToWindowsStore = require('electron-windows-store');
convertToWindowsStore({
    identityName: '12345MyCompany.Ghost',  // This is actually the package name!
    packageName: 'Ghost',  // This is actually the application id!!
    // ...
});

This is very confusing, and has led to many tickets:

The best way forward would be to introduce a separate program.applicationId config, which is used in preference to the packageName.

Additionally, this PR deprecates the identityName, because the best name is just packageName, as this is the established terminology.

There's a lot of terminological/conceptual confusion in the current API.

An .appx file should have an `AppXManifest.xml` which looks like the following,
omitting unimportant elements:

    <?xml version="1.0" encoding="utf-8"?>
    <Package ...>
        <Identity Name="12345MyCompany.MyApp" ... />
        ...
        <Applications>
            <Application Id="MyApp" ...>
                ...
            </Application>
        </Applications>
    </Package>

Notice that there are two separate identities: the Package Name, and the Application Id.

When you run `electron-windows-store`,
it generates an `AppXManifest.xml` from the config you supply.
[The template is here](https://github.com/felixrieseberg/electron-windows-store/blob/master/template/appxmanifest.xml)
and it looks like:

<?xml version="1.0" encoding="utf-8"?>
<Package ...>
  <Identity Name="${identityName}" ... />
  ...
  <Applications>
    <Application Id="${packageName}" ...>
      ...
    </Application>
  </Applications>
</Package>

Notice in the variable names:
it calls the package name `identityName`,
and calls the application id `packageName`.
These template variables are subtituted by the user-supplied config like so:

    lib/convert.js:      result = result.replace(/\${identityName}/g, program.identityName || program.packageName)
    lib/convert.js:      result = result.replace(/\${packageName}/g, program.packageName)

This means, to create a correct `AppXManifest.xml`,
you need to call it like so:

    const convertToWindowsStore = require('electron-windows-store');
    convertToWindowsStore({
        identityName: '12345MyCompany.Ghost',  // This is actually the package name!
        packageName: 'Ghost',  // This is actually the application id!!
        // ...
    });

This is very confusing, and has led to many tickets:

    electron-userland#82
    electron-userland#114
    electron-userland#103
    electron-userland#120

The best way forward would be to introduce a separate `program.applicationId` config,
which is used in preference to the `packageName`.
@jameshfisher
Copy link
Author

Note for comparison this alternative project which has the API I suggest in the PR: https://www.electron.build/configuration/appx

@mahnunchik
Copy link

Any news?

@jameshfisher
Copy link
Author

@mahnunchik no, I think this repo is dead/unmaintained :-(

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.

2 participants