Create ArchLinux, RPM, Debian and Docker packages from npm packages.
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.
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" }
}
}
Defining where the package content should come from.
content from the file system
content as provided by npm pack
content of all (production) dependencies
options: - withoutDevelpmentDependencies when to stip away dev dependencies (defaults to true)
You can import common configuration from other packages. See mf-hosting or mf-hosting-frontend modules.
- allInputs
- allOutputs
- npmArchMapping
- content2Sources
- PackageDefinition
- extractFromPackage
- NPMPackContentProvider
- NodeModulesContentProvider
- FileContentProvider
- NFTContentProvider
- ContentProvider
- DEBIAN
- fields
- fields
- fields
- fields
- pkgKeyValuePairOptions
- quoteFile
- RPM
- OCI
- DOCKER
- BUILDAH
- Packager
- Packager
- Field
- copyNodeModules
- PublishingDetail
- createPublishingDetails
- publish
- utf8StreamOptions
- decodePassword
- FunctionDecl
- extractFunctions
- fieldProvider
- Expander
- copyEntries
All content providers (input)
All output formats
Node architecture name to os native arch name mapping {@see https://nodejs.org/dist/latest-v18.x/docs/api/process.html#processargv}
Delivers ContentProviders from pkgbuild.content definition.
-
content
Object from pkgbuild.content -
dir
Returns Iterable<ContentProvider>
Type: Object
-
properties
Object values describing the package attributes-
properties.dependencies
Object
-
-
sources
Array<ContentProvider> content providers -
output
Object package type -
variant
Object identifier of the variant
Extract package definition from package.json.
- for each architecture deliver a new result
- if no architecture is given one result set is provided nethertheless
- architectures are taken from cpu (node arch ids) and from pkgbuild.arch (raw arch ids)
- architecture given in a variant definition are used to restrict the set of avaliable architectures
Returns AsyncIterable<PackageDefinition>
Extends ContentProvider
Content from npm pack.
-
dir
string
Returns string name of the content provider
Extends ContentProvider
Content from node_modules. Requires .npmrc or NPM_TOKEN environment
-
definitions
-
entryProperties
-
directoryProperties
-
withoutDevelpmentDependencies
boolean
Returns string name of the content provider
Extends ContentProvider
Content provided form the file system.
-
entryProperties
-
directoryProperties
Returns AsyncIterable<ContentEntry> all entries
Returns string name of the content provider
Extends ContentProvider
Content provided form the file system.
-
entryProperties
-
directoryProperties
Returns AsyncIterable<ContentEntry> all entries
Returns string name of the content provider
Source of package content.
-
definitions
-
entryProperties
-
directoryProperties
List all entries.
Returns AsyncIterable<ContentEntry> all entries
Extends Packager
Create .deb packages
Map install hook named from default (arch) to deb.
- See: https://www.debian.org/doc/debian-policy/ch-controlfields.html
- See: https://linux.die.net/man/5/deb-control
well known package properties https://www.archlinux.org/pacman/PKGBUILD.5.html
Type: Object
-
name
Extends Packager
Produce rpm packages.
Map install hook named from default (arch) to rpm.
Check for rpmbuild presence.
Returns Promise<boolean> true when rpmbuild executable is present
Extends Packager
Low level OCI compatible packager
Extends Packager
docker image build
Check for docker presence.
Returns Promise<boolean> true when docker executable is present
Extends DOCKER
Use buildah @see https://buildah.io
-
properties
What is the package name in the package eco-system.
-
name
string
Returns string package name in the target eco-system
Create tmp directory.
Returns Promise<string> directory path
Prepares artifact generation.
Returns Promise<{properties: Object, destination: string, tmpdir: string, staging: string}>
Execute package generation.
-
sources
Object -
transformer
Array<Object> -
publishingDetails
Array<PublishingDetail> -
options
Object -
expander
function (string): string?
Returns Promise<string> identifier of the resulting package
Returns {named: object, others: Array<string>}
Base Packager
-
properties
Object
What is the package name in the package eco-system.
-
name
string
Returns string package name in the target eco-system
Create tmp directory.
Returns Promise<string> directory path
Prepares artifact generation.
Returns Promise<{properties: Object, destination: string, tmpdir: string, staging: string}>
Execute package generation.
-
sources
Object -
transformer
Array<Object> -
publishingDetails
Array<PublishingDetail> -
options
Object -
expander
function (string): string?
Returns Promise<string> identifier of the resulting package
Returns {named: object, others: Array<string>}
Type: Object
Type: Object
-
properties
Object?
Returns Array<PublishingDetail>
-
artifactIdentifier
string -
publishingDetail
PublishingDetail? -
properties
Object? -
logger
function (any): void (optional, defaultconsole.log
)
Type: BufferEncoding
Decode a password
-
password
string
Returns string plaintext password
Type: Object
Extract shell functions from a given text.
-
source
AsyncIterable<string>
Returns AsyncIterable<FunctionDecl>
Returns Function
Type: Function
-
path
string
Returns string
Copy content from source into destinationDirectory. Destination paths a generated without leading '/' (as for entry names too).
-
source
AsyncIterable<ContentEntry> -
destinationDirectory
string -
expander
Expander (optional, defaultv=>v
)
With npm do:
npm install npm-pkgbuild
BSD-2-Clause