Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70ce3f4

Browse files
committed
fix create ts
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent12fb052 commit70ce3f4

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

‎src/cli.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
importargfrom"arg";
21
import*asinquirerfrom"inquirer";
32
importsimpleGitfrom"simple-git/promise";
43
import*asfsfrom"fs";
54
import*asTfrom"../typings/tutorial";
65
importbuild,{BuildOptions}from"./build";
76
importcreatefrom"./create";
87

8+
// import not working
9+
constarg=require("arg");
10+
911
typeQ=inquirer.Question<any>&{choices?:string[]};
1012

1113
typeParsedArgs={
@@ -49,18 +51,21 @@ function parseArgumentsIntoOptions(rawArgs: string[]): ParsedArgs {
4951
argv:rawArgs.slice(2),
5052
}
5153
);
54+
console.log(args);
5255
return{
5356
command:args["_"][0],
5457
git:args["--git"],
5558
dir:args["--dir"],
5659
codeBranch:args["--code"],
5760
setupBranch:args["--setup"],
58-
output:args["--output"],
61+
output:args["--output"]||"./config.json",
5962
help:args["--help"]||false,
6063
};
6164
}
6265

63-
asyncfunctionpromptForMissingOptions(options:ParsedArgs):Promise<Options>{
66+
exportasyncfunctionpromptForMissingOptions(
67+
options:ParsedArgs
68+
):Promise<Options>{
6469
constquestions:Q[]=[];
6570

6671
// if no git remote addres is provided, assume current folder
@@ -147,7 +152,7 @@ async function promptForMissingOptions(options: ParsedArgs): Promise<Options> {
147152
};
148153
}
149154

150-
exportasyncfunctioncli(args:string[]){
155+
exportasyncfunctioncli(args:string[]):Promise<void>{
151156
letparsedArgs:ParsedArgs=parseArgumentsIntoOptions(args);
152157

153158
// If help called just print the help text and exit
@@ -174,11 +179,12 @@ export async function cli(args: string[]) {
174179
console.log(JSON.stringify(tutorial,null,2));
175180
}
176181
}
177-
return;
182+
break;
178183

179184
case"create":
185+
console.log("here");
180186
create(process.cwd());
181-
return;
187+
break;
182188
}
183189
}
184190
}

‎src/create.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
import*asncpfrom"ncp";
22
import*aspathfrom"path";
33
import{promisify}from"util";
4-
import*asosfrom"os";
54

65
constcopy=promisify(ncp);
76

8-
constcopyFiles=async(filePath:string)=>{
7+
constcopyFiles=async(filePath:string):Promise<void>=>{
98
try{
10-
letfilePath=newURL(import.meta.url).pathname;
11-
12-
if(os.platform()==="win32"){
13-
// removes the leading drive letter from the path
14-
filePath=filePath.substr(3);
15-
}
16-
17-
consttemplateDirectory=path.resolve(filePath,"..","templates");
18-
9+
constpathToSrc=path.join(__dirname,"..","src");
10+
consttemplateDirectory=path.resolve(pathToSrc,"templates");
1911
consttargetDirectory=process.cwd();
2012

2113
awaitcopy(templateDirectory,targetDirectory,{

‎tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"module":"esnext",
3+
"module":"commonjs",
44
"target":"es2018",
55
"outDir":"build",
66
"lib": ["es2018","dom"],
@@ -22,5 +22,5 @@
2222
"removeComments":true,
2323
"skipLibCheck":true
2424
},
25-
"exclude": ["node_modules",".vscode","bin","build","test"]
25+
"exclude": [".vscode","bin","build","test"]
2626
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp