@eodash/eodash 5.0.0-alpha.1 → 5.0.0-alpha.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +3 -4
- package/bin/serverConfig.js +7 -3
- package/bin/update.js +3 -5
- package/bin/utils.js +11 -6
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { build, createServer, preview } from "vite"
|
|
4
|
-
import {
|
|
4
|
+
import { rootPath, appPath, buildTargetPath, appPublicPath } from "./utils.js";
|
|
5
5
|
import { writeFile, rm, cp } from "fs/promises";
|
|
6
6
|
import { update } from "./update.js";
|
|
7
7
|
import { indexHtml, serverConfig } from "./serverConfig.js";
|
|
@@ -25,7 +25,6 @@ export const buildApp = async () => {
|
|
|
25
25
|
await rm(htmlPath).catch(() => {
|
|
26
26
|
console.error('failed to remove index.html')
|
|
27
27
|
})
|
|
28
|
-
const appPublicPath = path.join(appPath, './public')
|
|
29
28
|
if (appPath.includes('node_modules') && existsSync(appPublicPath)) {
|
|
30
29
|
await rm(appPublicPath, { recursive: true }).catch((e) => {
|
|
31
30
|
console.error(e)
|
|
@@ -34,7 +33,7 @@ export const buildApp = async () => {
|
|
|
34
33
|
})
|
|
35
34
|
|
|
36
35
|
if (appPath.includes('node_modules')) {
|
|
37
|
-
await cp(appPath
|
|
36
|
+
await cp(path.join(appPath, 'dist'), buildTargetPath, { recursive: true }).then(() => {
|
|
38
37
|
console.info('dashboard built successfully')
|
|
39
38
|
}).catch((e) => {
|
|
40
39
|
console.error(e)
|
|
@@ -45,7 +44,7 @@ export const buildApp = async () => {
|
|
|
45
44
|
|
|
46
45
|
export async function previewApp() {
|
|
47
46
|
const previewServer = await preview({
|
|
48
|
-
root:
|
|
47
|
+
root: rootPath,
|
|
49
48
|
preview: {
|
|
50
49
|
port: 8080,
|
|
51
50
|
open: true,
|
package/bin/serverConfig.js
CHANGED
|
@@ -6,7 +6,11 @@ import vue from '@vitejs/plugin-vue';
|
|
|
6
6
|
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
|
|
7
7
|
import virtual, { updateVirtualModule } from 'vite-plugin-virtual'
|
|
8
8
|
import { fileURLToPath, URL } from 'url';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
runtimeConfigPath,
|
|
11
|
+
appPath, compiletimeConfigPath,
|
|
12
|
+
appPublicPath, cachePath, rootPublicPath
|
|
13
|
+
} from "./utils.js";
|
|
10
14
|
import { readFile } from "fs/promises";
|
|
11
15
|
import { defineConfig, searchForWorkspaceRoot } from "vite"
|
|
12
16
|
import { getUserModules } from './utils.js';
|
|
@@ -37,7 +41,7 @@ let virtualPlugin = null;
|
|
|
37
41
|
export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(defineConfig(async ({ mode, command }) => {
|
|
38
42
|
return {
|
|
39
43
|
base: '',
|
|
40
|
-
cacheDir:
|
|
44
|
+
cacheDir: cachePath,
|
|
41
45
|
plugins: [
|
|
42
46
|
vue({
|
|
43
47
|
template: {
|
|
@@ -77,7 +81,7 @@ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(def
|
|
|
77
81
|
include: ["webfontloader", "vuetify", "vue", "pinia"],
|
|
78
82
|
noDiscovery: true,
|
|
79
83
|
} : {},
|
|
80
|
-
publicDir: command === 'build' ?
|
|
84
|
+
publicDir: command === 'build' ? appPublicPath : rootPublicPath,
|
|
81
85
|
build: {
|
|
82
86
|
outDir: 'dist',
|
|
83
87
|
rollupOptions: {
|
package/bin/update.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { cp } from "fs/promises";
|
|
2
|
-
import {
|
|
2
|
+
import { rootPublicPath, appPath, runtimeConfigPath, appPublicPath } from "./utils.js";
|
|
3
3
|
import { existsSync } from "fs";
|
|
4
4
|
import path from "path";
|
|
5
5
|
|
|
6
6
|
export async function update() {
|
|
7
|
-
|
|
8
|
-
appPublicPath
|
|
9
|
-
if (execPublicPath !== appPublicPath) {
|
|
10
|
-
await cp(execPublicPath, appPublicPath, { recursive: true }).catch(err => {
|
|
7
|
+
if (rootPublicPath !== appPublicPath) {
|
|
8
|
+
await cp(rootPublicPath, appPublicPath, { recursive: true }).catch(err => {
|
|
11
9
|
console.error(err)
|
|
12
10
|
})
|
|
13
11
|
if (existsSync(runtimeConfigPath)) {
|
package/bin/utils.js
CHANGED
|
@@ -4,14 +4,19 @@ import { readFile } from 'fs/promises';
|
|
|
4
4
|
import { existsSync } from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
|
+
import { searchForWorkspaceRoot } from 'vite';
|
|
7
8
|
|
|
8
9
|
// global paths
|
|
9
|
-
export const appPath = fileURLToPath(new URL("..", import.meta.url))
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export const appPath = fileURLToPath(new URL("..", import.meta.url)),
|
|
11
|
+
appPublicPath = path.join(appPath, './public'),
|
|
12
|
+
rootPath = searchForWorkspaceRoot(process.cwd()),
|
|
13
|
+
rootPublicPath = path.join(rootPath, './public'),
|
|
14
|
+
srcPath = path.join(rootPath, "/src"),
|
|
15
|
+
runtimeConfigPath = path.join(srcPath, "./config.runtime.js"),
|
|
16
|
+
compiletimeConfigPath = path.join(srcPath, "/config.js"),
|
|
17
|
+
dotEodashPath = path.join(rootPath, "/.eodash"),
|
|
18
|
+
buildTargetPath = path.join(dotEodashPath, '/dist'),
|
|
19
|
+
cachePath = path.join(dotEodashPath, 'cache');
|
|
15
20
|
|
|
16
21
|
|
|
17
22
|
|