Comparing version 1.5.0 to 1.5.1
@@ -8,2 +8,8 @@ # Change Log | ||
## [1.5.1] - 2023-10-21 | ||
### Fixed | ||
Replaced jest by testscript | ||
## [1.5.0] - 2023-09-16 | ||
@@ -10,0 +16,0 @@ |
@@ -1,6 +0,6 @@ | ||
import { SsgStep } from "./SsgStep"; | ||
import { SsgConfig } from "../Ssg"; | ||
import { SsgContext } from "../SsgContext"; | ||
import { SsgStep } from './SsgStep'; | ||
import { SsgConfig } from '../Ssg'; | ||
import { SsgContext } from '../SsgContext'; | ||
export type CopyStepResult = { | ||
filesCount: number; | ||
files: string[]; | ||
}; | ||
@@ -7,0 +7,0 @@ /** |
@@ -1,2 +0,3 @@ | ||
import { FileUtil } from "../util"; | ||
import { FileUtil } from '../util'; | ||
import * as process from 'process'; | ||
/** | ||
@@ -9,3 +10,3 @@ * Perform copies to out directory. | ||
this.config = config; | ||
this.name = "copy"; | ||
this.name = 'copy'; | ||
} | ||
@@ -16,12 +17,12 @@ async execute(context) { | ||
try { | ||
context.log("Copying to", dest, copies); | ||
const files = await FileUtil.ssgCopy(dest, ...copies); | ||
return { | ||
filesCount: files.length | ||
}; | ||
context.log('Copying to', dest, copies); | ||
const copiedFiles = await FileUtil.ssgCopy(dest, copies); | ||
const cwd = process.cwd(); | ||
const files = copiedFiles.map(file => file.startsWith(cwd) ? file.substring(cwd.length + 1) : file); | ||
return { files }; | ||
} | ||
catch (e) { | ||
throw Error(`Could not copy${copies} because of ${e}`); | ||
throw Error(`Could not copy ${copies} because of ${e}`); | ||
} | ||
} | ||
} |
/// <reference types="node" /> | ||
import { Options } from 'cpy'; | ||
export declare class FileUtil { | ||
@@ -9,4 +10,4 @@ static toBufferEncoding(encoding: string | undefined): BufferEncoding | undefined; | ||
static dirNames(dir: string): Promise<string[]>; | ||
static ssgCopy(to: string, ...from: string[]): Promise<string[]>; | ||
static ssgCopy(to: string, from: string[], options?: Options): Promise<string[]>; | ||
static getContentType(html: HTMLElement): BufferEncoding | undefined; | ||
} |
@@ -1,7 +0,7 @@ | ||
import * as fs from "fs"; | ||
import { promises as fsAsync } from "fs"; | ||
import detectCharacterEncoding from "detect-character-encoding"; | ||
import path from "path"; | ||
import { readdir } from "fs/promises"; | ||
import cpy from "cpy"; | ||
import * as fs from 'fs'; | ||
import { promises as fsAsync } from 'fs'; | ||
import detectCharacterEncoding from 'detect-character-encoding'; | ||
import path from 'path'; | ||
import { readdir } from 'fs/promises'; | ||
import cpy from 'cpy'; | ||
export class FileUtil { | ||
@@ -63,4 +63,4 @@ static toBufferEncoding(encoding) { | ||
} | ||
static async ssgCopy(to, ...from) { | ||
return cpy(from, to); | ||
static async ssgCopy(to, from, options) { | ||
return cpy(from, to, options); | ||
} | ||
@@ -67,0 +67,0 @@ static getContentType(html) { |
@@ -5,3 +5,3 @@ { | ||
"author": "Jérôme Beau <javarome@gmail.com> (https://javarome.com)", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Static Site Generation TypeScript API", | ||
@@ -23,3 +23,4 @@ "exports": "./dist/src/index.js", | ||
"prepublishOnly": "npm run build && npm test", | ||
"test": "rm -Rf out && NODE_OPTIONS=--experimental-vm-modules jest --runInBand", | ||
"test": "rm -Rf out && tsx src/test.ts", | ||
"test-one": "rm -Rf out && tsx src/step/DirectoryStepTest.ts", | ||
"test-ci": "rm -Rf out && NODE_OPTIONS=--experimental-vm-modules jest --coverage --runInBand" | ||
@@ -36,8 +37,6 @@ }, | ||
"@types/jsdom": "^21.1.3", | ||
"@types/jest": "^29.5.5", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.2.2", | ||
"uuid": "^9.0.1", | ||
"@babel/plugin-transform-modules-commonjs": "^7.22.15" | ||
"tsx": "3.14.0", | ||
"@javarome/testscript": "^0.4.1" | ||
}, | ||
@@ -44,0 +43,0 @@ "keywords": [ |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances 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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
113158
6
145
2391
6