@tego/devkit 1.3.39 → 1.3.41
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/lib/commands/create-plugin.mjs +1 -0
- package/lib/plugin-generator.mjs +3 -1
- package/package.json +3 -3
- package/templates/plugin/package.json.tpl +4 -4
- package/templates/plugin/src/client/plugin.tsx.tpl +3 -3
- package/templates/plugin/src/server/commands/.gitkeep +0 -0
- package/templates/plugin/src/server/migrations/.gitkeep +0 -0
- package/templates/plugin/src/server/plugin.ts.tpl +3 -3
|
@@ -4,6 +4,7 @@ import { PluginGenerator } from "../plugin-generator.mjs";
|
|
|
4
4
|
var create_plugin_default = (cli) => {
|
|
5
5
|
cli.command("create-plugin").argument("<name>").allowUnknownOption().action(async (name, options) => {
|
|
6
6
|
const generator = new PluginGenerator({
|
|
7
|
+
baseDir: process.cwd(),
|
|
7
8
|
cwd: resolve(process.cwd(), name),
|
|
8
9
|
args: options,
|
|
9
10
|
context: {
|
package/lib/plugin-generator.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/plugin-generator.ts
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
3
|
import { readFile } from "fs/promises";
|
|
4
|
+
import { createRequire } from "module";
|
|
4
5
|
import { join, resolve } from "path";
|
|
5
6
|
import { URL } from "url";
|
|
6
7
|
import { Generator } from "@umijs/utils";
|
|
@@ -8,6 +9,7 @@ import chalk from "chalk";
|
|
|
8
9
|
import { execa } from "execa";
|
|
9
10
|
import { genTsConfigPaths } from "./util.mjs";
|
|
10
11
|
var __dirname = new URL(".", import.meta.url).pathname;
|
|
12
|
+
var require2 = createRequire(import.meta.url);
|
|
11
13
|
function camelize(str) {
|
|
12
14
|
return str.trim().replace(/[-_\s]+(.)?/g, (match, c) => c.toUpperCase());
|
|
13
15
|
}
|
|
@@ -35,7 +37,7 @@ var PluginGenerator = class extends Generator {
|
|
|
35
37
|
...this.context,
|
|
36
38
|
packageName: name,
|
|
37
39
|
packageVersion,
|
|
38
|
-
|
|
40
|
+
tegoVersion: require2("../package.json").version,
|
|
39
41
|
pascalCaseName: capitalize(camelize(name.split("/").pop()))
|
|
40
42
|
};
|
|
41
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tego/devkit",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@hapi/topo": "^6.0.2",
|
|
22
|
-
"@npmcli/arborist": "^9.1.
|
|
22
|
+
"@npmcli/arborist": "^9.1.3",
|
|
23
23
|
"@pnpm/workspace.find-packages": "^1.1.12",
|
|
24
24
|
"@rsbuild/core": "^1.4.7",
|
|
25
25
|
"@rsbuild/plugin-less": "^1.2.5",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"fs-extra": "^11.3.0",
|
|
38
38
|
"lodash": "^4.17.21",
|
|
39
39
|
"npm-packlist": "^10.0.1",
|
|
40
|
-
"open": "^10.
|
|
40
|
+
"open": "^10.2.0",
|
|
41
41
|
"p-all": "^3.0.0",
|
|
42
42
|
"package-json": "^10.0.1",
|
|
43
43
|
"portfinder": "^1.0.37",
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "{{{packageName}}}",
|
|
3
3
|
"version": "{{{packageVersion}}}",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
|
-
"
|
|
6
|
-
"peerDependencies": {
|
|
5
|
+
"devDependencies": {
|
|
7
6
|
"@tachybase/client": "workspace:*",
|
|
8
|
-
"@
|
|
9
|
-
"@
|
|
7
|
+
"@tego/client": "{{{tegoVersion}}}",
|
|
8
|
+
"@tego/server": "{{{tegoVersion}}}",
|
|
9
|
+
"@tachybase/test": "{{{tegoVersion}}}"
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Plugin } from '@
|
|
1
|
+
import { Plugin } from '@tego/client';
|
|
2
2
|
|
|
3
|
-
class {{{pascalCaseName}}}
|
|
3
|
+
class Plugin{{{pascalCaseName}}} extends Plugin {
|
|
4
4
|
async afterAdd() {}
|
|
5
5
|
|
|
6
6
|
async beforeLoad() {}
|
|
@@ -8,4 +8,4 @@ class {{{pascalCaseName}}}Client extends Plugin {
|
|
|
8
8
|
async load() {}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export default {{{pascalCaseName}}}
|
|
11
|
+
export default Plugin{{{pascalCaseName}}};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Plugin } from '@
|
|
1
|
+
import { Plugin } from '@tego/server';
|
|
2
2
|
|
|
3
|
-
export class {{{pascalCaseName}}}
|
|
3
|
+
export class Plugin{{{pascalCaseName}}} extends Plugin {
|
|
4
4
|
async afterAdd() {}
|
|
5
5
|
|
|
6
6
|
async beforeLoad() {}
|
|
@@ -16,4 +16,4 @@ export class {{{pascalCaseName}}}Server extends Plugin {
|
|
|
16
16
|
async remove() {}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default {{{pascalCaseName}}}
|
|
19
|
+
export default Plugin{{{pascalCaseName}}};
|