Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): run depcheck and lint in CI #138

Merged
merged 3 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Linting

on: [push, pull_request]

env:
CI: true

jobs:
test:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: yarn --frozen-lockfile
- run: yarn clean
- run: yarn prepack
- run: yarn lint
- run: yarn lint:deps
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -912,13 +912,11 @@ however, ensure that your action only applies to the shadow database by setting
the `"shadow": true` property, leaving you free to manage how your more
permanent databases are initialized.


## Examples

- [Running Graphile Migrate in a Docker container](docs/docker/README.md)
- [Examples of idempotent migration files including edge cases](docs/idempotent-examples.md)


## TODO:

- [ ] Store pgSettings with committed transactions to protect against user edits
Expand Down
8 changes: 4 additions & 4 deletions docs/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Running Graphile Migrate from a container

When working in a team it can be useful to package `graphile-migrate` and the
Postgres tooling into a Docker file so that everyone has easy access to the
same versions. This is also helpful if you're using Migrate as part of a larger
Postgres tooling into a Docker file so that everyone has easy access to the same
versions. This is also helpful if you're using Migrate as part of a larger
non-Node based project.

For these purposes we provide an [example Dockerfile](./Dockerfile) in the
`docs/docker` directory in the source tree. This uses the latest released
version of `graphile-migrate` from `npm` and packages it together with the
necessary Node and Postgres tools. You can build the Dockerfile from the
root of the repository using a command like such as:
necessary Node and Postgres tools. You can build the Dockerfile from the root of
the repository using a command like such as:

```bash
docker build -t graphile-migrate docs/docker \
Expand Down
12 changes: 8 additions & 4 deletions docs/idempotent-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ begin
/* if column `username` exists on users table */
if exists(
select 1
from information_schema.columns
from information_schema.columns
where table_schema = 'public'
and table_name = 'users'
and table_name = 'users'
and column_name = 'username'
) then
/* rename the column to `name` */
Expand All @@ -60,7 +60,9 @@ begin
end$$;
```

The structure changes a little if we want to rename an enum value, but the idea is the same:
The structure changes a little if we want to rename an enum value, but the idea
is the same:

```sql
do $$
begin
Expand All @@ -79,4 +81,6 @@ begin
end$$;

```
Because of its compliance with the SQL standard, the `information_schema` does not contain Postgres-only objects, like enums.

Because of its compliance with the SQL standard, the `information_schema` does
not contain Postgres-only objects, like enums.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"main": "dist/index.js",
"scripts": {
"lint": "yarn prettier:check && eslint --ext .js,.jsx,.ts,.tsx,.graphql .",
"lint:deps": "depcheck --ignores @types/jest,eslint_d,tslib ",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx,.graphql . --fix; prettier --ignore-path .eslintignore --write '**/*.{js,jsx,ts,tsx,graphql,md,json}'",
"prettier:check": "prettier --ignore-path .eslintignore --check '**/*.{js,jsx,ts,tsx,graphql,md,json}'",
"prepack": "tsc && chmod +x dist/cli.js",
"clean": "rm -Rf dist",
"test": "yarn lint && depcheck --ignores @types/jest,eslint_d,tslib && yarn run test:only --ci",
"test": "yarn lint && yarn run lint:deps && yarn run test:only --ci",
"test:only": "jest -i",
"version": "yarn prepack && ./scripts/update-docs.js && git add README.md",
"watch": "mkdir -p dist && touch dist/cli.js && chmod +x dist/cli.js && tsc --watch"
Expand Down