Skip to content

Commit

Permalink
temp: Merge newlib with lib
Browse files Browse the repository at this point in the history
  • Loading branch information
ewlsh committed Feb 10, 2024
1 parent 1b1aaf2 commit 5be3ecf
Show file tree
Hide file tree
Showing 69 changed files with 824 additions and 660 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ModuleLoader } from '../module-loader.js'
import prettier from 'prettier'

import type { ConfigFlags } from '@ts-for-gir/lib'
import { Formatter } from '@ts-for-gir/lib/lib/newlib/lib.js'
import { Formatter } from '@ts-for-gir/lib'

const command = 'generate [modules..]'

Expand Down
20 changes: 8 additions & 12 deletions packages/generator-typescript/src/type-definition-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,24 @@ import {
IntrospectedSignal,
IntrospectedProperty,
IntrospectedConstant,
} from '@ts-for-gir/lib'
import {
IntrospectedClassCallback,
IntrospectedClassFunction,
IntrospectedConstructor,
IntrospectedDirectAllocationConstructor,
IntrospectedFunctionParameter,
IntrospectedStaticClassFunction,
IntrospectedVirtualClassFunction,
} from '@ts-for-gir/lib/lib/newlib/gir/function.js'
import { IntrospectedNamespaceMember } from '@ts-for-gir/lib/lib/newlib/gir/base.js'
import {
FormatGenerator,
Generic,
GirEnumMember,
IntrospectedNamespaceMember,
IntrospectedAlias,
IntrospectedEnum,
IntrospectedSignalType,
IntrospectedEnumMember,
IntrospectedError,
FormatGenerator,
Generic,
NativeType,
} from '@ts-for-gir/lib/lib/newlib/lib.js'
import { IntrospectedError } from '@ts-for-gir/lib/lib/newlib/gir/enum.js'
import { isInvalid } from '@ts-for-gir/lib/lib/newlib/gir/util.js'
isInvalid,
} from '@ts-for-gir/lib'

function printGirDocComment(tsDoc: TsDoc, config: GenerateConfig) {
const desc: string[] = []
Expand Down Expand Up @@ -808,7 +804,7 @@ class ModuleGenerator extends FormatGenerator<string[]> {
return desc
}

generateEnumMember(tsMember: GirEnumMember, indentCount = 1) {
generateEnumMember(tsMember: IntrospectedEnumMember, indentCount = 1) {
const desc: string[] = []

desc.push(...this.addGirDocComment(tsMember.doc, [], indentCount))
Expand Down
40 changes: 20 additions & 20 deletions packages/lib/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
module.exports = {
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
],
"rules": {
"semi": ["error", "never"],
"no-debugger": "off",
"@typescript-eslint/triple-slash-reference": "off",
"camelcase": "off",
"@typescript-eslint/camelcase": "off"
rules: {
semi: ['error', 'never'],
'no-debugger': 'off',
'@typescript-eslint/triple-slash-reference': 'off',
camelcase: 'off',
'@typescript-eslint/camelcase': 'off',
},
"parserOptions": {
"tsconfigRootDir": __dirname,
"project": ["./tsconfig.json"]
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
globals: {
imports: true,
},
"globals": {
"imports": true
}
}
10 changes: 5 additions & 5 deletions packages/lib/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 4
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 4
}
1 change: 0 additions & 1 deletion packages/lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@
# Library

Node.js library to generate Typescript Type Definition files for Gjs and node-gtk.

130 changes: 65 additions & 65 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
{
"name": "@ts-for-gir/lib",
"version": "3.2.3",
"description": "Typescript .d.ts generator from GIR for gjs",
"module": "lib/index.js",
"main": "lib/index.js",
"type": "module",
"engines": {
"node": ">=18"
},
"scripts": {
"build": "yarn lint && yarn build:ts",
"build:ts": "tsc",
"clear": "yarn clear:build",
"clear:build": "rimraf ./lib",
"watch": "yarn build:ts --watch",
"lint": "eslint . --ext .ts,.tsx --fix",
"update-package-descriptions": "wget https://raw.githubusercontent.com/vala-lang/valadoc-org/master/documentation/packages.xml"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gjsify/ts-for-gir.git"
},
"author": "Pascal Garber <[email protected]>",
"files": [
"lib"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/gjsify/ts-for-gir/issues"
},
"homepage": "https://github.com/gjsify/ts-for-gir#readme",
"keywords": [
"gjs",
"typescript",
"generate",
"gir",
"gobject-introspection",
"gnome",
"gtk",
"glib",
"gobject",
"dts",
"type definitions"
],
"devDependencies": {
"@types/ejs": "^3.1.4",
"@types/eslint": "8.44.6",
"@types/lodash": "^4.14.200",
"@types/node": "^20.8.10",
"@types/xml2js": "^0.4.13",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"typescript": "^5.2.2"
},
"dependencies": {
"colorette": "^2.0.20",
"ejs": "^3.1.9",
"lodash": "^4.17.21",
"xml2js": "0.6.2"
}
"name": "@ts-for-gir/lib",
"version": "3.2.3",
"description": "Typescript .d.ts generator from GIR for gjs",
"module": "lib/index.js",
"main": "lib/index.js",
"type": "module",
"engines": {
"node": ">=18"
},
"scripts": {
"build": "yarn lint && yarn build:ts",
"build:ts": "tsc",
"clear": "yarn clear:build",
"clear:build": "rimraf ./lib",
"watch": "yarn build:ts --watch",
"lint": "eslint . --ext .ts,.tsx --fix",
"update-package-descriptions": "wget https://raw.githubusercontent.com/vala-lang/valadoc-org/master/documentation/packages.xml"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gjsify/ts-for-gir.git"
},
"author": "Pascal Garber <[email protected]>",
"files": [
"lib"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/gjsify/ts-for-gir/issues"
},
"homepage": "https://github.com/gjsify/ts-for-gir#readme",
"keywords": [
"gjs",
"typescript",
"generate",
"gir",
"gobject-introspection",
"gnome",
"gtk",
"glib",
"gobject",
"dts",
"type definitions"
],
"devDependencies": {
"@types/ejs": "^3.1.4",
"@types/eslint": "8.44.6",
"@types/lodash": "^4.14.200",
"@types/node": "^20.8.10",
"@types/xml2js": "^0.4.13",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"typescript": "^5.2.2"
},
"dependencies": {
"colorette": "^2.0.20",
"ejs": "^3.1.9",
"lodash": "^4.17.21",
"xml2js": "0.6.2"
}
}
2 changes: 1 addition & 1 deletion packages/lib/src/dependency-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Transformation } from './transformation.js'

import type { Dependency, GenerateConfig, GirInclude } from './types/index.js'
import type { GirModule } from './gir-module.js'
import { GirNSRegistry } from './newlib/lib.js'
import { GirNSRegistry } from './registry.js'

export class DependencyManager {
protected log: Logger
Expand Down
26 changes: 26 additions & 0 deletions packages/lib/src/formatters/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
rules: {
semi: ["error", "always"],
quotes: ["error", "double", { avoidEscape: true }],
"no-debugger": "off",
"@typescript-eslint/triple-slash-reference": "off",
camelcase: "off",
"@typescript-eslint/camelcase": "off"
},
parserOptions: {
tsconfigRootDir: __dirname,
project: ["../../tsconfig.json"]
},
globals: {
imports: true
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
"singleQuote": false,
"printWidth": 120,
"tabWidth": 4
}

}
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions packages/lib/src/generators/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
rules: {
semi: ["error", "always"],
quotes: ["error", "double", { avoidEscape: true }],
"no-debugger": "off",
"@typescript-eslint/triple-slash-reference": "off",
camelcase: "off",
"@typescript-eslint/camelcase": "off"
},
parserOptions: {
tsconfigRootDir: __dirname,
project: ["../../tsconfig.json"]
},
globals: {
imports: true
}
};
8 changes: 8 additions & 0 deletions packages/lib/src/generators/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"trailingComma": "none",
"arrowParens": "avoid",
"singleQuote": false,
"printWidth": 120,
"tabWidth": 4
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
import { GirDirection } from "@gi.ts/parser";
import { IntrospectedAlias } from "../gir/alias.js";
import { AnyIntrospectedType } from "../gir/base.js";
import { GenerateConfig } from "../../types/generate-config.js";
import { GenerateConfig } from "../types/generate-config.js";

export function versionImportFormat(versionFormat: string, namespace: string, version: string) {
const versionSlug = version.toLowerCase().split(".")[0];
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { IntrospectedStaticClassFunction } from "../gir/function.js";
import { IntrospectedVirtualClassFunction } from "../gir/function.js";
import { IntrospectedAlias } from "../gir/alias.js";
import { TypeExpression } from "../gir.js";
import { GenerateConfig } from "../../types/generate-config.js";
import { GenerateConfig } from "../types/generate-config.js";

export interface GenericDescriptor {
type: TypeExpression;
Expand Down
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions packages/lib/src/generics/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
rules: {
semi: ["error", "always"],
quotes: ["error", "double", { avoidEscape: true }],
"no-debugger": "off",
"@typescript-eslint/triple-slash-reference": "off",
camelcase: "off",
"@typescript-eslint/camelcase": "off"
},
parserOptions: {
tsconfigRootDir: __dirname,
project: ["../../tsconfig.json"]
},
globals: {
imports: true
}
};
8 changes: 8 additions & 0 deletions packages/lib/src/generics/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"trailingComma": "none",
"arrowParens": "avoid",
"singleQuote": false,
"printWidth": 120,
"tabWidth": 4
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5be3ecf

Please sign in to comment.