-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add copyFile and fix copyFiles
- Loading branch information
1 parent
6a64b4b
commit 88c4726
Showing
27 changed files
with
780 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ node_modules | |
.yalc | ||
dist | ||
src/fs/tmp.art | ||
/examples/copyFiles/target | ||
/examples/copyFiles/targetDirs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { copyDirs } from "../../src/fs/copyDirs"; | ||
import path from "node:path"; | ||
|
||
import { copyFiles } from "../../src/fs/copyFiles"; | ||
|
||
async function copydemo(){ | ||
// await copyDirs("sourceDirs", "targetDirs",{ | ||
// cwd: path.join(__dirname,"source"), | ||
// overwrite:true, | ||
// vars: { | ||
// scopeId: "app", | ||
// languages:[ | ||
// { name:"zh-CN",title:"中文", nativeTitle:"中文" }, | ||
// { name:"en-US",title:"English", nativeTitle:"English" }, | ||
// { name:"ja-JP",title:"日本語", nativeTitle:"日本語" } | ||
// ], | ||
// library:false, | ||
// activeLanguage:"zh-CN", | ||
// defaultLanguage:"zh-CN" | ||
// } | ||
// }) | ||
|
||
await copyFiles("**/*", "targetDirs/x",{ | ||
cwd: path.join(__dirname,"sourceDirs"), | ||
overwrite:true, | ||
vars: { | ||
scopeId: "app", | ||
languages:[ | ||
{ name:"zh-CN",title:"中文", nativeTitle:"中文" }, | ||
{ name:"en-US",title:"English", nativeTitle:"English" }, | ||
{ name:"ja-JP",title:"日本語", nativeTitle:"日本語" } | ||
], | ||
library:false, | ||
activeLanguage:"zh-CN", | ||
defaultLanguage:"zh-CN" | ||
} | ||
}) | ||
} | ||
|
||
|
||
copydemo().then(()=>{ | ||
console.log("copyFiles done") | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { copyFiles } from "../../src/fs/copyFiles"; | ||
import path from "node:path"; | ||
|
||
|
||
async function copydemo(){ | ||
await copyFiles("*.*", "target",{ | ||
cwd: path.join(__dirname,"source"), | ||
overwrite:true, | ||
vars: { | ||
scopeId: "app", | ||
languages:[ | ||
{ name:"zh-CN",title:"中文", nativeTitle:"中文" }, | ||
{ name:"en-US",title:"English", nativeTitle:"English" }, | ||
{ name:"ja-JP",title:"日本語", nativeTitle:"日本語" } | ||
], | ||
library:false, | ||
activeLanguage:"zh-CN", | ||
defaultLanguage:"zh-CN" | ||
} | ||
}) | ||
} | ||
|
||
|
||
copydemo().then(()=>{ | ||
console.log("copyFiles done") | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "copy", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.ts", | ||
"scripts": { | ||
"dev:files": "tsx copyFiles.ts", | ||
"dev:dirs": "tsx copyDirs.ts" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"tsx": "^4.19.2" | ||
} | ||
} |
Oops, something went wrong.