@baeta/generator-sdk 0.0.2 → 0.0.4
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/CHANGELOG.md +20 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +21 -23
- package/dist/index.js +7 -7
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @baeta/generator-sdk
|
|
2
2
|
|
|
3
|
+
## 0.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d1190c1`](https://github.com/andreisergiu98/baeta/commit/d1190c10e3c259c73ddeeb73a4bd312b22bf2ea4) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - create cli sdk
|
|
8
|
+
release prisma plugin
|
|
9
|
+
update dependencies
|
|
10
|
+
refactor generator plugins
|
|
11
|
+
- Updated dependencies [[`d1190c1`](https://github.com/andreisergiu98/baeta/commit/d1190c10e3c259c73ddeeb73a4bd312b22bf2ea4)]:
|
|
12
|
+
- @baeta/plugin@0.0.17
|
|
13
|
+
|
|
14
|
+
## 0.0.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`02936ae`](https://github.com/andreisergiu98/baeta/commit/02936aeb606c75a2a79b6ce4524851c6c62afb82) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - bump packages
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`02936ae`](https://github.com/andreisergiu98/baeta/commit/02936aeb606c75a2a79b6ce4524851c6c62afb82)]:
|
|
21
|
+
- @baeta/plugin@0.0.16
|
|
22
|
+
|
|
3
23
|
## 0.0.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -85,21 +85,21 @@ var GeneratorPluginVersion = /* @__PURE__ */ ((GeneratorPluginVersion2) => {
|
|
|
85
85
|
GeneratorPluginVersion2[GeneratorPluginVersion2["V1"] = 0] = "V1";
|
|
86
86
|
return GeneratorPluginVersion2;
|
|
87
87
|
})(GeneratorPluginVersion || {});
|
|
88
|
-
var defaultPluginFn = async (
|
|
89
|
-
return
|
|
88
|
+
var defaultPluginFn = async (ctx, next) => {
|
|
89
|
+
return next();
|
|
90
90
|
};
|
|
91
91
|
var defaultWatchFn = () => ({ include: [], ignore: [] });
|
|
92
|
-
function
|
|
93
|
-
return
|
|
92
|
+
function createPluginV1(options) {
|
|
93
|
+
return {
|
|
94
94
|
name: options.name,
|
|
95
|
-
|
|
95
|
+
actionName: options.actionName,
|
|
96
96
|
version: 0 /* V1 */,
|
|
97
97
|
type: _plugin.PluginType.Generator,
|
|
98
98
|
end: _nullishCoalesce(options.end, () => ( defaultPluginFn)),
|
|
99
99
|
generate: _nullishCoalesce(options.generate, () => ( defaultPluginFn)),
|
|
100
100
|
setup: _nullishCoalesce(options.setup, () => ( defaultPluginFn)),
|
|
101
101
|
watch: _nullishCoalesce(options.watch, () => ( defaultWatchFn))
|
|
102
|
-
}
|
|
102
|
+
};
|
|
103
103
|
}
|
|
104
104
|
function isGeneratorPlugin(plugin) {
|
|
105
105
|
return plugin.type === _plugin.PluginType.Generator;
|
|
@@ -117,4 +117,4 @@ function getGeneratorPlugins(plugins) {
|
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
exports.File = File; exports.FileManager = FileManager; exports.GeneratorPluginVersion = GeneratorPluginVersion; exports.
|
|
120
|
+
exports.File = File; exports.FileManager = FileManager; exports.GeneratorPluginVersion = GeneratorPluginVersion; exports.createPluginV1 = createPluginV1; exports.getGeneratorPlugins = getGeneratorPlugins; exports.isGeneratorPlugin = isGeneratorPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -37,13 +37,15 @@ declare class FileManager {
|
|
|
37
37
|
unlinkAll(): Promise<void>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
type Ctx<T =
|
|
40
|
+
type Ctx<T = unknown> = {
|
|
41
41
|
fileManager: FileManager;
|
|
42
42
|
didSetup: string[];
|
|
43
43
|
didGenerate: string[];
|
|
44
44
|
didEnd: string[];
|
|
45
45
|
pluginNames: string[];
|
|
46
46
|
generatorOptions: GeneratorOptions;
|
|
47
|
+
watching: boolean;
|
|
48
|
+
changedFile?: string;
|
|
47
49
|
} & T;
|
|
48
50
|
|
|
49
51
|
type MatchPattern = string | RegExp;
|
|
@@ -51,39 +53,35 @@ type Matcher = MatchPattern | MatchPattern[];
|
|
|
51
53
|
declare enum GeneratorPluginVersion {
|
|
52
54
|
V1 = 0
|
|
53
55
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
ctx: Ctx<Store>;
|
|
57
|
-
next: () => Promise<void>;
|
|
58
|
-
}
|
|
59
|
-
type GeneratorPluginV1Fn<Config, Store> = (params: GeneratorPluginV1Params<Config, Store>) => Promise<void>;
|
|
60
|
-
type GeneratorPluginV1WatchOptions<Config> = (generatorOptions: GeneratorOptions, pluginConfig: Config) => {
|
|
56
|
+
type GeneratorPluginV1Fn<Store = unknown> = (ctx: Ctx<Store>, next: () => Promise<void>) => Promise<void>;
|
|
57
|
+
type GeneratorPluginV1WatchOptions = (options: GeneratorOptions) => {
|
|
61
58
|
include: string | string[];
|
|
62
59
|
ignore: Matcher;
|
|
63
60
|
};
|
|
64
|
-
type GeneratorPluginV1Factory<
|
|
61
|
+
type GeneratorPluginV1Factory<Store = unknown> = {
|
|
65
62
|
name: string;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
actionName: string;
|
|
64
|
+
setup?: GeneratorPluginV1Fn<Store>;
|
|
65
|
+
generate?: GeneratorPluginV1Fn<Store>;
|
|
66
|
+
end?: GeneratorPluginV1Fn<Store>;
|
|
67
|
+
watch?: GeneratorPluginV1WatchOptions;
|
|
70
68
|
};
|
|
71
|
-
interface GeneratorPluginV1<
|
|
69
|
+
interface GeneratorPluginV1<Store = unknown> {
|
|
72
70
|
name: string;
|
|
71
|
+
actionName: string;
|
|
73
72
|
version: GeneratorPluginVersion.V1;
|
|
74
73
|
type: PluginType.Generator;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
watch: GeneratorPluginV1WatchOptions<Config>;
|
|
74
|
+
setup: GeneratorPluginV1Fn<Store>;
|
|
75
|
+
generate: GeneratorPluginV1Fn<Store>;
|
|
76
|
+
end: GeneratorPluginV1Fn<Store>;
|
|
77
|
+
watch: GeneratorPluginV1WatchOptions;
|
|
80
78
|
}
|
|
81
|
-
declare function
|
|
79
|
+
declare function createPluginV1<Store = {}>(options: GeneratorPluginV1Factory<Store>): GeneratorPluginV1<Store>;
|
|
82
80
|
declare function isGeneratorPlugin(plugin: {
|
|
83
81
|
type: PluginType;
|
|
84
|
-
}): plugin is GeneratorPluginV1<unknown
|
|
82
|
+
}): plugin is GeneratorPluginV1<unknown>;
|
|
85
83
|
declare function getGeneratorPlugins(plugins?: Array<{
|
|
86
84
|
type: PluginType;
|
|
87
|
-
}>): GeneratorPluginV1<unknown
|
|
85
|
+
}>): GeneratorPluginV1<unknown>[];
|
|
88
86
|
|
|
89
|
-
export { Ctx, File, FileManager, GeneratorOptions, GeneratorPluginV1, GeneratorPluginV1Factory, GeneratorPluginV1Fn,
|
|
87
|
+
export { Ctx, File, FileManager, GeneratorOptions, GeneratorPluginV1, GeneratorPluginV1Factory, GeneratorPluginV1Fn, GeneratorPluginV1WatchOptions, GeneratorPluginVersion, createPluginV1, getGeneratorPlugins, isGeneratorPlugin };
|
package/dist/index.js
CHANGED
|
@@ -85,21 +85,21 @@ var GeneratorPluginVersion = /* @__PURE__ */ ((GeneratorPluginVersion2) => {
|
|
|
85
85
|
GeneratorPluginVersion2[GeneratorPluginVersion2["V1"] = 0] = "V1";
|
|
86
86
|
return GeneratorPluginVersion2;
|
|
87
87
|
})(GeneratorPluginVersion || {});
|
|
88
|
-
var defaultPluginFn = async (
|
|
89
|
-
return
|
|
88
|
+
var defaultPluginFn = async (ctx, next) => {
|
|
89
|
+
return next();
|
|
90
90
|
};
|
|
91
91
|
var defaultWatchFn = () => ({ include: [], ignore: [] });
|
|
92
|
-
function
|
|
93
|
-
return
|
|
92
|
+
function createPluginV1(options) {
|
|
93
|
+
return {
|
|
94
94
|
name: options.name,
|
|
95
|
-
|
|
95
|
+
actionName: options.actionName,
|
|
96
96
|
version: 0 /* V1 */,
|
|
97
97
|
type: PluginType.Generator,
|
|
98
98
|
end: options.end ?? defaultPluginFn,
|
|
99
99
|
generate: options.generate ?? defaultPluginFn,
|
|
100
100
|
setup: options.setup ?? defaultPluginFn,
|
|
101
101
|
watch: options.watch ?? defaultWatchFn
|
|
102
|
-
}
|
|
102
|
+
};
|
|
103
103
|
}
|
|
104
104
|
function isGeneratorPlugin(plugin) {
|
|
105
105
|
return plugin.type === PluginType.Generator;
|
|
@@ -114,7 +114,7 @@ export {
|
|
|
114
114
|
File,
|
|
115
115
|
FileManager,
|
|
116
116
|
GeneratorPluginVersion,
|
|
117
|
-
|
|
117
|
+
createPluginV1,
|
|
118
118
|
getGeneratorPlugins,
|
|
119
119
|
isGeneratorPlugin
|
|
120
120
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/generator-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"homepage": "https://github.com/andreisergiu98/baeta#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/andreisergiu98/baeta/issues"
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"types": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@baeta/plugin": "^0.0.
|
|
27
|
+
"@baeta/plugin": "^0.0.17",
|
|
28
28
|
"chokidar": "^3.5.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@baeta/build-tools": "^0.0.0",
|
|
32
|
+
"@baeta/tsconfig": "^0.0.0",
|
|
32
33
|
"@types/node": "^18.11.18",
|
|
33
34
|
"typescript": "^4.9.4"
|
|
34
35
|
},
|