npm-pkgbuild
Version:
create ArchLinux, RPM and Debian packages from npm packages
77 lines (76 loc) • 2.58 kB
text/typescript
/**
* @typedef {Object} PackageDefinition
* @property {Object} properties values describing the package attributes
* @property {Object} properties.dependencies
* @property {ContentProvider[]} sources content providers
* @property {Object} output package type
* @property {Object} variant identifier of the variant
* @property {string} variant.name name of the variant
* @property {string} variant.arch name of the architecture
*/
/**
* 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
* @param {Object} options
* @param {string} [options.dir] where to look for package.json
* @param {boolean} [options.verbose] log
* @param {Object} env as delared in process.env
* @returns {AsyncIterable<PackageDefinition>}
*/
export function extractFromPackage(options?: {
dir?: string;
verbose?: boolean;
}, env?: any): AsyncIterable<PackageDefinition>;
/**
* All content providers (input)
*/
export const allInputs: (typeof NPMPackContentProvider | typeof NodeModulesContentProvider | typeof FileContentProvider | typeof NFTContentProvider)[];
/**
* All output formats
*/
export const allOutputs: (typeof OCI | typeof DOCKER)[];
export namespace npmArchMapping {
let arm64: string;
let arm: string;
let mips: string;
let mipsel: string;
let ppc: string;
let s390: string;
let s390x: string;
let ia32: string;
let x64: string;
let ppc64: string;
}
export type PackageDefinition = {
/**
* values describing the package attributes
*/
properties: {
dependencies: any;
};
/**
* content providers
*/
sources: ContentProvider[];
/**
* package type
*/
output: any;
/**
* identifier of the variant
*/
variant: {
name: string;
arch: string;
};
};
import { NPMPackContentProvider } from "./content/npm-pack-content-provider.mjs";
import { NodeModulesContentProvider } from "./content/node-modules-content-provider.mjs";
import { FileContentProvider } from "./content/file-content-provider.mjs";
import { NFTContentProvider } from "./content/nft-content-provider.mjs";
import { OCI } from "./output/oci.mjs";
import { DOCKER } from "./output/docker.mjs";
import { ContentProvider } from "./content/content-provider.mjs";