@jrmc/adonis-etl 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/build/commands/make/etl.js +19 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,11 +78,11 @@ This will create (with default configuration):
|
|
|
78
78
|
- `app/etl/transforms/import_product_csv_to_db_transform.ts`
|
|
79
79
|
- `app/etl/destinations/import_product_db_destination.ts`
|
|
80
80
|
|
|
81
|
-
Or with custom directory configuration (`directories.etl: '
|
|
81
|
+
Or with custom directory configuration (`directories.etl: 'etl'`):
|
|
82
82
|
|
|
83
|
-
- `
|
|
84
|
-
- `
|
|
85
|
-
- `
|
|
83
|
+
- `etl/sources/import_product_csv_source.ts`
|
|
84
|
+
- `etl/transforms/import_product_csv_to_db_transform.ts`
|
|
85
|
+
- `etl/destinations/import_product_db_destination.ts`
|
|
86
86
|
|
|
87
87
|
## Generated Files
|
|
88
88
|
|
|
@@ -19,17 +19,13 @@ export default class MakeEtl extends BaseCommand {
|
|
|
19
19
|
static description = 'Create a new ETL files (source, transform, destination)';
|
|
20
20
|
async run() {
|
|
21
21
|
// Ask which ETL components to create
|
|
22
|
-
const components = await this.prompt.multiple('Which ETL components do you want to create?', [
|
|
23
|
-
'Source',
|
|
24
|
-
'Transform',
|
|
25
|
-
'Destination'
|
|
26
|
-
], {
|
|
22
|
+
const components = await this.prompt.multiple('Which ETL components do you want to create?', ['Source', 'Transform', 'Destination'], {
|
|
27
23
|
validate: (value) => {
|
|
28
24
|
if (!value || value.length === 0) {
|
|
29
25
|
return 'You must select at least one component';
|
|
30
26
|
}
|
|
31
27
|
return true;
|
|
32
|
-
}
|
|
28
|
+
},
|
|
33
29
|
});
|
|
34
30
|
// Ask for source details if source is selected
|
|
35
31
|
let sourceDetails = null;
|
|
@@ -40,7 +36,7 @@ export default class MakeEtl extends BaseCommand {
|
|
|
40
36
|
return 'Source type is required';
|
|
41
37
|
}
|
|
42
38
|
return true;
|
|
43
|
-
}
|
|
39
|
+
},
|
|
44
40
|
});
|
|
45
41
|
}
|
|
46
42
|
// Ask for destination details if destination is selected
|
|
@@ -52,7 +48,7 @@ export default class MakeEtl extends BaseCommand {
|
|
|
52
48
|
return 'Destination type is required';
|
|
53
49
|
}
|
|
54
50
|
return true;
|
|
55
|
-
}
|
|
51
|
+
},
|
|
56
52
|
});
|
|
57
53
|
}
|
|
58
54
|
const codemods = await this.createCodemods();
|
|
@@ -61,30 +57,30 @@ export default class MakeEtl extends BaseCommand {
|
|
|
61
57
|
for (const component of components) {
|
|
62
58
|
if (component === 'Source') {
|
|
63
59
|
className = [
|
|
64
|
-
string.
|
|
65
|
-
string.
|
|
66
|
-
'
|
|
67
|
-
].join('
|
|
60
|
+
string.pascalCase(this.name),
|
|
61
|
+
string.pascalCase(sourceDetails),
|
|
62
|
+
'Source',
|
|
63
|
+
].join('');
|
|
68
64
|
}
|
|
69
65
|
else if (component === 'Destination') {
|
|
70
66
|
className = [
|
|
71
|
-
string.
|
|
72
|
-
string.
|
|
73
|
-
'
|
|
74
|
-
].join('
|
|
67
|
+
string.pascalCase(this.name),
|
|
68
|
+
string.pascalCase(destinationDetails),
|
|
69
|
+
'Destination',
|
|
70
|
+
].join('');
|
|
75
71
|
}
|
|
76
72
|
else if (component === 'Transform') {
|
|
77
73
|
className = [
|
|
78
|
-
string.
|
|
79
|
-
string.
|
|
80
|
-
'
|
|
81
|
-
string.
|
|
82
|
-
'
|
|
83
|
-
].join('
|
|
74
|
+
string.pascalCase(this.name),
|
|
75
|
+
string.pascalCase(sourceDetails),
|
|
76
|
+
'To',
|
|
77
|
+
string.pascalCase(destinationDetails),
|
|
78
|
+
'Transform',
|
|
79
|
+
].join('');
|
|
84
80
|
}
|
|
85
81
|
const stubPath = `make/etl/${component.toLowerCase()}s/main.ts.stub`;
|
|
86
82
|
await codemods.makeUsingStub(stubsRoot, stubPath, {
|
|
87
|
-
className
|
|
83
|
+
className,
|
|
88
84
|
});
|
|
89
85
|
}
|
|
90
86
|
this.logger.success(`ETL files created successfully for: ${this.name}`);
|