Skip to content

Commit

Permalink
Package importing fix | 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WarstekHUN committed Oct 5, 2023
1 parent 8a430e6 commit 93a9879
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 17 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
prerelease: false
body_path: "CHANGELOG.md"

publish:
publishNPM:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -33,19 +33,27 @@ jobs:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install modules
run: npm install
run: npm ci
- name: Build and generate coverage badges
run: npm run build
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publishGHP:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .npmrc file to publish to GitHub Packages
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@warstekhun'
- name: Install modules
run: npm ci
- name: Build and generate coverage badges
run: npm run build
- name: Publish to GitHub Packages
run: npm publish
env:
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- Fixed an issue with importing the library.

## Breaking Changes

### New importing
From now on, there is no default export.

ESM

```ts
import { ZilaConnection } from "zilaws-server";
```

CommonJS
```ts
const { ZilaConnection } = require("zilaws-server");
```
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://json.schemastore.org/package",
"name": "zilaws-server",
"version": "1.0.1",
"description": "Typescript NPM package template that is ready for NPM and Github Packages publish.",
"version": "1.1.0",
"description": "ZilaWS is a blazingly fast and very lightweight library that provides an extremely easy-to-use way to transmit data via websockets between clientside and serverside using eventhandlers and async waiters.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"umd:main": "dist/umd/index.js",
Expand All @@ -17,14 +17,13 @@
"build:esm": "rimraf ./dist/esm && tsc -p config/tsconfig.esm.json",
"build:types": "rimraf ./dist/types && tsc -p config/tsconfig.types.json",
"clean": "rimraf ./dist/cjs ./dist/esm ./dist/umd ./dist/types",
"package": "npm run build && npm pack",
"test": "jest --no-cache --runInBand",
"test:cov": "jest --coverage --no-cache --runInBand",
"test:cov-browser": "jest --coverage --no-cache --runInBand && start ./coverage/lcov-report/index.html",
"test:cov-build": "jest --coverage --no-cache --runInBand && jest-coverage-badges-ts --output \"./.coverage-badges\"",
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
"format:fix": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"release": "rimraf ./*.tgz -g && npm run package && node tools/versionManager.js"
"release": "rimraf ./*.tgz -g && npm run build && node tools/versionManager.js"
},
"files": [
"dist"
Expand Down Expand Up @@ -67,7 +66,7 @@
"typescript": "^5.2.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"zilaws-client": "^1.0.0"
"zilaws-client": "^1.1.0"
},
"dependencies": {
"ws": "^8.13.0"
Expand Down
2 changes: 1 addition & 1 deletion src/ZilaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { WebSocket as WebSocketClient } from "ws";
import { randomInt, randomUUID } from "crypto";
import ZilaServer, { WSStatus } from ".";
import { ZilaServer, WSStatus } from ".";
import { IWSMessage } from "./IWSMessage";

export default class ZilaClient {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ interface IServerEvents {
onClientRawMessageBeforeCallback: (socket: ZilaClient, rawMessage: string) => void;
}

export default class ZilaServer {
export class ZilaServer {
wss: WebSocketServer;
VerbLog?: ILogger;
Logger?: ILogger;
Expand Down
4 changes: 2 additions & 2 deletions test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ZilaServer, { ZilaClient, CloseCodes, WSStatus } from "../src/index";
import connectTo, { ZilaConnection } from "zilaws-client";
import { ZilaServer, ZilaClient, CloseCodes, WSStatus } from "../src/index";
import { connectTo, ZilaConnection } from "zilaws-client";
import { SimpleLogger, VerboseLogger } from "../src/verboseLogger";
import { WebSocket } from "ws";
import { join } from "path";
Expand Down

0 comments on commit 93a9879

Please sign in to comment.