diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b59c380..9a96523 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,7 +23,7 @@ jobs: prerelease: false body_path: "CHANGELOG.md" - publish: + publishNPM: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -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: diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..589a380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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"); +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 866707f..698a01f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "zilaws-server", - "version": "1.0.1", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zilaws-server", - "version": "1.0.1", + "version": "1.1.0", "license": "MIT", "dependencies": { "ws": "^8.13.0" @@ -25,7 +25,7 @@ "typescript": "^5.2.2", "webpack": "^5.88.2", "webpack-cli": "^5.1.4", - "zilaws-client": "^1.0.0" + "zilaws-client": "^1.1.0" }, "engines": { "node": ">=18.0.0" @@ -5334,9 +5334,9 @@ } }, "node_modules/zilaws-client": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/zilaws-client/-/zilaws-client-1.0.0.tgz", - "integrity": "sha512-SvVQaXMWQvS4dTO2i2g5c5S5f8ji53yiCJdq6Vs+6ZXwLh/NZ2xHSJsKO3p74w5T3f5Ky7Yb957eTTuxeJ8Ghg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/zilaws-client/-/zilaws-client-1.1.0.tgz", + "integrity": "sha512-uL2Sy33kURAa758R5AuBWYoqg8Frte9RCSiVPwJKwUS2Vej8+dnJgDWuZIE8HyGIIEEBy1EU/mvWhu1ItDiGGQ==", "dev": true, "dependencies": { "uuid": "^9.0.0", diff --git a/package.json b/package.json index 43e937d..88f539d 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" @@ -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" diff --git a/src/ZilaClient.ts b/src/ZilaClient.ts index a23c9ba..0f69786 100644 --- a/src/ZilaClient.ts +++ b/src/ZilaClient.ts @@ -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 { diff --git a/src/index.ts b/src/index.ts index ca5328b..73a009d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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; diff --git a/test/index.test.ts b/test/index.test.ts index d6781cf..38a0de8 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -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";