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

feat!: manifest.json should be generated by cli-plugin-pwa #2981

Merged
merged 1 commit into from
Apr 30, 2019
Merged

feat!: manifest.json should be generated by cli-plugin-pwa #2981

merged 1 commit into from
Apr 30, 2019

Conversation

aweikalee
Copy link
Contributor

English description provided by Google Translate.
中文在下方

English description

manifest.json should be generated by cli-plugin-pwa and should not be copied directly from the public folder.

manifest.json is a separate file that cannot be modified by vue.config.js, and these values are very suitable for configuration with vue.config.js. For example: name, short_name, start_url, icons[].src.

Some attributes of pwa are the same or similar to those of manifest.json. For example, pwa.themeColor and manifest.theme_color, pwa.name and manifest.name.

中文说明

manifest.json应该由cli-plugin-pwa生成,不应该直接从public文件夹复制。

原本manifest.json是一个完全独立的文件,通过vue.config.js无法修改某些值,而这些值又非常合适使用vue.config.js配置。比如:name, short_name, start_url, icons[].src

在原有的pwa的属性中,有些属性与manifest.json的属性相似或本应该是同一个。比如pwa.themeColormanifest.theme_color, pwa.namemanifest.name

@jonaskuske
Copy link
Contributor

We could also use webpack-pwa-manifest to generate the manifest instead of a simple Object.assign().

This would allow users to specify just one image/icon, which would then be down-scaled to all the required different icon sizes. That part is the biggest advantage of creating the manifest programmatically instead of by hand, im my opinion 🙂

@sodatea sodatea self-assigned this Mar 8, 2019
sodatea
sodatea previously requested changes Mar 9, 2019
Copy link
Member

@sodatea sodatea left a comment

Choose a reason for hiding this comment

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

Thanks for your PR. But to not break existing projects relying on manifest.json, we need to implement a compatibility layer for this feature:

  1. if the generated manifest.json is identical to the existing one, tell the user that they can safely delete the redundant file;
  2. if not identical, prefer the existing one, and output a warning that the settings are not in sync.

Also, a test case would be very much appreciated.

@aweikalee
Copy link
Contributor Author

How can I throw a warn when build complete?
I can't find a way in other vue-cli code.
I try to use setTimeout, but can't pass the test.

@sodatea
Copy link
Member

sodatea commented Apr 30, 2019

Now that we are planning a v4 alpha release, The compatibility layer is no longer needed. I'll merge this PR directly. Thanks for your contribution!

@sodatea sodatea dismissed their stale review April 30, 2019 06:59

manifest.json should be generated by cli-plugin-pwa (#2981)

@sodatea sodatea changed the title manifest.json should be generated by cli-plugin-pwa feat!: manifest.json should be generated by cli-plugin-pwa Apr 30, 2019
@sodatea sodatea merged commit 9c0bf4c into vuejs:dev Apr 30, 2019
@vue-bot
Copy link

vue-bot commented Apr 30, 2019

Thanks again! Cheers! 💚

@Akryum
Copy link
Member

Akryum commented May 26, 2019

I see the UI hasn't be updated to not use manifest.json

@septatrix
Copy link

This does not seem to work with the default setup using vite any longer. Looking at the code this plugin seems to hook into webpack so is this not compatible with vite? Are there plans to add this support or is this basically in maintenance-only mode and I should look for alternative solutions for vite?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants