create-blocklet 0.4.9 → 0.4.12

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.
File without changes
File without changes
File without changes
File without changes
package/lib/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-blocklet",
3
- "version": "0.4.9",
3
+ "version": "0.4.12",
4
4
  "exports": "./index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:blocklet/create-blocklet.git",
@@ -22,12 +22,6 @@
22
22
  "url": "https://github.com/blocklet/create-blocklet/issues"
23
23
  },
24
24
  "homepage": "https://github.com/blocklet/create-blocklet/tree/main#readme",
25
- "scripts": {
26
- "lint": "eslint .",
27
- "test": "NODE_ENV=development vitest",
28
- "test:ui": "vitest --ui",
29
- "test:run": "vitest run"
30
- },
31
25
  "dependencies": {
32
26
  "@arcblock/did": "^1.17.0",
33
27
  "@ocap/mcrypto": "^1.17.0",
@@ -50,5 +44,11 @@
50
44
  "eslint": "^8.19.0",
51
45
  "prettier": "^2.7.1",
52
46
  "vitest": "^0.16.0"
47
+ },
48
+ "scripts": {
49
+ "lint": "eslint .",
50
+ "test": "NODE_ENV=development vitest",
51
+ "test:ui": "vitest --ui",
52
+ "test:run": "vitest run"
53
53
  }
54
- }
54
+ }
@@ -30,9 +30,9 @@
30
30
  "npm-run-all": "^4.1.5",
31
31
  "prettier": "^2.7.1",
32
32
  "vite": "^2.9.12",
33
- "vite-plugin-blocklet": "^0.1.2",
34
33
  "vite-plugin-html": "^3.2.0",
35
- "vite-plugin-solid": "^2.2.6"
34
+ "vite-plugin-solid": "^2.2.6",
35
+ "vite-plugin-wss-hmr": "^0.4.12"
36
36
  },
37
37
  "dependencies": {
38
38
  "@arcblock/did-auth": "^1.17.0",
@@ -1,26 +1,37 @@
1
1
  import { defineConfig, loadEnv } from 'vite';
2
2
  import solidPlugin from 'vite-plugin-solid';
3
3
  import { createHtmlPlugin } from 'vite-plugin-html';
4
- import { createBlockletPlugin } from 'vite-plugin-blocklet';
4
+ import createWssHmrPlugin from 'vite-plugin-wss-hmr';
5
5
 
6
- export default ({ mode }) => {
6
+ export default defineConfig(async ({ mode }) => {
7
7
  const envMap = loadEnv(mode, process.cwd(), '');
8
8
  const port = process.env.BLOCKLET_PORT || 3000;
9
9
  const apiPort = envMap.API_PORT || 3030;
10
10
 
11
+ const whenDev = mode === 'development';
12
+
13
+ let mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
14
+
15
+ if (mountPoint && !mountPoint.endsWith('/')) {
16
+ mountPoint = `${mountPoint}/`;
17
+ }
18
+
19
+ const base = whenDev ? mountPoint : process.env.BASE_URL || '/';
20
+
11
21
  return defineConfig({
22
+ base,
12
23
  plugins: [
13
24
  solidPlugin(),
14
25
  createHtmlPlugin({
15
26
  minify: true,
16
27
  inject: {
17
28
  data: {
18
- base: process.env.BASE_URL || '/',
29
+ base,
19
30
  title: envMap.APP_TITLE,
20
31
  },
21
32
  },
22
33
  }),
23
- createBlockletPlugin(),
34
+ await createWssHmrPlugin(),
24
35
  ],
25
36
  build: {
26
37
  target: 'esnext',
@@ -33,4 +44,4 @@ export default ({ mode }) => {
33
44
  },
34
45
  },
35
46
  });
36
- };
47
+ });
@@ -24,9 +24,9 @@
24
24
  "lint-staged": "^12.5.0",
25
25
  "prettier": "^2.7.1",
26
26
  "vite": "^2.9.12",
27
- "vite-plugin-blocklet": "^0.1.2",
28
27
  "vite-plugin-html": "^3.2.0",
29
- "vite-plugin-solid": "^2.2.6"
28
+ "vite-plugin-solid": "^2.2.6",
29
+ "vite-plugin-wss-hmr": "^0.4.12"
30
30
  },
31
31
  "dependencies": {
32
32
  "solid-js": "^1.4.4"
@@ -1,25 +1,36 @@
1
1
  import { defineConfig, loadEnv } from 'vite';
2
2
  import solidPlugin from 'vite-plugin-solid';
3
3
  import { createHtmlPlugin } from 'vite-plugin-html';
4
- import { createBlockletPlugin } from 'vite-plugin-blocklet';
4
+ import createWssHmrPlugin from 'vite-plugin-wss-hmr';
5
5
 
6
- export default ({ mode }) => {
6
+ export default defineConfig(async ({ mode }) => {
7
7
  const envMap = loadEnv(mode, process.cwd(), '');
8
8
  const port = process.env.BLOCKLET_PORT || 3000;
9
9
 
10
- return defineConfig({
10
+ const whenDev = mode === 'development';
11
+
12
+ let mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
13
+
14
+ if (mountPoint && !mountPoint.endsWith('/')) {
15
+ mountPoint = `${mountPoint}/`;
16
+ }
17
+
18
+ const base = whenDev ? mountPoint : process.env.BASE_URL || '/';
19
+
20
+ return {
21
+ base,
11
22
  plugins: [
12
23
  solidPlugin(),
13
24
  createHtmlPlugin({
14
25
  minify: true,
15
26
  inject: {
16
27
  data: {
17
- base: process.env.BASE_URL || '/',
28
+ base,
18
29
  title: envMap.APP_TITLE,
19
30
  },
20
31
  },
21
32
  }),
22
- createBlockletPlugin(),
33
+ await createWssHmrPlugin(),
23
34
  ],
24
35
  build: {
25
36
  target: 'esnext',
@@ -28,5 +39,5 @@ export default ({ mode }) => {
28
39
  server: {
29
40
  port,
30
41
  },
31
- });
32
- };
42
+ };
43
+ });
@@ -43,8 +43,8 @@
43
43
  "prettier": "^2.7.1",
44
44
  "svelte": "^3.48.0",
45
45
  "vite": "^2.9.12",
46
- "vite-plugin-blocklet": "^0.1.2",
47
- "vite-plugin-html": "^3.2.0"
46
+ "vite-plugin-html": "^3.2.0",
47
+ "vite-plugin-wss-hmr": "^0.4.12"
48
48
  },
49
49
  "lint-staged": {
50
50
  "*.{mjs,js,vue}": [
@@ -1,27 +1,38 @@
1
1
  import { defineConfig, loadEnv } from 'vite';
2
2
  import { svelte } from '@sveltejs/vite-plugin-svelte';
3
3
  import { createHtmlPlugin } from 'vite-plugin-html';
4
- import { createBlockletPlugin } from 'vite-plugin-blocklet';
4
+ import createWssHmrPlugin from 'vite-plugin-wss-hmr';
5
5
 
6
6
  // https://vitejs.dev/config/
7
- export default ({ mode }) => {
7
+ export default defineConfig(async ({ mode }) => {
8
8
  const envMap = loadEnv(mode, process.cwd(), '');
9
9
  const port = process.env.BLOCKLET_PORT || 3000;
10
10
  const apiPort = envMap.API_PORT || 3030;
11
11
 
12
- return defineConfig({
12
+ const whenDev = mode === 'development';
13
+
14
+ let mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
15
+
16
+ if (mountPoint && !mountPoint.endsWith('/')) {
17
+ mountPoint = `${mountPoint}/`;
18
+ }
19
+
20
+ const base = whenDev ? mountPoint : process.env.BASE_URL || '/';
21
+
22
+ return {
23
+ base,
13
24
  plugins: [
14
25
  svelte(),
15
26
  createHtmlPlugin({
16
27
  minify: true,
17
28
  inject: {
18
29
  data: {
19
- base: process.env.BASE_URL || '/',
30
+ base,
20
31
  title: envMap.APP_TITLE,
21
32
  },
22
33
  },
23
34
  }),
24
- createBlockletPlugin(),
35
+ await createWssHmrPlugin(),
25
36
  ],
26
37
  server: {
27
38
  port,
@@ -29,5 +40,5 @@ export default ({ mode }) => {
29
40
  '/api': `http://127.0.0.1:${apiPort}`,
30
41
  },
31
42
  },
32
- });
33
- };
43
+ };
44
+ });
@@ -25,8 +25,8 @@
25
25
  "prettier": "^2.7.1",
26
26
  "svelte": "^3.48.0",
27
27
  "vite": "^2.9.12",
28
- "vite-plugin-blocklet": "^0.1.2",
29
- "vite-plugin-html": "^3.2.0"
28
+ "vite-plugin-html": "^3.2.0",
29
+ "vite-plugin-wss-hmr": "^0.4.12"
30
30
  },
31
31
  "lint-staged": {
32
32
  "*.{mjs,js,vue}": [
@@ -1,29 +1,40 @@
1
1
  import { defineConfig, loadEnv } from 'vite';
2
2
  import { svelte } from '@sveltejs/vite-plugin-svelte';
3
3
  import { createHtmlPlugin } from 'vite-plugin-html';
4
- import { createBlockletPlugin } from 'vite-plugin-blocklet';
4
+ import createWssHmrPlugin from 'vite-plugin-wss-hmr';
5
5
 
6
6
  // https://vitejs.dev/config/
7
- export default ({ mode }) => {
7
+ export default defineConfig(async ({ mode }) => {
8
8
  const envMap = loadEnv(mode, process.cwd(), '');
9
9
  const port = process.env.BLOCKLET_PORT || 3000;
10
10
 
11
- return defineConfig({
11
+ const whenDev = mode === 'development';
12
+
13
+ let mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
14
+
15
+ if (mountPoint && !mountPoint.endsWith('/')) {
16
+ mountPoint = `${mountPoint}/`;
17
+ }
18
+
19
+ const base = whenDev ? mountPoint : process.env.BASE_URL || '/';
20
+
21
+ return {
22
+ base,
12
23
  plugins: [
13
24
  svelte(),
14
25
  createHtmlPlugin({
15
26
  minify: true,
16
27
  inject: {
17
28
  data: {
18
- base: process.env.BASE_URL || '/',
29
+ base,
19
30
  title: envMap.APP_TITLE,
20
31
  },
21
32
  },
22
33
  }),
23
- createBlockletPlugin(),
34
+ await createWssHmrPlugin(),
24
35
  ],
25
36
  server: {
26
37
  port,
27
38
  },
28
- });
29
- };
39
+ };
40
+ });
@@ -47,7 +47,7 @@
47
47
  "npm-run-all": "^4.1.5",
48
48
  "prettier": "^2.7.1",
49
49
  "vite": "^2.9.12",
50
- "vite-plugin-blocklet": "^0.1.2"
50
+ "vite-plugin-wss-hmr": "^0.4.12"
51
51
  },
52
52
  "lint-staged": {
53
53
  "*.{mjs,js,vue}": [
@@ -1,28 +1,39 @@
1
1
  import { defineConfig, loadEnv } from 'vite';
2
2
  import vue from '@vitejs/plugin-vue';
3
3
  import { createHtmlPlugin } from 'vite-plugin-html';
4
- import { createBlockletPlugin } from 'vite-plugin-blocklet';
4
+ import createWssHmrPlugin from 'vite-plugin-wss-hmr';
5
5
 
6
6
  // https://vitejs.dev/config/
7
- export default ({ mode }) => {
8
- const port = process.env.BLOCKLET_PORT || 3000;
9
-
7
+ export default defineConfig(async ({ mode }) => {
10
8
  const envMap = loadEnv(mode, process.cwd(), '');
11
9
  const apiPort = envMap.API_PORT || 3030;
12
10
 
13
- return defineConfig({
11
+ const port = process.env.BLOCKLET_PORT || 3000;
12
+
13
+ const whenDev = mode === 'development';
14
+
15
+ let mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
16
+
17
+ if (mountPoint && !mountPoint.endsWith('/')) {
18
+ mountPoint = `${mountPoint}/`;
19
+ }
20
+
21
+ const base = whenDev ? mountPoint : process.env.BASE_URL || '/';
22
+
23
+ return {
24
+ base,
14
25
  plugins: [
15
26
  vue(),
16
27
  createHtmlPlugin({
17
28
  minify: true,
18
29
  inject: {
19
30
  data: {
20
- base: process.env.BASE_URL || '/',
31
+ base,
21
32
  title: envMap.APP_TITLE,
22
33
  },
23
34
  },
24
35
  }),
25
- createBlockletPlugin(),
36
+ await createWssHmrPlugin(),
26
37
  ],
27
38
  server: {
28
39
  port,
@@ -30,5 +41,5 @@ export default ({ mode }) => {
30
41
  '/api': `http://127.0.0.1:${apiPort}`,
31
42
  },
32
43
  },
33
- });
34
- };
44
+ };
45
+ });
@@ -26,8 +26,8 @@
26
26
  "lint-staged": "^12.5.0",
27
27
  "prettier": "^2.7.1",
28
28
  "vite": "^2.9.12",
29
- "vite-plugin-blocklet": "^0.1.2",
30
- "vite-plugin-html": "^3.2.0"
29
+ "vite-plugin-html": "^3.2.0",
30
+ "vite-plugin-wss-hmr": "^0.4.12"
31
31
  },
32
32
  "lint-staged": {
33
33
  "*.{mjs,js,vue}": [
@@ -1,29 +1,40 @@
1
1
  import { defineConfig, loadEnv } from 'vite';
2
2
  import vue from '@vitejs/plugin-vue';
3
3
  import { createHtmlPlugin } from 'vite-plugin-html';
4
- import { createBlockletPlugin } from 'vite-plugin-blocklet';
4
+ import createWssHmrPlugin from 'vite-plugin-wss-hmr';
5
5
 
6
6
  // https://vitejs.dev/config/
7
- export default ({ mode }) => {
7
+ export default defineConfig(async ({ mode }) => {
8
8
  const envMap = loadEnv(mode, process.cwd(), '');
9
9
  const port = process.env.BLOCKLET_PORT || 3000;
10
10
 
11
- return defineConfig({
11
+ const whenDev = mode === 'development';
12
+
13
+ let mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
14
+
15
+ if (mountPoint && !mountPoint.endsWith('/')) {
16
+ mountPoint = `${mountPoint}/`;
17
+ }
18
+
19
+ const base = whenDev ? mountPoint : process.env.BASE_URL || '/';
20
+
21
+ return {
22
+ base,
12
23
  plugins: [
13
24
  vue(),
14
25
  createHtmlPlugin({
15
26
  minify: true,
16
27
  inject: {
17
28
  data: {
18
- base: process.env.BASE_URL || '/',
29
+ base,
19
30
  title: envMap.APP_TITLE,
20
31
  },
21
32
  },
22
33
  }),
23
- createBlockletPlugin(),
34
+ await createWssHmrPlugin(),
24
35
  ],
25
36
  server: {
26
37
  port,
27
38
  },
28
- });
29
- };
39
+ };
40
+ });
@@ -3,14 +3,18 @@ require('dotenv-flow').config();
3
3
  const port = process.env.BLOCKLET_PORT || process.env.PORT || 3000;
4
4
  const apiPort = process.env.API_PORT || 3030;
5
5
 
6
+ const whenDev = process.env.NODE_ENV === 'development';
7
+
8
+ const mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
9
+
6
10
  module.exports = {
7
- publicPath: process.env.PUBLIC_PATH || '/',
11
+ publicPath: whenDev ? '' : process.env.PUBLIC_PATH || '/',
8
12
  devServer: {
9
13
  port,
10
14
  allowedHosts: 'all',
11
15
  client: {
12
16
  // If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
13
- webSocketURL: 'wss://0.0.0.0/ws',
17
+ webSocketURL: `wss://0.0.0.0${mountPoint}/ws`,
14
18
  },
15
19
  proxy: {
16
20
  '/api': {
@@ -1,13 +1,17 @@
1
1
  const port = process.env.BLOCKLET_PORT || process.env.PORT || 3000;
2
2
 
3
+ const whenDev = process.env.NODE_ENV === 'development';
4
+
5
+ const mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
6
+
3
7
  module.exports = {
4
- publicPath: process.env.PUBLIC_PATH || '/',
8
+ publicPath: whenDev ? '' : process.env.PUBLIC_PATH || '/',
5
9
  devServer: {
6
10
  port,
7
11
  allowedHosts: 'all',
8
12
  client: {
9
13
  // If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
10
- webSocketURL: 'wss://0.0.0.0/ws',
14
+ webSocketURL: `wss://0.0.0.0${mountPoint}/ws`,
11
15
  },
12
16
  },
13
17
  };