diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000..53a4676 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,50 @@ +name: Linting, Building and Testing + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18.17.0' # specify Node.js version here + + - name: Install pnpm + run: curl -f https://get.pnpm.io/v6.js | node - add --global pnpm + + - name: Install dependencies + run: pnpm install --no-frozen-lockfile + + - name: Run lint + run: pnpm run lint # add lint script in package.json + + + # test_and_build: + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + + # - name: Setup Node.js + # uses: actions/setup-node@v2 + # with: + # node-version: '18.17.0' + + # - name: Install pnpm + # run: curl -f https://get.pnpm.io/v6.js | node - add --global pnpm + + # - name: Install dependencies + # run: pnpm install --no-frozen-lockfile + + # - name: Run build + # run: pnpm run build + + # - name: Run test + # run: pnpm run test diff --git a/movie-service/src/datasource/index.ts b/movie-service/src/datasource/index.ts index 8e6bba1..2dfa55a 100644 --- a/movie-service/src/datasource/index.ts +++ b/movie-service/src/datasource/index.ts @@ -9,3 +9,17 @@ if (config.node_env === 'test') { } export default database; + +// import config from '@config'; +// import { PostgresClient, DB } from '@cineverse/libs'; +// import { Movie, Theater, ShowTime, Seat } from '@models'; + +// let database; +// const models = [Movie, Theater, Seat, ShowTime]; +// if (config.node_env === 'test') { +// database = new PostgresClient(config.test as DB, models); +// } else { +// database = new PostgresClient(config.development as DB, models); +// } + +// export default database; diff --git a/package.json b/package.json index e51ef81..8f53d2f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "scripts": { "start": "pnpm -r run dev", "test:server": "pnpm --parallel run test:server", - "build": "pnpm -r run build", "clean": "pnpm -r run clean", "libs": "pnpm --filter @cineverse/libs run dev", "libs:build": "pnpm --filter @cineverse/libs run build", @@ -16,7 +15,10 @@ "auth:test": "pnpm --filter auth-service run test", "movie": "pnpm --filter movie-service run dev", "movie:build": "pnpm --filter movie-service run build", - "movie:test": "pnpm --filter movie-service run test" + "movie:test": "pnpm --filter movie-service run test", + "test": "npx nx run-many --target=test --all", + "build": "npx nx run-many --target=build --all", + "lint": "npx nx run-many --target=lint --all" }, "devDependencies": { "nx": "^16.7.4"