create-blocklet 0.3.4 → 0.3.5
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/index.js +3 -3
- package/lib/git.js +21 -5
- package/lib/index.js +6 -2
- package/lib/npm.js +1 -1
- package/lib/server.js +6 -2
- package/package.json +6 -8
- package/{template-static/blocklet-page → templates/blocklet-page-static}/README.md +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/blocklet.md +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/blocklet.yml +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/package.json +1 -1
- package/{template-static/blocklet-page → templates/blocklet-page-static}/site/blocks/CustomBlock.mdx +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/site/composes/MyLayout.mdx +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/site/pages/index.mdx +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/xmark.yml +0 -0
- package/{template-api/express → templates/express-api}/README.md +0 -0
- package/{template-api/express → templates/express-api}/api/hooks/pre-start.js +0 -0
- package/{template-api/express → templates/express-api}/api/index.js +0 -0
- package/{template-api/express → templates/express-api}/api/libs/auth.js +0 -0
- package/{template-api/express → templates/express-api}/api/libs/env.js +0 -0
- package/{template-api/express → templates/express-api}/api/libs/logger.js +0 -0
- package/{template-api/express → templates/express-api}/blocklet.md +0 -0
- package/{template-api/express → templates/express-api}/blocklet.yml +0 -0
- package/{template-api/express → templates/express-api}/package.json +0 -0
- package/{template-api/express → templates/express-api}/screenshots/.gitkeep +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/.eslintrc.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/README.md +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/hooks/pre-start.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/index.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/auth.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/env.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/logger.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/routes/index.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/blocklet.md +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/blocklet.yml +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/next.config.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/package.json +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/_app.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/api/hello.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/index.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/styles/Home.module.css +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/styles/globals.css +0 -0
- package/{template-dapp/react → templates/react-dapp}/.env +0 -0
- package/{template-dapp/react → templates/react-dapp}/.env.local +0 -0
- package/{template-dapp/react → templates/react-dapp}/README.md +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/hooks/pre-start.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/index.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/libs/auth.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/libs/env.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/libs/logger.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/routes/index.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/blocklet.md +0 -0
- package/{template-dapp/react → templates/react-dapp}/blocklet.yml +0 -0
- package/templates/react-dapp/craco.config.js +17 -0
- package/{template-dapp/react → templates/react-dapp}/package.json +3 -3
- package/{template-dapp/react → templates/react-dapp}/public/index.html +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/app.css +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/app.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/index.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/libs/api.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/logo.svg +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/pages/about.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/pages/home.js +0 -0
- package/{template-static/react → templates/react-static}/.env +0 -0
- package/{template-static/react → templates/react-static}/README.md +0 -0
- package/{template-static/react → templates/react-static}/blocklet.md +0 -0
- package/{template-static/react → templates/react-static}/blocklet.yml +0 -0
- package/templates/react-static/craco.config.js +11 -0
- package/{template-static/react → templates/react-static}/package.json +3 -2
- package/{template-static/react → templates/react-static}/public/index.html +0 -0
- package/{template-static/react → templates/react-static}/src/app.css +0 -0
- package/{template-static/react → templates/react-static}/src/app.js +0 -0
- package/{template-static/react → templates/react-static}/src/index.js +0 -0
- package/{template-static/react → templates/react-static}/src/logo.svg +0 -0
- package/{template-static/react → templates/react-static}/src/pages/about.js +0 -0
- package/{template-static/react → templates/react-static}/src/pages/home.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/.browserslistrc +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/.env +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/.eslintrc.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/README.md +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/api/hooks/pre-start.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/api/index.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/api/libs/auth.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/api/libs/env.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/api/libs/logger.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/api/routes/index.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/blocklet.md +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/blocklet.yml +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/index.html +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/package.json +1 -1
- package/{template-dapp/vue → templates/vue-dapp}/src/App.vue +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/src/assets/logo.png +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/src/components/HelloWorld.vue +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/src/libs/api.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/src/main.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/vite.config.js +0 -0
- package/{template-dapp/vue2 → templates/vue-static}/.browserslistrc +0 -0
- package/{template-dapp/vue2 → templates/vue-static}/.env +0 -0
- package/{template-static/vue → templates/vue-static}/.eslintrc.js +0 -0
- package/{template-static/vue → templates/vue-static}/README.md +0 -0
- package/{template-static/vue → templates/vue-static}/blocklet.md +0 -0
- package/{template-static/vue → templates/vue-static}/blocklet.yml +0 -0
- package/{template-static/vue → templates/vue-static}/index.html +0 -0
- package/{template-static/vue → templates/vue-static}/package.json +1 -1
- package/{template-static/vue → templates/vue-static}/src/App.vue +0 -0
- package/{template-dapp/vue2 → templates/vue-static}/src/assets/logo.png +0 -0
- package/{template-static/vue → templates/vue-static}/src/components/HelloWorld.vue +0 -0
- package/{template-static/vue → templates/vue-static}/src/main.js +0 -0
- package/{template-static/vue → templates/vue-static}/vite.config.js +0 -0
- package/{template-static/vue → templates/vue2-dapp}/.browserslistrc +0 -0
- package/{template-static/vue → templates/vue2-dapp}/.env +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/.eslintrc.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/README.md +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/api/hooks/pre-start.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/api/index.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/api/libs/auth.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/api/libs/env.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/api/libs/logger.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/api/routes/index.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/babel.config.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/blocklet.md +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/blocklet.yml +1 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/jsconfig.json +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/package.json +1 -1
- package/{template-dapp/vue2 → templates/vue2-dapp}/public/index.html +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/src/App.vue +0 -0
- package/{template-static/vue → templates/vue2-dapp}/src/assets/logo.png +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/src/components/HelloWorld.vue +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/src/libs/api.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/src/main.js +0 -0
- package/templates/vue2-dapp/vue.config.js +18 -0
- package/{template-static/vue2 → templates/vue2-static}/.browserslistrc +0 -0
- package/{template-static/vue2 → templates/vue2-static}/.env +0 -0
- package/{template-static/vue2 → templates/vue2-static}/.eslintrc.js +0 -0
- package/{template-static/vue2 → templates/vue2-static}/README.md +0 -0
- package/{template-static/vue2 → templates/vue2-static}/babel.config.js +0 -0
- package/{template-static/vue2 → templates/vue2-static}/blocklet.md +0 -0
- package/{template-static/vue2 → templates/vue2-static}/blocklet.yml +0 -0
- package/{template-static/vue2 → templates/vue2-static}/jsconfig.json +0 -0
- package/{template-static/vue2 → templates/vue2-static}/package.json +0 -0
- package/{template-static/vue2 → templates/vue2-static}/public/index.html +0 -0
- package/{template-static/vue2 → templates/vue2-static}/src/App.vue +0 -0
- package/{template-static/vue2 → templates/vue2-static}/src/assets/logo.png +0 -0
- package/{template-static/vue2 → templates/vue2-static}/src/components/HelloWorld.vue +0 -0
- package/{template-static/vue2 → templates/vue2-static}/src/main.js +0 -0
- package/templates/vue2-static/vue.config.js +13 -0
- package/template-dapp/react/src/setupProxy.js +0 -12
- package/template-dapp/vue2/vue.config.js +0 -10
- package/template-static/vue2/vue.config.js +0 -3
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { checkServerInstalled, checkServerRunning, checkSatisfiedVersion, getSer
|
|
|
15
15
|
import { toBlockletDid } from './lib/did.js';
|
|
16
16
|
import { initGitRepo } from './lib/git.js';
|
|
17
17
|
|
|
18
|
-
const { yellow, red, green, cyan, blue, bold
|
|
18
|
+
const { yellow, red, green, cyan, blue, bold } = chalk;
|
|
19
19
|
|
|
20
20
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
21
21
|
|
|
@@ -229,7 +229,7 @@ async function init() {
|
|
|
229
229
|
|
|
230
230
|
const scaffoldSpinner = ora('Creating project...').start();
|
|
231
231
|
|
|
232
|
-
const templateDir = path.join(__dirname, `
|
|
232
|
+
const templateDir = path.join(__dirname, `templates/${framework}-${type}`);
|
|
233
233
|
const name = packageName || targetDir;
|
|
234
234
|
|
|
235
235
|
// copy common files
|
|
@@ -417,7 +417,7 @@ async function init() {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
if (!hasStart) {
|
|
420
|
-
console.log(dim('\n start it later by:\n'));
|
|
420
|
+
// console.log(dim('\n start it later by:\n'));
|
|
421
421
|
if (root !== cwd) console.log(blue(` cd ${bold(related)}`));
|
|
422
422
|
|
|
423
423
|
console.log(blue(` ${defaultAgent === 'yarn' ? 'yarn' : `${defaultAgent} install`}`));
|
package/lib/git.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
import { $, which, cd } from 'zx';
|
|
1
|
+
import { $, which, cd, chalk } from 'zx';
|
|
2
|
+
|
|
3
|
+
const { yellow } = chalk;
|
|
2
4
|
|
|
3
5
|
$.verbose = false;
|
|
4
6
|
|
|
7
|
+
async function canInitGit() {
|
|
8
|
+
const isInstalled = await isGitInstalled();
|
|
9
|
+
const gitInfo = await getUserInfo();
|
|
10
|
+
if (isInstalled && gitInfo.name && gitInfo.email) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
export async function isGitInstalled() {
|
|
6
17
|
try {
|
|
7
18
|
await which('git');
|
|
@@ -12,10 +23,15 @@ export async function isGitInstalled() {
|
|
|
12
23
|
}
|
|
13
24
|
|
|
14
25
|
export async function initGitRepo(root) {
|
|
15
|
-
await
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
const canInstalled = await canInitGit();
|
|
27
|
+
if (canInstalled) {
|
|
28
|
+
await cd(root);
|
|
29
|
+
await $`git init`;
|
|
30
|
+
await $`git add .`;
|
|
31
|
+
await $`git commit -m 'init'`;
|
|
32
|
+
} else {
|
|
33
|
+
console.warn(`${yellow('Git is not installed')}`);
|
|
34
|
+
}
|
|
19
35
|
}
|
|
20
36
|
|
|
21
37
|
export async function getUserInfo() {
|
package/lib/index.js
CHANGED
|
@@ -11,9 +11,13 @@ export async function getOutput(cmd) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export async function getUser() {
|
|
14
|
+
function purifyString(str) {
|
|
15
|
+
return [undefined, 'undefined', null, 'null'].includes(str) ? '' : str;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
const [npmAuthor, gitUser, serverUser] = await Promise.all([getAuthor(), getUserInfo(), getServerUserInfo()]);
|
|
15
19
|
return {
|
|
16
|
-
name: serverUser.name || npmAuthor.name || gitUser.name || '',
|
|
17
|
-
email: serverUser.email || npmAuthor.email || gitUser.email || '',
|
|
20
|
+
name: purifyString(serverUser.name) || purifyString(npmAuthor.name) || purifyString(gitUser.name) || '',
|
|
21
|
+
email: purifyString(serverUser.email) || purifyString(npmAuthor.email) || purifyString(gitUser.email) || '',
|
|
18
22
|
};
|
|
19
23
|
}
|
package/lib/npm.js
CHANGED
|
@@ -8,7 +8,7 @@ export async function getAuthor() {
|
|
|
8
8
|
const { stdout: name } = await $`npm config get init.author.name`;
|
|
9
9
|
const { stdout: email } = await $`npm config get init.author.email`;
|
|
10
10
|
|
|
11
|
-
return { name: name
|
|
11
|
+
return { name: name?.trim(), email: email?.trim() };
|
|
12
12
|
} catch {
|
|
13
13
|
return {
|
|
14
14
|
name: '',
|
package/lib/server.js
CHANGED
|
@@ -13,8 +13,12 @@ export async function checkServerInstalled() {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export async function getServerVersion() {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
try {
|
|
17
|
+
const { stdout: output } = await $`blocklet --version`;
|
|
18
|
+
return output.trim();
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return '0.0.0';
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
export async function getServerStatus() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-blocklet",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"exports": "./index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "git@github.com:blocklet/create-blocklet.git",
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
"index.js",
|
|
14
14
|
"common",
|
|
15
15
|
"lib",
|
|
16
|
-
"
|
|
17
|
-
"template-dapp",
|
|
18
|
-
"template-static"
|
|
16
|
+
"templates"
|
|
19
17
|
],
|
|
20
18
|
"engines": {
|
|
21
19
|
"node": ">=16.0.0"
|
|
@@ -31,9 +29,9 @@
|
|
|
31
29
|
"test:run": "vitest run"
|
|
32
30
|
},
|
|
33
31
|
"dependencies": {
|
|
34
|
-
"@arcblock/did": "^1.
|
|
35
|
-
"@ocap/mcrypto": "^1.
|
|
36
|
-
"@ocap/util": "^1.
|
|
32
|
+
"@arcblock/did": "^1.15.7",
|
|
33
|
+
"@ocap/mcrypto": "^1.15.7",
|
|
34
|
+
"@ocap/util": "^1.15.7",
|
|
37
35
|
"boxen": "^6.2.1",
|
|
38
36
|
"ejs": "^3.1.6",
|
|
39
37
|
"envfile": "^6.17.0",
|
|
@@ -44,7 +42,7 @@
|
|
|
44
42
|
"prompts": "^2.4.2",
|
|
45
43
|
"semver": "^7.3.5",
|
|
46
44
|
"terminal-link": "^3.0.0",
|
|
47
|
-
"zx": "^6.0.
|
|
45
|
+
"zx": "^6.0.7"
|
|
48
46
|
},
|
|
49
47
|
"devDependencies": {
|
|
50
48
|
"@arcblock/eslint-config": "0.1.8",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/{template-static/blocklet-page → templates/blocklet-page-static}/site/blocks/CustomBlock.mdx
RENAMED
|
File without changes
|
package/{template-static/blocklet-page → templates/blocklet-page-static}/site/composes/MyLayout.mdx
RENAMED
|
File without changes
|
package/{template-static/blocklet-page → templates/blocklet-page-static}/site/pages/index.mdx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
|
|
2
|
+
const dappPort = process.env.APP_PORT || 3030;
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
devServer: {
|
|
6
|
+
port,
|
|
7
|
+
client: {
|
|
8
|
+
// If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
|
|
9
|
+
webSocketURL: 'wss://0.0.0.0/ws',
|
|
10
|
+
},
|
|
11
|
+
proxy: {
|
|
12
|
+
'/api': {
|
|
13
|
+
target: `http://127.0.0.1:${dappPort}`,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "template-react",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"dev": "
|
|
6
|
-
"build": "
|
|
5
|
+
"dev": "craco start",
|
|
6
|
+
"build": "craco build",
|
|
7
7
|
"eject": "react-scripts eject",
|
|
8
8
|
"lint": "eslint src api --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
9
9
|
"start": "npm-run-all --parallel start:*",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@arcblock/did-auth": "^1.15.2",
|
|
43
43
|
"@arcblock/did-auth-storage-nedb": "^1.6.3",
|
|
44
44
|
"@blocklet/sdk": "^1.7.0",
|
|
45
|
+
"@craco/craco": "^6.4.3",
|
|
45
46
|
"@ocap/client": "^1.15.2",
|
|
46
47
|
"@ocap/mcrypto": "^1.15.2",
|
|
47
48
|
"@ocap/wallet": "^1.15.2",
|
|
@@ -70,7 +71,6 @@
|
|
|
70
71
|
"eslint-plugin-react": "^7.24.0",
|
|
71
72
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
72
73
|
"eslint-plugin-unicorn": "^34.0.1",
|
|
73
|
-
"http-proxy-middleware": "^2.0.4",
|
|
74
74
|
"husky": "^7.0.4",
|
|
75
75
|
"lint-staged": "^12.3.7",
|
|
76
76
|
"nodemon": "^2.0.15",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
devServer: {
|
|
5
|
+
port,
|
|
6
|
+
client: {
|
|
7
|
+
// If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
|
|
8
|
+
webSocketURL: 'wss://0.0.0.0/ws',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "template-react",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"dev": "
|
|
6
|
-
"build": "
|
|
5
|
+
"dev": "craco start",
|
|
6
|
+
"build": "craco build",
|
|
7
7
|
"eject": "react-scripts eject",
|
|
8
8
|
"lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
9
9
|
"start": "npm run dev",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@craco/craco": "^6.4.3",
|
|
38
39
|
"react": "^17.0.2",
|
|
39
40
|
"react-dom": "^17.0.2",
|
|
40
41
|
"react-router-dom": "^6.2.2",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"start:api": "NODE_ENV=development nodemon api/index.js -w api",
|
|
11
11
|
"clean": "rm -rf .blocklet",
|
|
12
12
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
13
|
-
"bundle:client": "vite build --base /.blocklet/proxy/<%= did
|
|
13
|
+
"bundle:client": "vite build --base /.blocklet/proxy/<%= did %>/",
|
|
14
14
|
"bundle:api": "npm run clean && blocklet bundle --zip --create-release",
|
|
15
15
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
16
16
|
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"lint": "eslint src --ext .mjs,.js,.vue",
|
|
9
9
|
"serve": "vite preview",
|
|
10
10
|
"clean": "rm -rf .blocklet",
|
|
11
|
-
"bundle": "npm run clean && vite build --base /.blocklet/proxy/<%= did
|
|
11
|
+
"bundle": "npm run clean && vite build --base /.blocklet/proxy/<%= did %>/ && blocklet bundle --zip --create-release",
|
|
12
12
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
13
13
|
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
|
|
14
14
|
"prepare": "husky install"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"start:api": "NODE_ENV=development nodemon api/index.js -w api",
|
|
12
12
|
"clean": "rm -rf .blocklet",
|
|
13
13
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
14
|
-
"bundle:client": "PUBLIC_PATH=/.blocklet/proxy
|
|
14
|
+
"bundle:client": "PUBLIC_PATH=/.blocklet/proxy/<%= did %> npm run build",
|
|
15
15
|
"bundle:api": "npm run clean && blocklet bundle --zip --create-release",
|
|
16
16
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
17
17
|
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
publicPath: process.env.PUBLIC_PATH || '/',
|
|
5
|
+
devServer: {
|
|
6
|
+
port,
|
|
7
|
+
allowedHosts: 'all',
|
|
8
|
+
client: {
|
|
9
|
+
// 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',
|
|
11
|
+
},
|
|
12
|
+
proxy: {
|
|
13
|
+
'/api': {
|
|
14
|
+
target: 'http://127.0.0.1:3030',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
publicPath: process.env.PUBLIC_PATH || '/',
|
|
5
|
+
devServer: {
|
|
6
|
+
port,
|
|
7
|
+
allowedHosts: 'all',
|
|
8
|
+
client: {
|
|
9
|
+
// 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',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
require('dotenv-flow').config();
|
|
2
|
-
|
|
3
|
-
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
4
|
-
|
|
5
|
-
module.exports = (app) => {
|
|
6
|
-
app.use(
|
|
7
|
-
'/api',
|
|
8
|
-
createProxyMiddleware({
|
|
9
|
-
target: `http://127.0.0.1:${process.env.APP_PORT || 3030}`,
|
|
10
|
-
})
|
|
11
|
-
);
|
|
12
|
-
};
|