metaowl 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -72,17 +72,11 @@ npm install metaowl
72
72
 
73
73
  ## Create a New Project
74
74
 
75
- The fastest way to get started is the `metaowl-create` scaffolder:
76
-
77
- ```bash
78
- npx metaowl-create my-app
79
- ```
80
-
81
- Or install metaowl globally and run it interactively:
75
+ Install metaowl globally and run it interactively:
82
76
 
83
77
  ```bash
84
78
  npm install -g metaowl
85
- metaowl-create
79
+ metaowl-create app_name
86
80
  ```
87
81
 
88
82
  This generates a ready-to-run project:
@@ -91,10 +91,10 @@ module.exports = createPostcssConfig()
91
91
  write('jsconfig.json', JSON.stringify({
92
92
  extends: './node_modules/metaowl/config/jsconfig.base.json',
93
93
  compilerOptions: {
94
- baseUrl: 'src',
94
+ baseUrl: '.',
95
95
  paths: {
96
- '@pages/*': ['pages/*'],
97
- '@components/*': ['components/*']
96
+ '@pages/*': ['src/pages/*'],
97
+ '@components/*': ['src/components/*']
98
98
  }
99
99
  },
100
100
  include: ['src']
@@ -159,8 +159,7 @@ export default class Index extends Component {
159
159
 
160
160
  // --- src/pages/index/Index.xml ---
161
161
  write('src/pages/index/Index.xml',
162
- `<?xml version="1.0" encoding="UTF-8"?>
163
- <templates>
162
+ `<templates>
164
163
  <t t-name="Index">
165
164
  <div class="layout">
166
165
  <AppHeader />
@@ -198,8 +197,7 @@ export default class AppHeader extends Component {
198
197
 
199
198
  // --- src/components/AppHeader/AppHeader.xml ---
200
199
  write('src/components/AppHeader/AppHeader.xml',
201
- `<?xml version="1.0" encoding="UTF-8"?>
202
- <templates>
200
+ `<templates>
203
201
  <t t-name="AppHeader">
204
202
  <header class="app-header">
205
203
  <span class="app-header__logo">${name}</span>
@@ -235,8 +233,7 @@ export default class AppFooter extends Component {
235
233
 
236
234
  // --- src/components/AppFooter/AppFooter.xml ---
237
235
  write('src/components/AppFooter/AppFooter.xml',
238
- `<?xml version="1.0" encoding="UTF-8"?>
239
- <templates>
236
+ `<templates>
240
237
  <t t-name="AppFooter">
241
238
  <footer class="app-footer">
242
239
  <span>Built with metaowl</span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metaowl",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Lightweight meta-framework for Odoo OWL — file-based routing, app mounting, Fetch helper, Cache, Meta tags, SSG generator, and a Vite plugin.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/vite/plugin.js CHANGED
@@ -1,11 +1,20 @@
1
1
  import { fileURLToPath } from 'node:url'
2
2
  import { resolve, dirname } from 'node:path'
3
3
  import { mkdirSync, copyFileSync, cpSync, existsSync } from 'node:fs'
4
+ import { createRequire } from 'node:module'
4
5
  import { globSync } from 'glob'
5
6
  import { config as dotenvConfig } from 'dotenv'
6
7
  import ViteRestart from 'vite-plugin-restart'
7
8
  import tsconfigPaths from 'vite-tsconfig-paths'
8
9
 
10
+ const require = createRequire(import.meta.url)
11
+
12
+ function resolveOwlPath() {
13
+ return require.resolve('@odoo/owl/dist/owl.es.js', {
14
+ paths: [process.cwd(), dirname(fileURLToPath(import.meta.url))]
15
+ })
16
+ }
17
+
9
18
  /**
10
19
  * Collect all .xml files from a directory glob and return them as
11
20
  * URL-style paths (e.g. /components/Header/Header.xml).
@@ -91,7 +100,7 @@ export function metaowlPlugin(options = {}) {
91
100
  cfg.publicDir = cfg.publicDir ?? publicDir
92
101
  cfg.appType = cfg.appType ?? 'spa'
93
102
 
94
- const owlPath = fileURLToPath(new URL('../node_modules/@odoo/owl/dist/owl.es.js', import.meta.url))
103
+ const owlPath = resolveOwlPath()
95
104
  cfg.resolve = {
96
105
  ...(cfg.resolve ?? {}),
97
106
  alias: {