diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..a02904c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,43 @@ +version: 2 +jobs: + build: + docker: + - image: circleci/node:6.10 + steps: + - checkout + - restore_cache: + key: speedy-{{ .Branch }}-{{ checksum "package.json" }} + - run: + name: Installing npm packages + command: npm install + - run: + name: Build + command: npm run build + - save_cache: + key: speedy-{{ .Branch }}-{{ checksum "package.json" }} + paths: + - node_modules + test: + docker: + - image: circleci/node:6.10 + steps: + - checkout + - restore_cache: + key: speedy-{{ .Branch }}-{{ checksum "package.json" }} + - run: + name: Installing npm packages + command: npm install + - run: + name: Test + command: npm t + - save_cache: + key: speedy-{{ .Branch }}-{{ checksum "package.json" }} + paths: + - node_modules + +workflows: + version: 2 + default_workflow: + jobs: + - build + - test \ No newline at end of file diff --git a/.npmignore b/.npmignore index 4ce06b0..970fd38 100644 --- a/.npmignore +++ b/.npmignore @@ -7,6 +7,7 @@ node_modules /test /tsconfig.json /tslint.json +/.circleci .npmignore .editorconfig diff --git a/CHANGELOG.md b/CHANGELOG.md index ba0b6bf..103def2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ + +## [1.1.1](https://github.com/alan-agius4/speedy-json-extends/compare/v1.1.0...v1.1.1) (2017-04-02) + + + # [1.1.0](https://github.com/alan-agius4/speedy-json-extends/compare/v1.0.2...v1.1.0) (2017-04-01) diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 5d95fff..0000000 --- a/circle.yml +++ /dev/null @@ -1,11 +0,0 @@ -machine: - node: - version: 6.9.5 - post: - - npm install -g npm@3.x.x -compile: - override: - - npm run build -test: - override: - - npm run test \ No newline at end of file diff --git a/package.json b/package.json index 2e6e166..89bd789 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@speedy/json-extends", - "version": "1.1.1", + "version": "1.2.0", "description": "Extend a JSON file with one or many existing files.", "main": "./dist/json.js", "repository": { @@ -40,7 +40,7 @@ "@types/jasmine": "^2.5.41", "@types/lodash": "^4.14.51", "@types/mock-fs": "^3.6.30", - "@types/node": "^7.0.5", + "@types/node": "^8.0.31", "conventional-changelog-cli": "^1.3.1", "jasmine": "^2.5.3", "mock-fs": "^4.1.0", diff --git a/src/json.spec.ts b/src/json.spec.ts index 866eb1d..444048f 100644 --- a/src/json.spec.ts +++ b/src/json.spec.ts @@ -29,7 +29,7 @@ describe("jsonSpec", () => { }; const PRIMARY_EXTEND_FILE = { - extends: "./config/secondary-extend.json", + extends: "./secondary-extend.json", rules: { message: { minLength: 1, @@ -105,7 +105,7 @@ describe("jsonSpec", () => { }); }); - describe("and have nested extends", () => { + fdescribe("and have nested extends", () => { it("should merge properties of nested json", async done => { const result = await json.read("speedy-commit-msg-hook.json"); expect(result.rules.message.noDashes).toBe(true); diff --git a/src/json.ts b/src/json.ts index 4ce9322..465c02b 100644 --- a/src/json.ts +++ b/src/json.ts @@ -1,5 +1,6 @@ import * as _ from "lodash"; import * as fs from "fs"; +import { resolve, dirname } from "path"; export namespace json { @@ -63,9 +64,9 @@ export namespace json { } } - contentUnmerged.push(readSync(path, namedExtends)); + contentUnmerged.push(readSync(resolve(dirname(filePath), path), namedExtends)); } - return _.merge({}, ...contentUnmerged, content); + return _.merge({}, ...contentUnmerged, content); } } \ No newline at end of file