0.8.12 • Published 19 days ago

@tramvai/tools-migrate v0.8.12

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
19 days ago

Tool for code migrations

Tool for executing code migrations for the tramvai modules.

How does it work:

  • in published module folder __migrations__ contains migrations files for the execution
  • found migrations that were have not been executed before are running
  • migrations can change files package.json, tramvai.json and project source code
  • after migration run information about executed migrations is added to file .tramvai-migrate-applied.json to the project root
  • all of the changed files after migrations should be added and committed to remote repository

How to

Disable migrations

To disable migration add environment variable SKIP_TRAMVAI_MIGRATIONS.

Add new migration

You can add new migration with command yarn generate:migration. You will need to specify package name for the migration and the migration name itself.

Also add to this package's package.json folder with the built migrations to the field files if it wasn't specified before:

"files": [
    "lib",
    "__migrations__"
],

Migration is a function that accepts special api using which it implements changes to the source code or configs.

export interface Api {
  packageJSON: PackageJSON; // object represented root package.json
  tramvaiJSON: TramvaiJSON; // object represented tramvai.json
  transform: (transformer: Transform, pathTransformer?: PathTransformer) => Promise<void>; // function that accepts transform function for `jscodeshift` and transform function for the file renames
}

Code transformations is done with jscodeshift

How to

Write migration

Transformation

Rules:

  • Prefer to return null | undefined or original source from the transform function in cases when migration doesn't change source code. Otherwise it will lead to unnecessary fs writing.
  • Prefer to use embedded methods of collections returned by call j(source) to make searches and transforms
0.7.10

19 days ago

0.9.4

19 days ago

0.8.12

19 days ago

0.8.11

30 days ago

0.8.9

1 month ago

0.9.3

1 month ago

0.8.8

1 month ago

0.8.7

2 months ago

0.9.2

1 month ago

0.7.9

1 month ago

0.7.8

2 months ago

0.8.5

2 months ago

0.8.6

2 months ago

0.7.6

2 months ago

0.7.7

2 months ago

0.8.4

4 months ago

0.8.3

4 months ago

0.8.2

6 months ago

0.7.5

4 months ago

0.8.1

8 months ago

0.7.4

8 months ago

0.7.3

12 months ago

0.7.2

12 months ago

0.7.1

1 year ago

0.7.0

1 year ago

0.6.21

1 year ago

0.6.20

1 year ago

0.6.23

1 year ago

0.6.22

1 year ago

0.6.19

1 year ago

0.6.18

2 years ago

0.6.17

2 years ago

0.6.15

2 years ago

0.6.14

2 years ago

0.6.13

2 years ago

0.6.12

2 years ago

0.6.11

2 years ago

0.6.10

2 years ago

0.6.7

2 years ago

0.6.8

2 years ago

0.6.6

2 years ago

0.6.3

2 years ago

0.6.5

2 years ago

0.5.138

2 years ago

0.5.137

2 years ago

0.5.139

2 years ago

0.5.136

2 years ago

0.5.135

2 years ago

0.5.134

2 years ago

0.5.133

3 years ago

0.5.130

3 years ago

0.5.132

3 years ago

0.5.131

3 years ago

0.5.129

3 years ago

0.5.128

3 years ago

0.5.125

3 years ago

0.5.124

3 years ago

0.5.127

3 years ago

0.5.126

3 years ago

0.5.121

3 years ago

0.5.120

3 years ago

0.5.123

3 years ago

0.5.122

3 years ago

0.5.119

3 years ago

0.5.118

3 years ago

0.5.114

3 years ago

0.5.113

3 years ago

0.5.115

3 years ago

0.5.110

3 years ago

0.5.112

3 years ago

0.5.111

3 years ago

0.5.109

3 years ago

0.5.107

3 years ago

0.5.106

3 years ago

0.5.105

3 years ago

0.5.104

3 years ago

0.5.103

3 years ago

0.5.102

3 years ago

0.5.101

3 years ago

0.5.98

3 years ago

0.5.99

3 years ago

0.5.96

3 years ago

0.5.97

3 years ago

0.5.100

3 years ago

0.5.94

3 years ago

0.5.95

3 years ago

0.5.92

3 years ago

0.5.93

3 years ago

0.5.90

3 years ago

0.5.91

3 years ago

0.5.87

3 years ago

0.5.88

3 years ago

0.5.85

3 years ago

0.5.86

3 years ago

0.5.84

3 years ago

0.5.89

3 years ago

0.5.83

3 years ago

0.5.81

3 years ago

0.5.82

3 years ago

0.5.80

3 years ago

0.5.76

3 years ago

0.5.77

3 years ago

0.5.74

3 years ago

0.5.75

3 years ago

0.5.78

3 years ago

0.5.72

3 years ago

0.5.73

3 years ago

0.5.71

3 years ago

0.5.70

3 years ago

0.5.69

3 years ago

0.5.68

3 years ago

0.5.67

3 years ago

0.5.66

3 years ago

0.5.65

3 years ago

0.5.64

3 years ago

0.5.63

3 years ago

0.5.62

3 years ago

0.5.61

3 years ago

0.5.60

3 years ago

0.5.54

3 years ago