mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-08-15 11:55:49 +08:00
build: move to esm (wip)
This commit is contained in:
@ -71,7 +71,12 @@ const builds = [
|
||||
sourcemap: true
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
export default [
|
||||
...builds.map(options => configBuild(options, false)),
|
||||
...builds.map(options => configBuild(options, true)),
|
||||
{
|
||||
input: "src/index.ts",
|
||||
plugins: [
|
||||
@ -90,8 +95,3 @@ const builds = [
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
export default [
|
||||
...builds.map(options => configBuild(options, false)),
|
||||
...builds.map(options => configBuild(options, true))
|
||||
];
|
||||
|
@ -1,15 +1,8 @@
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import commentMark from "comment-mark";
|
||||
import { getPackageMeta, resolvePath } from "./utils";
|
||||
|
||||
function resolvePath(...parts) {
|
||||
return resolve(dirname(fileURLToPath(import.meta.url)), ...parts);
|
||||
}
|
||||
|
||||
const { name, version } = JSON.parse(
|
||||
readFileSync(resolvePath("..", "package.json"), "utf8")
|
||||
);
|
||||
const { name, version } = getPackageMeta();
|
||||
|
||||
const CDN_PREFIX = "https://cdn.jsdelivr.net/npm/";
|
||||
|
||||
@ -45,7 +38,7 @@ const scripts = {
|
||||
};
|
||||
|
||||
const README_FILES = ["README.md", "README.zh-Hans.md"].map(name =>
|
||||
resolvePath("..", name)
|
||||
resolvePath(import.meta.url, "..", name)
|
||||
);
|
||||
|
||||
README_FILES.forEach(file => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
import { resolvePath } from "./utils.js";
|
||||
|
||||
const packageFile = path.resolve(__dirname, "../package.json");
|
||||
const packageFile = resolvePath(import.meta.url, "../package.json");
|
||||
|
||||
const typesPaths = {
|
||||
3: "dist/index.d.ts",
|
||||
|
13
scripts/utils.js
Normal file
13
scripts/utils.js
Normal file
@ -0,0 +1,13 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
export function resolvePath(url, ...parts) {
|
||||
return resolve(dirname(fileURLToPath(url)), ...parts);
|
||||
}
|
||||
|
||||
export function getPackageMeta() {
|
||||
return JSON.parse(
|
||||
readFileSync(resolvePath(import.meta.url, "/package.json"), "utf8")
|
||||
);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import { init } from "echarts/core";
|
||||
import type { Ref } from "vue";
|
||||
import type { Ref } from "vue-demi";
|
||||
import type { SetOptionOpts, ECElementEvent, ElementEvent } from "echarts";
|
||||
|
||||
export type Injection<T> = T | null | Ref<T | null> | { value: T | null };
|
||||
|
Reference in New Issue
Block a user