diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..87bfaf2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,36 @@ +name: publish +on: + release: + types: [ created ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 17 + registry-url: "https://registry.npmjs.org" + + - name: Install dependencies + run: npm install --force + + - name: Build + run: npm run build --if-present + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 17 + registry-url: "https://registry.npmjs.org" + + - name: Publish + run: npm install && npm run build --if-present && npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + diff --git a/.gitignore b/.gitignore index acd2f4f..88351a1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,17 +2,16 @@ .idea node_modules build +package # ================= mistake commit prevent ================= # # test bot config test/config.json # source js -src/*.js src/**/*.js src/**/*.map # test js -test/*.js test/**/*.js test/**/*.map \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..605e00f --- /dev/null +++ b/.npmignore @@ -0,0 +1,2 @@ +!package +src \ No newline at end of file diff --git a/package.json b/package.json index d9a42fb..5d4ef23 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "discordp", - "version": "1.0.1", - "main": "src/Client.ts", + "version": "1.1.0", + "main": "package/Client.d.ts", "author": "PleahMaCaka", "license": "MIT", "bugs": "https://github.com/PleahMaCaka/discordp/issues", @@ -32,6 +32,7 @@ "url": "git+https://github.com/PleahMaCaka/discordp.git" }, "scripts": { - "build": "tsc" + "build": "tsc", + "test:bot": "yarn build && ts-node test/bot.ts" } } diff --git a/tsconfig.json b/tsconfig.json index f4b0397..c11d2e6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,15 +2,15 @@ "compilerOptions": { "target": "ES6", "module": "CommonJS", - "outDir": "build", + "outDir": "package", "sourceMap": false, "declaration": true }, "include": [ - "src/**/*.ts", - "test/**/*.ts" + "src/**/*.ts" ], "exclude": [ - "node_modules" + "node_modules", + "test/**/*.ts" ] } \ No newline at end of file