From d7f004407eb1f97f44d8cccf0caca7e6458f68f2 Mon Sep 17 00:00:00 2001 From: Beace Date: Sun, 18 Jun 2023 00:03:47 +0800 Subject: [PATCH] chore: change ts build --- .github/workflows/npm-publish.yaml | 6 +++--- agent.ts | 2 +- app.ts | 2 +- {src/impl => impl}/elasticsearch.ts | 0 package.json | 14 +++----------- tsconfig.build.json | 3 +++ src/types.ts => types.ts | 0 7 files changed, 11 insertions(+), 16 deletions(-) rename {src/impl => impl}/elasticsearch.ts (100%) rename src/types.ts => types.ts (100%) diff --git a/.github/workflows/npm-publish.yaml b/.github/workflows/npm-publish.yaml index 6cb4efb..19c2419 100644 --- a/.github/workflows/npm-publish.yaml +++ b/.github/workflows/npm-publish.yaml @@ -26,7 +26,7 @@ jobs: - name: Use Node.js 16 uses: actions/setup-node@v1 with: - node-version: 16 + node-version: 18 # Specifies the registry, this field is required! registry-url: https://registry.npmjs.org/ # clean install of your projects' deps. We use "npm ci" to avoid package lock changes @@ -45,12 +45,12 @@ jobs: # run tests just in case - run: npm test # publish to NPM -> there is one caveat, continue reading for the fix - - run: npm publish --provenance --access public + - run: cd lib && npm publish --provenance --access public if: "!github.event.release.prerelease" env: # Use a token to publish to NPM. See below for how to set it up NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: npm publish --provenance --access public --tag beta + - run: cd lib && npm publish --provenance --access public --tag beta if: "github.event.release.prerelease" env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/agent.ts b/agent.ts index c128c47..e064d7c 100644 --- a/agent.ts +++ b/agent.ts @@ -1,5 +1,5 @@ import { Application } from 'egg'; -import elasticsearch from './src/impl/elasticsearch'; +import elasticsearch from './impl/elasticsearch'; export default (app: Application) => { if (app.config.elasticsearch.app) elasticsearch(app); diff --git a/app.ts b/app.ts index c128c47..e064d7c 100644 --- a/app.ts +++ b/app.ts @@ -1,5 +1,5 @@ import { Application } from 'egg'; -import elasticsearch from './src/impl/elasticsearch'; +import elasticsearch from './impl/elasticsearch'; export default (app: Application) => { if (app.config.elasticsearch.app) elasticsearch(app); diff --git a/src/impl/elasticsearch.ts b/impl/elasticsearch.ts similarity index 100% rename from src/impl/elasticsearch.ts rename to impl/elasticsearch.ts diff --git a/package.json b/package.json index ea00e29..5daae04 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "eggjs-elasticsearch", "version": "0.0.1", "description": "eggjs elasticsearch plugin", - "types": "./lib/type.d.ts", + "types": "./type.d.ts", "eggPlugin": { "name": "elasticsearch" }, @@ -11,17 +11,10 @@ "test-local": "egg-bin test", "cov": "egg-bin cov", "ci": "npm run lint && npm run cov", - "build": "tsc -p ./tsconfig.build.json", + "build": "tsc -p ./tsconfig.build.json && cp ./package.json lib/", "lint:fix": "eslint . --ext .ts --fix", "lint": "eslint . --ext .ts" }, - "files": [ - "lib", - "app.js", - "app.d.js", - "agent.js", - "app.d.js" - ], "repository": { "type": "git", "url": "git+https://github.com/Beace/eggjs-elasticsearch.git" @@ -54,7 +47,6 @@ "version": "16, 18" }, "dependencies": { - "@elastic/elasticsearch": "^8.8.1", - "ioredis": "^5.3.2" + "@elastic/elasticsearch": "^8.8.1" } } diff --git a/tsconfig.build.json b/tsconfig.build.json index 8761cf4..5b504e5 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,4 +1,7 @@ { "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "./", + }, "exclude": ["lib", "test", "**/*.test.ts"] } \ No newline at end of file diff --git a/src/types.ts b/types.ts similarity index 100% rename from src/types.ts rename to types.ts