create-blocklet 0.3.3 → 0.3.4
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 +28 -23
- package/lib/did.js +1 -1
- package/package.json +2 -1
- package/template-api/express/blocklet.yml +3 -4
- package/template-dapp/nextjs/blocklet.yml +3 -4
- package/template-dapp/react/blocklet.yml +3 -4
- package/template-dapp/vue/blocklet.yml +3 -4
- package/template-dapp/vue2/blocklet.yml +3 -4
- package/template-static/react/blocklet.yml +3 -4
- package/template-static/vue/blocklet.yml +3 -4
- package/template-static/vue2/blocklet.yml +3 -4
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import boxen from 'boxen';
|
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import { execSync } from 'child_process';
|
|
7
7
|
import { cd, argv, fs, YAML, chalk, path } from 'zx';
|
|
8
|
-
import
|
|
8
|
+
import ora from 'ora';
|
|
9
9
|
import prompts from 'prompts';
|
|
10
10
|
import * as envfile from 'envfile';
|
|
11
11
|
|
|
@@ -206,7 +206,7 @@ async function init() {
|
|
|
206
206
|
// user choice associated with prompts
|
|
207
207
|
const { type, framework, overwrite, packageName, authorName, authorEmail } = result;
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
await echoDocument();
|
|
210
210
|
|
|
211
211
|
const root = path.join(cwd, targetDir);
|
|
212
212
|
|
|
@@ -216,15 +216,18 @@ async function init() {
|
|
|
216
216
|
fs.mkdirSync(root);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
const checkSpinner = ora({
|
|
220
|
+
text: 'Checking blocklet server runtime environment\n',
|
|
221
|
+
}).start();
|
|
222
222
|
|
|
223
223
|
const isServerInstalled = await checkServerInstalled();
|
|
224
224
|
const isSatisfiedVersion = await checkSatisfiedVersion();
|
|
225
225
|
const isServerRunning = await checkServerRunning();
|
|
226
|
+
checkSpinner.succeed('Done');
|
|
227
|
+
|
|
228
|
+
console.log(`\nScaffolding project in ${cyan(root)}`);
|
|
226
229
|
|
|
227
|
-
|
|
230
|
+
const scaffoldSpinner = ora('Creating project...').start();
|
|
228
231
|
|
|
229
232
|
const templateDir = path.join(__dirname, `template-${type}/${framework}`);
|
|
230
233
|
const name = packageName || targetDir;
|
|
@@ -307,9 +310,9 @@ async function init() {
|
|
|
307
310
|
// fs.writeFileSync(path.join(root, 'logo.png'), pngIcon);
|
|
308
311
|
})();
|
|
309
312
|
|
|
313
|
+
scaffoldSpinner.succeed('✨ Done. Now run:\n');
|
|
314
|
+
|
|
310
315
|
const related = path.relative(cwd, root);
|
|
311
|
-
console.log('\n\n✨ Done. Now run:\n');
|
|
312
|
-
stopSpinner();
|
|
313
316
|
|
|
314
317
|
// const pkgManager =
|
|
315
318
|
// // eslint-disable-next-line no-nested-ternary
|
|
@@ -319,19 +322,20 @@ async function init() {
|
|
|
319
322
|
// ? 'yarn'
|
|
320
323
|
// : 'npm';
|
|
321
324
|
try {
|
|
322
|
-
const { yes } = await prompts(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
);
|
|
325
|
+
// const { yes } = await prompts(
|
|
326
|
+
// {
|
|
327
|
+
// type: 'confirm',
|
|
328
|
+
// name: 'yes',
|
|
329
|
+
// initial: 'Y',
|
|
330
|
+
// message: 'Install and start it now?',
|
|
331
|
+
// },
|
|
332
|
+
// {
|
|
333
|
+
// onCancel: () => {
|
|
334
|
+
// throw new Error(`${red('✖')} Operation cancelled`);
|
|
335
|
+
// },
|
|
336
|
+
// }
|
|
337
|
+
// );
|
|
338
|
+
const yes = false;
|
|
335
339
|
let hasStart = false;
|
|
336
340
|
|
|
337
341
|
await initGitRepo(root);
|
|
@@ -465,9 +469,10 @@ async function init() {
|
|
|
465
469
|
const env = envfile.parse(envContent);
|
|
466
470
|
modifyFn(env);
|
|
467
471
|
write('.env', envfile.stringify(env));
|
|
468
|
-
} else {
|
|
469
|
-
console.warn(`\n${yellow('No .env file found, please add one.')}`);
|
|
470
472
|
}
|
|
473
|
+
// else {
|
|
474
|
+
// console.warn(`\n${yellow('No .env file found, please add one.')}`);
|
|
475
|
+
// }
|
|
471
476
|
}
|
|
472
477
|
}
|
|
473
478
|
|
package/lib/did.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fromPublicKey } from '@arcblock/did';
|
|
|
7
7
|
const { types } = Mcrypto;
|
|
8
8
|
|
|
9
9
|
export function toBlockletDid(name) {
|
|
10
|
-
const pk = toHex(name);
|
|
10
|
+
const pk = toHex(Buffer.from(typeof name === 'string' ? name.trim() : name));
|
|
11
11
|
return fromPublicKey(pk, { role: types.RoleType.ROLE_ANY });
|
|
12
12
|
}
|
|
13
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-blocklet",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"exports": "./index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "git@github.com:blocklet/create-blocklet.git",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"figlet": "^1.5.2",
|
|
41
41
|
"gradient-string": "^2.0.0",
|
|
42
42
|
"jdenticon": "^3.1.1",
|
|
43
|
+
"ora": "^6.1.0",
|
|
43
44
|
"prompts": "^2.4.2",
|
|
44
45
|
"semver": "^7.3.5",
|
|
45
46
|
"terminal-link": "^3.0.0",
|