From fcae724f9bd61dad3a78303f5fb607b422f4b484 Mon Sep 17 00:00:00 2001 From: TatsuyaYamamoto Date: Wed, 26 Apr 2023 23:10:36 +0900 Subject: [PATCH 1/5] add meta object --- src/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.ts b/src/index.ts index bf582c2f..86b3d1a6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -208,3 +208,9 @@ function parseAsScript(code: string, options: ParserOptions) { }), }) } + +export const meta = { + name: "vue-eslint-parser", + // eslint-disable-next-line @typescript-eslint/no-require-imports + version: require("../package.json"), +}; From 4144baa6be37dcf45ed103e27b2b2b0f8ca9ab44 Mon Sep 17 00:00:00 2001 From: TatsuyaYamamoto Date: Wed, 26 Apr 2023 23:12:17 +0900 Subject: [PATCH 2/5] fix: lint error --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 86b3d1a6..a69c1331 100644 --- a/src/index.ts +++ b/src/index.ts @@ -213,4 +213,4 @@ export const meta = { name: "vue-eslint-parser", // eslint-disable-next-line @typescript-eslint/no-require-imports version: require("../package.json"), -}; +} From 0dc56977889e97e74bade4bdafa8c24320620bcd Mon Sep 17 00:00:00 2001 From: TatsuyaYamamoto Date: Wed, 26 Apr 2023 23:20:39 +0900 Subject: [PATCH 3/5] fix: fix path and write comment --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index a69c1331..3d455763 100644 --- a/src/index.ts +++ b/src/index.ts @@ -211,6 +211,7 @@ function parseAsScript(code: string, options: ParserOptions) { export const meta = { name: "vue-eslint-parser", + // Bundled index.js is output to the same package root directory as package.json // eslint-disable-next-line @typescript-eslint/no-require-imports - version: require("../package.json"), + version: require("./package.json").version, } From ee4615970cdca6ab85cdb95291e94c6b95c9da8d Mon Sep 17 00:00:00 2001 From: TatsuyaYamamoto Date: Fri, 28 Apr 2023 01:35:01 +0900 Subject: [PATCH 4/5] chore: add plugin --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 7fef57b5..e4375340 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "rimraf": "^3.0.2", "rollup": "^2.60.0", "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-replace": "^2.2.0", "rollup-plugin-sourcemaps": "^0.6.3", "ts-node": "^10.4.0", "typescript": "~4.8.4", From 3e638888fcfddfff1fe86b465b4071fc421425a4 Mon Sep 17 00:00:00 2001 From: TatsuyaYamamoto Date: Fri, 28 Apr 2023 01:35:17 +0900 Subject: [PATCH 5/5] set version with replacing --- rollup.config.js | 9 ++++++++- src/index.ts | 5 ++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index ccd8c5ff..fef6483f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -5,6 +5,7 @@ */ import resolve from "rollup-plugin-node-resolve" import sourcemaps from "rollup-plugin-sourcemaps" +import replace from "rollup-plugin-replace" const pkg = require("./package.json") const deps = new Set( @@ -23,6 +24,12 @@ export default { * See LICENSE file in root directory for full license. */`, }, - plugins: [sourcemaps(), resolve()], + plugins: [ + sourcemaps(), + resolve(), + replace({ + "process.env.PACKAGE_VERSION": `"${pkg.version}"`, + }), + ], external: id => deps.has(id) || id.startsWith("lodash"), } diff --git a/src/index.ts b/src/index.ts index 3d455763..20a067fd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -211,7 +211,6 @@ function parseAsScript(code: string, options: ParserOptions) { export const meta = { name: "vue-eslint-parser", - // Bundled index.js is output to the same package root directory as package.json - // eslint-disable-next-line @typescript-eslint/no-require-imports - version: require("./package.json").version, + // eslint-disable-next-line no-process-env + version: process.env.PACKAGE_VERSION, }