@nesso-how/plugin-example 0.0.0-stage → 0.2.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Omar Desogus and Paolo Manfredotti
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,50 @@
1
- # Temporary Holding Version
1
+ # Uppercase labels
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The official Nesso action plugin example, published as [`@nesso-how/plugin-example`](https://www.npmjs.com/package/@nesso-how/plugin-example). It uppercases labels in the invoked view with one undoable batch. Shared concepts change in every view containing them.
4
+
5
+ ## Install and try
6
+
7
+ In the desktop app, open Settings → Plugins, search for `@nesso-how/plugin-example`, and install it. Approve its declared access to concept labels.
8
+
9
+ Run **Uppercase labels** from a view's context menu in the Explorer, or from the view's actions in the Inspector with no concepts or relations selected. Use Undo to restore the original labels.
10
+
11
+ ## Build your own
12
+
13
+ Copy this directory outside the workspace, then install the published SDK and build:
14
+
15
+ ```sh
16
+ npm install
17
+ npm run build
18
+ ```
19
+
20
+ The build typechecks and bundles `src/index.ts` and its package metadata into `dist/index.js`. The SDK is a development dependency; the installed plugin needs only the bundled module and its manifest. Source files are included in the npm package so the example can also be inspected and adapted after downloading it.
21
+
22
+ Choose your own package name and action ID before publishing a derived plugin.
23
+
24
+ ## Test an unpublished build
25
+
26
+ To try it in desktop DevTools, set `manifest` to your parsed `package.json` and `compiledCode` to the text of `dist/index.js`:
27
+
28
+ ```ts
29
+ await window.nessoPlugins.propose(
30
+ crypto.randomUUID(),
31
+ { manifest, files: [{ path: manifest.nesso.entry, bytes: new TextEncoder().encode(compiledCode) }] },
32
+ 'en'
33
+ )
34
+ ```
35
+
36
+ Approve the Nesso access dialog. Installation persists; disable or remove it in Settings. To replace a build, pass its installed `contentId` as the fourth argument; development proposals require fresh approval.
37
+
38
+ ## Publish
39
+
40
+ The official example shares the SDK's version and is released with it using `pnpm release:plugin` from the repository root. The release script updates both versions and pins the example to that SDK version. CI publishes the SDK first, then builds and publishes the standalone example against the published SDK.
41
+
42
+ Maintainers bootstrap the example with `npm publish` from this directory using an npm account with access to the `@nesso-how` scope, once its SDK version is available. Configure npm Trusted Publishing for `nesso-how/nesso` and workflow `plugin-release.yml` on the new package before subsequent CI releases. Do not republish an existing SDK version to bootstrap the example.
43
+
44
+ To inspect the example package locally after installing its dependencies:
45
+
46
+ ```sh
47
+ npm pack --dry-run
48
+ ```
49
+
50
+ Packing and publishing run the typecheck and build automatically. Authors of derived plugins use their own package name and version and publish independently with `npm publish`.
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ // package.json
2
+ var package_default = {
3
+ name: "@nesso-how/plugin-example",
4
+ version: "0.2.0",
5
+ description: "Uppercase concept labels in the invoked Nesso view",
6
+ license: "MIT",
7
+ repository: {
8
+ type: "git",
9
+ url: "git+https://github.com/nesso-how/nesso.git",
10
+ directory: "packages/plugin/example"
11
+ },
12
+ type: "module",
13
+ keywords: ["nesso-plugin"],
14
+ files: ["dist", "src", "tsconfig.json"],
15
+ scripts: {
16
+ check: "tsc",
17
+ build: "npm run check && esbuild src/index.ts --bundle --format=esm --platform=browser --target=es2022 --outfile=dist/index.js",
18
+ prepack: "npm run build"
19
+ },
20
+ publishConfig: {
21
+ access: "public",
22
+ registry: "https://registry.npmjs.org/"
23
+ },
24
+ devDependencies: {
25
+ "@nesso-how/plugin": "0.2.0",
26
+ esbuild: "^0.28.2",
27
+ typescript: "~7.0.2"
28
+ },
29
+ nesso: {
30
+ apiVersion: 1,
31
+ kind: "actions",
32
+ entry: "dist/index.js",
33
+ writes: ["concept.label"],
34
+ capabilities: []
35
+ },
36
+ i18n: {
37
+ metadata: {
38
+ name: { en: "Uppercase labels" },
39
+ description: { en: "Uppercase concept labels in the invoked view." },
40
+ documentation: { en: "Changes the labels of concepts in the invoked view in one undoable transaction. Concepts shared with other views change there too." }
41
+ }
42
+ }
43
+ };
44
+
45
+ // src/index.ts
46
+ var create = ({ store }) => [{
47
+ id: "uppercase-labels",
48
+ label: package_default.i18n.metadata.name,
49
+ run: async () => {
50
+ const state = store.getState();
51
+ if (!("viewGraph" in state)) return;
52
+ const operations = state.viewGraph.concepts.map(({ id, label }) => ({ kind: "concept.label", id, value: label.toUpperCase() }));
53
+ await store.applyOperations(operations, { atRevision: state.revision });
54
+ }
55
+ }];
56
+ export {
57
+ create
58
+ };
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@nesso-how/plugin-example",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Uppercase concept labels in the invoked Nesso view",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/nesso-how/nesso.git",
9
+ "directory": "packages/plugin/example"
10
+ },
11
+ "type": "module",
12
+ "keywords": ["nesso-plugin"],
13
+ "files": ["dist", "src", "tsconfig.json"],
14
+ "scripts": {
15
+ "check": "tsc",
16
+ "build": "npm run check && esbuild src/index.ts --bundle --format=esm --platform=browser --target=es2022 --outfile=dist/index.js",
17
+ "prepack": "npm run build"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public",
21
+ "registry": "https://registry.npmjs.org/"
22
+ },
23
+ "devDependencies": {
24
+ "@nesso-how/plugin": "0.2.0",
25
+ "esbuild": "^0.28.2",
26
+ "typescript": "~7.0.2"
27
+ },
28
+ "nesso": {
29
+ "apiVersion": 1,
30
+ "kind": "actions",
31
+ "entry": "dist/index.js",
32
+ "writes": ["concept.label"],
33
+ "capabilities": []
34
+ },
35
+ "i18n": {
36
+ "metadata": {
37
+ "name": { "en": "Uppercase labels" },
38
+ "description": { "en": "Uppercase concept labels in the invoked view." },
39
+ "documentation": { "en": "Changes the labels of concepts in the invoked view in one undoable transaction. Concepts shared with other views change there too." }
40
+ }
41
+ }
42
+ }
package/src/index.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { ActionContext, ActionContribution, NessoOperation } from '@nesso-how/plugin'
2
+ import source from '../package.json' with { type: 'json' }
3
+
4
+ export const create = ({ store }: ActionContext): readonly ActionContribution[] => [{
5
+ id: 'uppercase-labels',
6
+ label: source.i18n.metadata.name,
7
+ run: async () => {
8
+ const state = store.getState()
9
+ if (!('viewGraph' in state)) return
10
+ const operations: readonly NessoOperation[] = state.viewGraph.concepts.map(({ id, label }) => ({ kind: 'concept.label', id, value: label.toUpperCase() }))
11
+ await store.applyOperations(operations, { atRevision: state.revision })
12
+ },
13
+ }]
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "WebWorker"],
5
+ "module": "NodeNext",
6
+ "moduleResolution": "NodeNext",
7
+ "resolveJsonModule": true,
8
+ "strict": true,
9
+ "verbatimModuleSyntax": true,
10
+ "noEmit": true,
11
+ "types": []
12
+ },
13
+ "include": ["src"]
14
+ }