@hkamran/utility-assets 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +7 -5
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export function minifyJSON(
4
4
  excludeSchemas?: string,
5
5
  ): Promise<void>;
6
6
  export function minifyCSS(basePath: string, outputDir: string): Promise<void>;
7
+ export const ignoredFilenameContents: string[];
8
+ export const ignoredFileExtensions: string[];
7
9
  export function moveFiles(
8
10
  basePath: string,
9
11
  outputDir: string,
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { existsSync } from "fs";
1
2
  import {
2
3
  constants,
3
4
  copyFile,
@@ -109,6 +110,9 @@ const checkIgnoredEndings = (check, ignoredEndings) => {
109
110
  return false;
110
111
  };
111
112
 
113
+ export const ignoredFilenameContents = ["schema"];
114
+ export const ignoredFileExtensions = ["json", "css", "toml", "md"];
115
+
112
116
  /**
113
117
  * Move files
114
118
  * @param {string} basePath The base path to use
@@ -119,8 +123,8 @@ const checkIgnoredEndings = (check, ignoredEndings) => {
119
123
  export const moveFiles = async (
120
124
  basePath,
121
125
  outputDir,
122
- ignoredFilenameContents = ["schema"],
123
- ignoredFileExtensions = ["json", "css", "toml", "md"],
126
+ ignoredFilenameContents = ignoredFilenameContents,
127
+ ignoredFileExtensions = ignoredFileExtensions,
124
128
  ) => {
125
129
  (await readdir(basePath, { withFileTypes: true }))
126
130
  .filter((item) => item.isFile())
@@ -147,9 +151,7 @@ export const moveFiles = async (
147
151
  * @param {string} outputDir The output directory (optional)
148
152
  */
149
153
  export const moveFolder = async (basePath, outputDir) => {
150
- if (outputDir) {
151
- await mkdir(outputDir);
152
- }
154
+ if (outputDir && !existsSync(outputDir)) await mkdir(outputDir);
153
155
 
154
156
  (await readdir(basePath, { withFileTypes: true })).forEach(async (item) => {
155
157
  if (item.isFile()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkamran/utility-assets",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A quick way to set up an assets site",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",