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

Convert/typescript#3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 5 commits intomasterfromconvert/typescript
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
fix create ts
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedMay 30, 2020
commit70ce3f4cc571b2f51d5909f9bb336fe487b2ebc2
18 changes: 12 additions & 6 deletionssrc/cli.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
import arg from "arg";
import * as inquirer from "inquirer";
import simpleGit from "simple-git/promise";
import * as fs from "fs";
import * as T from "../typings/tutorial";
import build, { BuildOptions } from "./build";
import create from "./create";

// import not working
const arg = require("arg");

type Q = inquirer.Question<any> & { choices?: string[] };

type ParsedArgs = {
Expand DownExpand Up@@ -49,18 +51,21 @@ function parseArgumentsIntoOptions(rawArgs: string[]): ParsedArgs {
argv: rawArgs.slice(2),
}
);
console.log(args);
return {
command: args["_"][0],
git: args["--git"],
dir: args["--dir"],
codeBranch: args["--code"],
setupBranch: args["--setup"],
output: args["--output"],
output: args["--output"] || "./config.json",
help: args["--help"] || false,
};
}

async function promptForMissingOptions(options: ParsedArgs): Promise<Options> {
export async function promptForMissingOptions(
options: ParsedArgs
): Promise<Options> {
const questions: Q[] = [];

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

export async function cli(args: string[]) {
export async function cli(args: string[]): Promise<void> {
let parsedArgs: ParsedArgs = parseArgumentsIntoOptions(args);

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

case "create":
console.log("here");
create(process.cwd());
return;
break;
}
}
}
14 changes: 3 additions & 11 deletionssrc/create.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
import * as ncp from "ncp";
import * as path from "path";
import { promisify } from "util";
import * as os from "os";

const copy = promisify(ncp);

const copyFiles = async (filePath: string) => {
const copyFiles = async (filePath: string): Promise<void> => {
try {
let filePath = new URL(import.meta.url).pathname;

if (os.platform() === "win32") {
// removes the leading drive letter from the path
filePath = filePath.substr(3);
}

const templateDirectory = path.resolve(filePath, "..", "templates");

const pathToSrc = path.join(__dirname, "..", "src");
const templateDirectory = path.resolve(pathToSrc, "templates");
const targetDirectory = process.cwd();

await copy(templateDirectory, targetDirectory, {
Expand Down
4 changes: 2 additions & 2 deletionstsconfig.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "esnext",
"module": "commonjs",
"target": "es2018",
"outDir": "build",
"lib": ["es2018", "dom"],
Expand All@@ -22,5 +22,5 @@
"removeComments": true,
"skipLibCheck": true
},
"exclude": ["node_modules", ".vscode", "bin", "build", "test"]
"exclude": [".vscode", "bin", "build", "test"]
}

[8]ページ先頭

©2009-2025 Movatter.jp