@vylos/cli 0.1.0 → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 DevOpsBenjamin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@vylos/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/DevOpsBenjamin/Vylos"
7
+ },
4
8
  "type": "module",
5
9
  "bin": {
6
10
  "vylos": "./bin/vylos.mjs"
@@ -13,7 +17,7 @@
13
17
  "tailwindcss": "^4.0.0",
14
18
  "@tailwindcss/vite": "^4.0.0",
15
19
  "tsx": "^4.19.2",
16
- "@vylos/core": "0.1.0"
20
+ "@vylos/core": "0.2.1"
17
21
  },
18
22
  "devDependencies": {
19
23
  "typescript": "^5.7.2"
@@ -6,13 +6,14 @@ import { resolve } from 'path';
6
6
  import { vylosProjectPlugin } from '../vite/projectPlugin';
7
7
  import { vylosI18nPlugin } from '../vite/i18nPlugin';
8
8
 
9
- export async function build(projectRoot: string) {
9
+ export async function build(projectRoot: string, base?: string) {
10
10
  console.log(`\n Vylos building...\n Project: ${projectRoot}\n`);
11
11
 
12
12
  const outDir = resolve(projectRoot, 'dist');
13
13
 
14
14
  await viteBuild({
15
15
  root: projectRoot,
16
+ base: base ?? '/',
16
17
  plugins: [
17
18
  vue(),
18
19
  tailwindcss(),
@@ -28,6 +29,7 @@ export async function build(projectRoot: string) {
28
29
  build: {
29
30
  outDir,
30
31
  emptyOutDir: true,
32
+ assetsInlineLimit: 0,
31
33
  rollupOptions: {
32
34
  input: resolve(projectRoot, 'index.html'),
33
35
  },
package/src/index.ts CHANGED
@@ -4,6 +4,13 @@ import { resolve } from 'path';
4
4
  const args = process.argv.slice(2);
5
5
  const command = args[0];
6
6
 
7
+ function parseFlag(flag: string): string | undefined {
8
+ const idx = args.indexOf(flag);
9
+ if (idx !== -1 && idx + 1 < args.length) {
10
+ return args[idx + 1];
11
+ }
12
+ }
13
+
7
14
  async function main() {
8
15
  switch (command) {
9
16
  case 'dev': {
@@ -14,9 +21,11 @@ async function main() {
14
21
  }
15
22
 
16
23
  case 'build': {
17
- const projectRoot = resolve(args[1] ?? process.cwd());
24
+ const base = parseFlag('--base');
25
+ const projectArg = args.find((a, i) => i > 0 && a !== '--' && !a.startsWith('--') && args[i - 1] !== '--base');
26
+ const projectRoot = resolve(projectArg ?? process.cwd());
18
27
  const { build } = await import('./commands/build');
19
- await build(projectRoot);
28
+ await build(projectRoot, base);
20
29
  break;
21
30
  }
22
31
 
@@ -50,11 +59,12 @@ async function main() {
50
59
  Vylos — Visual Novel Engine
51
60
 
52
61
  Usage:
53
- vylos dev [project-dir] Start dev server
54
- vylos build [project-dir] Build for production
55
- vylos editor [project-dir] Open visual editor
56
- vylos verify [project-dir] Type-check project
57
- vylos create <name> Create new project
62
+ vylos dev [project-dir] Start dev server
63
+ vylos build [project-dir] Build for production
64
+ vylos build [project-dir] --base /p/ Build with custom base path
65
+ vylos editor [project-dir] Open visual editor
66
+ vylos verify [project-dir] Type-check project
67
+ vylos create <name> Create new project
58
68
  `);
59
69
  }
60
70
  }
@@ -1,10 +1,10 @@
1
1
  import type { Plugin } from 'vite';
2
2
  import { resolve } from 'path';
3
- import { existsSync } from 'fs';
3
+ import { existsSync, cpSync } from 'fs';
4
4
 
5
5
  /**
6
6
  * Vite plugin that resolves virtual module `vylos:project` to the project's config.
7
- * Also serves project assets.
7
+ * Also serves project assets in dev and copies them in build.
8
8
  */
9
9
  export function vylosProjectPlugin(projectRoot: string): Plugin {
10
10
  const virtualModuleId = 'vylos:project';
@@ -37,24 +37,14 @@ export function vylosProjectPlugin(projectRoot: string): Plugin {
37
37
  },
38
38
 
39
39
  configureServer(server) {
40
- // Serve location assets
41
- const locationsDir = resolve(projectRoot, 'locations');
42
- const globalDir = resolve(projectRoot, 'global');
40
+ const assetsDir = resolve(projectRoot, 'assets');
43
41
 
44
42
  server.middlewares.use((req, _res, next) => {
45
43
  if (!req.url) return next();
46
44
 
47
- // Rewrite /locations/... to project locations dir
48
- if (req.url.startsWith('/locations/')) {
49
- const assetPath = resolve(locationsDir, req.url.slice('/locations/'.length));
50
- if (existsSync(assetPath)) {
51
- req.url = '/@fs/' + assetPath.replace(/\\/g, '/');
52
- }
53
- }
54
-
55
- // Rewrite /global/... to project global dir
56
- if (req.url.startsWith('/global/')) {
57
- const assetPath = resolve(globalDir, req.url.slice('/global/'.length));
45
+ // Rewrite /assets/... to project assets dir
46
+ if (req.url.startsWith('/assets/')) {
47
+ const assetPath = resolve(assetsDir, req.url.slice('/assets/'.length));
58
48
  if (existsSync(assetPath)) {
59
49
  req.url = '/@fs/' + assetPath.replace(/\\/g, '/');
60
50
  }
@@ -63,5 +53,14 @@ export function vylosProjectPlugin(projectRoot: string): Plugin {
63
53
  next();
64
54
  });
65
55
  },
56
+
57
+ writeBundle() {
58
+ const assetsDir = resolve(projectRoot, 'assets');
59
+ const outDir = resolve(projectRoot, 'dist', 'assets');
60
+
61
+ if (existsSync(assetsDir)) {
62
+ cpSync(assetsDir, outDir, { recursive: true });
63
+ }
64
+ },
66
65
  };
67
66
  }