Skip to content

Normalize package.json files, to prepare publication on NPM#2595

Merged
Kocal merged 5 commits into
symfony:2.xfrom
Kocal:prepare-js-pkgs-for-npm
Feb 28, 2025
Merged

Normalize package.json files, to prepare publication on NPM#2595
Kocal merged 5 commits into
symfony:2.xfrom
Kocal:prepare-js-pkgs-for-npm

Conversation

@Kocal

@Kocal Kocal commented Feb 23, 2025

Copy link
Copy Markdown
Member
Q A
Bug fix? no
New feature? no
Issues Fix #...
License MIT

This is a first iteration for #2575: rework our package.json files in order to make them more "friendly" and work on npm.

Next steps:

  1. Add some verifications, to ensure PHP and JS versions of a same package are identical (and so 100% compatible)
  2. See how we can deploy JS packages when creating a new UX releases. I'm thinking about a full automated process using the CI with a workflow listening on tag creation, which will be responsible to upgrade the version from package.json files, commit, push, and publish to npm)
  3. Check if we need to manually create the packages on npm before trying to publishing them

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Feb 23, 2025
@Kocal Kocal requested review from WebMamba, kbond and smnandre February 23, 2025 09:09
Comment thread src/Autocomplete/assets/package.json Outdated
Comment thread src/LiveComponent/assets/package.json Outdated
Comment thread src/Swup/assets/package.json
Comment thread src/Svelte/assets/package.json Outdated
Comment thread src/Typed/assets/package.json
@Kocal Kocal force-pushed the prepare-js-pkgs-for-npm branch from edcce14 to f2da909 Compare February 24, 2025 19:06
@Kocal Kocal requested a review from smnandre February 25, 2025 22:52
@smnandre

Copy link
Copy Markdown
Member

Ho yes one thing. Would the LICENCE be published with these settings? Or do we need to duplicate the repository one in the assets directory ?

@Kocal

Kocal commented Feb 27, 2025

Copy link
Copy Markdown
Member Author

We already have "license": "MIT" defined in package.json files, but it's true that's make sense to ship the LICENSE file in javascript packages.

I'm on it

EDIT: it means that we also need a README.md file for each packages aswell

@Kocal

Kocal commented Feb 27, 2025

Copy link
Copy Markdown
Member Author

Files README.md and LICENSE added!

@Kocal

Kocal commented Feb 28, 2025

Copy link
Copy Markdown
Member Author

@symfony/ux-map will need a special treatment, since bridges dist files already include the dist/abstract_map_controller.js from @symfony/ux-map, it means that there is no need to publish it as a npm package.

For the same reasons, installing symfony/ux-map with composer should not update the package.json, which is the case today:

        "@symfony/ux-leaflet-map": "file:vendor/symfony/ux-leaflet-map/assets",
        "@symfony/ux-map": "file:vendor/symfony/ux-map/assets",

EDIT: see #2611

Kocal added a commit that referenced this pull request Feb 28, 2025
…age.json (Kocal)

This PR was merged into the 2.x branch.

Discussion
----------

[Map] JavaScript package should not be added in user's package.json

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

See #2595 (comment)

Commits
-------

7fe8c35 [Map] JavaScript package should not be added in user's package.json
@Kocal Kocal force-pushed the prepare-js-pkgs-for-npm branch from 24305cd to 87bc2b8 Compare February 28, 2025 23:01
@Kocal

Kocal commented Feb 28, 2025

Copy link
Copy Markdown
Member Author

Added "private": true to src/Map/assets/package.json, this way we can easily exclude Map package from yarn workspaces ... commands with the help of --no-private.

Next steps:

  1. Check PHP / JS packages versions sync
  2. Ensure all packages can be installed correctly from npm (@symfony/ux-leaflet-map works fine) manually and automatically with a CI workflow
  3. Deploy the packages on npm
  4. Ensure all pacakges can be installed correctly from jsdelivr
  5. Write a CI workflow to automatically bump versions (of all packages) and publish packages (except private ones)

@Kocal Kocal merged commit ea891c8 into symfony:2.x Feb 28, 2025
@Kocal Kocal deleted the prepare-js-pkgs-for-npm branch February 28, 2025 23:14
Kocal added a commit that referenced this pull request Mar 1, 2025
…tallation and recommended alternatives. (Kocal)

This PR was squashed before being merged into the 2.x branch.

Discussion
----------

Document `src/**/assets/README.md` files about direct installation and recommended alternatives.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - For new features, provide some code snippets to help understand usage.
 - Features and deprecations must be submitted against branch main.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Follow #2595, related to #2575

Commits
-------

9a4acb1 [CI] Do not run `test` workflow if only `src/**/*.md` files have been modified
d49923b Document `src/**/assets/README.md` files about direct installation and recommended alternatives.
Kocal added a commit that referenced this pull request Mar 2, 2025
… packages (Kocal)

This PR was merged into the 2.x branch.

Discussion
----------

[Map] Add missing README/LICENSE files for Map Bridges JS packages

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

Unfortunately I forgot about Map Bridges when working on #2595.

It will be shown on npm on the next release.

Commits
-------

cc111b6 [Map] Add missing README/LICENSE files for Map Bridges JS packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DX Status: Needs Review Needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants