@kopflos-cms/vite 0.0.1-beta.1 → 0.0.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/index.js +10 -2
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @kopflos-cms/vite
2
2
 
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 67ba100: Added CHANGELOG.md to build
8
+ - 730ecc2: Ensure the the `outDir` setting is also used for serving files in in production mode
9
+ - 87f4e96: The plugin populates a variable `VITE.basePath` which will be resolved to the correct path in development and production mode
10
+ - 67ba100: Added type augmentation of plugin config interface
11
+ - 1b8a2bc: Serve the entire UI build statically. Before, `public` vite resources would not be accessible
12
+ - Updated dependencies [67ba100]
13
+ - Updated dependencies [730ecc2]
14
+ - @kopflos-cms/logger@0.1.0
15
+
16
+ ## 0.0.1-beta.2
17
+
18
+ ### Patch Changes
19
+
20
+ - 87f4e96: The plugin populates a variable `VITE.basePath` which will be resolved to the correct path in development and production mode
21
+ - 1b8a2bc: Serve the entire UI build statically. Before, `public` vite resources would not be accessible
22
+
3
23
  ## 0.0.1-beta.1
4
24
 
5
25
  ### Patch Changes
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.1",
3
+ "version": "0.0.1",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "author": "Zazuko GmbH",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/zazuko/kopflos",
29
29
  "dependencies": {
30
- "@kopflos-cms/logger": "^0.1.0-beta.1",
30
+ "@kopflos-cms/logger": "^0.1.0",
31
31
  "express": "^5.0.1",
32
32
  "glob": "^11.0.0",
33
33
  "onetime": "^7.0.0",