Skip to content

Commit

Permalink
config: add check version scripts (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
danstarns authored Apr 6, 2021
1 parent 146d793 commit 29cdd2a
Show file tree
Hide file tree
Showing 6 changed files with 395 additions and 11 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"test": "jest",
"test:pr": "run-s lint test",
"neo-push": "concurrently \"yarn workspace neo-push-server start\" \"yarn workspace neo-push-client start\"",
"neo-push:seed": "yarn workspace neo-push-server run seed"
"neo-push:seed": "yarn workspace neo-push-server run seed",
"conditional-publish": "yarn workspaces foreach --include \"@neo4j/*\" run conditional-publish"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "4.1.1",
Expand Down
5 changes: 4 additions & 1 deletion packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"build": "tsc --project src/",
"build:clean": "run-s clean build",
"watch": "tsc -w",
"start": "run-s build:clean watch"
"start": "run-s build:clean watch",
"conditional-publish": "(node ./scripts/check-version.js && npm publish --access=public) ; exit 0"
},
"author": "Neo4j Inc.",
"peerDependencies": {
Expand All @@ -59,10 +60,12 @@
"graphql-tag": "2.11.0",
"is-uuid": "1.0.2",
"jest": "26.2.2",
"libnpmsearch": "3.1.0",
"neo4j-driver": "4.2.0",
"npm-run-all": "4.1.5",
"randomstring": "1.1.5",
"rimraf": "3.0.2",
"semver": "7.3.5",
"ts-jest": "26.1.4",
"typescript": "3.9.7"
},
Expand Down
19 changes: 19 additions & 0 deletions packages/graphql/scripts/check-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const search = require("libnpmsearch");
const semver = require("semver");
const packageJSON = require("../package.json");

search(packageJSON.name).then((data) => {
const current = data.find((x) => x.name === packageJSON.name);

if (!current) {
return;
}

const newVersion = packageJSON.version;

const isGreater = semver.gt(newVersion, current.version);

if (!isGreater) {
process.exit(1);
}
});
5 changes: 4 additions & 1 deletion packages/ogm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"test:unit": "jest src/**/*.test.ts",
"test:unit:watch": "test:unit -- --watch",
"test:int": "jest tests/integration",
"test:int:watch": "test:int -- --watch"
"test:int:watch": "test:int -- --watch",
"conditional-publish": "(node ./scripts/check-version.js && npm publish --access=public) ; exit 0"
},
"author": "Neo4j Inc.",
"dependencies": {
Expand All @@ -45,8 +46,10 @@
"@types/node": "14.0.27",
"graphql-tag": "2.11.0",
"jest": "26.2.2",
"libnpmsearch": "3.1.0",
"npm-run-all": "^4.1.5",
"randomstring": "1.1.5",
"semver": "7.3.5",
"ts-jest": "26.1.4",
"typescript": "3.9.7"
}
Expand Down
19 changes: 19 additions & 0 deletions packages/ogm/scripts/check-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const search = require("libnpmsearch");
const semver = require("semver");
const packageJSON = require("../package.json");

search(packageJSON.name).then((data) => {
const current = data.find((x) => x.name === packageJSON.name);

if (!current) {
return;
}

const newVersion = packageJSON.version;

const isGreater = semver.gt(newVersion, current.version);

if (!isGreater) {
process.exit(1);
}
});
Loading

0 comments on commit 29cdd2a

Please sign in to comment.