Skip to content

Commit

Permalink
Do not create a directory for each module if package.json mode is dis…
Browse files Browse the repository at this point in the history
…abled
  • Loading branch information
JumpLink committed Jul 19, 2024
1 parent 72b4d57 commit cf64260
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion packages/generator-typescript/src/template-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ export class TemplateProcessor {
}

public getOutputPath(baseOutputPath: string, outputFilename: string): string {
const filePath = join(this.data?.importName || this.packageName, outputFilename)
// Create a directory for each package if package.json mode is enabled otherwise use the output directory directly
const filePath = this.config.package
? join(this.data?.importName || this.packageName, outputFilename)
: outputFilename
const outputPath = join(baseOutputPath, filePath)
return outputPath
}
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-typescript/templates/gjs/dom.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%_ const GLib = dep.find('GLib') -%>
<%_ if(!package && GLib){ _%>
/// <reference path="../glib-2.0/glib-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
<%_ } -%>

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/generator-typescript/templates/gjs/gjs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<%_ const GLib = await dep.get('GLib', '2.0') _%>
<%_ if(!package){ -%>
<%_ if(GObject){ -%>
/// <reference path="../gobject-2.0/gobject-2.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
<% } -%>
<%_ if(GLib){ -%>
/// <reference path="../glib-2.0/glib-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
<% } -%>
/// <reference path="./gettext.d.ts" />
/// <reference path="./system.d.ts" />
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-typescript/templates/gjs/system.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%_ const GObject = await dep.get('GObject', '2.0') _%>
<%_ if(!package && GObject){ _%>
/// <reference path="../gobject-2.0/gobject-2.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
<%_ } -%>

<%- GObject ? GObject.importDef : '' %>
Expand Down
10 changes: 5 additions & 5 deletions tests/types-package/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import './@types/gjs/gjs.d.ts'
import './@types/gjs/dom.d.ts'
import './@types/gtk-2.0/gtk-2.0.d.ts'
import './@types/gtk-3.0/gtk-3.0.d.ts'
import './@types/gtk-4.0/gtk-4.0.d.ts'
import './@types/gjs.d.ts'
import './@types/dom.d.ts'
import './@types/gtk-2.0.d.ts'
import './@types/gtk-3.0.d.ts'
import './@types/gtk-4.0.d.ts'

import Gettext from 'gettext'
console.log(Gettext.textdomain)
Expand Down

0 comments on commit cf64260

Please sign in to comment.