create-ampless 1.0.0-alpha.78 → 1.0.0-alpha.80
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 +411 -32
- package/dist/templates/_shared/docs/plugin-author-guide.ja.md +258 -12
- package/dist/templates/_shared/docs/plugin-author-guide.md +337 -20
- package/dist/templates/_shared/package.json +12 -12
- package/dist/templates/_shared/plugins/README.ja.md +30 -6
- package/dist/templates/_shared/plugins/README.md +32 -6
- package/dist/templates/plugin-local/README.md +34 -0
- package/dist/templates/plugin-local/index.ts +39 -0
- package/dist/templates/plugin-standalone/CHANGELOG.md +1 -0
- package/dist/templates/plugin-standalone/README.ja.md +43 -0
- package/dist/templates/plugin-standalone/README.md +43 -0
- package/dist/templates/plugin-standalone/package.json +47 -0
- package/dist/templates/plugin-standalone/src/index.test.ts +16 -0
- package/dist/templates/plugin-standalone/src/index.ts +29 -0
- package/dist/templates/plugin-standalone/tsconfig.json +16 -0
- package/dist/templates/plugin-standalone/tsup.config.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
> 日本語版: [README.ja.md](./README.ja.md)
|
|
2
|
+
|
|
3
|
+
# {{packageName}}
|
|
4
|
+
|
|
5
|
+
> [Pre-release / alpha] {{description}}
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install {{packageName}}@alpha
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Configure
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// cms.config.ts
|
|
17
|
+
import { defineConfig } from 'ampless'
|
|
18
|
+
import {{nameCamelCase}}Plugin from '{{packageName}}'
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
// ...
|
|
22
|
+
plugins: [
|
|
23
|
+
{{nameCamelCase}}Plugin(),
|
|
24
|
+
],
|
|
25
|
+
})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then go to `/admin/plugins` to configure.
|
|
29
|
+
|
|
30
|
+
## Trust level
|
|
31
|
+
|
|
32
|
+
`{{trustLevel}}`. Capabilities: `{{capabilitiesList}}`.
|
|
33
|
+
|
|
34
|
+
## Publishing
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm install
|
|
38
|
+
pnpm test
|
|
39
|
+
pnpm build
|
|
40
|
+
pnpm publish --access public --tag alpha
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See the [ampless plugin author guide](https://github.com/heavymoons/ampless/blob/main/packages/ampless/docs/plugin-author-guide.md) for the full API.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": {{descriptionJson}},
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsup",
|
|
23
|
+
"dev": "tsup --watch",
|
|
24
|
+
"lint": "tsc --noEmit",
|
|
25
|
+
"test": "vitest run --passWithNoTests"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"ampless": "^{{amplessVersion}}"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"tsup": "^8.5.1",
|
|
32
|
+
"typescript": "^5.7.0",
|
|
33
|
+
"vitest": "^4.1.7"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"ampless",
|
|
37
|
+
"plugin",
|
|
38
|
+
"ampless-plugin"
|
|
39
|
+
],
|
|
40
|
+
"amplessPlugin": {
|
|
41
|
+
"apiVersion": 1,
|
|
42
|
+
"name": "{{nameKebab}}",
|
|
43
|
+
"trustLevel": "{{trustLevel}}",
|
|
44
|
+
"capabilities": [{{capabilitiesJsonArray}}],
|
|
45
|
+
"displayName": { "en": "{{DisplayName}}", "ja": "{{displayNameJa}}" }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import {{nameCamelCase}}Plugin from './index.js'
|
|
3
|
+
|
|
4
|
+
describe('{{nameCamelCase}}Plugin', () => {
|
|
5
|
+
it('returns a plugin with the declared name + apiVersion', () => {
|
|
6
|
+
const plugin = {{nameCamelCase}}Plugin()
|
|
7
|
+
expect(plugin.name).toBe('{{nameKebab}}')
|
|
8
|
+
expect(plugin.apiVersion).toBe(1)
|
|
9
|
+
expect(plugin.trust_level).toBe('{{trustLevel}}')
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it('honors an explicit instanceId', () => {
|
|
13
|
+
const plugin = {{nameCamelCase}}Plugin({ instanceId: 'custom-instance' })
|
|
14
|
+
expect(plugin.instanceId).toBe('custom-instance')
|
|
15
|
+
})
|
|
16
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { definePlugin, type AmplessPlugin } from 'ampless'
|
|
2
|
+
|
|
3
|
+
export interface {{NameCamelCase}}Options {
|
|
4
|
+
/** Optional namespace when registering multiple instances. */
|
|
5
|
+
instanceId?: string
|
|
6
|
+
// TODO: add the constructor options your plugin needs.
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* {{description}}
|
|
11
|
+
*/
|
|
12
|
+
export default function {{nameCamelCase}}Plugin(
|
|
13
|
+
options: {{NameCamelCase}}Options = {}
|
|
14
|
+
): AmplessPlugin {
|
|
15
|
+
const instanceId = options.instanceId ?? '{{nameKebab}}'
|
|
16
|
+
return definePlugin({
|
|
17
|
+
name: '{{nameKebab}}',
|
|
18
|
+
packageName: '{{packageName}}',
|
|
19
|
+
instanceId,
|
|
20
|
+
apiVersion: 1,
|
|
21
|
+
trust_level: '{{trustLevel}}',
|
|
22
|
+
displayName: { en: '{{DisplayName}}', ja: '{{displayNameJa}}' },
|
|
23
|
+
capabilities: [{{capabilitiesList}}],
|
|
24
|
+
// TODO: implement the surfaces declared in `capabilities`. The
|
|
25
|
+
// most common starting point is `publicHead(ctx)` returning a
|
|
26
|
+
// descriptor array. See:
|
|
27
|
+
// https://github.com/heavymoons/ampless/blob/main/packages/ampless/docs/plugin-author-guide.md
|
|
28
|
+
})
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"lib": ["ES2022", "DOM"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"outDir": "dist",
|
|
12
|
+
"rootDir": "src",
|
|
13
|
+
"verbatimModuleSyntax": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["src"]
|
|
16
|
+
}
|