From da275e74fd8eb2f719355cbda5b9c3ed3bafcae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 21 May 2019 13:53:16 +0200 Subject: [PATCH] [REF] owl: move metadata into __info__ This differentiate better metadata and owl exported values. Also, and this is the goal, it gives a space to add extra keys in the future. --- extras/playground/app.js | 4 ++-- rollup.config.js | 2 +- src/index.ts | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/extras/playground/app.js b/extras/playground/app.js index 5c3ec3df..1bc6ed24 100644 --- a/extras/playground/app.js +++ b/extras/playground/app.js @@ -153,7 +153,7 @@ owl.utils.whenReady(startApp);`; class App extends owl.Component { constructor(...args) { super(...args); - this.version = owl._version; + this.version = owl.__info__.version; this.SAMPLES = SAMPLES; this.widgets = { TabbedEditor }; @@ -349,7 +349,7 @@ class TabbedEditor extends owl.Component { //------------------------------------------------------------------------------ // Application initialization //------------------------------------------------------------------------------ -document.title = `${document.title} (v${owl._version})`; +document.title = `${document.title} (v${owl.__info__.version})`; document.addEventListener("DOMContentLoaded", async function() { const templates = await owl.utils.loadTemplates("templates.xml"); const qweb = new owl.QWeb(templates); diff --git a/rollup.config.js b/rollup.config.js index cf0f7171..59eae6d1 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -9,6 +9,6 @@ export default { format: "iife", name: "owl", extend: true, - outro: `exports._version = '${version}';\nexports._date = '${new Date().toISOString()}';\nexports._hash = '${git.short()}';\nexports._url = 'https://github.com/odoo/owl';` + outro: `exports.__info__.version = '${version}';\nexports.__info__.date = '${new Date().toISOString()}';\nexports.__info__.hash = '${git.short()}';\nexports.__info__.url = 'https://github.com/odoo/owl';` } }; diff --git a/src/index.ts b/src/index.ts index 1353d133..dfccbf1e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,5 +17,7 @@ export { QWeb } from "./qweb_core"; export { connect, Store } from "./store"; import * as _utils from "./utils"; +export const __info__ = {} + export const utils = _utils;