From e65c9d3b3831ffa0187a145d74212fb2df2dd961 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Sun, 23 May 2021 16:27:34 +0200 Subject: [PATCH] Provide format script (#749) * Provide format script * Run format script * Improve syntax --- .circleci/config.yml | 36 +++++++------- .github/workflows/codeql-analysis.yml | 68 +++++++++++++-------------- .prettierignore | 1 + docs/index.html | 47 +++++++++--------- package.json | 1 + test/ts/customRunnerDBClient.ts | 7 +-- test/ts/customRunnerDBUrl.ts | 7 +-- 7 files changed, 87 insertions(+), 80 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d454400..5852b1d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,7 +18,7 @@ save: &save key: code-{{ .Revision }} paths: - . - - "~/.npm-global" + - '~/.npm-global' restore: &restore restore_cache: @@ -333,16 +333,16 @@ jobs: - <<: *test-postgres test-env-vars: docker: - - <<: *node-image - environment: - - PGUSER=ubuntu - - PGPASSWORD=123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ - - PGDATABASE=circle_test - - image: postgres:13.2-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ - - POSTGRES_DB=circle_test + - <<: *node-image + environment: + - PGUSER=ubuntu + - PGPASSWORD=123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ + - PGDATABASE=circle_test + - image: postgres:13.2-alpine + environment: + - POSTGRES_USER=ubuntu + - POSTGRES_PASSWORD=123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ + - POSTGRES_DB=circle_test steps: - <<: *restore - <<: *postgres-wait @@ -509,22 +509,22 @@ workflows: - install - test-env-vars: requires: - - install + - install - test-schema: requires: - - install + - install - test-schemas: requires: - - install + - install - test-typescript-migration: requires: - - install + - install - test-typescript-customrunner-url: requires: - - install + - install - test-typescript-customrunner-client: requires: - - install + - install - test-create-migration: requires: - - install + - install diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 38798382..55aa6175 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,7 +3,7 @@ # # You may wish to alter this file to override the set of languages analyzed, # or to provide custom queries or build logic. -name: "CodeQL" +name: 'CodeQL' on: push: @@ -29,43 +29,43 @@ jobs: # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.prettierignore b/.prettierignore index f8a26871..0d842b9e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ +dist templates diff --git a/docs/index.html b/docs/index.html index 1db67867..f161c43b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,22 +1,25 @@ - - - - - node-pg-migrate - Postgresql database migration management tool for node.js - - - - - - -
- - - - + + + + + node-pg-migrate - Postgresql database migration management tool for node.js + + + + + + +
+ + + + diff --git a/package.json b/package.json index eccd8192..7782d02e 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "build": "tsc --removeComments && tsc --declaration --emitDeclarationOnly", "test": "cross-env NODE_ENV=test mocha --require ./mocha.bootstrap.js \"test/*.ts\"", "migrate": "node bin/node-pg-migrate", + "format": "prettier --write .", "lint": "eslint . bin/* --ext .js,.ts", "lintfix": "npm run lint -- --fix && prettier --write *.json *.md docs/*.md", "prepare": "npm run build", diff --git a/test/ts/customRunnerDBClient.ts b/test/ts/customRunnerDBClient.ts index 7e2b5166..63603583 100644 --- a/test/ts/customRunnerDBClient.ts +++ b/test/ts/customRunnerDBClient.ts @@ -1,12 +1,13 @@ import { Client } from 'pg' import { run } from './customRunner' -// eslint-disable-next-line prettier/prettier -(async () => { +async function start() { process.exitCode = 1 const dbClient = new Client(process.env.DATABASE_URL) await dbClient.connect() const result = await run({ dbClient }) // dbClient.end() process.exit(result === true ? 0 : 1) -})() +} + +start() diff --git a/test/ts/customRunnerDBUrl.ts b/test/ts/customRunnerDBUrl.ts index aedeee44..8b04ea83 100644 --- a/test/ts/customRunnerDBUrl.ts +++ b/test/ts/customRunnerDBUrl.ts @@ -1,8 +1,9 @@ import { run } from './customRunner' -// eslint-disable-next-line prettier/prettier -(async () => { +async function start() { process.exitCode = 1 const result = await run({ databaseUrl: String(process.env.DATABASE_URL) }) process.exit(result === true ? 0 : 1) -})() +} + +start()