mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
26 lines
469 B
TypeScript
26 lines
469 B
TypeScript
import { parse, CommandEntry, ParseOptions } from 'docker-file-parser';
|
|
|
|
const file = `
|
|
FROM node:8
|
|
|
|
ADD . /opt/
|
|
WORKDIR /opt
|
|
|
|
RUN npm install --production
|
|
|
|
EXPOSE 8080
|
|
VOLUME /opt/scripts
|
|
|
|
CMD ["npm", "start"]
|
|
`;
|
|
|
|
const options: ParseOptions = {
|
|
includeComments: false
|
|
};
|
|
|
|
const result: CommandEntry[] = parse(file, options);
|
|
const line1Name = result[0].name;
|
|
const line1Number = result[0].lineno;
|
|
const line1Args = result[0].args;
|
|
const line1Raw = result[0].raw;
|