mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
start npm! data-files package
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -37,3 +37,6 @@ __pycache__
|
||||
.tmp_versions
|
||||
Module.symvers
|
||||
modules.order
|
||||
|
||||
# node.js
|
||||
node_modules
|
||||
|
||||
24
README.adoc
24
README.adoc
@@ -14411,7 +14411,9 @@ Examples:
|
||||
|
||||
==== Node.js
|
||||
|
||||
Build and install the interpreter with:
|
||||
Host installation shown at: https://askubuntu.com/questions/594656/how-to-install-the-latest-versions-of-nodejs-and-npm/971612#971612
|
||||
|
||||
Build and install the interpreter in Buildroot with:
|
||||
|
||||
....
|
||||
./build-buildroot --config 'BR2_PACKAGE_NODEJS=y'
|
||||
@@ -14436,6 +14438,26 @@ Examples:
|
||||
** link:rootfs_overlay/lkmc/nodejs/file_write_read.js[]
|
||||
** link:rootfs_overlay/lkmc/nodejs/read_stdin_to_string.js[] Question: https://stackoverflow.com/questions/30441025/read-all-text-from-stdin-to-a-string
|
||||
|
||||
===== NPM
|
||||
|
||||
https://en.wikipedia.org/wiki/Npm_(software)
|
||||
|
||||
Some sample packages can be found under: link:npm[].
|
||||
|
||||
Local testing of those packages can be done as shown at: https://stackoverflow.com/questions/59389027/how-to-interactively-test-the-executable-of-an-npm-node-js-package-during-develo
|
||||
|
||||
The packages will also be published to the NPM registry, so you can also play with them as:
|
||||
|
||||
....
|
||||
npm install cirosantilli-<directory-name>
|
||||
....
|
||||
|
||||
====== NPM data-files
|
||||
|
||||
Illustrates how to add extra non-code data files to an NPM package, and then use those files at runtime:
|
||||
|
||||
https://stackoverflow.com/questions/10111163/in-node-js-how-can-i-get-the-path-of-a-module-i-have-loaded-via-require-that-is
|
||||
|
||||
==== Java
|
||||
|
||||
No OpenJDK package as of 2018.08: https://stackoverflow.com/questions/28874150/buildroot-with-jamvm-2-0-for-java-8/59290927#59290927 partly because their build system is shit like the rest of the project's setup.
|
||||
|
||||
1
npm/README.adoc
Normal file
1
npm/README.adoc
Normal file
@@ -0,0 +1 @@
|
||||
https://cirosantilli.com/linux-kernel-module-cheat#npm
|
||||
1
npm/data-files/.nvmrc
Normal file
1
npm/data-files/.nvmrc
Normal file
@@ -0,0 +1 @@
|
||||
v10.15.1
|
||||
1
npm/data-files/README.adoc
Normal file
1
npm/data-files/README.adoc
Normal file
@@ -0,0 +1 @@
|
||||
https://cirosantilli.com/linux-kernel-module-cheat#npm-data-files
|
||||
5
npm/data-files/cirosantilli-data-files
Executable file
5
npm/data-files/cirosantilli-data-files
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const cirosantilli_data_files = require('cirosantilli-data-files');
|
||||
|
||||
console.log(cirosantilli_data_files.myfunc());
|
||||
8
npm/data-files/index.js
Normal file
8
npm/data-files/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function myfunc() {
|
||||
const package_path = path.dirname(require.resolve(path.join('cirosantilli-data-files', 'package.json')));
|
||||
return fs.readFileSync(path.join(package_path, 'mydata.txt'), 'utf-8');
|
||||
}
|
||||
exports.myfunc = myfunc;
|
||||
1
npm/data-files/mydata.txt
Normal file
1
npm/data-files/mydata.txt
Normal file
@@ -0,0 +1 @@
|
||||
hello world
|
||||
5
npm/data-files/package-lock.json
generated
Normal file
5
npm/data-files/package-lock.json
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "cirosantilli-data-files",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
14
npm/data-files/package.json
Normal file
14
npm/data-files/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"bin": {
|
||||
"cirosantilli-data-files": "cirosantilli-data-files"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"cirosantilli-data-files",
|
||||
"mydata.txt",
|
||||
"index.js"
|
||||
],
|
||||
"name": "cirosantilli-data-files",
|
||||
"repository": "cirosantilli/linux-kernel-module-cheat",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
Reference in New Issue
Block a user