@mysten/create-dapp 0.0.0-experimental-20231012193859 → 0.0.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mysten/create-dapp
2
2
 
3
- ## 0.0.0-experimental-20231012193859
3
+ ## 0.0.1
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -10,5 +10,5 @@
10
10
  - Updated dependencies [11cf4e68b]
11
11
  - Updated dependencies [0c5cdc049]
12
12
  - Updated dependencies [c7e12c928]
13
- - @mysten/dapp-kit@0.0.0-experimental-20231012193859
14
- - @mysten/sui.js@0.0.0-experimental-20231012193859
13
+ - @mysten/dapp-kit@0.3.0
14
+ - @mysten/sui.js@0.44.0
package/dist/index.js CHANGED
@@ -7,13 +7,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const fs_1 = require("fs");
8
8
  const promises_1 = require("fs/promises");
9
9
  const path_1 = require("path");
10
+ const util_1 = require("util");
10
11
  const enquirer_1 = require("enquirer");
12
+ const { values: args } = (0, util_1.parseArgs)({
13
+ options: {
14
+ template: {
15
+ type: 'string',
16
+ default: '',
17
+ short: 't',
18
+ },
19
+ },
20
+ });
11
21
  async function main() {
12
22
  const results = await (0, enquirer_1.prompt)([
13
23
  {
14
24
  type: 'select',
15
25
  name: 'template',
16
- message: 'Which started template would you like to use?',
26
+ message: 'Which starter template would you like to use?',
17
27
  choices: [
18
28
  {
19
29
  name: 'react-client-dapp',
@@ -31,12 +41,12 @@ async function main() {
31
41
  message: 'What is the name of your dApp? (this will be used as the directory name)',
32
42
  initial: 'my-first-sui-dapp',
33
43
  },
34
- ]);
44
+ ].filter((question) => !args[question.name]));
35
45
  const outDir = (0, path_1.resolve)(process.cwd(), results.dAppName);
36
46
  if ((0, fs_1.existsSync)(outDir)) {
37
47
  throw new Error(`Directory ${outDir} already exists`);
38
48
  }
39
- const files = await collectFiles(results.template, results.dAppName);
49
+ const files = await collectFiles(results.template ?? args.template, results.dAppName);
40
50
  await writeFiles(files, outDir);
41
51
  }
42
52
  main();
@@ -45,7 +55,7 @@ async function collectFiles(template, dAppName) {
45
55
  const templateDir = (0, path_1.resolve)(__dirname, '../templates', template);
46
56
  const files = new Array();
47
57
  if (!(0, fs_1.statSync)(templateDir).isDirectory()) {
48
- throw new Error(`Template directory ${templateDir} could not be found`);
58
+ throw new Error(`Template ${templateDir} could not be found`);
49
59
  }
50
60
  await addDir(templateDir);
51
61
  return files;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,sCAAsC;AACtC,iDAAiD;AACjD,0CAA0C;;AAE1C,2BAA0C;AAC1C,0CAAkE;AAClE,+BAAyC;AACzC,uCAAkC;AAElC,KAAK,UAAU,IAAI;IAClB,MAAM,OAAO,GAAG,MAAM,IAAA,iBAAM,EAGzB;QACF;YACC,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,+CAA+C;YACxD,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,mBAAmB;oBACzB,IAAI,EAAE,kEAAkE;iBACxE;gBACD;oBACC,IAAI,EAAE,mBAAmB;oBACzB,IAAI,EAAE,6EAA6E;iBACnF;aACD;SACD;QACD;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,0EAA0E;YACnF,OAAO,EAAE,mBAAmB;SAC5B;KACD,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAExD,IAAI,IAAA,eAAU,EAAC,MAAM,CAAC,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,aAAa,MAAM,iBAAiB,CAAC,CAAC;KACtD;IAED,MAAM,KAAK,GAAG,MAAM,YA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AAK,UAAU,qBAAqB;IACnC,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,mBAAQ,EAAC,WAAW,EAAE,OAAO,CAAC,CAE9D,CAAC;IAEF,OAAO;QACN,kBAAkB,EAAE,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC;QAC5D,gBAAgB,EAAE,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC;KAC1D,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "A CLI for creating new Sui dApps",
5
5
  "homepage": "https://sui-typescript-docs.vercel.app",
6
- "version": "0.0.0-experimental-20231012193859",
6
+ "version": "0.0.1",
7
7
  "license": "Apache-2.0",
8
8
  "files": [
9
9
  "CHANGELOG.md",
@@ -31,8 +31,8 @@
31
31
  "dependencies": {
32
32
  "@types/node": "^20.4.2",
33
33
  "enquirer": "^2.4.1",
34
- "@mysten/dapp-kit": "0.0.0-experimental-20231012193859",
35
- "@mysten/sui.js": "0.0.0-experimental-20231012193859"
34
+ "@mysten/dapp-kit": "0.3.0",
35
+ "@mysten/sui.js": "0.44.0"
36
36
  },
37
37
  "sideEffects": false,
38
38
  "bin": "./bin/index.js",
package/src/index.ts CHANGED
@@ -6,35 +6,49 @@
6
6
  import { existsSync, statSync } from 'fs';
7
7
  import { mkdir, readdir, readFile, writeFile } from 'fs/promises';
8
8
  import { relative, resolve } from 'path';
9
+ import { parseArgs } from 'util';
9
10
  import { prompt } from 'enquirer';
10
11
 
12
+ const { values: args } = parseArgs({
13
+ options: {
14
+ template: {
15
+ type: 'string',
16
+ default: '',
17
+ short: 't',
18
+ },
19
+ },
20
+ });
21
+
11
22
  async function main() {
12
23
  const results = await prompt<{
13
24
  template: string;
14
25
  dAppName: string;
15
- }>([
16
- {
17
- type: 'select',
18
- name: 'template',
19
- message: 'Which started template would you like to use?',
20
- choices: [
21
- {
22
- name: 'react-client-dapp',
23
- hint: 'React Client dApp that reads data from wallet and the blockchain',
24
- },
25
- {
26
- name: 'react-e2e-counter',
27
- hint: 'React dApp with a move smart contract that implements a distributed counter',
28
- },
29
- ],
30
- },
31
- {
32
- type: 'input',
33
- name: 'dAppName',
34
- message: 'What is the name of your dApp? (this will be used as the directory name)',
35
- initial: 'my-first-sui-dapp',
36
- },
37
- ]);
26
+ }>(
27
+ [
28
+ {
29
+ type: 'select',
30
+ name: 'template',
31
+ message: 'Which starter template would you like to use?',
32
+ choices: [
33
+ {
34
+ name: 'react-client-dapp',
35
+ hint: 'React Client dApp that reads data from wallet and the blockchain',
36
+ },
37
+ {
38
+ name: 'react-e2e-counter',
39
+ hint: 'React dApp with a move smart contract that implements a distributed counter',
40
+ },
41
+ ],
42
+ },
43
+ {
44
+ type: 'input',
45
+
46
+ name: 'dAppName',
47
+ message: 'What is the name of your dApp? (this will be used as the directory name)',
48
+ initial: 'my-first-sui-dapp',
49
+ },
50
+ ].filter((question) => !args[question.name as 'template']),
51
+ );
38
52
 
39
53
  const outDir = resolve(process.cwd(), results.dAppName);
40
54
 
@@ -42,7 +56,7 @@ async function main() {
42
56
  throw new Error(`Directory ${outDir} already exists`);
43
57
  }
44
58
 
45
- const files = await collectFiles(results.template, results.dAppName);
59
+ const files = await collectFiles(results.template ?? args.template, results.dAppName);
46
60
  await writeFiles(files, outDir);
47
61
  }
48
62
 
@@ -57,7 +71,7 @@ async function collectFiles(template: string, dAppName: string) {
57
71
  }>();
58
72
 
59
73
  if (!statSync(templateDir).isDirectory()) {
60
- throw new Error(`Template directory ${templateDir} could not be found`);
74
+ throw new Error(`Template ${templateDir} could not be found`);
61
75
  }
62
76
 
63
77
  await addDir(templateDir);