create-sammi-next 0.0.1
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/dist/index.js +1118 -0
- package/index.js +3 -0
- package/package.json +44 -0
- package/template-minimal-js/README.md +15 -0
- package/template-minimal-js/_gitignore +1 -0
- package/template-minimal-js/eslint.config.mjs +76 -0
- package/template-minimal-js/package.json +20 -0
- package/template-minimal-js/sammi.config.js +9 -0
- package/template-minimal-js/src/script.js +5 -0
- package/template-minimal-ts/README.md +15 -0
- package/template-minimal-ts/_gitignore +1 -0
- package/template-minimal-ts/eslint.config.mjs +88 -0
- package/template-minimal-ts/package.json +21 -0
- package/template-minimal-ts/sammi.config.ts +9 -0
- package/template-minimal-ts/src/script.ts +5 -0
- package/template-minimal-ts/tsconfig.json +26 -0
- package/template-sample-js/README.md +15 -0
- package/template-sample-js/_gitignore +1 -0
- package/template-sample-js/eslint.config.mjs +76 -0
- package/template-sample-js/package.json +20 -0
- package/template-sample-js/sammi.config.js +16 -0
- package/template-sample-js/src/external.html +47 -0
- package/template-sample-js/src/over.json +1 -0
- package/template-sample-js/src/script.js +64 -0
- package/template-sample-js/src/utils/utils.js +3 -0
- package/template-sample-ts/README.md +15 -0
- package/template-sample-ts/_gitignore +1 -0
- package/template-sample-ts/eslint.config.mjs +88 -0
- package/template-sample-ts/package.json +21 -0
- package/template-sample-ts/sammi.config.ts +16 -0
- package/template-sample-ts/src/external.html +47 -0
- package/template-sample-ts/src/over.json +1 -0
- package/template-sample-ts/src/script.ts +63 -0
- package/template-sample-ts/src/utils/utils.ts +3 -0
- package/template-sample-ts/tsconfig.json +26 -0
- package/template-vanilla-js/README.md +15 -0
- package/template-vanilla-js/_gitignore +1 -0
- package/template-vanilla-js/eslint.config.mjs +76 -0
- package/template-vanilla-js/package.json +20 -0
- package/template-vanilla-js/sammi.config.js +16 -0
- package/template-vanilla-js/src/external.html +0 -0
- package/template-vanilla-js/src/over.json +1 -0
- package/template-vanilla-js/src/script.js +16 -0
- package/template-vanilla-ts/README.md +15 -0
- package/template-vanilla-ts/_gitignore +1 -0
- package/template-vanilla-ts/eslint.config.mjs +88 -0
- package/template-vanilla-ts/package.json +21 -0
- package/template-vanilla-ts/sammi.config.ts +16 -0
- package/template-vanilla-ts/src/external.html +0 -0
- package/template-vanilla-ts/src/over.json +0 -0
- package/template-vanilla-ts/src/script.ts +16 -0
- package/template-vanilla-ts/tsconfig.json +26 -0
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-sammi-next",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Benjas333",
|
|
8
|
+
"url": "https://github.com/Benjas333"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"create-sammi-next": "index.js",
|
|
12
|
+
"csn": "index.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.js",
|
|
16
|
+
"template-*",
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "tsdown --watch",
|
|
21
|
+
"build": "tsdown",
|
|
22
|
+
"typecheck": "tsc",
|
|
23
|
+
"prepublishOnly": "bun run build"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/Benjas333/SAMMI-Next.git",
|
|
31
|
+
"directory": "packages/create-sammi-next"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/Benjas333/SAMMI-Next/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/Benjas333/SAMMI-Next/tree/master/packages/create_sammi-next#readme",
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@clack/prompts": "^0.11.0",
|
|
39
|
+
"@types/node": "^25.0.9",
|
|
40
|
+
"mri": "^1.2.0",
|
|
41
|
+
"picocolors": "^1.1.1",
|
|
42
|
+
"tsdown": "^0.20.0-beta.3"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# {{EXTENSION_NAME}}
|
|
2
|
+
|
|
3
|
+
To install dependencies:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
To run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This project was created using create-sammi-next v{{CREATE_VERSION}}. [SAMMI Next](https://github.com/Benjas333/sammi-next) is a fast all-in-one SAMMI extension builder for SAMMI Bridge.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node_modules
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
3
|
+
import pluginImport from 'eslint-plugin-import';
|
|
4
|
+
import sdl from '@microsoft/eslint-plugin-sdl';
|
|
5
|
+
import globals from "globals";
|
|
6
|
+
import sammiNext from 'eslint-plugin-sammi-next';
|
|
7
|
+
import extensionConfig from './sammi.config.js';
|
|
8
|
+
|
|
9
|
+
export default defineConfig([
|
|
10
|
+
{
|
|
11
|
+
name: "main",
|
|
12
|
+
languageOptions: {
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.browser,
|
|
15
|
+
'SAMMI': true,
|
|
16
|
+
'sammiclient': true,
|
|
17
|
+
'SAMMIExtensions': true,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "sammi next entry script",
|
|
23
|
+
files: [extensionConfig.entry],
|
|
24
|
+
extends: [
|
|
25
|
+
sammiNext.configs.requiredEntry,
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "javascript files",
|
|
30
|
+
files: ["**/*.{js,mjs,cjs}"],
|
|
31
|
+
extends: [
|
|
32
|
+
js.configs.recommended,
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "general rules",
|
|
37
|
+
rules: {
|
|
38
|
+
'no-unused-vars': [
|
|
39
|
+
'error',
|
|
40
|
+
{ varsIgnorePattern: '^[A-Z_]' }
|
|
41
|
+
],
|
|
42
|
+
"@typescript-eslint/no-explicit-any": [
|
|
43
|
+
"warn",
|
|
44
|
+
{ fixToUnknown: true },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "import rules",
|
|
50
|
+
plugins: {
|
|
51
|
+
import: pluginImport
|
|
52
|
+
},
|
|
53
|
+
rules: {
|
|
54
|
+
'import/no-nodejs-modules': 'error',
|
|
55
|
+
'import/no-deprecated': 'error',
|
|
56
|
+
'import/no-extraneous-dependencies': 'error',
|
|
57
|
+
'import/export': 'error',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "@microsoft/sdl rules",
|
|
62
|
+
plugins: {
|
|
63
|
+
"@microsoft/sdl": sdl
|
|
64
|
+
},
|
|
65
|
+
rules: {
|
|
66
|
+
"@microsoft/sdl/no-document-write": "warn",
|
|
67
|
+
"@microsoft/sdl/no-inner-html": "warn",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
globalIgnores([
|
|
71
|
+
"node_modules",
|
|
72
|
+
"dist",
|
|
73
|
+
"eslint.config.*",
|
|
74
|
+
"sammi.config.*",
|
|
75
|
+
])
|
|
76
|
+
]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-vanilla-js",
|
|
3
|
+
"devDependencies": {
|
|
4
|
+
"@eslint/js": "^9.39.2",
|
|
5
|
+
"@microsoft/eslint-plugin-sdl": "^1.1.0",
|
|
6
|
+
"eslint": "^9.39.2",
|
|
7
|
+
"eslint-plugin-import": "^2.32.0",
|
|
8
|
+
"eslint-plugin-sammi-next": "^1.0.0",
|
|
9
|
+
"globals": "^17.0.0"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "sammi-next dev",
|
|
13
|
+
"build": "sammi-next",
|
|
14
|
+
"lint": "eslint ."
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"sammi-next": "^1.5.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# {{EXTENSION_NAME}}
|
|
2
|
+
|
|
3
|
+
To install dependencies:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
To run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This project was created using create-sammi-next v{{CREATE_VERSION}}. [SAMMI Next](https://github.com/Benjas333/sammi-next) is a fast all-in-one SAMMI extension builder for SAMMI Bridge.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node_modules
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
4
|
+
import pluginImport from 'eslint-plugin-import';
|
|
5
|
+
import sdl from '@microsoft/eslint-plugin-sdl';
|
|
6
|
+
import sammiNext from 'eslint-plugin-sammi-next';
|
|
7
|
+
import extensionConfig from './sammi.config.ts'
|
|
8
|
+
|
|
9
|
+
export default defineConfig([
|
|
10
|
+
js.configs.recommended,
|
|
11
|
+
{
|
|
12
|
+
name: "main",
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parserOptions: {
|
|
15
|
+
// projectService: true,
|
|
16
|
+
projectService: {
|
|
17
|
+
allowDefaultProject: ['eslint.config.*'],
|
|
18
|
+
defaultProject: "tsconfig.json",
|
|
19
|
+
},
|
|
20
|
+
tsconfigRootDir: import.meta.dirname,
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "sammi next entry script",
|
|
27
|
+
files: [extensionConfig.entry],
|
|
28
|
+
extends: [
|
|
29
|
+
sammiNext.configs.requiredEntry,
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "javascript files",
|
|
34
|
+
files: ["**/*.{js,mjs,cjs}"],
|
|
35
|
+
extends: [
|
|
36
|
+
tseslint.configs.recommended,
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "typescript files",
|
|
41
|
+
files: ["**/*.{ts,mts,cts}"],
|
|
42
|
+
extends: [
|
|
43
|
+
tseslint.configs.stylistic,
|
|
44
|
+
tseslint.configs.recommendedTypeChecked
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "general rules",
|
|
49
|
+
rules: {
|
|
50
|
+
'no-unused-vars': [
|
|
51
|
+
'error',
|
|
52
|
+
{ varsIgnorePattern: '^[A-Z_]' }
|
|
53
|
+
],
|
|
54
|
+
"@typescript-eslint/no-explicit-any": [
|
|
55
|
+
"warn",
|
|
56
|
+
{ fixToUnknown: true },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "import rules",
|
|
62
|
+
plugins: {
|
|
63
|
+
import: pluginImport
|
|
64
|
+
},
|
|
65
|
+
rules: {
|
|
66
|
+
'import/no-nodejs-modules': 'error',
|
|
67
|
+
'import/no-deprecated': 'error',
|
|
68
|
+
'import/no-extraneous-dependencies': 'error',
|
|
69
|
+
'import/export': 'error',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "@microsoft/sdl rules",
|
|
74
|
+
plugins: {
|
|
75
|
+
"@microsoft/sdl": sdl
|
|
76
|
+
},
|
|
77
|
+
rules: {
|
|
78
|
+
"@microsoft/sdl/no-document-write": "warn",
|
|
79
|
+
"@microsoft/sdl/no-inner-html": "warn",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
globalIgnores([
|
|
83
|
+
"node_modules",
|
|
84
|
+
"dist",
|
|
85
|
+
"eslint.config.*",
|
|
86
|
+
"sammi.config.*",
|
|
87
|
+
])
|
|
88
|
+
]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-vanilla-ts",
|
|
3
|
+
"devDependencies": {
|
|
4
|
+
"@eslint/js": "^9.39.2",
|
|
5
|
+
"@microsoft/eslint-plugin-sdl": "^1.1.0",
|
|
6
|
+
"eslint": "^9.39.2",
|
|
7
|
+
"eslint-plugin-import": "^2.32.0",
|
|
8
|
+
"eslint-plugin-sammi-next": "^1.0.0",
|
|
9
|
+
"typescript": "^5",
|
|
10
|
+
"typescript-eslint": "^8.53.0"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "sammi-next dev",
|
|
14
|
+
"build": "sammi-next",
|
|
15
|
+
"lint": "eslint ."
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"sammi-next": "^1.5.0"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
5
|
+
|
|
6
|
+
"module": "preserve",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
|
|
12
|
+
"outDir": "./dist",
|
|
13
|
+
"rootDir": ".",
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
"strict": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"forceConsistentCasingInFileNames": true,
|
|
20
|
+
"allowJs": true,
|
|
21
|
+
// "noEmit": true,
|
|
22
|
+
"declaration": true,
|
|
23
|
+
"emitDeclarationOnly": true
|
|
24
|
+
},
|
|
25
|
+
"include": ["src/**/*"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# {{EXTENSION_NAME}}
|
|
2
|
+
|
|
3
|
+
To install dependencies:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
To run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This project was created using create-sammi-next v{{CREATE_VERSION}}. [SAMMI Next](https://github.com/Benjas333/sammi-next) is a fast all-in-one SAMMI extension builder for SAMMI Bridge.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node_modules
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
3
|
+
import pluginImport from 'eslint-plugin-import';
|
|
4
|
+
import sdl from '@microsoft/eslint-plugin-sdl';
|
|
5
|
+
import globals from "globals";
|
|
6
|
+
import sammiNext from 'eslint-plugin-sammi-next';
|
|
7
|
+
import extensionConfig from './sammi.config.js';
|
|
8
|
+
|
|
9
|
+
export default defineConfig([
|
|
10
|
+
{
|
|
11
|
+
name: "main",
|
|
12
|
+
languageOptions: {
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.browser,
|
|
15
|
+
'SAMMI': true,
|
|
16
|
+
'sammiclient': true,
|
|
17
|
+
'SAMMIExtensions': true,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "sammi next entry script",
|
|
23
|
+
files: [extensionConfig.entry],
|
|
24
|
+
extends: [
|
|
25
|
+
sammiNext.configs.requiredEntry,
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "javascript files",
|
|
30
|
+
files: ["**/*.{js,mjs,cjs}"],
|
|
31
|
+
extends: [
|
|
32
|
+
js.configs.recommended,
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "general rules",
|
|
37
|
+
rules: {
|
|
38
|
+
'no-unused-vars': [
|
|
39
|
+
'error',
|
|
40
|
+
{ varsIgnorePattern: '^[A-Z_]' }
|
|
41
|
+
],
|
|
42
|
+
"@typescript-eslint/no-explicit-any": [
|
|
43
|
+
"warn",
|
|
44
|
+
{ fixToUnknown: true },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "import rules",
|
|
50
|
+
plugins: {
|
|
51
|
+
import: pluginImport
|
|
52
|
+
},
|
|
53
|
+
rules: {
|
|
54
|
+
'import/no-nodejs-modules': 'error',
|
|
55
|
+
'import/no-deprecated': 'error',
|
|
56
|
+
'import/no-extraneous-dependencies': 'error',
|
|
57
|
+
'import/export': 'error',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "@microsoft/sdl rules",
|
|
62
|
+
plugins: {
|
|
63
|
+
"@microsoft/sdl": sdl
|
|
64
|
+
},
|
|
65
|
+
rules: {
|
|
66
|
+
"@microsoft/sdl/no-document-write": "warn",
|
|
67
|
+
"@microsoft/sdl/no-inner-html": "warn",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
globalIgnores([
|
|
71
|
+
"node_modules",
|
|
72
|
+
"dist",
|
|
73
|
+
"eslint.config.*",
|
|
74
|
+
"sammi.config.*",
|
|
75
|
+
])
|
|
76
|
+
]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-sample-js",
|
|
3
|
+
"devDependencies": {
|
|
4
|
+
"@eslint/js": "^9.39.2",
|
|
5
|
+
"@microsoft/eslint-plugin-sdl": "^1.1.0",
|
|
6
|
+
"eslint": "^9.39.2",
|
|
7
|
+
"eslint-plugin-import": "^2.32.0",
|
|
8
|
+
"eslint-plugin-sammi-next": "^1.0.0",
|
|
9
|
+
"globals": "^17.0.0"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "sammi-next dev",
|
|
13
|
+
"build": "sammi-next",
|
|
14
|
+
"lint": "eslint ."
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"sammi-next": "^1.5.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'sammi-next/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
id: "{{EXTENSION_ID}}",
|
|
5
|
+
name: "{{EXTENSION_NAME}}",
|
|
6
|
+
info: "An example of an extension using SAMMI Next",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
entry: "src/script.js",
|
|
9
|
+
external: "src/external.html",
|
|
10
|
+
over: "src/over.json",
|
|
11
|
+
out: {
|
|
12
|
+
dir: "dist",
|
|
13
|
+
js: "extension.js",
|
|
14
|
+
sef: "extension.sef",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
[insert_external]
|
|
3
|
+
|
|
4
|
+
### Original documentation from https://sammi.solutions/extensions/build
|
|
5
|
+
This section appears inside the extension’s tab in Bridge, and it provides a visual interface for the extension if needed. It’s written in HTML and CSS.
|
|
6
|
+
-->
|
|
7
|
+
<h1 id="title"></h1>
|
|
8
|
+
<!-- You can access your exports through the `SAMMIExtensions` namespace -->
|
|
9
|
+
<button onclick="SAMMIExtensions['{{EXTENSION_ID}}'].welcome()">Execute welcome()</button>
|
|
10
|
+
<div class="calculator">
|
|
11
|
+
<h4>Multiply numbers</h4>
|
|
12
|
+
<span>
|
|
13
|
+
<span>Num 1:</span>
|
|
14
|
+
<input type="number" id="number-a" value="2">
|
|
15
|
+
</span>
|
|
16
|
+
<span>
|
|
17
|
+
<span>Num 2:</span>
|
|
18
|
+
<input type="number" id="number-b" value="3">
|
|
19
|
+
</span>
|
|
20
|
+
<span>
|
|
21
|
+
<button onclick="SAMMIExtensions['{{EXTENSION_ID}}'].multiplyButton()">Execute multiply()</button>
|
|
22
|
+
<span>Result:</span>
|
|
23
|
+
<span class="result-box"><b id="result"></b></span>
|
|
24
|
+
</span>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
/* The id of the div that wraps your [insert_external] section follows the format: {extension_id}-external */
|
|
29
|
+
#{{EXTENSION_ID}}-external {
|
|
30
|
+
.calculator {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
max-width: fit-content;
|
|
34
|
+
padding: 10px;
|
|
35
|
+
border-radius: 10px;
|
|
36
|
+
color: black;
|
|
37
|
+
background-color: #acacac;
|
|
38
|
+
|
|
39
|
+
.result-box {
|
|
40
|
+
padding: 5px;
|
|
41
|
+
border-radius: 10px;
|
|
42
|
+
color: white;
|
|
43
|
+
background-color: #585858;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [insert_script]
|
|
3
|
+
* In this section, you’re encouraged to write your own TypeScript code.
|
|
4
|
+
*
|
|
5
|
+
* ### Original documentation from https://sammi.solutions/extensions/build
|
|
6
|
+
* We recommend having one main function that runs as soon as SAMMI connects to Bridge, and which you call from [insert_command] section.
|
|
7
|
+
* Inside this function, you can set up listeners for extension commands coming from SAMMI, e.g. when a user actually runs a button containing your extension command you defined in [insert_command] section.
|
|
8
|
+
*
|
|
9
|
+
* Learn more about Listening to Extension Commands in the SAMMI Bridge documentation.
|
|
10
|
+
*
|
|
11
|
+
* SAMMI Bridge provides premade helper functions for you to use, such as retrieving variables, setting variables, triggering buttons and more. You can find all the helper functions in the SAMMI Bridge documentation
|
|
12
|
+
*/
|
|
13
|
+
import { getExternalSection, initExtension, insertCommandSection } from "sammi-next";
|
|
14
|
+
// <reference types="sammi-next" />
|
|
15
|
+
// sammi-next globals are automatically imported when importing anything from sammi-next library.
|
|
16
|
+
import { multiply } from "./utils/utils";
|
|
17
|
+
import extensionConfig from '../sammi.config';
|
|
18
|
+
|
|
19
|
+
const CONFIG = initExtension(extensionConfig);
|
|
20
|
+
|
|
21
|
+
// Use getExternalSection() to retrieve your [insert_external] section.
|
|
22
|
+
const EXTERNAL = getExternalSection(CONFIG.id);
|
|
23
|
+
|
|
24
|
+
const title = EXTERNAL.querySelector('#title');
|
|
25
|
+
|
|
26
|
+
title.innerText = `${CONFIG.name} - v${CONFIG.version}`;
|
|
27
|
+
|
|
28
|
+
const inputA = EXTERNAL.querySelector("#number-a");
|
|
29
|
+
const inputB = EXTERNAL.querySelector("#number-b");
|
|
30
|
+
const resultEl = EXTERNAL.querySelector('#result');
|
|
31
|
+
|
|
32
|
+
// The default export is your [insert_command] section. It must be a function.
|
|
33
|
+
export default insertCommandSection(() => {
|
|
34
|
+
/**
|
|
35
|
+
* [insert_command]
|
|
36
|
+
*
|
|
37
|
+
* ### Original documentation from https://sammi.solutions/extensions/build
|
|
38
|
+
* In this section, you can define Extension Commands.
|
|
39
|
+
* These commands will be available to users in SAMMI Core when they install your extension.
|
|
40
|
+
* You can define multiple commands in this section. Refer to the SAMMI Bridge documentation for Extension Command details.
|
|
41
|
+
* In this section, you can also automatically call your main extension function that should run as soon as SAMMI connects to Bridge.
|
|
42
|
+
*/
|
|
43
|
+
welcome();
|
|
44
|
+
|
|
45
|
+
SAMMI.extCommand("Extension Sample Command", 3355443, 52).catch(e => console.error(e));
|
|
46
|
+
sammiclient.on("Extension Sample Command", () => {
|
|
47
|
+
const handler = async () => {
|
|
48
|
+
await SAMMI.notification('Command Sample');
|
|
49
|
+
};
|
|
50
|
+
handler().catch((e) => console.error(e));
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const message = `Hello world from ${CONFIG.name}!`;
|
|
55
|
+
|
|
56
|
+
// Export the functions you want to access from your [insert_external] section.
|
|
57
|
+
export function welcome() {
|
|
58
|
+
console.log(message);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function multiplyButton() {
|
|
62
|
+
const result = multiply(parseInt(inputA.value), parseInt(inputB.value));
|
|
63
|
+
resultEl.innerText = result.toString();
|
|
64
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# {{EXTENSION_NAME}}
|
|
2
|
+
|
|
3
|
+
To install dependencies:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
To run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This project was created using create-sammi-next v{{CREATE_VERSION}}. [SAMMI Next](https://github.com/Benjas333/sammi-next) is a fast all-in-one SAMMI extension builder for SAMMI Bridge.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node_modules
|