New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

symply

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

symply - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

dist/entities/actions.js

6

dist/commands/generate.js

@@ -36,2 +36,3 @@ "use strict";

const Partials = __importStar(require("../entities/partials"));
const Actions = __importStar(require("../entities/actions"));
const filesystem = __importStar(require("../filesystem"));

@@ -45,2 +46,3 @@ const logger_1 = __importDefault(require("../logger"));

};
await Actions.runPreBuildAsync(configuration_1.default.getActions().preBuild);
const globals = Globals.load();

@@ -63,2 +65,4 @@ const partials = Partials.load();

stats.copiedFilesCount += copiedFilesCount;
logger_1.default.info(`Copied ${stats.copiedFilesCount} files to the distribution directory.`);
await Actions.runPostBuildAsync(configuration_1.default.getActions().postBuild);
return stats;

@@ -86,3 +90,3 @@ }

await Promise.all(copyPromises);
return sourceFilesGroups.length;
return copyPromises.length;
}

@@ -89,0 +93,0 @@ function compileSourceFilesAndCopyToDistributionDirectory(htmlTemplateSourceFiles, hbsTemplateSourceFiles, globals, stats) {

@@ -18,2 +18,3 @@ "use strict";

this.helpers = {};
this.actions = {};
/*-----------------------------------------------------------------------------

@@ -70,2 +71,3 @@ * System configuration (default values)

this.helpers = lodash_1.default.defaultTo((_c = config.entities) === null || _c === void 0 ? void 0 : _c.helpers, this.helpers);
this.actions = lodash_1.default.defaultTo(config.actions, this.actions);
this._debugOutput = lodash_1.default.defaultTo(config.debugOutput, this._debugOutput);

@@ -110,2 +112,5 @@ this._ignoreMissingProperties = lodash_1.default.defaultTo(config.ignoreMissingProperties, this.ignoreMissingProperties);

}
getActions() {
return this.actions;
}
/*-----------------------------------------------------------------------------

@@ -112,0 +117,0 @@ * Public path getters

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.joinAndResolvePath = exports.createFile = exports.createFileIfNotExists = exports.createDirectoryIfNotExists = exports.getFileContents = exports.clearDirectoryContents = exports.copyFileAsync = exports.createDirectoryAsync = exports.hasFileExtension = exports.scanFiles = exports.existsSync = void 0;
exports.joinAndResolvePath = exports.createFile = exports.createFileIfNotExists = exports.createDirectoryIfNotExists = exports.getFileContents = exports.clearDirectoryContents = exports.moveFile = exports.renameDirectory = exports.renameFile = exports.copyFilesToDirectoryAsync = exports.copyFileToDirectoryAsync = exports.copyFileAsync = exports.copyDirectory = exports.removeDirectory = exports.createDirectoryAsync = exports.hasFileExtension = exports.scanFiles = exports.existsSync = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));

@@ -45,6 +45,62 @@ const path_1 = __importDefault(require("path"));

exports.createDirectoryAsync = createDirectoryAsync;
async function copyFileAsync(filePath, destinationPath) {
return util_1.promisify(fs_extra_1.default.copyFile)(filePath, destinationPath);
function removeDirectory(dirPath) {
fs_extra_1.default.rmSync(dirPath, { force: true, recursive: true });
}
exports.removeDirectory = removeDirectory;
function copyDirectory(srcDirPath, destDirPath) {
fs_extra_1.default.copySync(srcDirPath, destDirPath);
}
exports.copyDirectory = copyDirectory;
async function copyFileAsync(filePath, destinationFilePath) {
return util_1.promisify(fs_extra_1.default.copyFile)(filePath, destinationFilePath);
}
exports.copyFileAsync = copyFileAsync;
async function copyFileToDirectoryAsync(filePath, destinationDirectoryPath) {
const fileName = path_1.default.basename(filePath);
return util_1.promisify(fs_extra_1.default.copyFile)(filePath, path_1.default.join(destinationDirectoryPath, fileName));
}
exports.copyFileToDirectoryAsync = copyFileToDirectoryAsync;
async function copyFilesToDirectoryAsync(srcDirPath, destDirPath, filterFunc = () => true) {
const entities = fs_extra_1.default.readdirSync(srcDirPath, { withFileTypes: true });
for (const entity of entities) {
if (entity.isFile()) {
if (filterFunc('FILE', entity.name, path_1.default.extname(entity.name).slice(1))) {
await copyFileAsync(path_1.default.join(srcDirPath, entity.name), path_1.default.join(destDirPath, entity.name));
}
}
else if (entity.isDirectory()) {
if (filterFunc('DIR', entity.name, '')) {
copyDirectory(path_1.default.join(srcDirPath, entity.name), path_1.default.join(destDirPath, entity.name));
}
}
else {
throw new Error(`File is not supported: ${entity.name}`);
}
}
}
exports.copyFilesToDirectoryAsync = copyFilesToDirectoryAsync;
function renameFile(filePath, newName) {
if (fs_extra_1.default.statSync(filePath).isFile()) {
fs_extra_1.default.renameSync(filePath, path_1.default.join(path_1.default.dirname(filePath), newName));
}
else {
throw new Error(`Trying to rename an invalid file: ${filePath}`);
}
}
exports.renameFile = renameFile;
function renameDirectory(dirPath, newName) {
if (fs_extra_1.default.statSync(dirPath).isDirectory()) {
fs_extra_1.default.renameSync(dirPath, path_1.default.join(path_1.default.dirname(dirPath), newName));
}
else {
throw new Error(`Trying to rename an invalid directory: ${dirPath}`);
}
}
exports.renameDirectory = renameDirectory;
/** Move file with creating directories if needed. */
function moveFile(filePath, newFilePath) {
fs_extra_1.default.ensureFileSync(newFilePath);
fs_extra_1.default.renameSync(filePath, newFilePath);
}
exports.moveFile = moveFile;
function scanFilesInDirectory(scanPath, basePath, readFileContents, scanNestedDirectories) {

@@ -51,0 +107,0 @@ let files = [];

2

package.json
{
"name": "symply",
"version": "0.4.1",
"version": "0.5.0",
"description": "A simple static site generator.",

@@ -5,0 +5,0 @@ "author": "Oleg Legun <oleg.legun@gmail.com>",

@@ -126,5 +126,8 @@ /* eslint-disable */

export type Action =
| CopyFilesAction
| CopyFileAction
| MoveFilesAction
| CopyFileToDirectoryAction
| CopyFilesToDirectoryAction
| MoveFileAction
| CopyDirectoryAction
| CopyDirectoryToDirectoryAction
| EmptyDirectoryAction

@@ -135,29 +138,52 @@ | RemoveDirectoryAction

export interface CopyFilesAction {
type: 'COPY_FILES'
fromDir: string
toDir: string
filter: (fileName: string, fileExtension: string) => boolean
}
export interface CopyFileAction {
type: 'COPY_FILE'
fromPath: string
toDir: string
fromFilePath: string | string[]
toFilePath: string | string[]
}
export interface MoveFilesAction {
type: 'MOVE_FILES'
from: string
to: string
export interface CopyFileToDirectoryAction {
type: 'COPY_FILE_TO_DIR'
fromFilePath: string | string[]
toDirPath: string | string[]
}
export type FileFilterFunc = (type: 'DIR' | 'FILE', name: string, extension: string) => boolean
export interface CopyFilesToDirectoryAction {
type: 'COPY_FILES_TO_DIR'
fromDirPath: string | string[]
toDirPath: string | string[]
/** @default () => true */
filterFunc?: FileFilterFunc
}
export interface MoveFileAction {
type: 'MOVE_FILE'
fromFilePath: string | string[]
/** Non-existent directories will be automatically created. */
toFilePath: string | string[]
}
export interface CopyDirectoryAction {
type: 'COPY_DIR'
fromDirPath: string | string[]
/** Must be the same final directory name as `fromDirPath` */
toDirPath: string | string[]
}
export interface CopyDirectoryToDirectoryAction {
type: 'COPY_DIR_TO_DIR'
fromDirPath: string | string[]
toParentDirPath: string | string[]
}
export interface EmptyDirectoryAction {
type: 'EMPTY_DIRECTORY'
path: string
type: 'EMPTY_DIR'
dirPath: string | string[]
}
export interface RemoveDirectoryAction {
type: 'REMOVE_DIRECTORY'
path: string
type: 'REMOVE_DIR'
dirPath: string | string[]
}

@@ -167,3 +193,3 @@

type: 'RENAME_FILE'
path: string
filePath: string | string[]
newName: string

@@ -173,4 +199,4 @@ }

export interface RenameDirectoryAction {
type: 'RENAME_DIRECTORY'
path: string
type: 'RENAME_DIR'
dirPath: string | string[]
newName: string

@@ -177,0 +203,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc