create-ngis-plugin 0.1.0
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/LICENSE +201 -0
- package/README.md +39 -0
- package/dist/args.mjs +61 -0
- package/dist/catalog.mjs +41 -0
- package/dist/cli.mjs +63 -0
- package/dist/generate.mjs +146 -0
- package/dist/prompts.mjs +57 -0
- package/dist/templates/plugin-starter/manifest.json +19 -0
- package/dist/templates/plugin-starter/package.json +19 -0
- package/dist/templates/plugin-starter/presets/connector/manifest.json +17 -0
- package/dist/templates/plugin-starter/presets/connector/src/plugin.ts +132 -0
- package/dist/templates/plugin-starter/presets/tool-frontend/manifest.json +22 -0
- package/dist/templates/plugin-starter/presets/tool-frontend/src/plugin.ts +158 -0
- package/dist/templates/plugin-starter/presets/workflow-app/manifest.json +20 -0
- package/dist/templates/plugin-starter/presets/workflow-app/src/plugin.ts +161 -0
- package/dist/templates/plugin-starter/scripts/build.mjs +59 -0
- package/dist/templates/plugin-starter/scripts/finalize.mjs +33 -0
- package/dist/templates/plugin-starter/scripts/validate-manifest.mjs +77 -0
- package/dist/templates/plugin-starter/src/plugin.ts +65 -0
- package/dist/templates/plugin-starter/tsconfig.json +14 -0
- package/package.json +40 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `org.example.my-plugin` — the NGIS plugin-starter template's example plugin
|
|
3
|
+
* (Stage 11 E3, DevKit). Rename `manifest.id` (and this file's contents) to
|
|
4
|
+
* build your own; see `../README.md` for the full authoring walkthrough.
|
|
5
|
+
*
|
|
6
|
+
* Kept dependency-free on purpose (no React, no map-mount, one file) so
|
|
7
|
+
* `npm run package` and `npm test` both work with nothing but
|
|
8
|
+
* the bundled authoring declarations — the same "framework-agnostic, node-testable"
|
|
9
|
+
* discipline the first-party `ngis.sample-coordinate-pin` demo plugin follows
|
|
10
|
+
* in the main `ngis-frontend` repo.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { defineNgisPlugin, type NgisPlugin } from "@ngis/plugin-sdk";
|
|
14
|
+
|
|
15
|
+
export const PANEL_ID = "org.example.my-plugin.main";
|
|
16
|
+
export const OPEN_PANEL_TOOL_ID = "org.example.my-plugin.open";
|
|
17
|
+
|
|
18
|
+
const plugin: NgisPlugin = defineNgisPlugin({
|
|
19
|
+
manifest: {
|
|
20
|
+
// Must contain a "." (namespaced) — the server enforces
|
|
21
|
+
// `^[a-z0-9-]+(\.[a-z0-9-]+)+$`; `ngis.*` is reserved for first-party.
|
|
22
|
+
id: "org.example.my-plugin",
|
|
23
|
+
name: "My NGIS Plugin",
|
|
24
|
+
version: "0.1.0",
|
|
25
|
+
// The lowest NGIS_MAP_API_VERSION your plugin needs. Read it from
|
|
26
|
+
// `@ngis/plugin-sdk`'s own `NGIS_MAP_API_VERSION` at authoring time if
|
|
27
|
+
// you want "whatever this SDK version was built against"; hardcoding a
|
|
28
|
+
// lower value here is fine (and often correct) if you only use an older
|
|
29
|
+
// facet surface.
|
|
30
|
+
minNgisVersion: "0.4.0",
|
|
31
|
+
capabilities: {
|
|
32
|
+
panels: [
|
|
33
|
+
{
|
|
34
|
+
id: PANEL_ID,
|
|
35
|
+
slot: "right",
|
|
36
|
+
label: "My NGIS Plugin",
|
|
37
|
+
render: (container) => {
|
|
38
|
+
container.replaceChildren();
|
|
39
|
+
const content = document.createElement("div");
|
|
40
|
+
content.style.padding = "16px";
|
|
41
|
+
content.textContent = "Your UI plugin panel is running.";
|
|
42
|
+
container.appendChild(content);
|
|
43
|
+
return () => container.replaceChildren();
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
railTools: [
|
|
48
|
+
{
|
|
49
|
+
id: OPEN_PANEL_TOOL_ID,
|
|
50
|
+
// Literal string, not an i18n key — third-party plugins have no
|
|
51
|
+
// message catalog to point at.
|
|
52
|
+
label: "Open My NGIS Plugin",
|
|
53
|
+
kind: "action",
|
|
54
|
+
invoke: (ctx) => {
|
|
55
|
+
ctx.api.panels.open("right", PANEL_ID);
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// The bundle contract (ED16c) requires a default export — the loader's
|
|
64
|
+
// `import()` reads `module.default` as the `NgisPlugin`.
|
|
65
|
+
export default plugin;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": ["ES2020", "DOM"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-ngis-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Create a buildable NeoGIS plugin from an official starter template.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"private": false,
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"create-ngis-plugin": "./dist/cli.mjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/GeoScenarioScripter/NeoGIS-Frontend.git",
|
|
20
|
+
"directory": "packages/create-ngis-plugin"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/GeoScenarioScripter/NeoGIS-Frontend#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/GeoScenarioScripter/NeoGIS-Frontend/issues"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"neogis",
|
|
28
|
+
"plugin",
|
|
29
|
+
"scaffold",
|
|
30
|
+
"cli"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "node scripts/build.mjs",
|
|
37
|
+
"prepack": "npm run build",
|
|
38
|
+
"test": "node --test test/cli-core.test.mjs test/generate.test.mjs test/package.test.mjs test/e2e-tarballs.test.mjs"
|
|
39
|
+
}
|
|
40
|
+
}
|