Comparing version 0.2.6 to 0.3.0
{ | ||
"name": "auri", | ||
"version": "0.2.6", | ||
"version": "0.3.0", | ||
"description": "Organize package changes and releases", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,22 +28,29 @@ import fs from "fs"; | ||
}; | ||
const getGitignoreItemPaths = () => { | ||
const readdirRecursiveFileSync = (workingAbsolutePath = process.cwd()) => { | ||
const ignoreItemRelativePaths = [".git"]; | ||
if (fs.existsSync(path.resolve(".gitignore"))) { | ||
const file = fs.readFileSync(path.resolve(".gitignore")); | ||
const gitignoreFilePath = path.join(workingAbsolutePath, ".gitignore"); | ||
if (fs.existsSync(gitignoreFilePath)) { | ||
const file = fs.readFileSync(gitignoreFilePath); | ||
const fileText = file.toString(); | ||
ignoreItemRelativePaths.push(...fileText.split("\n")); | ||
ignoreItemRelativePaths.push(...fileText.split("\n").filter((val) => !!val && !val.startsWith("#"))); | ||
} | ||
return ignoreItemRelativePaths.map((relativePath) => path.resolve(relativePath)); | ||
}; | ||
const readdirRecursiveFileSync = (absolutePath = process.cwd()) => { | ||
const ignoreItemAbsolutePaths = getGitignoreItemPaths(); | ||
const relativeFilePaths = []; | ||
const dirItemNames = fs.readdirSync(absolutePath); | ||
const ignoreItemAbsolutePaths = ignoreItemRelativePaths | ||
.map((relativePath) => path.join(workingAbsolutePath, relativePath)) | ||
.map((filePath) => { | ||
if (!filePath.endsWith("/")) | ||
return filePath; | ||
return filePath.slice(0, -1); | ||
}) | ||
.filter((path) => path !== workingAbsolutePath); | ||
const absoluteFilePaths = []; | ||
const dirItemNames = fs.readdirSync(workingAbsolutePath); | ||
for (const itemName of dirItemNames) { | ||
const absoluteItemPath = path.resolve(absolutePath, itemName); | ||
const relativeItemPath = path.relative(process.cwd(), absoluteItemPath); | ||
const stat = fs.lstatSync(path.resolve(relativeItemPath)); | ||
if (stat.isFile()) { | ||
relativeFilePaths.push(relativeItemPath); | ||
const absoluteItemPath = path.join(workingAbsolutePath, itemName); | ||
const stat = fs.lstatSync(absoluteItemPath); | ||
if (stat.isFile() && !ignoreItemAbsolutePaths.includes(absoluteItemPath)) { | ||
absoluteFilePaths.push(absoluteItemPath); | ||
continue; | ||
} | ||
if (stat.isFile()) | ||
continue; | ||
const isDir = stat.isDirectory(); | ||
@@ -54,6 +61,6 @@ const ignoreDir = isDir && | ||
const nestedItemPaths = readdirRecursiveFileSync(absoluteItemPath); | ||
relativeFilePaths.push(...nestedItemPaths); | ||
absoluteFilePaths.push(...nestedItemPaths); | ||
} | ||
} | ||
return relativeFilePaths; | ||
return absoluteFilePaths; | ||
}; | ||
@@ -60,0 +67,0 @@ export const getPackage = async (packageName) => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3732588
81179