Publish the samples as @cap2ui5/samples, a package a CAP project adds - #3
Merged
Merged
Conversation
abap2UI5's samples run in any system they are pulled into; these ran only
as a project of their own. cap2UI5's plugin now loads the apps a
dependency declares (cap2UI5 "Serve the apps a package brings, beside the
project's own"), and it is published as @cap2ui5/cds-plugin 0.3.0. So the
samples become @cap2ui5/samples: `npm add -D @cap2ui5/samples` in a CAP
project, and cds watch lists every sample beside the project's own apps.
- package.json: the name, version 0.1.0 and what npm shows; files is
srv/apps, the README, the changelog and the license; "cap2ui5":
{ "apps": "srv/apps" } is where the plugin finds the apps; the plugin
is a peer dependency (^0.3.0), so the samples run on the project's
own. Everything the repository needs for itself is a devDependency.
- srv/apps: every sample imports @cap2ui5/cds-plugin - the 69 generated
ones regenerated by abap2js 0.3.0 from the pin (the import line is the
only change), the two hand-written ones edited the same way; generate
and originals take abap2js and the runtime from the new name.
- scripts/consumer-test.mjs: packs the samples as publish would, installs
the tarball with the plugin into a throwaway CAP project that has an
app of its own, serves it, and checks that the plugin loads every
sample from the package, a sample shows its view and the project's app
still answers. `--plugin <tarball>` runs it before the plugin is on npm.
- test.yml: the plugin from npm, as a project installs it - it used to
pack cap2UI5's plugin from a branch that has since been deleted, so the
workflow could not run any more - and the consumer test; callable by
release.yml.
- release.yml: a tag v<version> runs test.yml on the tagged commit and
publishes by trusted publishing, as cap2UI5's release.yml does; the
first version is published by hand, and its header and the README say
how, `npm trust` included.
- README: how to add the samples to a project, how to publish; the note
about installing the plugin from a branch is gone. CHANGELOG: 0.1.0.
Tested against @cap2ui5/cds-plugin 0.3.0 packed from cap2UI5's branch:
npm test (9 tests, every sample over the wire), check:generated, the
differential test (all 71 behave as their ABAP originals), and the
consumer test - 71 app modules loaded from @cap2ui5/samples in a project
that installed the tarball. CI needs @cap2ui5/cds-plugin 0.3.0 on npm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018bBcFp146qnMCmXWztQaH8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
abap2UI5's samples run in any system they are pulled into, but these could only run as a project of their own. With cap2UI5/cap2UI5#90 the plugin loads the apps a dependency declares, and it is published as
@cap2ui5/cds-plugin0.3.0. So the samples become@cap2ui5/samples. Runnpm add -D @cap2ui5/samplesin a CAP project, andcds watchlists every sample beside the project's own apps.package.jsonfilescoverssrv/apps, the README, the changelog and the license."cap2ui5": { "apps": "srv/apps" }tells the plugin where the apps are.^0.3.0), so the samples run on the project's own plugin.srv/apps@cap2ui5/cds-plugin.generateandoriginalstake abap2js and the runtime from the new name.scripts/consumer-test.mjs(new)--plugin <tarball>runs it before the plugin is on npm.test.ymlrelease.yml.release.yml(new)v<version>runstest.ymlon the tagged commit and publishes by trusted publishing, as cap2UI5's ownrelease.ymldoes.Merge order: CI needs
@cap2ui5/cds-plugin0.3.0 on npmtest.ymlinstalls@cap2ui5/cds-plugin@^0.3.0from the registry. Until that version is published,npm installfails withETARGET. The order is:After merging: the first publish
Test plan
All of these ran locally against
@cap2ui5/cds-plugin0.3.0, packed from cap2UI5/cap2UI5#90.npm test: 9 tests, every sample over the wirenpm run check:generated:srv/appsis what abap2js writes from the pinnpm run consumer-test: in a project that installed the tarball, 71 app modules load from@cap2ui5/samples🤖 Generated with Claude Code
https://claude.ai/code/session_018bBcFp146qnMCmXWztQaH8
Generated by Claude Code