mirror of
https://github.com/lowdefy/lowdefy.git
synced 2024-12-03 05:30:13 +08:00
fix: Rename copyDirectory util to copyFileOrDirectory.
This commit is contained in:
parent
6c5e35f68d
commit
b7d38844c8
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,6 +25,7 @@ packages/plugins/connections/connection-mongodb/*.lock
|
||||
|
||||
packages/utils/node-utils/test/writeFile/writeFile.txt
|
||||
packages/utils/node-utils/test/copyDirectory/**
|
||||
packages/utils/node-utils/test/copyFile/**
|
||||
|
||||
app/**
|
||||
packages/server-dev/plugins/**
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
import fsExtra from 'fs-extra';
|
||||
|
||||
async function copyDirectory(dirPathFrom, dirPathTo, options) {
|
||||
async function copyFileOrDirectory(dirPathFrom, dirPathTo, options) {
|
||||
await fsExtra.copy(dirPathFrom, dirPathTo, options);
|
||||
}
|
||||
|
||||
export default copyDirectory;
|
||||
export default copyFileOrDirectory;
|
@ -16,11 +16,11 @@
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import copyDirectory from './copyDirectory.js';
|
||||
import copyFileOrDirectory from './copyFileOrDirectory.js';
|
||||
|
||||
test('copyDirectory', async () => {
|
||||
const dirPathFrom = path.resolve(process.cwd(), 'test/copyDirectory/From/');
|
||||
const dirPathTo = path.resolve(process.cwd(), 'test/copyDirectory/To/');
|
||||
test('copy directory', async () => {
|
||||
const dirPathFrom = path.resolve(process.cwd(), 'test/copyDirectory/from/');
|
||||
const dirPathTo = path.resolve(process.cwd(), 'test/copyDirectory/to/');
|
||||
const filePathFrom = path.resolve(dirPathFrom, 'copyDirectory.txt');
|
||||
const filePathTo = path.resolve(dirPathTo, 'copyDirectory.txt');
|
||||
|
||||
@ -29,6 +29,21 @@ test('copyDirectory', async () => {
|
||||
});
|
||||
fs.writeFileSync(filePathFrom, 'copyDirectory');
|
||||
|
||||
await copyDirectory(dirPathFrom, dirPathTo);
|
||||
await copyFileOrDirectory(dirPathFrom, dirPathTo);
|
||||
expect(fs.existsSync(filePathTo)).toBe(true);
|
||||
});
|
||||
|
||||
test('copy file', async () => {
|
||||
const dirPathFrom = path.resolve(process.cwd(), 'test/copyFile/from/');
|
||||
const dirPathTo = path.resolve(process.cwd(), 'test/copyFile/to/');
|
||||
const filePathFrom = path.resolve(dirPathFrom, 'copyFile.txt');
|
||||
const filePathTo = path.resolve(dirPathTo, 'copyFile.txt');
|
||||
|
||||
fs.mkdirSync(dirPathFrom, {
|
||||
recursive: true,
|
||||
});
|
||||
fs.writeFileSync(filePathFrom, 'copyFile');
|
||||
|
||||
await copyFileOrDirectory(filePathFrom, filePathTo);
|
||||
expect(fs.existsSync(filePathTo)).toBe(true);
|
||||
});
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import cleanDirectory from './cleanDirectory.js';
|
||||
import copyDirectory from './copyDirectory.js';
|
||||
import copyFileOrDirectory from './copyFileOrDirectory.js';
|
||||
import getConfigFromEnv from './getConfigFromEnv.js';
|
||||
import getFileExtension, { getFileSubExtension } from './getFileExtension.js';
|
||||
import getSecretsFromEnv from './getSecretsFromEnv.js';
|
||||
@ -25,7 +25,7 @@ import writeFile from './writeFile.js';
|
||||
|
||||
export {
|
||||
cleanDirectory,
|
||||
copyDirectory,
|
||||
copyFileOrDirectory,
|
||||
getConfigFromEnv,
|
||||
getFileExtension,
|
||||
getFileSubExtension,
|
||||
|
Loading…
Reference in New Issue
Block a user