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

Commit40a57fb

Browse files
committed
switch to fs-extra in validate
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent5b1a6dd commit40a57fb

File tree

3 files changed

+52
-16
lines changed

3 files changed

+52
-16
lines changed

‎package-lock.json

Lines changed: 41 additions & 3 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"dependencies": {
5050
"ajv":"^6.12.2",
5151
"esm":"^3.2.25",
52+
"fs-extra":"^9.0.1",
5253
"js-yaml":"^3.14.0",
5354
"kleur":"^3.0.3",
5455
"lodash":"^4.17.15",
@@ -58,6 +59,7 @@
5859
"devDependencies": {
5960
"@babel/preset-typescript":"^7.10.1",
6061
"@types/ajv":"^1.0.0",
62+
"@types/fs-extra":"^9.0.1",
6163
"@types/inquirer":"^6.5.0",
6264
"@types/jest":"^25.2.3",
6365
"@types/js-yaml":"^3.12.4",

‎src/validate.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
import*aspathfrom"path";
2-
import*asfsfrom"fs";
3-
importutilfrom"util";
2+
import*asfsfrom"fs-extra";
43
import*asyamlParserfrom"js-yaml";
54
import{getArg}from"./utils/args";
65
importgitP,{SimpleGit}from"simple-git/promise";
76
import{getCommits,CommitLogObject}from"./utils/commits";
8-
importsimplegitfrom"simple-git/promise";
9-
10-
constmkdir=util.promisify(fs.mkdir);
11-
constexists=util.promisify(fs.exists);
12-
constrmdir=util.promisify(fs.rmdir);
13-
constread=util.promisify(fs.readFile);
147

158
asyncfunctionvalidate(args:string[]){
169
// dir - default .
@@ -22,7 +15,7 @@ async function validate(args: string[]) {
2215
yaml:getArg(args,{name:"yaml",alias:"y"})||"coderoad.yaml",
2316
};
2417

25-
const_yaml=awaitread(path.join(localDir,options.yaml),"utf8");
18+
const_yaml=awaitfs.readFile(path.join(localDir,options.yaml),"utf8");
2619

2720
// parse yaml config
2821
letskeleton;
@@ -42,19 +35,22 @@ async function validate(args: string[]) {
4235
constcodeBranch:string=skeleton.config.repo.branch;
4336

4437
// validate commits
45-
constcommits=awaitgetCommits({ localDir, codeBranch});
38+
constcommits:CommitLogObject=awaitgetCommits({ localDir, codeBranch});
39+
console.log("commits",commits);
4640

4741
// setup tmp dir
4842
consttmpDir=path.join(localDir,".tmp");
4943

5044
try{
51-
if(!(awaitexists(tmpDir))){
52-
awaitmkdir(tmpDir);
45+
if(!(awaitfs.pathExists(tmpDir))){
46+
awaitfs.emptyDir(tmpDir);
5347
}
5448
consttempGit:SimpleGit=gitP(tmpDir);
5549
awaittempGit.init();
5650

5751
// VALIDATE TUTORIAL TESTS
52+
if(commits.INIT){
53+
}
5854

5955
// run test runner setup command(s)
6056
// loop over commits:
@@ -75,7 +71,7 @@ async function validate(args: string[]) {
7571
console.error(e.message);
7672
}finally{
7773
// cleanup
78-
awaitrmdir(tmpDir);
74+
awaitfs.emptyDir(tmpDir);
7975
}
8076
}
8177

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp