From fde53d1eab7abc5e5b481164cd06ce8fcb7cff06 Mon Sep 17 00:00:00 2001 From: Tatsuya Yamamoto / T28_tatsuya Date: Fri, 28 Apr 2023 09:21:36 +0900 Subject: [PATCH] Add exported meta object (#190) * add meta object * fix: lint error * fix: fix path and write comment * chore: add plugin * set version with replacing --- package.json | 1 + rollup.config.js | 9 ++++++++- src/index.ts | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) 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", 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 bf582c2f..20a067fd 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 no-process-env + version: process.env.PACKAGE_VERSION, +}