From b3c4425215e31f7e0ad888f8260ff6280d4b0996 Mon Sep 17 00:00:00 2001 From: Yury Shkoda Date: Fri, 9 Jul 2021 11:12:15 +0300 Subject: [PATCH] chore(ci): configured github action for testing and building the project --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/npmpublish.yml | 22 ---------------------- .gitignore | 3 ++- README.md | 1 + package.json | 6 ++++-- tsconfig.json | 2 +- 6 files changed, 38 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/npmpublish.yml create mode 100644 README.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1471e29 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: SASjs Server Build + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Install Dependencies + run: npm ci + - name: Check Code Style + run: npm run lint + - name: Run Unit Tests + run: npm test + - name: Build Package + run: npm run package:lib + env: + CI: true diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml deleted file mode 100644 index 68b5672..0000000 --- a/.github/workflows/npmpublish.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: SASjs Server Deploy - -on: - push: - branches: - - master - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install dependencies - run: npm ci - - name: Build Project - run: npm run build - - name: Semantic Release - uses: cycjimmy/semantic-release-action@v2 - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 8e6fd33..ba89e4c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ node_modules/ .DS_Store .env* sas/ -tmp/ \ No newline at end of file +tmp/ +build/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..8af0c54 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# @sasjs/server diff --git a/package.json b/package.json index 4095d82..f6a0d67 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,13 @@ "main": "./src/server.ts", "scripts": { "start": "nodemon ./src/index.ts", - "build": "tsc --project ./", + "build": "rimraf build && tsc", "semantic-release": "semantic-release -d", "prepare": "[ -d .git ] && git config core.hooksPath ./.git-hooks || true", "test": "jest --coverage", "lint:fix": "npx prettier --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"", - "lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"" + "lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"", + "package:lib": "npm run build && cp ./package.json build && cp README.md build && cd build && npm version \"5.0.0\" && npm pack" }, "release": { "branches": [ @@ -31,6 +32,7 @@ "jest": "^27.0.6", "nodemon": "^2.0.7", "prettier": "^2.3.1", + "rimraf": "^3.0.2", "semantic-release": "^17.4.3", "supertest": "^6.1.3", "ts-jest": "^27.0.3", diff --git a/tsconfig.json b/tsconfig.json index a5976c8..8826cbe 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "target": "es5", "module": "commonjs", "rootDir": "./", - "outDir": "./dist", + "outDir": "./build", "esModuleInterop": true, "strict": true }