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 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 { startSpinner } from 'zx/experimental';
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
- const stopSpinner = startSpinner();
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
- await echoDocument();
220
-
221
- console.log('Checking blocklet server runtime environment...', '\n');
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
- console.log(`\n\nScaffolding project in ${root}...`);
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
- type: 'confirm',
325
- name: 'yes',
326
- initial: 'Y',
327
- message: 'Install and start it now?',
328
- },
329
- {
330
- onCancel: () => {
331
- throw new Error(`${red('✖')} Operation cancelled`);
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",
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",
@@ -33,10 +33,9 @@ community: ''
33
33
  documentation: ''
34
34
  homepage: ''
35
35
  license: ''
36
- charging:
37
- price: 0
38
- tokens: []
39
- shares: []
36
+ payment:
37
+ price: []
38
+ share: []
40
39
  timeout:
41
40
  start: 60
42
41
  requirements:
@@ -34,10 +34,9 @@ community: ''
34
34
  documentation: ''
35
35
  homepage: ''
36
36
  license: ''
37
- charging:
38
- price: 0
39
- tokens: []
40
- shares: []
37
+ payment:
38
+ price: []
39
+ share: []
41
40
  timeout:
42
41
  start: 60
43
42
  requirements:
@@ -34,10 +34,9 @@ community: ''
34
34
  documentation: ''
35
35
  homepage: ''
36
36
  license: ''
37
- charging:
38
- price: 0
39
- tokens: []
40
- shares: []
37
+ payment:
38
+ price: []
39
+ share: []
41
40
  timeout:
42
41
  start: 60
43
42
  requirements:
@@ -34,10 +34,9 @@ community: ''
34
34
  documentation: ''
35
35
  homepage: ''
36
36
  license: ''
37
- charging:
38
- price: 0
39
- tokens: []
40
- shares: []
37
+ payment:
38
+ price: []
39
+ share: []
41
40
  timeout:
42
41
  start: 60
43
42
  requirements:
@@ -33,10 +33,9 @@ community: ''
33
33
  documentation: ''
34
34
  homepage: ''
35
35
  license: ''
36
- charging:
37
- price: 0
38
- tokens: []
39
- shares: []
36
+ payment:
37
+ price: []
38
+ share: []
40
39
  timeout:
41
40
  start: 60
42
41
  requirements:
@@ -32,10 +32,9 @@ community: ''
32
32
  documentation: ''
33
33
  homepage: ''
34
34
  license: ''
35
- charging:
36
- price: 0
37
- tokens: []
38
- shares: []
35
+ payment:
36
+ price: []
37
+ share: []
39
38
  timeout:
40
39
  start: 60
41
40
  requirements:
@@ -32,10 +32,9 @@ community: ''
32
32
  documentation: ''
33
33
  homepage: ''
34
34
  license: ''
35
- charging:
36
- price: 0
37
- tokens: []
38
- shares: []
35
+ payment:
36
+ price: []
37
+ share: []
39
38
  timeout:
40
39
  start: 60
41
40
  requirements:
@@ -32,10 +32,9 @@ community: ''
32
32
  documentation: ''
33
33
  homepage: ''
34
34
  license: ''
35
- charging:
36
- price: 0
37
- tokens: []
38
- shares: []
35
+ payment:
36
+ price: []
37
+ share: []
39
38
  timeout:
40
39
  start: 60
41
40
  requirements: