Skip to content

Commit

Permalink
prettierx refactor: read prettier version from package.json
Browse files Browse the repository at this point in the history
(in prettierx-rebase-branch-001 version branch)

as proposed in:

- #569
- #603

Co-authored-by: Adaline Valentina Simonian <[email protected]>
Co-authored-by: Christopher J. Brody <[email protected]>
  • Loading branch information
Christopher J. Brody and adalinesimonian committed Jun 28, 2021
1 parent fda5ec1 commit f7ede4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "prettierx-rebase-branch-001",
"version": "0.1.0-dev",
"prettier-version": "2.4.0",
"description": "prettierx-rebase-branch-001 version branch",
"bin": "./bin/prettier.js",
"license": "MIT",
Expand Down
6 changes: 4 additions & 2 deletions src/main/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ const semver = {
gte: require("semver/functions/gte"),
};
const arrayify = require("../utils/arrayify");
// [prettierx] read info from package.json:
const pkg = require("../../package.json");
const coreOptions = require("./core-options").options;

// [prettierx] quick workaround:
const currentVersion = "2.2.0";
// [prettierx] get info from package.json:
const currentVersion = pkg["prettier-version"];

/**
* Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version
Expand Down

0 comments on commit f7ede4b

Please sign in to comment.