@kopflos-cms/vite 0.0.1-beta.0 → 0.0.1-beta.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # @kopflos-cms/vite
2
+
3
+ ## 0.0.1-beta.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 87f4e96: The plugin populates a variable `VITE.basePath` which will be resolved to the correct path in development and production mode
8
+ - 1b8a2bc: Serve the entire UI build statically. Before, `public` vite resources would not be accessible
9
+
10
+ ## 0.0.1-beta.1
11
+
12
+ ### Patch Changes
13
+
14
+ - 67ba100: Added CHANGELOG.md to build
15
+ - 67ba100: Added type augmentation of plugin config interface
16
+ - Updated dependencies [67ba100]
17
+ - @kopflos-cms/logger@0.1.0-beta.1
18
+
19
+ ## 0.0.1-beta.0
20
+
21
+ ### Patch Changes
22
+
23
+ - 730ecc2: Ensure the the `outDir` setting is also used for serving files in in production mode
24
+ - Updated dependencies [730ecc2]
25
+ - @kopflos-cms/logger@0.1.0-beta.0
package/index.d.ts CHANGED
@@ -6,4 +6,9 @@ export interface Options {
6
6
  outDir?: string;
7
7
  entrypoints?: string[];
8
8
  }
9
+ declare module '@kopflos-cms/core' {
10
+ interface PluginConfig {
11
+ '@kopflos-cms/vite'?: Options;
12
+ }
13
+ }
9
14
  export default function ({ outDir, ...options }: Options): KopflosPlugin;
package/index.js CHANGED
@@ -6,7 +6,16 @@ import { prepareConfig } from './lib/config.js';
6
6
  import { log } from './lib/log.js';
7
7
  export { defineConfig } from 'vite';
8
8
  export default function ({ outDir = 'dist', ...options }) {
9
+ const rootDir = resolve(process.cwd(), options.root || '');
10
+ const buildDir = resolve(process.cwd(), outDir);
9
11
  return {
12
+ onStart({ env }) {
13
+ const viteVars = {
14
+ basePath: env.kopflos.config.mode === 'development' ? rootDir : buildDir,
15
+ };
16
+ log.info('Variables', viteVars);
17
+ env.kopflos.variables.VITE = Object.freeze(viteVars);
18
+ },
10
19
  async beforeMiddleware(host, { env }) {
11
20
  if (env.kopflos.config.mode === 'development') {
12
21
  log.info('Development UI mode. Creating Vite server...');
@@ -15,9 +24,8 @@ export default function ({ outDir = 'dist', ...options }) {
15
24
  }
16
25
  else {
17
26
  log.info('Serving UI from build directory');
18
- const buildDir = resolve(process.cwd(), outDir);
19
27
  log.debug('Build directory:', buildDir);
20
- host.use('/assets', express.static(resolve(buildDir, 'assets')));
28
+ host.use(express.static(buildDir));
21
29
  }
22
30
  },
23
31
  async build() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopflos-cms/vite",
3
- "version": "0.0.1-beta.0",
3
+ "version": "0.0.1-beta.2",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "author": "Zazuko GmbH",
@@ -11,6 +11,7 @@
11
11
  "prepack": "npm run build"
12
12
  },
13
13
  "files": [
14
+ "CHANGELOG.md",
14
15
  "lib/*.js",
15
16
  "lib/*.d.ts",
16
17
  "*.js",
@@ -26,7 +27,7 @@
26
27
  },
27
28
  "homepage": "https://github.com/zazuko/kopflos",
28
29
  "dependencies": {
29
- "@kopflos-cms/logger": "^0.1.0-beta.0",
30
+ "@kopflos-cms/logger": "^0.1.0-beta.1",
30
31
  "express": "^5.0.1",
31
32
  "glob": "^11.0.0",
32
33
  "onetime": "^7.0.0",