@atomist/sdm-pack-spring
Version:
Atomist software delivery machine extension pack for Spring and Spring Boot applications
60 lines (59 loc) • 1.61 kB
TypeScript
import { Project } from "@atomist/automation-client";
import { CodeTransform } from "@atomist/sdm";
/**
* File of updatable properties. Change keys or values and call flush() to write out any changes.
*/
export interface PropertiesFile {
/**
* Path to the file in the project
*/
path: string;
/**
* Return the properties as an indexed properties object.
* Objects will be mutable.
*/
obj: {
[key: string]: string;
};
/**
* Updatable properties
*/
properties: Property[];
/**
* Add a property to the end of the file, or changes it if
* it already exists
* @param {Property} prop
*/
addProperty(prop: Property): Promise<void>;
/**
* Flush changes
* @return {Promise<void>}
*/
flush(): Promise<void>;
}
/**
* Properties are updatable
*/
export interface Property {
key: string;
value: string;
comment?: string;
}
/**
* Parse the given file within the project, returning updatable properties
* @param {Project} p
* @param {string} path
* @return {Promise<PropertiesFile>}
*/
export declare function parseProperties(p: Project, path: string): Promise<PropertiesFile>;
export declare function propertiesObject(p: Project, path: string): Promise<{
[key: string]: string;
}>;
/**
* Code transform to add the property to the given file,
* creating it if it doesn't exist. Updates any existing property.
* @param {Property} prop
* @param {string} path
* @return {CodeTransform}
*/
export declare function addProperty(prop: Property, path: string): CodeTransform;