npm-pkgbuild
v15.6.8
Published
create ArchLinux, RPM and Debian packages from npm packages
Downloads
10,355
Maintainers
Readme
npm-pkgbuild
Create ArchLinux, RPM, Debian and Docker packages from npm packages.
usage
In a package directory execute
npm-pkgbuild --rpm --debian --arch --content /destination:build --publish /some/directory
This will create a arch, rpm and a debian package of the build dir.
upload package
npm-pkgbuild --arch --content build --publish 'https://my.package-service.com/binaries/linux/{{type}}/{{access}}/{{arch}}'
You can specify the package content in package.json.
{
"pkgbuild": {
"content": {
"/some/location/" : { "base": "build" },
"/etc/myconfig.json" : "sample-config.json",
"/erc/secret" : { "name": "secret", "mode": "600" },
"/opt/myapp": [
{
"type": "npm-pack"
},
{
"type": "node-modules",
"withoutDevelpmentDependencies": true
}
]
},
"hooks" : "pkg/hooks",
"output": {
"debian" : {},
"rpm" : {},
"arch" : {}
},
"dependencies": { "nginx" : ">=1.12" }
}
}
content providers
Defining where the package content should come from.
files (default)
content from the file system
npm-pack
content as provided by npm pack
node-modules
content of all (production) dependencies
options: - withoutDevelpmentDependencies when to stip away dev dependencies (defaults to true)
shared configuration
You can import common configuration from other packages. See mf-hosting or mf-hosting-frontend modules.
API
Table of Contents
- ContentProvider
- FileContentProvider
- utf8StreamOptions
- decodePassword
- FunctionDecl
- extractFunctions
- fieldProvider
- Expander
- copyEntries
- NFTContentProvider
- NodeModulesContentProvider
- NPMPackContentProvider
- pkgKeyValuePairOptions
- fields
- fields
- fields
- fields
- BUILDAH
- hookMapping
- hookMapping
- DEBIAN
- DOCKER
- OCI
- Packager
- Packager
- Field
- PublishingDetail
- createPublishingDetails
- publish
- quoteFile
- RPM
ContentProvider
Source of package content.
Parameters
definitions
entryProperties
Properties
destinationPrefix
asyncIterator
List all entries.
Returns AsyncIterable<ContentEntry> all entries
FileContentProvider
Extends ContentProvider
Content provided form the file system.
Parameters
entryProperties
name
Returns string name of the content provider
utf8StreamOptions
Type: Object
Properties
encoding
BufferEncoding
decodePassword
Decode a password
Parameters
password
string
Returns string plaintext password
FunctionDecl
Type: Object
Properties
extractFunctions
Extract shell functions from a given text.
Parameters
source
AsyncIterable<string>
Returns AsyncIterable<FunctionDecl>
fieldProvider
Parameters
Returns Function
Expander
Type: Function
Parameters
path
string
Returns string
copyEntries
Copy content from source into destinationDirectory. Destination paths a generated without leading '/' (as for entry names too).
Parameters
source
AsyncIterable<ContentEntry>destinationDirectory
stringexpander
Expander (optional, defaultv=>v
)
NFTContentProvider
Extends ContentProvider
Content provided form the file system.
Parameters
entryProperties
name
Returns string name of the content provider
NodeModulesContentProvider
Extends ContentProvider
Content from node_modules. Requires .npmrc or NPM_TOKEN environment
Parameters
definitions
entryProperties
Properties
name
Returns string name of the content provider
NPMPackContentProvider
Extends ContentProvider
Content from npm pack.
Parameters
Properties
dir
string
name
Returns string name of the content provider
pkgKeyValuePairOptions
Type: Object
fields
well known package properties https://www.archlinux.org/pacman/PKGBUILD.5.html
fields
- See: https://www.debian.org/doc/debian-policy/ch-controlfields.html
- See: https://linux.die.net/man/5/deb-control
fields
fields
BUILDAH
Extends DOCKER
Use buildah @see https://buildah.io
hookMapping
map install hook named from arch to deb
hookMapping
map install hook named from arch to rpm
DEBIAN
Extends Packager
Create .deb packages
prepare
Parameters
DOCKER
Extends Packager
docker image build
prepare
Check for docker presence.
Parameters
Returns Promise<boolean> true when docker executable is present
OCI
Extends Packager
Low level OCI compatible packager
Packager
Parameters
properties
packageName
What is the package name in the package eco-system.
Parameters
name
string
Returns string package name in the target eco-system
tmpdir
Create tmp directory.
Returns Promise<string> directory path
prepare
Prepares artifact generation
Parameters
Returns Promise<{properties: Object, destination: string, tmpdir: string, staging: string}>
create
Execute package generation.
Parameters
sources
Objecttransformer
Array<Object>dependencies
ObjectpublishingDetails
Array<PublishingDetail>options
Objectexpander
function (string): string
Returns Promise<string> identifier of the resulting package
workspaceLayout
Returns {named: object, others: []}
prepare
Parameters
Packager
Base Packager
Parameters
properties
Object
packageName
What is the package name in the package eco-system.
Parameters
name
string
Returns string package name in the target eco-system
tmpdir
Create tmp directory.
Returns Promise<string> directory path
prepare
Prepares artifact generation
Parameters
Returns Promise<{properties: Object, destination: string, tmpdir: string, staging: string}>
create
Execute package generation.
Parameters
sources
Objecttransformer
Array<Object>dependencies
ObjectpublishingDetails
Array<PublishingDetail>options
Objectexpander
function (string): string
Returns Promise<string> identifier of the resulting package
workspaceLayout
Returns {named: object, others: []}
prepare
Parameters
Field
Type: Object
Properties
PublishingDetail
Type: Object
Properties
createPublishingDetails
Parameters
properties
Object?
Returns Array<PublishingDetail>
publish
Parameters
artifactIdentifier
stringpublishingDetail
PublishingDetail?properties
Object?logger
function (any): void (optional, defaultconsole.log
)
quoteFile
Parameters
name
RPM
Extends Packager
produce rpm packages
prepare
Check for rpmbuild presence.
Parameters
Returns Promise<boolean> true when rpmbuild executable is present
install
With npm do:
npm install npm-pkgbuild
license
BSD-2-Clause