Skip to content

Commit

Permalink
Published 1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip Gates-Idem committed Feb 16, 2018
1 parent fa7cfa3 commit f57e313
Show file tree
Hide file tree
Showing 7 changed files with 424 additions and 125 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"env": {
"test": {
"plugins": [ "istanbul" ],
"sourceMaps": "inline"
}
}
}
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Terraform Plan Parser

[![Greenkeeper badge](https://badges.greenkeeper.io/lifeomic/terraform-plan-parser.svg)](https://greenkeeper.io/)

[![Build Status](https://travis-ci.org/lifeomic/terraform-plan-parser.svg?branch=master)](https://travis-ci.org/lifeomic/terraform-plan-parser)

[![Coverage Status](https://coveralls.io/repos/github/lifeomic/terraform-plan-parser/badge.svg?branch=master)](https://coveralls.io/github/lifeomic/terraform-plan-parser?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/lifeomic/terraform-plan-parser.svg)](https://greenkeeper.io/) [![Build Status](https://travis-ci.org/lifeomic/terraform-plan-parser.svg?branch=master)](https://travis-ci.org/lifeomic/terraform-plan-parser) [![Coverage Status](https://coveralls.io/repos/github/lifeomic/terraform-plan-parser/badge.svg?branch=master)](https://coveralls.io/github/lifeomic/terraform-plan-parser?branch=master) [![npm version](https://badge.fury.io/js/terraform-plan-parser.svg)](https://badge.fury.io/js/terraform-plan-parser)

This project provides a CLI and JavaScript API for parsing terraform
plan output.
Expand Down Expand Up @@ -49,6 +45,16 @@ npm install terraform-plan-parser
yarn add terraform-plan-parser
```

**IMPORTANT:**

This project requires [Node v8.9.0 (LTS)](https://nodejs.org/en/blog/release/v8.9.0/)
or newer because the source code utilizes language features such as
`async` / `await`. If you are using an unsupported version of Node then you
will see `SyntaxError: Unexpected token function`. It's possible to use
`babel` to transpile the code for older versions of the Node runtime.
The [babel-preset-env](https://github.com/babel/babel/tree/master/packages/babel-preset-env)
is a good package for supporting this.

### Parse string that contains stdout logs from terraform plan

```javascript
Expand Down
33 changes: 24 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "terraform-plan-parser",
"version": "1.0.8",
"version": "1.0.9",
"description": "This module provides functionality for parsing stdout from \"terraform plan\" and converting it to JSON that can be more easily analyzed.",
"repository": {
"type": "git",
Expand All @@ -11,18 +11,23 @@
"main": "./work/dist/src/",
"module": "./work/dist/es6/src/",
"jsnext:main": "./work/dist/esnext/src/",
"types": "./work/dist/src/index.d.ts",
"bin": {
"parse-terraform-plan": "./work/dist/src/cli.js"
},
"scripts": {
"compile-src-cjs": "tsc -p tsconfig-src-cjs.json",
"compile-src-cjs": "tsc --declaration --declarationDir ./work/dist -p tsconfig-src-cjs.json",
"compile-src-es6": "tsc -p tsconfig-src-es6.json",
"compile-src-esnext": "tsc -p tsconfig-src-esnext.json",
"compile-src": "rm -rf ./work/dist && yarn compile-src-cjs && yarn compile-src-es6 && yarn compile-src-esnext && chmod +x ./work/dist/src/cli.js",
"compile-test": "rm -rf ./work/dist-test && tsc -p tsconfig-test.json && cp -r test/unit/data ./work/dist-test/test/unit/",
"precompile-src": "rm -rf ./work/dist",
"compile-src": "yarn compile-src-cjs && yarn compile-src-es6 && yarn compile-src-esnext",
"transpile-test-js": "BABEL_ENV=test babel work/dist-test --out-dir work/dist-test --source-maps",
"precompile-test": "rm -rf ./work/dist-test",
"compile-test": "tsc -p tsconfig-test.json && yarn transpile-test-js",
"postcompile-test": "cp -r test/unit/data ./work/dist-test/test/unit/",
"lint": "tslint --format codeFrame --project tsconfig.json 'src/**/*.ts' 'test/**/*.ts'",
"pretest": "yarn lint && yarn compile-test",
"test": "nyc ava 'work/dist-test/test/unit/**/*.test.js'",
"test": "BABEL_ENV=test nyc ava 'work/dist-test/test/**/*.test.js'",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"prebuild": "yarn test",
"build": "yarn compile-src && ./tools/bin/postbuild",
Expand All @@ -35,15 +40,25 @@
"yargs": "^11.0.0"
},
"devDependencies": {
"@types/node": "^9.3.0",
"@types/node": "^9.4.6",
"ava": "^0.25.0",
"chalk": "^2.3.0",
"babel-cli": "^6.26.0",
"babel-plugin-istanbul": "^4.1.5",
"chalk": "^2.3.1",
"coveralls": "^3.0.0",
"nyc": "^11.4.1",
"proxyquire": "^1.8.0",
"resolve": "^1.5.0",
"tslint": "^5.9.1",
"tslint-config-semistandard": "^7.0.0",
"typescript": "^2.6.2"
"typescript": "^2.7.2"
},
"ava": {
"require": [
"source-map-support/register"
]
},
"nyc": {
"sourceMap": false,
"instrument": false
}
}
13 changes: 3 additions & 10 deletions tools/bin/postbuild
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,17 @@ function rewritePackageJsonPaths (obj, keys) {
}

async function run () {
await spawn('cp', ['-r', 'LICENSE', 'index.d.ts', 'src', `${DIST_DIR}/`], { cwd: ROOT_DIR });
await spawn('cp', ['-r', 'LICENSE', 'src', `${DIST_DIR}/`], { cwd: ROOT_DIR });

const packageObj = await readJsonFile(ROOT_PACKAGE_JSON_FILE);

// Remove some properties that we don't need from package.json
for (const key of [
'devDependencies',
'scripts'
]) {
delete packageObj[key];
}

// Fix some of the paths
rewritePackageJsonPaths(packageObj.bin);
rewritePackageJsonPaths(packageObj, [
'main',
'module',
'jsnext:main'
'jsnext:main',
'types'
]);

await writeJsonFile(DIST_PACKAGE_JSON_FILE, packageObj);
Expand Down
4 changes: 3 additions & 1 deletion tsconfig-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./work/dist-test",
"module": "CommonJS"
"module": "CommonJS",
"inlineSourceMap": true,
"inlineSources": true
},
"include": [
"test/**/*"
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
"rootDir": ".",
"baseUrl": ".",
"outDir": "./work/dist",
"noUnusedLocals": true,
"allowSyntheticDefaultImports": false,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"allowJs": true,
"allowJs": false,
"moduleResolution": "node",
"module": "ES6",
"target": "ESNext",
"pretty": true,
"inlineSourceMap": false,
"inlineSources": false,
"paths": {
"~/*": ["./*"]
}
Expand Down

0 comments on commit f57e313

Please sign in to comment.