chore: first commit 🎉
This commit is contained in:
commit
9c5f9ebf23
28 changed files with 6264 additions and 0 deletions
8
.changeset/README.md
Normal file
8
.changeset/README.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Changesets
|
||||
|
||||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
||||
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
||||
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
||||
|
||||
We have a quick list of common questions to get you started engaging with this project in
|
||||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
||||
11
.changeset/config.json
Normal file
11
.changeset/config.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
|
||||
"changelog": "@changesets/cli/changelog",
|
||||
"commit": false,
|
||||
"fixed": [],
|
||||
"linked": [],
|
||||
"access": "restricted",
|
||||
"baseBranch": "main",
|
||||
"updateInternalDependencies": "patch",
|
||||
"ignore": []
|
||||
}
|
||||
14
.editorconfig
Normal file
14
.editorconfig
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{ts,js,tsx,json,yml}]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
38
.github/workflows/ci.yaml
vendored
Normal file
38
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Test
|
||||
timeout-minutes: 15
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- uses: pnpm/action-setup@v2.2.4
|
||||
with:
|
||||
version: 8.3.1
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20.9.0
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Checks
|
||||
run: pnpm checks
|
||||
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
node_modules
|
||||
.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
coverage
|
||||
|
||||
# next.js
|
||||
.next/
|
||||
out/
|
||||
build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# turbo
|
||||
.turbo
|
||||
out/
|
||||
|
||||
# typescript
|
||||
dist
|
||||
cjs
|
||||
4
.husky/commit-msg
Executable file
4
.husky/commit-msg
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm commit-msg
|
||||
4
.husky/pre-commit
Executable file
4
.husky/pre-commit
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm pre-commit
|
||||
4
.husky/pre-push
Executable file
4
.husky/pre-push
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm pre-push
|
||||
1
.npmrc
Normal file
1
.npmrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
save-prefix=''
|
||||
1
.nvmrc
Normal file
1
.nvmrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
20.9.0
|
||||
5
.prettierignore
Normal file
5
.prettierignore
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Add files here to ignore them from prettier formatting
|
||||
|
||||
/dist
|
||||
/coverage
|
||||
pnpm-lock.yaml
|
||||
7
.prettierrc
Normal file
7
.prettierrc
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 120,
|
||||
"arrowParens": "always",
|
||||
"bracketSpacing": true
|
||||
}
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Aboviq AB
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
26
README.md
Normal file
26
README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Emigrate
|
||||
|
||||
> The modern, modular and flexible migration tool for any database
|
||||
|
||||
It's effectively a successor of [klei-migrate](https://www.npmjs.com/package/klei-migrate) and [Immigration](https://www.npmjs.com/package/immigration).
|
||||
|
||||
## Features
|
||||
|
||||
- Database agnostic
|
||||
- Emigrate can migrate any database
|
||||
- Works at any scale
|
||||
- Supports any database as storage so multiple instances can share the same migration history
|
||||
- Uses smart locking to ensure only one instance migrates a certain migration at a time
|
||||
- Thanks to the smart locking it's safe to run migrations in parallel
|
||||
- Can be run inside containers
|
||||
- It's common for Docker or Kubernetes to kill containers with health checks if migrations takes too long to run
|
||||
- Emigrate makes sure the migration history does not get stuck in a locked state if that's the case
|
||||
- Supports any file type for your migration files
|
||||
- You can easily write migrations in JavaScript, TypeScript or plain SQL (or any other language)
|
||||
- You can customize the template for your migration files to fit your needs (or use a plugin to do it for you)
|
||||
- Easy to debug
|
||||
- Emigrate will store any errors that occur during migration in the migration history so you can easily debug them
|
||||
|
||||
## License
|
||||
|
||||
Emigrate is licensed under the MIT license. See [LICENSE](LICENSE) for the full license text.
|
||||
9
bin/prepare
Executable file
9
bin/prepare
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -eu
|
||||
|
||||
CI="${CI:-false}"
|
||||
|
||||
if [ "$CI" != "true" ]; then
|
||||
pnpm husky install
|
||||
fi
|
||||
10
commitlint.config.js
Normal file
10
commitlint.config.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
const commitlintConfig = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
rules: {
|
||||
'header-max-length': [2, 'always', 128],
|
||||
'body-max-line-length': [2, 'always', 256],
|
||||
'footer-max-line-length': [2, 'always', 256],
|
||||
},
|
||||
};
|
||||
|
||||
export default commitlintConfig;
|
||||
68
package.json
Normal file
68
package.json
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"name": "@emigrate/root",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "A monorepo for Emigrate the modern, modular, and flexible migration tool",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"prepare": "bin/prepare",
|
||||
"build": "turbo run build",
|
||||
"build:watch": "turbo run build:watch",
|
||||
"checks": "turbo run checks",
|
||||
"format": "prettier --write \"**/*.{ts,tsx,md,json,js}\"",
|
||||
"lint": "turbo run lint",
|
||||
"test": "turbo run test",
|
||||
"test:watch": "turbo run test:watch",
|
||||
"lint-staged": "lint-staged",
|
||||
"pre-commit": "run-s build lint-staged",
|
||||
"commit-msg": "commitlint --edit",
|
||||
"pre-push": "turbo run checks"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": {
|
||||
"name": "Aboviq AB",
|
||||
"email": "dev@aboviq.com",
|
||||
"url": "https://www.aboviq.com"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Joakim Carlstein",
|
||||
"email": "joakim@aboviq.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"volta": {
|
||||
"node": "20.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,tsx,html}": [
|
||||
"xo --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"*.{json,md,yaml}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"xo": {
|
||||
"space": true,
|
||||
"prettier": true
|
||||
},
|
||||
"dependencies": {
|
||||
"@changesets/cli": "2.26.2",
|
||||
"@commitlint/cli": "18.2.0",
|
||||
"@commitlint/config-conventional": "18.1.0",
|
||||
"@manypkg/cli": "0.21.0",
|
||||
"@types/node": "20.9.0",
|
||||
"husky": "8.0.3",
|
||||
"lint-staged": "15.0.2",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "3.0.3",
|
||||
"turbo": "1.10.16",
|
||||
"typescript": "5.2.2",
|
||||
"vitest": "0.34.6",
|
||||
"xo": "0.56.0"
|
||||
}
|
||||
}
|
||||
40
packages/emigrate/package.json
Normal file
40
packages/emigrate/package.json
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "emigrate",
|
||||
"version": "0.0.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"bin": {
|
||||
"emigrate": "dist/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "xo",
|
||||
"build": "tsc --pretty",
|
||||
"build:watch": "tsc --pretty --watch"
|
||||
},
|
||||
"keywords": [
|
||||
"migrate",
|
||||
"migrations",
|
||||
"database",
|
||||
"emigrate",
|
||||
"immigration"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@emigrate/tsconfig": "workspace:*"
|
||||
},
|
||||
"author": {
|
||||
"name": "Aboviq AB",
|
||||
"email": "dev@aboviq.com",
|
||||
"url": "https://www.aboviq.com"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Joakim Carlstein",
|
||||
"email": "joakim@aboviq.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
4
packages/emigrate/src/cli.ts
Normal file
4
packages/emigrate/src/cli.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env node
|
||||
import { emigrate } from '.';
|
||||
|
||||
emigrate();
|
||||
3
packages/emigrate/src/index.ts
Normal file
3
packages/emigrate/src/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export const emigrate = () => {
|
||||
console.log('Done!');
|
||||
};
|
||||
8
packages/emigrate/tsconfig.json
Normal file
8
packages/emigrate/tsconfig.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "@emigrate/tsconfig/build.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
26
packages/tsconfig/base.json
Normal file
26
packages/tsconfig/base.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Default",
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"inlineSources": false,
|
||||
"isolatedModules": true,
|
||||
"incremental": true,
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"noEmit": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"preserveWatchOutput": true,
|
||||
"resolveJsonModule": false,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "ES2022",
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"]
|
||||
}
|
||||
}
|
||||
8
packages/tsconfig/build.json
Normal file
8
packages/tsconfig/build.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Build",
|
||||
"extends": "./base.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false
|
||||
}
|
||||
}
|
||||
11
packages/tsconfig/package.json
Normal file
11
packages/tsconfig/package.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "@emigrate/tsconfig",
|
||||
"version": "0.0.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"base.json",
|
||||
"build.json"
|
||||
]
|
||||
}
|
||||
5855
pnpm-lock.yaml
generated
Normal file
5855
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
2
pnpm-workspace.yaml
Normal file
2
pnpm-workspace.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
packages:
|
||||
- 'packages/*'
|
||||
4
renovate.json
Normal file
4
renovate.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["config:base"]
|
||||
}
|
||||
34
turbo.json
Normal file
34
turbo.json
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"$schema": "https://turborepo.org/schema.json",
|
||||
"pipeline": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": ["src/**/*", "!src/**/*.test.ts", "tsconfig.json", "tsconfig.build.json"],
|
||||
"outputs": ["dist/**", "cjs/**"]
|
||||
},
|
||||
"build:watch": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": ["src/**/*", "!src/**/*.test.ts", "tsconfig.json", "tsconfig.build.json"],
|
||||
"outputs": ["dist/**", "cjs/**"],
|
||||
"cache": false
|
||||
},
|
||||
"lint": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": ["src/**/*", ".eslintrc"],
|
||||
"outputs": []
|
||||
},
|
||||
"test": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": ["src/**/*"],
|
||||
"outputs": []
|
||||
},
|
||||
"test:watch": {
|
||||
"dependsOn": ["^build"],
|
||||
"cache": false
|
||||
},
|
||||
"checks": {
|
||||
"dependsOn": ["build", "lint", "test"],
|
||||
"outputs": []
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue