@ts-for-gir/lib 3.0.0-beta.11 → 3.0.0
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/lib/conflict-resolver.d.ts +1 -0
- package/lib/conflict-resolver.js +20 -6
- package/lib/conflict-resolver.js.map +1 -1
- package/lib/constants.d.ts +7 -3
- package/lib/constants.js +14 -2
- package/lib/constants.js.map +1 -1
- package/lib/dependency-manager.d.ts +52 -3
- package/lib/dependency-manager.js +138 -18
- package/lib/dependency-manager.js.map +1 -1
- package/lib/gir-module.d.ts +12 -5
- package/lib/gir-module.js +52 -25
- package/lib/gir-module.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/injection/classes/gjs/gio-2.0.d.ts +5 -0
- package/lib/injection/classes/gjs/gio-2.0.js +218 -0
- package/lib/injection/classes/gjs/gio-2.0.js.map +1 -0
- package/lib/injection/classes/gjs/glib-2.0.d.ts +2 -0
- package/lib/injection/classes/gjs/glib-2.0.js +205 -0
- package/lib/injection/classes/gjs/glib-2.0.js.map +1 -0
- package/lib/injection/classes/gjs/gobject-2.0.d.ts +2 -0
- package/lib/injection/classes/gjs/gobject-2.0.js +634 -0
- package/lib/injection/classes/gjs/gobject-2.0.js.map +1 -0
- package/lib/injection/classes/gjs/index.js +3 -3
- package/lib/injection/classes/glib-2.0.d.ts +2 -0
- package/lib/injection/classes/glib-2.0.js +35 -0
- package/lib/injection/classes/glib-2.0.js.map +1 -0
- package/lib/injection/classes/index.js +1 -1
- package/lib/injection/classes/node-gtk/gdk-4.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/gdk-4.0.js +32 -0
- package/lib/injection/classes/node-gtk/gdk-4.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/gio-2.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/gio-2.0.js +14 -0
- package/lib/injection/classes/node-gtk/gio-2.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/glib-2.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/glib-2.0.js +19 -0
- package/lib/injection/classes/node-gtk/glib-2.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/gobject-2.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/gobject-2.0.js +66 -0
- package/lib/injection/classes/node-gtk/gobject-2.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/graphene-1.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/graphene-1.0.js +133 -0
- package/lib/injection/classes/node-gtk/graphene-1.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/gtk-3.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/gtk-3.0.js +31 -0
- package/lib/injection/classes/node-gtk/gtk-3.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/gtk-4.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/gtk-4.0.js +52 -0
- package/lib/injection/classes/node-gtk/gtk-4.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/index.js +8 -8
- package/lib/injection/classes/node-gtk/pango-1.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/pango-1.0.js +31 -0
- package/lib/injection/classes/node-gtk/pango-1.0.js.map +1 -0
- package/lib/library-version.d.ts +8 -0
- package/lib/library-version.js +32 -0
- package/lib/library-version.js.map +1 -0
- package/lib/messages.d.ts +0 -2
- package/lib/messages.js +1 -3
- package/lib/messages.js.map +1 -1
- package/lib/package-data-parser.d.ts +13 -0
- package/lib/package-data-parser.js +67 -0
- package/lib/package-data-parser.js.map +1 -0
- package/lib/package-data.d.ts +9 -0
- package/lib/package-data.js +41 -0
- package/lib/package-data.js.map +1 -0
- package/lib/symtable.js +2 -1
- package/lib/symtable.js.map +1 -1
- package/lib/template-processor.d.ts +59 -19
- package/lib/template-processor.js +128 -41
- package/lib/template-processor.js.map +1 -1
- package/lib/transformation.d.ts +52 -29
- package/lib/transformation.js +101 -73
- package/lib/transformation.js.map +1 -1
- package/lib/types/construct-name.d.ts +1 -1
- package/lib/types/dependency.d.ts +17 -2
- package/lib/types/generate-config.d.ts +9 -2
- package/lib/types/gir-callable-param-element.d.ts +7 -5
- package/lib/types/gir-direction.d.ts +3 -1
- package/lib/types/gir-direction.js +2 -0
- package/lib/types/gir-direction.js.map +1 -1
- package/lib/types/gir-instance-parameter.d.ts +2 -0
- package/lib/types/gir-property-element.d.ts +2 -0
- package/lib/types/gir-transfer-ownership.d.ts +5 -1
- package/lib/types/index.d.ts +5 -0
- package/lib/types/index.js +5 -0
- package/lib/types/index.js.map +1 -1
- package/lib/types/module-type.d.ts +1 -1
- package/lib/types/package-data-parsed.d.ts +28 -0
- package/lib/types/package-data-parsed.js +2 -0
- package/lib/types/package-data-parsed.js.map +1 -0
- package/lib/types/package-data.d.ts +23 -0
- package/lib/types/package-data.js +2 -0
- package/lib/types/package-data.js.map +1 -0
- package/lib/types/package-section-parsed.d.ts +8 -0
- package/lib/types/package-section-parsed.js +2 -0
- package/lib/types/package-section-parsed.js.map +1 -0
- package/lib/types/package-section.d.ts +8 -0
- package/lib/types/package-section.js +2 -0
- package/lib/types/package-section.js.map +1 -0
- package/lib/types/parsed-package-data.d.ts +6 -0
- package/lib/types/parsed-package-data.js +2 -0
- package/lib/types/parsed-package-data.js.map +1 -0
- package/lib/types/template-data.d.ts +7 -0
- package/lib/types/template-data.js +2 -0
- package/lib/types/template-data.js.map +1 -0
- package/lib/types/transformation-case.d.ts +1 -1
- package/lib/types/transformations.d.ts +1 -1
- package/lib/types/user-config.d.ts +6 -2
- package/lib/utils.d.ts +38 -17
- package/lib/utils.js +85 -33
- package/lib/utils.js.map +1 -1
- package/package.json +20 -19
- package/templates/README.md +102 -0
- package/templates/gjs/README-GJS.md +109 -0
- package/templates/gjs/ambient.d.ts +59 -0
- package/templates/gjs/cairo-1.0.d.ts +9 -0
- package/templates/gjs/cairo.d.ts +8 -0
- package/templates/gjs/cairo.js +11 -0
- package/templates/gjs/gettext.d.ts +41 -0
- package/templates/gjs/gettext.js +11 -0
- package/templates/{Gjs/Gio-2.0.d.ts → gjs/gio-2.0.d.ts} +1 -1
- package/templates/{Gjs/index.d.ts → gjs/gjs.d.ts} +221 -58
- package/templates/gjs/gjs.js +10 -0
- package/templates/{Gjs/GObject-2.0.d.ts → gjs/gobject-2.0.d.ts} +1 -1
- package/templates/gjs/module-ambient.d.ts +31 -0
- package/templates/gjs/module-import.d.ts +33 -0
- package/templates/gjs/module.append.d.ts +1 -0
- package/templates/gjs/module.d.ts +12 -0
- package/templates/gjs/module.js +17 -0
- package/templates/gjs/system.d.ts +32 -0
- package/templates/gjs/system.js +11 -0
- package/templates/gjs/tsconfig.alias.json +12 -0
- package/templates/node-gtk/README-NODE-GTK.md +71 -0
- package/templates/node-gtk/ambient.d.ts +19 -0
- package/templates/node-gtk/module-import.d.ts +29 -0
- package/templates/node-gtk/module.append.d.ts +1 -0
- package/templates/node-gtk/module.d.ts +4 -0
- package/templates/node-gtk/module.js +2 -1
- package/templates/node-gtk/node-gtk.d.ts +25 -0
- package/templates/node-gtk/{index.js → node-gtk.js} +0 -2
- package/templates/package.json +173 -0
- package/templates/tsconfig.doc.json +30 -0
- package/templates/Gjs/Gjs.d.ts +0 -204
- package/templates/Gjs/Gjs.js +0 -21
- package/templates/Gjs/GnomeShell.d.ts +0 -154
- package/templates/Gjs/GnomeShell.js +0 -10
- package/templates/Gjs/index.js +0 -4
- package/templates/Gjs/misc/dbusUtils.d.ts +0 -15
- package/templates/Gjs/misc/dbusUtils.js +0 -6
- package/templates/Gjs/misc/extensionUtils.d.ts +0 -99
- package/templates/Gjs/misc/extensionUtils.js +0 -6
- package/templates/Gjs/misc/fileUtils.d.ts +0 -51
- package/templates/Gjs/misc/fileUtils.js +0 -6
- package/templates/Gjs/misc/gnomeSession.d.ts +0 -74
- package/templates/Gjs/misc/gnomeSession.js +0 -6
- package/templates/Gjs/misc/parentalControlsManager.d.ts +0 -42
- package/templates/Gjs/misc/parentalControlsManager.js +0 -6
- package/templates/Gjs/misc/signals.d.ts +0 -15
- package/templates/Gjs/misc/signals.js +0 -6
- package/templates/Gjs/module.d.ts +0 -6
- package/templates/Gjs/module.js +0 -16
- package/templates/Gjs/tsconfig.alias.json +0 -10
- package/templates/Gjs/ui/accessDialog.d.ts +0 -19
- package/templates/Gjs/ui/accessDialog.js +0 -6
- package/templates/Gjs/ui/altTab.d.ts +0 -124
- package/templates/Gjs/ui/altTab.js +0 -6
- package/templates/Gjs/ui/animation.d.ts +0 -58
- package/templates/Gjs/ui/animation.js +0 -6
- package/templates/Gjs/ui/appDisplay.d.ts +0 -204
- package/templates/Gjs/ui/appDisplay.js +0 -6
- package/templates/Gjs/ui/appFavorites.d.ts +0 -34
- package/templates/Gjs/ui/appFavorites.js +0 -6
- package/templates/Gjs/ui/appMenu.d.ts +0 -74
- package/templates/Gjs/ui/appMenu.js +0 -6
- package/templates/Gjs/ui/audioDeviceSelection.d.ts +0 -51
- package/templates/Gjs/ui/audioDeviceSelection.js +0 -6
- package/templates/Gjs/ui/background.d.ts +0 -255
- package/templates/Gjs/ui/background.js +0 -5
- package/templates/Gjs/ui/backgroundMenu.d.ts +0 -19
- package/templates/Gjs/ui/backgroundMenu.js +0 -5
- package/templates/Gjs/ui/barLevel.d.ts +0 -42
- package/templates/Gjs/ui/barLevel.js +0 -5
- package/templates/Gjs/ui/boxpointer.d.ts +0 -103
- package/templates/Gjs/ui/boxpointer.js +0 -5
- package/templates/Gjs/ui/calendar.d.ts +0 -261
- package/templates/Gjs/ui/calendar.js +0 -5
- package/templates/Gjs/ui/checkBox.d.ts +0 -22
- package/templates/Gjs/ui/checkBox.js +0 -5
- package/templates/Gjs/ui/closeDialog.d.ts +0 -40
- package/templates/Gjs/ui/closeDialog.js +0 -5
- package/templates/Gjs/ui/components/__init__.d.ts +0 -9
- package/templates/Gjs/ui/components/__init__.js +0 -6
- package/templates/Gjs/ui/components/automountManager.d.ts +0 -8
- package/templates/Gjs/ui/components/automountManager.js +0 -6
- package/templates/Gjs/ui/components/autorunManager.d.ts +0 -8
- package/templates/Gjs/ui/components/autorunManager.js +0 -6
- package/templates/Gjs/ui/components/index.d.ts +0 -6
- package/templates/Gjs/ui/components/index.js +0 -6
- package/templates/Gjs/ui/components/keyring.d.ts +0 -19
- package/templates/Gjs/ui/components/keyring.js +0 -6
- package/templates/Gjs/ui/components/networkAgent.d.ts +0 -10
- package/templates/Gjs/ui/components/networkAgent.js +0 -6
- package/templates/Gjs/ui/components/polkitAgent.d.ts +0 -19
- package/templates/Gjs/ui/components/polkitAgent.js +0 -6
- package/templates/Gjs/ui/components/telepathyClient.d.ts +0 -10
- package/templates/Gjs/ui/components/telepathyClient.js +0 -6
- package/templates/Gjs/ui/dialog.d.ts +0 -78
- package/templates/Gjs/ui/dialog.js +0 -6
- package/templates/Gjs/ui/dnd.d.ts +0 -127
- package/templates/Gjs/ui/dnd.js +0 -6
- package/templates/Gjs/ui/iconGrid.d.ts +0 -172
- package/templates/Gjs/ui/iconGrid.js +0 -6
- package/templates/Gjs/ui/layout.d.ts +0 -311
- package/templates/Gjs/ui/layout.js +0 -6
- package/templates/Gjs/ui/main.d.ts +0 -215
- package/templates/Gjs/ui/main.js +0 -6
- package/templates/Gjs/ui/messageList.d.ts +0 -113
- package/templates/Gjs/ui/messageList.js +0 -6
- package/templates/Gjs/ui/messageTray.d.ts +0 -423
- package/templates/Gjs/ui/messageTray.js +0 -6
- package/templates/Gjs/ui/modalDialog.d.ts +0 -96
- package/templates/Gjs/ui/modalDialog.js +0 -6
- package/templates/Gjs/ui/mpris.d.ts +0 -78
- package/templates/Gjs/ui/mpris.js +0 -6
- package/templates/Gjs/ui/notificationDaemon.d.ts +0 -5
- package/templates/Gjs/ui/notificationDaemon.js +0 -6
- package/templates/Gjs/ui/panel.d.ts +0 -65
- package/templates/Gjs/ui/panel.js +0 -6
- package/templates/Gjs/ui/panelMenu.d.ts +0 -51
- package/templates/Gjs/ui/panelMenu.js +0 -6
- package/templates/Gjs/ui/popupMenu.d.ts +0 -228
- package/templates/Gjs/ui/popupMenu.js +0 -6
- package/templates/Gjs/ui/ripples.d.ts +0 -44
- package/templates/Gjs/ui/ripples.js +0 -6
- package/templates/Gjs/ui/search.d.ts +0 -158
- package/templates/Gjs/ui/search.js +0 -6
- package/templates/Gjs/ui/switcherPopup.d.ts +0 -107
- package/templates/Gjs/ui/switcherPopup.js +0 -6
- package/templates/Gjs/ui/userWidget.d.ts +0 -13
- package/templates/Gjs/ui/userWidget.js +0 -6
- package/templates/node-gtk/index.d.ts +0 -40
- /package/templates/{Cogl-2.0.d.ts → cogl-2-0.d.ts} +0 -0
- /package/templates/{Granite-1.0.d.ts → granite-1.0.d.ts} +0 -0
- /package/templates/{Granite-7.0.d.ts → granite-7.0.d.ts} +0 -0
- /package/templates/{GstBase-0.10.d.ts → gstbase-0.10.d.ts} +0 -0
- /package/templates/node-gtk/{GObject-2.0.d.ts → gobject-2.0.d.ts} +0 -0
- /package/templates/{RygelServer-2.6.d.ts → rygelserver-2.6.d.ts} +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { parseStringPromise } from 'xml2js';
|
|
2
|
+
import { readFile } from 'fs/promises';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
import { Logger } from './logger.js';
|
|
5
|
+
import { __dirname, splitModuleName, cleanString } from './utils.js';
|
|
6
|
+
export class PackageDataParser {
|
|
7
|
+
config;
|
|
8
|
+
log;
|
|
9
|
+
packages = [];
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.log = new Logger('', config.verbose, 'ModuleLoader');
|
|
13
|
+
}
|
|
14
|
+
get(name) {
|
|
15
|
+
return this.packages.find((pkg) => pkg.gir === name);
|
|
16
|
+
}
|
|
17
|
+
parseSections(sections) {
|
|
18
|
+
for (const section of sections) {
|
|
19
|
+
this.log.log(`Found section`, section.$.name);
|
|
20
|
+
if (section.package) {
|
|
21
|
+
this.parsePackages(section.package);
|
|
22
|
+
}
|
|
23
|
+
if (section.section) {
|
|
24
|
+
this.parseSections(section.section);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
transformPackageData(pkg, parentSection) {
|
|
29
|
+
const { gir, home, gallery, 'c-docs': cDocs, deprecated, maintainers, maintainer } = pkg.$;
|
|
30
|
+
const description = cleanString(pkg._);
|
|
31
|
+
if (!gir) {
|
|
32
|
+
throw new Error(`No gir name specified for package "${pkg.$.name}"`);
|
|
33
|
+
}
|
|
34
|
+
const { namespace, version } = splitModuleName(gir);
|
|
35
|
+
const trans = {
|
|
36
|
+
description,
|
|
37
|
+
namespace,
|
|
38
|
+
version,
|
|
39
|
+
gir,
|
|
40
|
+
home,
|
|
41
|
+
gallery,
|
|
42
|
+
cDocs,
|
|
43
|
+
deprecated: deprecated === 'true',
|
|
44
|
+
maintainers: maintainers || maintainer,
|
|
45
|
+
section: parentSection,
|
|
46
|
+
};
|
|
47
|
+
return trans;
|
|
48
|
+
}
|
|
49
|
+
parsePackages(packages, parentSection) {
|
|
50
|
+
for (const pkg of packages) {
|
|
51
|
+
this.log.log(`Found package "${pkg.$.name}"`);
|
|
52
|
+
if (pkg.$.ignore === 'true' || !pkg.$.gir) {
|
|
53
|
+
this.log.warn(`Ignoring package "${pkg.$.name}"`);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const transPgk = this.transformPackageData(pkg, parentSection);
|
|
57
|
+
this.packages.push(transPgk);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async start() {
|
|
61
|
+
this.log.log(`Parsing package.xml...`);
|
|
62
|
+
const fileContents = await readFile(resolve(__dirname, '../packages.xml'), 'utf8');
|
|
63
|
+
const result = (await parseStringPromise(fileContents));
|
|
64
|
+
this.parseSections(result.packages.section);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=package-data-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-data-parser.js","sourceRoot":"","sources":["../src/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AAG,MAAM,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAA;QAClF,MAAM,MAAM,GAAG,CAAC,MAAM,kBAAkB,CAAC,YAAY,CAAC,CAAsB,CAAA;QAC5E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;CACJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Logger } from './logger.js';
|
|
2
|
+
import type { GenerateConfig, PackageSection } from './types/index.js';
|
|
3
|
+
export declare class PackageData {
|
|
4
|
+
protected readonly config: GenerateConfig;
|
|
5
|
+
log: Logger;
|
|
6
|
+
constructor(config: GenerateConfig);
|
|
7
|
+
start(): Promise<void>;
|
|
8
|
+
parseSections(sections: PackageSection[]): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { parseStringPromise } from 'xml2js';
|
|
2
|
+
import { readFile } from 'fs/promises';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
import { Logger } from './logger.js';
|
|
5
|
+
import { __dirname } from './utils.js';
|
|
6
|
+
export class PackageDataParser {
|
|
7
|
+
config;
|
|
8
|
+
log;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.log = new Logger('', config.verbose || true, 'ModuleLoader');
|
|
12
|
+
}
|
|
13
|
+
async start() {
|
|
14
|
+
this.log.log(`Parsing package.xml...`);
|
|
15
|
+
const fileContents = await readFile(resolve(__dirname, '../packages.xml'), 'utf8');
|
|
16
|
+
const result = (await parseStringPromise(fileContents));
|
|
17
|
+
this.log.log(`Parsed package.xml`, result.packages.section);
|
|
18
|
+
this.parseSections(result.packages.section);
|
|
19
|
+
}
|
|
20
|
+
async parseSections(sections) {
|
|
21
|
+
for (const section of sections) {
|
|
22
|
+
this.log.log(`Found package section`, section.$.name);
|
|
23
|
+
if (section.package) {
|
|
24
|
+
for (const pkg of section.package) {
|
|
25
|
+
this.log.log(`Found package`, pkg.$.name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (section.section) {
|
|
29
|
+
this.parseSections(section.section);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async parsePackages(packages) {
|
|
34
|
+
for (const key in data) {
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
36
|
+
const element = data[key];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=package-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-data.js","sourceRoot":"","sources":["../src/package-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAItC,MAAM,OAAO,iBAAiB;IAEK;IAD/B,GAAG,CAAQ;IACX,YAA+B,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QACjD,IAAI,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE,cAAc,CAAC,CAAA;IACrE,CAAC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QACtC,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAA;QAClF,MAAM,MAAM,GAAG,CAAC,MAAM,kBAAkB,CAAC,YAAY,CAAC,CAAsB,CAAA;QAC5E,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC3D,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAE/C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAA0B;QAC1C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YACrD,IAAG,OAAO,CAAC,OAAO,EAAE;gBAChB,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE;oBAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;iBAC5C;aACJ;YAED,IAAG,OAAO,CAAC,OAAO,EAAE;gBAChB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;aACtC;SAEJ;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAuB;QACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACpB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;gBACjD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;aAE7B;SACJ;IACL,CAAC;CACJ"}
|
package/lib/symtable.js
CHANGED
|
@@ -3,7 +3,7 @@ import { WARN_NOT_FOUND_PACKAGE_NAME } from './messages.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* The SymTable is used to get any Type from any dependency to compare or to get information from
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
class SymTable {
|
|
7
7
|
config;
|
|
8
8
|
modPackageName;
|
|
9
9
|
modNamespace;
|
|
@@ -60,4 +60,5 @@ export class SymTable {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
export { SymTable };
|
|
63
64
|
//# sourceMappingURL=symtable.js.map
|
package/lib/symtable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symtable.js","sourceRoot":"","sources":["../src/symtable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA;AAE3D;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"symtable.js","sourceRoot":"","sources":["../src/symtable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA;AAE3D;;GAEG;AACH,MAAa,QAAQ;IAQI;IACA;IACA;IATrB;;OAEG;IACK,MAAM,CAAC,KAAK,GAAkB,EAAE,CAAA;IAChC,GAAG,CAAQ;IAEnB,YACqB,MAAsB,EACtB,cAAsB,EACtB,YAAoB;QAFpB,WAAM,GAAN,MAAM,CAAgB;QACtB,mBAAc,GAAd,cAAc,CAAQ;QACtB,iBAAY,GAAZ,YAAY,CAAQ;QAErC,IAAI,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;IACnF,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,YAA0B,EAAE,cAAsB;QAC5D,IAAI,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC,EAAE;YACtD,OAAO,cAAc,CAAA;SACxB;QAED,IAAI,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,EAAE;YACpD,OAAO,IAAI,CAAC,cAAc,GAAG,GAAG,GAAG,cAAc,CAAA;SACpD;QAED,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Y,CAAC,CAAA;QACnD,IAAI,GAAG,EAAE;YACL,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,CAAA;SACnC;IACL,CAAC;;SA/DQ,QAAQ"}
|
|
@@ -4,49 +4,89 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import ejs from 'ejs';
|
|
6
6
|
import { Logger } from './logger.js';
|
|
7
|
-
import
|
|
7
|
+
import { Transformation } from './transformation.js';
|
|
8
|
+
import type { GenerateConfig, Dependency, TemplateData, Environment } from './types/index.js';
|
|
8
9
|
export declare class TemplateProcessor {
|
|
9
|
-
protected readonly data:
|
|
10
|
+
protected readonly data: TemplateData | undefined;
|
|
10
11
|
protected readonly packageName: string;
|
|
12
|
+
protected readonly deps: Dependency[];
|
|
11
13
|
protected readonly config: GenerateConfig;
|
|
12
14
|
protected environmentTemplateDir: string;
|
|
13
15
|
protected log: Logger;
|
|
14
|
-
|
|
16
|
+
protected transformation: Transformation;
|
|
17
|
+
constructor(data: TemplateData | undefined, packageName: string, deps: Dependency[], config: GenerateConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Get the output or input directory of the environment
|
|
20
|
+
* @param environment The environment to get the directory for
|
|
21
|
+
* @param baseDir The base directory
|
|
22
|
+
* @returns The path to the directory
|
|
23
|
+
*/
|
|
24
|
+
protected getEnvironmentDir: (environment: Environment, baseDir: string) => string;
|
|
25
|
+
protected getAppendTemplateName(templateFilename: string): string;
|
|
15
26
|
/**
|
|
16
27
|
* Loads and renders a template and gets the rendered templates back
|
|
17
28
|
* @param templateFilename
|
|
18
29
|
*/
|
|
19
|
-
load(templateFilename: string): Promise<
|
|
30
|
+
load(templateFilename: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<{
|
|
31
|
+
prepend: string;
|
|
32
|
+
append: string;
|
|
33
|
+
}>;
|
|
20
34
|
/**
|
|
21
35
|
* Loads and renders all templates in a directory and gets the rendered templates back
|
|
22
36
|
* @param templateDirname
|
|
37
|
+
* @param fileExtension
|
|
38
|
+
* @param options EJS options
|
|
39
|
+
* @param overrideTemplateData Override template data if you want
|
|
40
|
+
* @returns The rendered templates
|
|
23
41
|
*/
|
|
24
|
-
loadAll(templateDirname: string, fileExtension: string): Promise<{
|
|
42
|
+
loadAll(templateDirname: string, fileExtension: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<{
|
|
25
43
|
[path: string]: string;
|
|
26
44
|
}>;
|
|
27
45
|
/**
|
|
28
46
|
* Loads an template, render the template and write the template to the filesystem
|
|
29
|
-
* @param templateFilename
|
|
30
|
-
* @param
|
|
31
|
-
* @param outputFilename
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @
|
|
47
|
+
* @param templateFilename The filename of the template
|
|
48
|
+
* @param baseOutputPath The base output directory path where the templates should be written to
|
|
49
|
+
* @param outputFilename The filename of the output file
|
|
50
|
+
* @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
|
|
51
|
+
* @param content A (optional) string that should be appended to the rendered template
|
|
52
|
+
* @param options EJS options
|
|
53
|
+
* @param overrideTemplateData Override template data if you want
|
|
54
|
+
* @return The rendered template string
|
|
35
55
|
*/
|
|
36
|
-
create(templateFilename: string,
|
|
56
|
+
create(templateFilename: string, baseOutputPath: string, outputFilename: string, prependEnv?: boolean, content?: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<string>;
|
|
37
57
|
/**
|
|
38
58
|
* Loads all templates with file extension in dir, render the templates and write the template to the filesystem
|
|
39
|
-
* @param fileExtension
|
|
40
|
-
* @param templateDirname
|
|
41
|
-
* @param
|
|
42
|
-
* @param outputDirname
|
|
59
|
+
* @param fileExtension The file extension of the templates
|
|
60
|
+
* @param templateDirname The directory where the templates are located
|
|
61
|
+
* @param baseOutputPath The base output directory path where the templates should be written to
|
|
62
|
+
* @param outputDirname The child output directory of the base output directory where the templates should be written to
|
|
63
|
+
* @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
|
|
64
|
+
* @param append A (optional) string that should be appended to the rendered template
|
|
65
|
+
* @param options EJS options
|
|
66
|
+
* @param overrideTemplateData Override template data if you want
|
|
43
67
|
* @return The rendered (and if possible prettified) templates
|
|
44
68
|
*/
|
|
45
|
-
createAll(fileExtension: string, templateDirname: string,
|
|
69
|
+
createAll(fileExtension: string, templateDirname: string, baseOutputPath: string, outputDirname: string, prependEnv?: boolean, append?: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<{
|
|
46
70
|
[path: string]: string;
|
|
47
71
|
}>;
|
|
48
|
-
|
|
49
|
-
|
|
72
|
+
getOutputPath(baseOutputPath: string, outputFilename: string, prependEnv?: boolean): string;
|
|
73
|
+
/**
|
|
74
|
+
* Writes the `content` to the filesystem
|
|
75
|
+
* @param content The content (normally the content of a rendered template file) that should be written to the filesystem
|
|
76
|
+
* @param baseOutputPath The base output directory path where the templates should be written to
|
|
77
|
+
* @param outputFilename The filename of the output file
|
|
78
|
+
* @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
protected write(content: string, baseOutputPath: string, outputFilename: string, prependEnv?: boolean): Promise<string>;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param templateString The template content string that should be rendered
|
|
85
|
+
* @param options EJS options
|
|
86
|
+
* @param overrideTemplateData Override template data if you want
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
89
|
+
protected render(templateString: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<string>;
|
|
50
90
|
/**
|
|
51
91
|
* Checks if the template file or directory exists and returns the path if found
|
|
52
92
|
* Tries first to load the file / directory from the environment-specific template folder and otherwise looks for it in the general template folder
|
|
@@ -4,100 +4,186 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
import { readFile, writeFile, mkdir, readdir } from 'fs/promises';
|
|
7
|
-
import
|
|
7
|
+
import { join, dirname, relative, extname } from 'path';
|
|
8
8
|
import ejs from 'ejs';
|
|
9
9
|
import { Logger } from './logger.js';
|
|
10
|
-
import { APP_NAME, APP_USAGE, APP_SOURCE } from './constants.js';
|
|
11
|
-
import { __dirname,
|
|
10
|
+
import { APP_NAME, APP_USAGE, APP_SOURCE, APP_VERSION, PACKAGE_DESC, PACKAGE_KEYWORDS } from './constants.js';
|
|
11
|
+
import { __dirname, getDestPath } from './utils.js';
|
|
12
12
|
import { DependencyManager } from './dependency-manager.js';
|
|
13
|
-
|
|
13
|
+
import { Transformation } from './transformation.js';
|
|
14
|
+
const TEMPLATE_DIR = join(__dirname, '../templates');
|
|
14
15
|
export class TemplateProcessor {
|
|
15
16
|
data;
|
|
16
17
|
packageName;
|
|
18
|
+
deps;
|
|
17
19
|
config;
|
|
18
20
|
environmentTemplateDir;
|
|
19
21
|
log;
|
|
20
|
-
|
|
22
|
+
transformation;
|
|
23
|
+
constructor(data, packageName, deps, config) {
|
|
21
24
|
this.data = data;
|
|
22
25
|
this.packageName = packageName;
|
|
26
|
+
this.deps = deps;
|
|
23
27
|
this.config = config;
|
|
28
|
+
this.transformation = new Transformation(config);
|
|
24
29
|
const dep = DependencyManager.getInstance(config);
|
|
30
|
+
let outdir = config.outdir || './';
|
|
31
|
+
// Make outdir relative to the root directory
|
|
32
|
+
outdir = relative(config.root, outdir);
|
|
33
|
+
const typeDir = getDestPath(outdir);
|
|
25
34
|
this.data = {
|
|
26
35
|
...this.data,
|
|
27
36
|
APP_NAME,
|
|
28
37
|
APP_USAGE,
|
|
29
38
|
APP_SOURCE,
|
|
39
|
+
APP_VERSION,
|
|
40
|
+
PACKAGE_DESC: PACKAGE_DESC(packageName, this.config.environment, this.data?.girModule?.libraryVersion),
|
|
41
|
+
PACKAGE_KEYWORDS: PACKAGE_KEYWORDS(packageName, this.config.environment),
|
|
42
|
+
importName: this.transformation.transformImportName(packageName),
|
|
30
43
|
dep,
|
|
44
|
+
deps,
|
|
45
|
+
typeDir,
|
|
46
|
+
join,
|
|
47
|
+
dirname,
|
|
31
48
|
};
|
|
32
|
-
this.environmentTemplateDir = getEnvironmentDir(config.environment, TEMPLATE_DIR);
|
|
49
|
+
this.environmentTemplateDir = this.getEnvironmentDir(config.environment, TEMPLATE_DIR);
|
|
33
50
|
this.log = new Logger(config.environment, config.verbose, this.packageName);
|
|
34
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Get the output or input directory of the environment
|
|
54
|
+
* @param environment The environment to get the directory for
|
|
55
|
+
* @param baseDir The base directory
|
|
56
|
+
* @returns The path to the directory
|
|
57
|
+
*/
|
|
58
|
+
getEnvironmentDir = (environment, baseDir) => {
|
|
59
|
+
if (!baseDir.endsWith(environment))
|
|
60
|
+
if (environment === 'gjs' && !baseDir.endsWith('/gjs')) {
|
|
61
|
+
return join(baseDir, 'gjs');
|
|
62
|
+
}
|
|
63
|
+
if (environment === 'node' && !baseDir.endsWith('/node-gtk')) {
|
|
64
|
+
return join(baseDir, 'node-gtk');
|
|
65
|
+
}
|
|
66
|
+
return baseDir;
|
|
67
|
+
};
|
|
68
|
+
getAppendTemplateName(templateFilename) {
|
|
69
|
+
let appendTemplateFilename = templateFilename;
|
|
70
|
+
if (appendTemplateFilename.endsWith('.d.ts')) {
|
|
71
|
+
appendTemplateFilename = appendTemplateFilename.replace('.d.ts', '.append.d.ts');
|
|
72
|
+
}
|
|
73
|
+
else if (extname(appendTemplateFilename)) {
|
|
74
|
+
const ext = extname(appendTemplateFilename);
|
|
75
|
+
appendTemplateFilename = appendTemplateFilename.replace(ext, '.append' + ext);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
appendTemplateFilename += '.append';
|
|
79
|
+
}
|
|
80
|
+
return appendTemplateFilename;
|
|
81
|
+
}
|
|
35
82
|
/**
|
|
36
83
|
* Loads and renders a template and gets the rendered templates back
|
|
37
84
|
* @param templateFilename
|
|
38
85
|
*/
|
|
39
|
-
async load(templateFilename) {
|
|
86
|
+
async load(templateFilename, options = {}, overrideTemplateData = {}) {
|
|
40
87
|
const fileContent = await this.read(templateFilename);
|
|
41
|
-
|
|
88
|
+
const prepend = await this.render(fileContent, options, overrideTemplateData);
|
|
89
|
+
let append = '';
|
|
90
|
+
const appendTemplateFilename = this.getAppendTemplateName(templateFilename);
|
|
91
|
+
if (this.exists(appendTemplateFilename)) {
|
|
92
|
+
const appendFileContent = await this.read(appendTemplateFilename);
|
|
93
|
+
append = await this.render(appendFileContent, options, overrideTemplateData);
|
|
94
|
+
}
|
|
95
|
+
return { prepend, append };
|
|
42
96
|
}
|
|
43
97
|
/**
|
|
44
98
|
* Loads and renders all templates in a directory and gets the rendered templates back
|
|
45
99
|
* @param templateDirname
|
|
100
|
+
* @param fileExtension
|
|
101
|
+
* @param options EJS options
|
|
102
|
+
* @param overrideTemplateData Override template data if you want
|
|
103
|
+
* @returns The rendered templates
|
|
46
104
|
*/
|
|
47
|
-
async loadAll(templateDirname, fileExtension) {
|
|
105
|
+
async loadAll(templateDirname, fileExtension, options = {}, overrideTemplateData = {}) {
|
|
48
106
|
const fileContents = await this.readAll(templateDirname, fileExtension);
|
|
49
107
|
for (const file of Object.keys(fileContents)) {
|
|
50
|
-
fileContents[file] = await this.render(fileContents[file]);
|
|
108
|
+
fileContents[file] = await this.render(fileContents[file], options, overrideTemplateData);
|
|
51
109
|
}
|
|
52
110
|
return fileContents;
|
|
53
111
|
}
|
|
54
112
|
/**
|
|
55
113
|
* Loads an template, render the template and write the template to the filesystem
|
|
56
|
-
* @param templateFilename
|
|
57
|
-
* @param
|
|
58
|
-
* @param outputFilename
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @
|
|
114
|
+
* @param templateFilename The filename of the template
|
|
115
|
+
* @param baseOutputPath The base output directory path where the templates should be written to
|
|
116
|
+
* @param outputFilename The filename of the output file
|
|
117
|
+
* @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
|
|
118
|
+
* @param content A (optional) string that should be appended to the rendered template
|
|
119
|
+
* @param options EJS options
|
|
120
|
+
* @param overrideTemplateData Override template data if you want
|
|
121
|
+
* @return The rendered template string
|
|
62
122
|
*/
|
|
63
|
-
async create(templateFilename,
|
|
64
|
-
const
|
|
65
|
-
const code =
|
|
66
|
-
await this.write(code,
|
|
123
|
+
async create(templateFilename, baseOutputPath, outputFilename, prependEnv = true, content = '', options = {}, overrideTemplateData = {}) {
|
|
124
|
+
const { prepend, append } = await this.load(templateFilename, options, overrideTemplateData);
|
|
125
|
+
const code = prepend + '\n' + content + '\n' + append;
|
|
126
|
+
await this.write(code, baseOutputPath, outputFilename, prependEnv);
|
|
67
127
|
return code;
|
|
68
128
|
}
|
|
69
129
|
/**
|
|
70
130
|
* Loads all templates with file extension in dir, render the templates and write the template to the filesystem
|
|
71
|
-
* @param fileExtension
|
|
72
|
-
* @param templateDirname
|
|
73
|
-
* @param
|
|
74
|
-
* @param outputDirname
|
|
131
|
+
* @param fileExtension The file extension of the templates
|
|
132
|
+
* @param templateDirname The directory where the templates are located
|
|
133
|
+
* @param baseOutputPath The base output directory path where the templates should be written to
|
|
134
|
+
* @param outputDirname The child output directory of the base output directory where the templates should be written to
|
|
135
|
+
* @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
|
|
136
|
+
* @param append A (optional) string that should be appended to the rendered template
|
|
137
|
+
* @param options EJS options
|
|
138
|
+
* @param overrideTemplateData Override template data if you want
|
|
75
139
|
* @return The rendered (and if possible prettified) templates
|
|
76
140
|
*/
|
|
77
|
-
async createAll(fileExtension, templateDirname,
|
|
78
|
-
const
|
|
141
|
+
async createAll(fileExtension, templateDirname, baseOutputPath, outputDirname, prependEnv = true, append = '', options = {}, overrideTemplateData = {}) {
|
|
142
|
+
const rendered = await this.loadAll(templateDirname, fileExtension, options, overrideTemplateData);
|
|
79
143
|
const result = {};
|
|
80
|
-
for (const filename of Object.keys(
|
|
81
|
-
const destPath = getDestPath(
|
|
82
|
-
result[destPath] =
|
|
83
|
-
await this.write(result[destPath],
|
|
144
|
+
for (const filename of Object.keys(rendered)) {
|
|
145
|
+
const destPath = getDestPath(baseOutputPath, outputDirname, filename);
|
|
146
|
+
result[destPath] = rendered[filename] + '\n' + append;
|
|
147
|
+
await this.write(result[destPath], baseOutputPath, join(outputDirname, filename), prependEnv);
|
|
84
148
|
}
|
|
85
149
|
return result;
|
|
86
150
|
}
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
?
|
|
90
|
-
:
|
|
151
|
+
getOutputPath(baseOutputPath, outputFilename, prependEnv = true) {
|
|
152
|
+
const filePath = this.config.package
|
|
153
|
+
? join(this.data?.importName || this.packageName, outputFilename)
|
|
154
|
+
: outputFilename;
|
|
155
|
+
const outputPath = prependEnv ? getDestPath(baseOutputPath, filePath) : join(baseOutputPath, filePath);
|
|
156
|
+
return outputPath;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Writes the `content` to the filesystem
|
|
160
|
+
* @param content The content (normally the content of a rendered template file) that should be written to the filesystem
|
|
161
|
+
* @param baseOutputPath The base output directory path where the templates should be written to
|
|
162
|
+
* @param outputFilename The filename of the output file
|
|
163
|
+
* @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
async write(content, baseOutputPath, outputFilename, prependEnv = true) {
|
|
167
|
+
const outputPath = this.getOutputPath(baseOutputPath, outputFilename, prependEnv);
|
|
91
168
|
// write template result file
|
|
92
|
-
await mkdir(
|
|
93
|
-
await writeFile(
|
|
94
|
-
return Promise.resolve(
|
|
169
|
+
await mkdir(dirname(outputPath), { recursive: true });
|
|
170
|
+
await writeFile(outputPath, content, { encoding: 'utf8', flag: 'w' });
|
|
171
|
+
return Promise.resolve(outputPath);
|
|
95
172
|
}
|
|
96
|
-
|
|
173
|
+
/**
|
|
174
|
+
*
|
|
175
|
+
* @param templateString The template content string that should be rendered
|
|
176
|
+
* @param options EJS options
|
|
177
|
+
* @param overrideTemplateData Override template data if you want
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
async render(templateString, options = {}, overrideTemplateData = {}) {
|
|
97
181
|
try {
|
|
98
182
|
const renderedTpl = await ejs.render(templateString, {
|
|
99
183
|
...this.config,
|
|
100
184
|
...this.data,
|
|
185
|
+
packageName: this.packageName,
|
|
186
|
+
...overrideTemplateData,
|
|
101
187
|
}, {
|
|
102
188
|
async: true,
|
|
103
189
|
...options,
|
|
@@ -105,6 +191,7 @@ export class TemplateProcessor {
|
|
|
105
191
|
return renderedTpl;
|
|
106
192
|
}
|
|
107
193
|
catch (error) {
|
|
194
|
+
console.error(error);
|
|
108
195
|
this.log.error('Error on render', error);
|
|
109
196
|
return '';
|
|
110
197
|
}
|
|
@@ -115,8 +202,8 @@ export class TemplateProcessor {
|
|
|
115
202
|
* @param templateFilename
|
|
116
203
|
*/
|
|
117
204
|
exists(templateFilename) {
|
|
118
|
-
const fullEnvironmentTemplatePath =
|
|
119
|
-
const fullGeneralTemplatePath =
|
|
205
|
+
const fullEnvironmentTemplatePath = join(this.environmentTemplateDir, templateFilename);
|
|
206
|
+
const fullGeneralTemplatePath = join(TEMPLATE_DIR, templateFilename);
|
|
120
207
|
if (existsSync(fullEnvironmentTemplatePath)) {
|
|
121
208
|
return fullEnvironmentTemplatePath;
|
|
122
209
|
}
|
|
@@ -154,7 +241,7 @@ export class TemplateProcessor {
|
|
|
154
241
|
}
|
|
155
242
|
const results = {};
|
|
156
243
|
for (const file of files) {
|
|
157
|
-
results[file] = await readFile(
|
|
244
|
+
results[file] = await readFile(join(path, file), 'utf8');
|
|
158
245
|
}
|
|
159
246
|
return results;
|
|
160
247
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-processor.js","sourceRoot":"","sources":["../src/template-processor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAA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