create-blocklet 0.3.7 → 0.3.10

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.
Files changed (114) hide show
  1. package/README.md +5 -0
  2. package/common/.makefiles/bump_version.sh +2 -1
  3. package/common/_editorconfig +23 -0
  4. package/common/_gitignore +9 -16
  5. package/common/{.prettierrc → _prettierrc} +0 -0
  6. package/index.js +50 -12
  7. package/package.json +2 -1
  8. package/templates/blocklet-page-static/package.json +1 -1
  9. package/templates/express-api/api/index.js +1 -1
  10. package/templates/express-api/package.json +4 -4
  11. package/templates/html-static/app/favicon.ico +0 -0
  12. package/templates/html-static/app/images/logo.svg +17 -0
  13. package/templates/html-static/app/index.html +39 -0
  14. package/templates/html-static/app/styles/style.css +67 -0
  15. package/templates/html-static/blocklet.md +3 -0
  16. package/templates/html-static/blocklet.yml +48 -0
  17. package/templates/html-static/package.json +13 -0
  18. package/templates/{react-dapp/.env.local → nextjs-dapp/.env} +0 -0
  19. package/templates/nextjs-dapp/api/index.js +1 -1
  20. package/templates/nextjs-dapp/package.json +13 -13
  21. package/templates/react-dapp/.env +0 -1
  22. package/templates/react-dapp/api/index.js +1 -5
  23. package/templates/react-dapp/craco.config.js +5 -3
  24. package/templates/react-dapp/package.json +11 -11
  25. package/templates/react-gun-dapp/.env +0 -1
  26. package/templates/react-gun-dapp/api/index.js +1 -5
  27. package/templates/react-gun-dapp/craco.config.js +6 -4
  28. package/templates/react-gun-dapp/package.json +13 -13
  29. package/templates/react-static/craco.config.js +1 -1
  30. package/templates/react-static/package.json +6 -6
  31. package/templates/solidjs-dapp/.env +1 -0
  32. package/templates/solidjs-dapp/.eslintrc.js +17 -0
  33. package/templates/solidjs-dapp/README.md +147 -0
  34. package/templates/solidjs-dapp/api/hooks/pre-start.js +33 -0
  35. package/templates/solidjs-dapp/api/index.js +51 -0
  36. package/templates/solidjs-dapp/api/libs/auth.js +22 -0
  37. package/templates/solidjs-dapp/api/libs/env.js +6 -0
  38. package/templates/solidjs-dapp/api/libs/logger.js +3 -0
  39. package/templates/solidjs-dapp/api/routes/index.js +6 -0
  40. package/templates/solidjs-dapp/blocklet.md +3 -0
  41. package/templates/solidjs-dapp/blocklet.yml +49 -0
  42. package/templates/solidjs-dapp/index.html +17 -0
  43. package/templates/solidjs-dapp/package.json +63 -0
  44. package/templates/solidjs-dapp/src/App.jsx +24 -0
  45. package/templates/solidjs-dapp/src/App.module.css +33 -0
  46. package/templates/solidjs-dapp/src/assets/favicon.ico +0 -0
  47. package/templates/solidjs-dapp/src/index.css +13 -0
  48. package/templates/solidjs-dapp/src/index.jsx +7 -0
  49. package/templates/solidjs-dapp/src/logo.svg +1 -0
  50. package/templates/solidjs-dapp/vite.config.js +36 -0
  51. package/templates/solidjs-static/.env +1 -0
  52. package/templates/solidjs-static/.eslintrc.js +9 -0
  53. package/templates/solidjs-static/README.md +147 -0
  54. package/templates/solidjs-static/blocklet.md +3 -0
  55. package/templates/solidjs-static/blocklet.yml +49 -0
  56. package/templates/solidjs-static/index.html +17 -0
  57. package/templates/solidjs-static/package.json +43 -0
  58. package/templates/solidjs-static/src/App.jsx +24 -0
  59. package/templates/solidjs-static/src/App.module.css +33 -0
  60. package/templates/solidjs-static/src/assets/favicon.ico +0 -0
  61. package/templates/solidjs-static/src/index.css +13 -0
  62. package/templates/solidjs-static/src/index.jsx +7 -0
  63. package/templates/solidjs-static/src/logo.svg +1 -0
  64. package/templates/solidjs-static/vite.config.js +32 -0
  65. package/templates/svelte-dapp/.browserslistrc +4 -0
  66. package/templates/svelte-dapp/.env +1 -0
  67. package/templates/svelte-dapp/.eslintrc.js +22 -0
  68. package/templates/svelte-dapp/.vscode/extensions.json +3 -0
  69. package/templates/svelte-dapp/README.md +146 -0
  70. package/templates/svelte-dapp/api/hooks/pre-start.js +33 -0
  71. package/templates/svelte-dapp/api/index.js +51 -0
  72. package/templates/svelte-dapp/api/libs/auth.js +22 -0
  73. package/templates/svelte-dapp/api/libs/env.js +6 -0
  74. package/templates/svelte-dapp/api/libs/logger.js +3 -0
  75. package/templates/svelte-dapp/api/routes/index.js +6 -0
  76. package/templates/svelte-dapp/blocklet.md +3 -0
  77. package/templates/svelte-dapp/blocklet.yml +49 -0
  78. package/templates/svelte-dapp/index.html +16 -0
  79. package/templates/svelte-dapp/jsconfig.json +34 -0
  80. package/templates/svelte-dapp/package.json +59 -0
  81. package/templates/svelte-dapp/src/App.svelte +64 -0
  82. package/templates/svelte-dapp/src/assets/svelte.png +0 -0
  83. package/templates/svelte-dapp/src/lib/Counter.svelte +34 -0
  84. package/templates/svelte-dapp/src/main.js +7 -0
  85. package/templates/svelte-dapp/src/vite-env.d.ts +2 -0
  86. package/templates/svelte-dapp/vite.config.js +33 -0
  87. package/templates/svelte-static/.browserslistrc +4 -0
  88. package/templates/svelte-static/.env +1 -0
  89. package/templates/svelte-static/.eslintrc.js +22 -0
  90. package/templates/svelte-static/.vscode/extensions.json +3 -0
  91. package/templates/svelte-static/README.md +146 -0
  92. package/templates/svelte-static/blocklet.md +3 -0
  93. package/templates/svelte-static/blocklet.yml +49 -0
  94. package/templates/svelte-static/index.html +16 -0
  95. package/templates/svelte-static/jsconfig.json +34 -0
  96. package/templates/svelte-static/package.json +40 -0
  97. package/templates/svelte-static/src/App.svelte +64 -0
  98. package/templates/svelte-static/src/assets/svelte.png +0 -0
  99. package/templates/svelte-static/src/lib/Counter.svelte +34 -0
  100. package/templates/svelte-static/src/main.js +7 -0
  101. package/templates/svelte-static/src/vite-env.d.ts +2 -0
  102. package/templates/svelte-static/vite.config.js +29 -0
  103. package/templates/vue-dapp/api/index.js +1 -5
  104. package/templates/vue-dapp/index.html +1 -1
  105. package/templates/vue-dapp/package.json +15 -15
  106. package/templates/vue-dapp/vite.config.js +8 -4
  107. package/templates/vue-static/README.md +0 -1
  108. package/templates/vue-static/package.json +9 -9
  109. package/templates/vue-static/vite.config.js +5 -3
  110. package/templates/vue2-dapp/api/index.js +1 -5
  111. package/templates/vue2-dapp/package.json +16 -16
  112. package/templates/vue2-dapp/vue.config.js +5 -2
  113. package/templates/vue2-static/package.json +8 -8
  114. package/templates/vue2-static/vue.config.js +1 -1
@@ -0,0 +1,22 @@
1
+ const path = require('path');
2
+ const AuthStorage = require('@arcblock/did-auth-storage-nedb');
3
+ const getWallet = require('@blocklet/sdk/lib/wallet');
4
+ const WalletAuthenticator = require('@blocklet/sdk/lib/wallet-authenticator');
5
+ const WalletHandler = require('@blocklet/sdk/lib/wallet-handler');
6
+
7
+ const env = require('./env');
8
+
9
+ const wallet = getWallet();
10
+ const authenticator = new WalletAuthenticator();
11
+ const handlers = new WalletHandler({
12
+ authenticator,
13
+ tokenStorage: new AuthStorage({
14
+ dbPath: path.join(env.dataDir, 'auth.db'),
15
+ }),
16
+ });
17
+
18
+ module.exports = {
19
+ authenticator,
20
+ handlers,
21
+ wallet,
22
+ };
@@ -0,0 +1,6 @@
1
+ const env = require('@blocklet/sdk/lib/env');
2
+
3
+ module.exports = {
4
+ ...env,
5
+ chainHost: process.env.CHAIN_HOST || '',
6
+ };
@@ -0,0 +1,3 @@
1
+ const logger = console;
2
+
3
+ module.exports = logger;
@@ -0,0 +1,6 @@
1
+ const middleware = require('@blocklet/sdk/lib/middlewares');
2
+ const router = require('express').Router();
3
+
4
+ router.use('/user', middleware.user(), (req, res) => res.json(req.user || {}));
5
+
6
+ module.exports = router;
@@ -0,0 +1,3 @@
1
+ # template-svelte
2
+
3
+ A svelte template for creating a new blocklet project.
@@ -0,0 +1,49 @@
1
+ name: template-svelte
2
+ title: Blocklet Template Svelte
3
+ description: A Blocklet Server blocklet
4
+ keywords:
5
+ - blocklet
6
+ - svelte
7
+ group: static
8
+ did: ''
9
+ main: dist
10
+ author:
11
+ name: Blocklet
12
+ email: blocklet@arcblock.io
13
+ repository:
14
+ type: git
15
+ url: 'git+https://github.com/blocklet/create-blocklet.git'
16
+ specVersion: 1.1.1
17
+ version: 0.1.0
18
+ logo: logo.png
19
+ files:
20
+ - logo.png
21
+ - README.md
22
+ - blocklet.md
23
+ - screenshots
24
+ interfaces:
25
+ - type: web
26
+ name: publicUrl
27
+ path: /
28
+ prefix: '*'
29
+ port: BLOCKLET_PORT
30
+ protocol: http
31
+ community: ''
32
+ documentation: ''
33
+ homepage: ''
34
+ license: ''
35
+ payment:
36
+ price: []
37
+ share: []
38
+ timeout:
39
+ start: 60
40
+ requirements:
41
+ server: '>=1.6.29'
42
+ os: '*'
43
+ cpu: '*'
44
+ scripts:
45
+ dev: npm run start
46
+ environments: []
47
+ capabilities: {}
48
+ screenshots: []
49
+ children: []
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="<%- base %>favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
7
+ <meta name="theme-color" content="#4F6AF5" />
8
+ <meta name="description" content="Web site created using create-blocklet" />
9
+ <title><%- title %></title>
10
+ <script src="__meta__.js"></script>
11
+ </head>
12
+ <body>
13
+ <div id="app"></div>
14
+ <script type="module" src="/src/main.js"></script>
15
+ </body>
16
+ </html>
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ "moduleResolution": "node",
4
+ "target": "esnext",
5
+ "module": "esnext",
6
+ /**
7
+ * svelte-preprocess cannot figure out whether you have
8
+ * a value or a type, so tell TypeScript to enforce using
9
+ * `import type` instead of `import` for Types.
10
+ */
11
+ "importsNotUsedAsValues": "error",
12
+ "isolatedModules": true,
13
+ "resolveJsonModule": true,
14
+ /**
15
+ * To have warnings / errors of the Svelte compiler at the
16
+ * correct position, enable source maps by default.
17
+ */
18
+ "sourceMap": true,
19
+ "esModuleInterop": true,
20
+ "skipLibCheck": true,
21
+ "forceConsistentCasingInFileNames": true,
22
+ "baseUrl": ".",
23
+ /**
24
+ * Typecheck JS in `.svelte` and `.js` files by default.
25
+ * Disable this if you'd like to use dynamic types.
26
+ */
27
+ "checkJs": true
28
+ },
29
+ /**
30
+ * Use global.d.ts instead of compilerOptions.types
31
+ * to avoid limiting type declarations.
32
+ */
33
+ "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
34
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "template-svelte",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "vite build",
8
+ "serve": "vite preview",
9
+ "start": "npm-run-all --parallel start:*",
10
+ "start:client": "npm run dev",
11
+ "start:api": "NODE_ENV=development nodemon api/index.js -w api",
12
+ "clean": "rm -rf .blocklet",
13
+ "bundle": "npm run bundle:client && npm run bundle:api",
14
+ "bundle:client": "vite build --base /.blocklet/proxy/<%= did %>/",
15
+ "bundle:api": "npm run clean && blocklet bundle --zip --create-release",
16
+ "deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
17
+ "upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
18
+ "prepare": "husky install"
19
+ },
20
+ "dependencies": {
21
+ "@arcblock/did-auth": "^1.16.4",
22
+ "@arcblock/did-auth-storage-nedb": "^1.6.3",
23
+ "@blocklet/sdk": "^1.7.9",
24
+ "@ocap/client": "^1.16.4",
25
+ "@ocap/mcrypto": "^1.16.4",
26
+ "@ocap/wallet": "^1.16.4",
27
+ "axios": "^0.27.2",
28
+ "compression": "^1.7.4",
29
+ "cookie-parser": "^1.4.6",
30
+ "cors": "^2.8.5",
31
+ "dotenv-flow": "^3.2.0",
32
+ "express": "^4.18.0",
33
+ "express-async-errors": "^3.1.1",
34
+ "express-history-api-fallback": "^2.2.1"
35
+ },
36
+ "devDependencies": {
37
+ "@sveltejs/vite-plugin-svelte": "1.0.0-next.42",
38
+ "eslint": "^8.14.0",
39
+ "eslint-config-prettier": "^8.5.0",
40
+ "eslint-plugin-prettier": "^4.0.0",
41
+ "eslint-plugin-svelte3": "^3.4.1",
42
+ "husky": "^7.0.4",
43
+ "lint-staged": "^12.4.1",
44
+ "prettier": "^2.6.2",
45
+ "svelte": "^3.47.0",
46
+ "vite": "^2.9.6",
47
+ "vite-plugin-blocklet": "^0.1.2",
48
+ "vite-plugin-html": "^3.2.0"
49
+ },
50
+ "lint-staged": {
51
+ "*.{mjs,js,vue}": [
52
+ "prettier --write",
53
+ "eslint --ext .js,.mjs,.svelte"
54
+ ],
55
+ "*.{css,less,scss,json,graphql}": [
56
+ "prettier --write"
57
+ ]
58
+ }
59
+ }
@@ -0,0 +1,64 @@
1
+ <script>
2
+ import logo from './assets/svelte.png';
3
+ import Counter from './lib/Counter.svelte';
4
+ </script>
5
+
6
+ <main>
7
+ <img src={logo} alt="Svelte Logo" />
8
+ <h1>Hello world!</h1>
9
+
10
+ <Counter />
11
+
12
+ <p>
13
+ Visit <a href="https://svelte.dev">svelte.dev</a> to learn how to build Svelte apps.
14
+ </p>
15
+
16
+ <p>
17
+ Check out <a href="https://github.com/sveltejs/kit#readme">SvelteKit</a> for the officially supported framework, also
18
+ powered by Vite!
19
+ </p>
20
+ </main>
21
+
22
+ <style>
23
+ :root {
24
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
25
+ 'Helvetica Neue', sans-serif;
26
+ }
27
+
28
+ main {
29
+ text-align: center;
30
+ padding: 1em;
31
+ margin: 0 auto;
32
+ }
33
+
34
+ img {
35
+ height: 16rem;
36
+ width: 16rem;
37
+ }
38
+
39
+ h1 {
40
+ color: #ff3e00;
41
+ text-transform: uppercase;
42
+ font-size: 4rem;
43
+ font-weight: 100;
44
+ line-height: 1.1;
45
+ margin: 2rem auto;
46
+ max-width: 14rem;
47
+ }
48
+
49
+ p {
50
+ max-width: 14rem;
51
+ margin: 1rem auto;
52
+ line-height: 1.35;
53
+ }
54
+
55
+ @media (min-width: 480px) {
56
+ h1 {
57
+ max-width: none;
58
+ }
59
+
60
+ p {
61
+ max-width: none;
62
+ }
63
+ }
64
+ </style>
@@ -0,0 +1,34 @@
1
+ <script>
2
+ let count = 0;
3
+ const increment = () => {
4
+ count += 1;
5
+ };
6
+ </script>
7
+
8
+ <button on:click={increment}>
9
+ Clicks: {count}
10
+ </button>
11
+
12
+ <style>
13
+ button {
14
+ font-family: inherit;
15
+ font-size: inherit;
16
+ padding: 1em 2em;
17
+ color: #ff3e00;
18
+ background-color: rgba(255, 62, 0, 0.1);
19
+ border-radius: 2em;
20
+ border: 2px solid rgba(255, 62, 0, 0);
21
+ outline: none;
22
+ width: 200px;
23
+ font-variant-numeric: tabular-nums;
24
+ cursor: pointer;
25
+ }
26
+
27
+ button:focus {
28
+ border: 2px solid #ff3e00;
29
+ }
30
+
31
+ button:active {
32
+ background-color: rgba(255, 62, 0, 0.2);
33
+ }
34
+ </style>
@@ -0,0 +1,7 @@
1
+ import App from './App.svelte';
2
+
3
+ const app = new App({
4
+ target: document.getElementById('app'),
5
+ });
6
+
7
+ export default app;
@@ -0,0 +1,2 @@
1
+ /// <reference types="svelte" />
2
+ /// <reference types="vite/client" />
@@ -0,0 +1,33 @@
1
+ import { defineConfig, loadEnv } from 'vite';
2
+ import { svelte } from '@sveltejs/vite-plugin-svelte';
3
+ import { createHtmlPlugin } from 'vite-plugin-html';
4
+ import { createBlockletPlugin } from 'vite-plugin-blocklet';
5
+
6
+ // https://vitejs.dev/config/
7
+ export default ({ mode }) => {
8
+ const envMap = loadEnv(mode, process.cwd(), '');
9
+ const port = process.env.BLOCKLET_PORT || 3000;
10
+ const apiPort = envMap.API_PORT || 3030;
11
+
12
+ return defineConfig({
13
+ plugins: [
14
+ svelte(),
15
+ createHtmlPlugin({
16
+ minify: true,
17
+ inject: {
18
+ data: {
19
+ base: process.env.BASE_URL || '/',
20
+ title: envMap.APP_TITLE,
21
+ },
22
+ },
23
+ }),
24
+ createBlockletPlugin(),
25
+ ],
26
+ server: {
27
+ port,
28
+ proxy: {
29
+ '/api': `http://127.0.0.1:${apiPort}`,
30
+ },
31
+ },
32
+ });
33
+ };
@@ -0,0 +1,4 @@
1
+ > 1%
2
+ last 2 versions
3
+ not dead
4
+ not ie 11
@@ -0,0 +1 @@
1
+ APP_TITLE=''
@@ -0,0 +1,22 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: {
4
+ es6: true,
5
+ browser: true,
6
+ },
7
+ parserOptions: {
8
+ ecmaVersion: 2019,
9
+ sourceType: 'module',
10
+ },
11
+ plugins: ['svelte3'],
12
+ overrides: [
13
+ {
14
+ files: ['*.svelte'],
15
+ processor: 'svelte3/svelte3',
16
+ },
17
+ ],
18
+ rules: {
19
+ 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
20
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
21
+ },
22
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["svelte.svelte-vscode"]
3
+ }
@@ -0,0 +1,146 @@
1
+ # Getting Started with Create Blocklet
2
+
3
+ This project was bootstrapped with [Create Blocklet](https://github.com/blocklet/create-blocklet).
4
+
5
+ This blocklet is a static project, which means this is a frontend application. It's contained `client` code.
6
+
7
+ ## File Structure
8
+
9
+ - public/ - static files
10
+ - favicon.ico - favicon
11
+ - favicon.svg - favicon
12
+ - index.html - main html file, template for vite vue
13
+ - screenshots/ - Screenshots
14
+ - src/ - Client side code (A standard vue app structure)
15
+ - .env - Environment variables
16
+ - .eslintrc.js - ESLint configuration
17
+ - .gitignore - Git ignore file
18
+ - .prettierrc - Prettier configuration
19
+ - blocklet.md - Blocklet README
20
+ - blocklet.yml - Blocklet configuration
21
+ - LICENSE - License file
22
+ - logo.png - Blocklet logo file
23
+ - Makefile - Makefile
24
+ - package.json - Npm package file
25
+ - README.md - A guide for this blocklet
26
+ - version - Version file
27
+
28
+ ## Development
29
+
30
+ 1. Make sure you have [@blocklet/cli](https://www.npmjs.com/package/@blocklet/cli) installed
31
+
32
+ Blocklet needs blocklet server as a dependency. So you need to install it first.
33
+ `npm install -g @blocklet/cli`
34
+ See details in [https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distribution](https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distribution)
35
+
36
+ 2. Init blocklet server & start blocklet server
37
+
38
+ Before starting an blocklet server, you need to init blocklet server.
39
+ `blocklet server init --mode=debug`
40
+ `blocklet server start`
41
+ See details in [https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-node](https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-node)
42
+
43
+ 3. Go to the project directory `cd [name]`
44
+ 4. Install dependencies: `npm install` or `yarn`
45
+ 5. Start development server: `blocklet dev`
46
+
47
+ ## Bundle
48
+
49
+ After developing a blocklet, you may need to bundle it. Use `npm run bundle` command.
50
+
51
+ ## Deploy
52
+
53
+ - If you want to deploy this blocklet to local blocklet server, you can use `blocklet deploy .blocklet/bundle` command(Make sure the blocklet is bundled before deployment.)
54
+ > Or you can simply use `npm run deploy` command.
55
+ - If you want to deploy this blocklet to remote blocklet server, you can use the command below.
56
+
57
+ ```shell
58
+ blocklet deploy .blocklet/bundle --endpoint {your blocklet server url} --access-key {blocklet server access key} --access-secret {blocklet server access secret}
59
+ ```
60
+
61
+ > Make sure the blocklet is bundled before deployment.
62
+
63
+ ## Upload to blocklet store
64
+
65
+ - If you want to upload the blocklet to any store for other users to download and use, you can following the following instructions.
66
+
67
+ Bump version at first.
68
+
69
+ ```shell
70
+ make bump-version
71
+ ```
72
+
73
+ Then config blocklet store url.
74
+ You can use those store url in below.
75
+
76
+ 1. [https://store.blocklet.dev/](https://store.blocklet.dev/)
77
+ 2. [https://dev.store.blocklet.dev/](https://dev.store.blocklet.dev/)
78
+ 3. A blocklet store started by yourself.
79
+ > Make sure you have installed a `blocklet store` on your own blocklet server. Check it on here: [https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ](https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ)
80
+
81
+ ```shell
82
+ blocklet config set store {store url}
83
+ ```
84
+
85
+ Get a `accessToken` from blocklet store.
86
+
87
+ > Why we need a `accessToken`?
88
+ > A `accessToken` is genrate by blocklet store, which help us upload our blocklet to any store.
89
+
90
+ Set `accessToken` to blocklet config
91
+
92
+ ```shell
93
+ blocklet config set accessToken {accessToken}
94
+ ```
95
+
96
+ Upload a new version to a store.
97
+
98
+ > Make sure the blocklet is bundled before upload.
99
+
100
+ ```shell
101
+ blocklet upload
102
+ ```
103
+
104
+ Or you can simply use `npm run upload` command.
105
+
106
+ - You also can upload a new version to blocklet store by Github CI.
107
+ Bump version at first.
108
+
109
+ ```shell
110
+ make bump-version
111
+ ```
112
+
113
+ Push your code to Github main/master branch, or make a pull request to the main/master branch.
114
+ The CI workflow will automatically upload a new version to a store.
115
+
116
+ ## Q & A
117
+
118
+ 1. Q: How to change a blocklet's name?
119
+
120
+ A: Change the `name` field in the `package.json` file, change the `name` field in the `blocklet.yml` file.
121
+
122
+ You can also change the `title` field and `description` field in the `blocklet.yml` file.
123
+
124
+ Run `blocklet meta` command, you will get a `did` config, copy the `did` value.
125
+
126
+ Replace this command `"bundle": "vite build --base /.blocklet/proxy/<%= did %>",` in `package.json`
127
+
128
+ Replace `did` field in the `blocklet.yml`
129
+
130
+ 2. Q: How to change a blocklet's logo?
131
+
132
+ Change the `logo.png` file root folder.
133
+
134
+ Or you can change the `logo` field in the `blocklet.yml` file.
135
+
136
+ > Make sure you have added the logo path to the `blocklet.yml` file `files` field.
137
+
138
+ ## Learn More
139
+
140
+ - Full specification of `blocklet.yml`: [https://github.com/blocklet/blocklet-specification/blob/main/docs/meta.md](https://github.com/blocklet/blocklet-specification/blob/main/docs/meta.md)
141
+ - Full document of Blocklet Server & blocklet development: [https://docs.arcblock.io/abtnode/en/introduction](https://docs.arcblock.io/abtnode/en/introduction)
142
+
143
+ ## License
144
+
145
+ The code is licensed under the Apache 2.0 license found in the
146
+ [LICENSE](LICENSE) file.
@@ -0,0 +1,3 @@
1
+ # template-svelte
2
+
3
+ A svelte template for creating a new blocklet project.
@@ -0,0 +1,49 @@
1
+ name: template-svelte
2
+ title: Blocklet Template Svelte
3
+ description: A Blocklet Server blocklet
4
+ keywords:
5
+ - blocklet
6
+ - svelte
7
+ group: static
8
+ did: ''
9
+ main: dist
10
+ author:
11
+ name: Blocklet
12
+ email: blocklet@arcblock.io
13
+ repository:
14
+ type: git
15
+ url: 'git+https://github.com/blocklet/create-blocklet.git'
16
+ specVersion: 1.1.1
17
+ version: 0.1.0
18
+ logo: logo.png
19
+ files:
20
+ - logo.png
21
+ - README.md
22
+ - blocklet.md
23
+ - screenshots
24
+ interfaces:
25
+ - type: web
26
+ name: publicUrl
27
+ path: /
28
+ prefix: '*'
29
+ port: BLOCKLET_PORT
30
+ protocol: http
31
+ community: ''
32
+ documentation: ''
33
+ homepage: ''
34
+ license: ''
35
+ payment:
36
+ price: []
37
+ share: []
38
+ timeout:
39
+ start: 60
40
+ requirements:
41
+ server: '>=1.6.29'
42
+ os: '*'
43
+ cpu: '*'
44
+ scripts:
45
+ dev: npm run start
46
+ environments: []
47
+ capabilities: {}
48
+ screenshots: []
49
+ children: []
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="<%- base %>favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
7
+ <meta name="theme-color" content="#4F6AF5" />
8
+ <meta name="description" content="Web site created using create-blocklet" />
9
+ <title><%- title %></title>
10
+ <script src="__meta__.js"></script>
11
+ </head>
12
+ <body>
13
+ <div id="app"></div>
14
+ <script type="module" src="/src/main.js"></script>
15
+ </body>
16
+ </html>
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ "moduleResolution": "node",
4
+ "target": "esnext",
5
+ "module": "esnext",
6
+ /**
7
+ * svelte-preprocess cannot figure out whether you have
8
+ * a value or a type, so tell TypeScript to enforce using
9
+ * `import type` instead of `import` for Types.
10
+ */
11
+ "importsNotUsedAsValues": "error",
12
+ "isolatedModules": true,
13
+ "resolveJsonModule": true,
14
+ /**
15
+ * To have warnings / errors of the Svelte compiler at the
16
+ * correct position, enable source maps by default.
17
+ */
18
+ "sourceMap": true,
19
+ "esModuleInterop": true,
20
+ "skipLibCheck": true,
21
+ "forceConsistentCasingInFileNames": true,
22
+ "baseUrl": ".",
23
+ /**
24
+ * Typecheck JS in `.svelte` and `.js` files by default.
25
+ * Disable this if you'd like to use dynamic types.
26
+ */
27
+ "checkJs": true
28
+ },
29
+ /**
30
+ * Use global.d.ts instead of compilerOptions.types
31
+ * to avoid limiting type declarations.
32
+ */
33
+ "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
34
+ }