Skip to content

Commit

Permalink
feat: add commonjs export
Browse files Browse the repository at this point in the history
  • Loading branch information
rixcian committed Aug 28, 2024
1 parent bf49093 commit 4f71fac
Show file tree
Hide file tree
Showing 7 changed files with 2,155 additions and 709 deletions.
Binary file added .DS_Store
Binary file not shown.
2,813 changes: 2,116 additions & 697 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,40 @@
"type": "module",
"license": "MIT",
"scripts": {
"build": "rimraf dist && tsc",
"build": "rimraf dist && tsup",
"ci": "npm run build && npm run lint:fix && npm run test",
"dev": "tsc --watch",
"lint:fix": "prettier --write .",
"lint": "prettier --check --ignore-unknown .",
"lint:fix": "tsc && prettier --write .",
"lint": "tsc && prettier --check --ignore-unknown .",
"check:exports": "attw --pack .",
"test": "vitest run",
"test:watch": "vitest",
"prerelease": "npx changeset",
"release": "changeset version && changeset publish",
"prepublishOnly": "npm run ci"
},
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/index.js",
"default": "./dist/index.cjs"
}
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.4",
"@changesets/cli": "^2.27.7",
"@types/electron-config": "^3.2.2",
"@types/request-promise": "^4.1.51",
"@types/uuid": "^10.0.0",
"dotenv": "^16.4.5",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"tsup": "^8.2.4",
"typescript": "^5.5.4",
"vitest": "^2.0.5"
},
"dependencies": {
"electron-store": "^10.0.0",
"electron-config": "^1.0.0",
"http_ece": "^1.2.1",
"long": "^5.2.3",
"protobufjs": "^7.4.0",
Expand Down
8 changes: 8 additions & 0 deletions src/electron/electron-config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare module 'electron-config' {
export default class ElectronConfig {
constructor(options?: { defaults: { [key: string]: any } });
get(key: string): any;
set(key: string, value: any): void;
delete(key: string): void;
}
}
2 changes: 1 addition & 1 deletion src/electron/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ipcMain, type WebContents } from 'electron';
import ElectronStore from 'electron-store';
import ElectronStore from 'electron-config';

import { listen } from '../core/listen.js';
import { register, type FirebaseCredentials } from '../core/register.js';
Expand Down
15 changes: 8 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@
"moduleDetection": "force",
"isolatedModules": true,
"verbatimModuleSyntax": true,
"noEmit": true,

/* Strictness */
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,

/* If transpiling with TypeScript: */
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"rootDir": "src",
"sourceMap": true,
"module": "Preserve",
// "moduleResolution": "NodeNext",
// "outDir": "dist",
// "rootDir": "src",
// "sourceMap": true,

/* AND if you're building for a library: */
"declaration": true,
// "declaration": true,

/* AND if you're building for a library in a monorepo: */
"declarationMap": true,
// "declarationMap": true,

/* Use ES2022 library definitions */
"lib": ["ES2022"]
Expand Down
9 changes: 9 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts'],
format: ['cjs', 'esm'],
dts: true,
outDir: 'dist',
clean: true,
});

0 comments on commit 4f71fac

Please sign in to comment.