Skip to contentSkip to conversation

doc: bitbake-user-manual: document npm and npmsw fetchers

PATCH In review Quentin Schulz 2 participants 3 messages Jul 4, 2022 – Jul 27, 2022 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Michael,

Quoted 31 lines · Michael Opdenacker via lists.yoctoproject.org

From: Michael Opdenacker <[email protected]>

This addresses bug [YOCTO #10098]

---

* Changes in V3:
- Fix typos reported by Ulrich Ölmann

* Changes in V2:
- Fix typos in the names of explicit targets ("nmp" instead of "npm")
- Simplify the reference to the "nmpsw" section:
no need to use a complex reference when you can directly use a target ("target_" as defined in ".. _target:")

---
  .../bitbake-user-manual-fetching.rst          | 76 ++++++++++++++++++-
  1 file changed, 74 insertions(+), 2 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +3 -0
index f9d9e617..a2d5dc9e 100644
@@ -704,6 +704,80 @@ Here is an example URL::
 
     SRC_URI = "crate://crates.io/glob/0.2.11"
 
+.. _npm-fetcher:
+
+NPM Fetcher (``npm://``)

doc/bitbake-user-manual/bitbake-user-manual-fetching.rst Here is an example URL:: · line 719

Quoted 10 lines
doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +10 -0
+------------------------
+
+This submodule fetches source code from an
+`NPM <https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikipedia.org_wiki_Npm-5F-28software-29&d=DwIDaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=6jfs2SPcK6ODjoy9Rx1f1FwJ0XIpcaSmxNFOVz8Q09Z9tjd9MMlRRLE3wLZdeN6W&s=WcYU-cB0-HVFYar75YxpK_jUOrlJLotZTtXzDBVTisQ&e= >`__
+Javascript package registry.
+
+The format for the :term:`SRC_URI` setting must be::
+
+   SRC_URI = "npm://some.registry.url;OptionA=xxx;OptionB=xxx;..."
+

Nitpick: here you say OptionA but you use the word "parameter" in the list below. For consistency I'd just do a s/Option/Parameter/ here and same for the NPM shrinkwrap.

What do you think? I know it's already merged but we could send a follow-up patch to "fix" this.

Cheers,
Quentin

Quoted 84 lines
doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +61 -3
+This fetcher supports the following parameters:
+
+-  *"package":* The NPM package name. This is a mandatory parameter.
+
+-  *"version":* The NPM package version. This is a mandatory parameter.
+
+-  *"downloadfilename":* Specifies the filename used when storing the downloaded file.
+
+-  *"destsuffix":* Specifies the directory to use to unpack the package (default: ``npm``).
+
+Note that NPM fetcher only fetches the package source itself. The dependencies
+can be fetched through the `npmsw-fetcher`_.
+
+Here is an example URL with both fetchers::
+
+   SRC_URI = " \
+       npm://registry.npmjs.org/;package=cute-files;version=${PV} \
+       npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \
+       "
+
+See :yocto_docs:`Creating Node Package Manager (NPM) Packages
+</dev-manual/common-tasks.html#creating-node-package-manager-npm-packages>`
+in the Yocto Project manual for details about using
+:yocto_docs:`devtool <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.yoctoproject.org_ref-2Dmanual_devtool-2Dreference.html&d=DwIDaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=6jfs2SPcK6ODjoy9Rx1f1FwJ0XIpcaSmxNFOVz8Q09Z9tjd9MMlRRLE3wLZdeN6W&s=WZN8VHjrTvZOsYaUrtzruMGbthalXahWckP5bF9dzdc&e= >`
+to automatically create a recipe from an NPM URL.
+
+.. _npmsw-fetcher:
+
+NPM shrinkwrap Fetcher (``npmsw://``)
+-------------------------------------
+
+This submodule fetches source code from an
+`NPM shrinkwrap <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.npmjs.com_cli_v8_commands_npm-2Dshrinkwrap&d=DwIDaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=6jfs2SPcK6ODjoy9Rx1f1FwJ0XIpcaSmxNFOVz8Q09Z9tjd9MMlRRLE3wLZdeN6W&s=tn-14IgatAsb4UxaOE9WHyr2SDmpLwq6kdd4fdeew6A&e= >`__
+description file, which lists the dependencies
+of an NPM package while locking their versions.
+
+The format for the :term:`SRC_URI` setting must be::
+
+   SRC_URI = "npmsw://some.registry.url;OptionA=xxx;OptionB=xxx;..."
+
+This fetcher supports the following parameters:
+
+-  *"dev":* Set this parameter to ``1`` to install "devDependencies".
+
+-  *"destsuffix":* Specifies the directory to use to unpack the dependencies
+   (``${S}`` by default).
+
+Note that the shrinkwrap file can also be provided by the recipe for
+the package which has such dependencies, for example::
+
+   SRC_URI = " \
+       npm://registry.npmjs.org/;package=cute-files;version=${PV} \
+       npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \
+       "
+
+Such a file can automatically be generated using
+:yocto_docs:`devtool <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.yoctoproject.org_ref-2Dmanual_devtool-2Dreference.html&d=DwIDaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=6jfs2SPcK6ODjoy9Rx1f1FwJ0XIpcaSmxNFOVz8Q09Z9tjd9MMlRRLE3wLZdeN6W&s=WZN8VHjrTvZOsYaUrtzruMGbthalXahWckP5bF9dzdc&e= >`
+as described in the :yocto_docs:`Creating Node Package Manager (NPM) Packages
+</dev-manual/common-tasks.html#creating-node-package-manager-npm-packages>`
+section of the Yocto Project.
+
  Other Fetchers
  --------------
 
@@ -713,8 +787,6 @@ Fetch submodules also exist for the following:
 
  -  Mercurial (``hg://``)
 
--  npm (``npm://``)
-
  -  OSC (``osc://``)
 
  -  Secure FTP (``sftp://``)
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#3017): https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_g_docs_message_3017&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=6jfs2SPcK6ODjoy9Rx1f1FwJ0XIpcaSmxNFOVz8Q09Z9tjd9MMlRRLE3wLZdeN6W&s=U-oDJ6f7AxQVn7Hu-iPX2eqtmmGau2B3g_rb_waPFMA&e=
Mute This Topic: https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_mt_91917725_6293953&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=6jfs2SPcK6ODjoy9Rx1f1FwJ0XIpcaSmxNFOVz8Q09Z9tjd9MMlRRLE3wLZdeN6W&s=FsbeoZkUIfzevApQ_qlmLYrBREoNQsYFpGls7XxZhxw&e=
Group Owner: [email protected]
Unsubscribe: https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_g_docs_unsub&d=DwIFaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=6jfs2SPcK6ODjoy9Rx1f1FwJ0XIpcaSmxNFOVz8Q09Z9tjd9MMlRRLE3wLZdeN6W&s=_HwyPc3o-uWBbqPaJ9CYJdLtpGA9MA7JTGm7Am8EMWU&e= [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

PATCH 1/1 bitbake-user-manual: npm fetcher: improve description of SRC_URI format

From: Michael Opdenacker <[email protected]>

Using the term "Parameter" which is consistent with the description of SRC_URI parameters in the following text.

---
 doc/bitbake-user-manual/bitbake-user-manual-fetching.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +2 -2
index 4dfb7889..9c269ca8 100644
@@ -717,7 +717,7 @@ Javascript package registry.
 
 The format for the :term:`SRC_URI` setting must be::
 
-   SRC_URI = "npm://some.registry.url;OptionA=xxx;OptionB=xxx;..."
+   SRC_URI = "npm://some.registry.url;ParameterA=xxx;ParameterB=xxx;..."
 
 This fetcher supports the following parameters:
 
@@ -757,7 +757,7 @@ of an NPM package while locking their versions.
 
 The format for the :term:`SRC_URI` setting must be::
 
-   SRC_URI = "npmsw://some.registry.url;OptionA=xxx;OptionB=xxx;..."
+   SRC_URI = "npmsw://some.registry.url;ParameterA=xxx;ParameterB=xxx;..."
 
 This fetcher supports the following parameters:
 
Signature · 1 line
2.34.1
author Reviewed-by on v1 1/1
#4 lore raw

Re: [docs] [PATCH] bitbake-user-manual: npm fetcher: improve description of SRC_URI format

Hi Michael,

Quoted 8 lines · Michael Opdenacker via lists.yoctoproject.org

From: Michael Opdenacker <[email protected]>

Using the term "Parameter" which is consistent with the description of SRC_URI parameters in the following text.

---

/me is happy :)

Thanks!
Quentin