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

@frontity/file-settings

Package Overview
Dependencies
Maintainers
5
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontity/file-settings - npm Package Compare versions

Comparing version 0.1.1 to 0.2.1

13

CHANGELOG.md

@@ -6,3 +6,3 @@ # Change Log

## [0.1.1](https://github.com/frontity/frontity/compare/@frontity/file-settings@0.1.0...@frontity/file-settings@0.1.1) (2019-04-16)
## [0.2.1](https://github.com/frontity/frontity/compare/@frontity/file-settings@0.2.0...@frontity/file-settings@0.2.1) (2019-05-15)

@@ -15,2 +15,13 @@ **Note:** Version bump only for package @frontity/file-settings

# [0.2.0](https://github.com/frontity/frontity/compare/@frontity/file-settings@0.1.0...@frontity/file-settings@0.2.0) (2019-05-15)
### Features
* **frontity:** use the frontity package as interface for the core packages ([#48](https://github.com/frontity/frontity/issues/48)) ([429e795](https://github.com/frontity/frontity/commit/429e795))
# 0.1.0 (2019-03-27)

@@ -17,0 +28,0 @@

8

dist/getAllSites.d.ts

@@ -1,7 +0,3 @@

declare type Sites = {
name: string;
mode: string;
packages: string[];
};
declare const _default: () => Promise<Sites[]>;
import { Site } from "./types";
declare const _default: () => Promise<Site[]>;
export default _default;

@@ -14,4 +14,4 @@ "use strict";

mode,
packages: packages.map(pkg => pkg.name)
packages: packages.filter(pkg => pkg.active).map(pkg => pkg.name)
}));
};
import { NormalizedSettings } from "./types";
declare const _default: ({ name, url }: {
declare type Props = {
name: string;
url: string;
} | {
name: string;
url?: string;
} | {
name?: string;
url: string;
}) => Promise<NormalizedSettings<import("./types").Package>>;
};
declare const _default: ({ name, url }: Props) => Promise<NormalizedSettings<import("./types").NormalizedPackage>>;
export default _default;

@@ -26,8 +26,8 @@ "use strict";

}
// 3. Return settings when `matches` match the param `url`.
// 3. Return settings when `match` match the param `url`.
const validMatch = allSettings
// Get all matches in one array.
// Get all match in one array.
.reduce((final, current) => {
if (current.matches)
final = final.concat(current.matches);
if (current.match)
final = final.concat(current.match);
return final;

@@ -41,6 +41,6 @@ }, [])

if (validMatch)
return allSettings.find(settings => settings.matches && settings.matches.includes(validMatch));
return allSettings.find(settings => settings.match && settings.match.includes(validMatch));
// 4. Return the first settings without a match defined or,
// if all of them have matches, the first settings in the array.
return allSettings.filter(settings => !settings.matches)[0] || allSettings[0];
// if all of them have match, the first settings in the array.
return allSettings.filter(settings => !settings.match)[0] || allSettings[0];
};
import { NormalizedSettings } from "./types";
declare const _default: () => Promise<NormalizedSettings<import("./types").Package>[]>;
declare const _default: () => Promise<NormalizedSettings<import("./types").NormalizedPackage>[]>;
export default _default;

@@ -1,3 +0,4 @@

import { Settings, NormalizedSettings } from "./types";
declare function normalizeSettings(settings: Settings): NormalizedSettings[];
import { NormalizedSettings } from "./types";
import Settings from "@frontity/types/src/settings";
declare const normalizeSettings: (settings: Settings<import("@frontity/types").Package>) => NormalizedSettings<import("./types").NormalizedPackage>[];
export default normalizeSettings;

@@ -20,18 +20,16 @@ "use strict";

mode: "html",
settings: {
timezone: 0,
language: "en"
}
state: {}
};
const defaultPackage = {
active: true
active: true,
state: {}
};
// This function merges the imported settings with
// the default settings.
function mergeSettings(_a) {
// This function merges the imported settings with the default settings.
const mergeSettings = (_a) => {
var { packages } = _a, settings = __rest(_a, ["packages"]);
return mergeDeepRight_1.default(Object.assign({}, defaultSettings, { packages: packages.map(pkg => mergeDeepRight_1.default(defaultPackage, typeof pkg === "string" ? { name: pkg } : pkg)) }), settings);
}
return (Object.assign({}, mergeDeepRight_1.default(defaultSettings, settings), { packages: packages.map(pkg => typeof pkg === "string"
? Object.assign({}, defaultPackage, { name: pkg }) : Object.assign({}, defaultPackage, pkg)) }));
};
// This function normalizes the imported settings.
function normalizeSettings(settings) {
const normalizeSettings = (settings) => {
// TODO

@@ -47,3 +45,3 @@ // Default settings and validator from packages

return settings.map(s => mergeSettings(s));
}
};
exports.default = normalizeSettings;
declare type Base = {
matches?: string[];
match?: string[];
mode?: string;
settings?: {
url?: string;
title?: string;
timezone?: number;
language?: string;
};
state?: object;
};

@@ -14,5 +9,8 @@ export declare type Package = {

active?: boolean;
namespaces?: string[];
settings?: object;
state?: object;
};
export declare type NormalizedPackage = Package & {
active: boolean;
state: object;
};
declare type Mono = Base & {

@@ -29,6 +27,3 @@ name?: string;

mode: string;
settings: {
timezone: number;
language: string;
};
state: object;
packages: T[];

@@ -38,4 +33,9 @@ };

export declare type MultiSettings<T = Package> = Imported<T> & Multi;
export declare type NormalizedSettings<T = Package> = Normalized<T> & Multi;
export declare type Settings<T = Package> = MonoSettings<T> | MultiSettings<T>[];
export declare type NormalizedSettings<T = NormalizedPackage> = Normalized<T> & Multi;
export declare type Site = {
name: string;
mode: string;
packages: string[];
};
export {};

@@ -1,3 +0,3 @@

import { Settings, Package } from "./types";
declare const _default: (settings: Settings<Package>) => void;
import { Settings } from "@frontity/types";
declare const _default: (settings: Settings<import("@frontity/types").Package>) => void;
export default _default;
{
"name": "@frontity/file-settings",
"version": "0.1.1",
"version": "0.2.1",
"description": "file settings package",

@@ -13,3 +13,3 @@ "author": "Eduardo Campaña <asrielo@gmail.com>",

"type": "git",
"url": "git+https://github.com/frontity/frontity.git"
"url": "https://github.com/frontity/frontity.git"
},

@@ -22,3 +22,3 @@ "publishConfig": {

"test": "jest --watch",
"test:inspect": "node --inspect ./node_modules/jest/bin/jest.js --watch --no-cache --runInBand",
"test:inspect": "node --inspect ./node_modules/.bin/jest --watch --no-cache --runInBand",
"dev": "ts-node src/index.ts",

@@ -35,10 +35,11 @@ "build": "tsc --project ./tsconfig.build.json",

"devDependencies": {
"@frontity/types": "^0.1.1",
"@types/jest": "^24.0.11",
"@types/ramda": "^0.26.3",
"jest": "^24.3.1",
"ts-jest": "^24.0.0",
"@types/ramda": "^0.26.6",
"jest": "^24.7.1",
"ts-jest": "^24.0.2",
"ts-node": "^8.0.3",
"typescript": "^3.3.3333"
"typescript": "^3.4.2"
},
"gitHead": "a157be3ac862faca1803042454e7d46be86a74e9"
"gitHead": "eeaa52b7f20aa9b179e9730e16e17e498a93f9d7"
}
# File Settings
This package is used to import the Frontity settings from a local file.
### _This is an internal package used by @frontity/core._
## Usage
This package is used to import the Frontity settings from a local file.
You can install it with `npm`:

@@ -85,10 +87,5 @@

name?: string;
matches?: string[];
match?: string[];
mode?: string; // Default: "html"
settings?: {
url?: string;
title?: string;
timezone?: number; // Default: 0
language?: string; // Default; "en"
},
state?: object,
packages: [

@@ -99,4 +96,3 @@ string,

active?: boolean; // Default: true
namespaces?: string[];
settings?: object;
state?: object;
}

@@ -113,13 +109,13 @@ ]

{
name: string; // This time the name is mandatory and must be unique.
matches?: string[];
name: string; // Here name is mandatory and must be unique.
match?: string[];
mode?: string; // Default: "html"
settings?: { ... },
state?: { ... },
packages: [ ... ]
},
{
name: string; // This time the name is mandatory and must be unique.
matches?: string[];
name: string; // Here name is mandatory and must be unique.
match?: string[];
mode?: string; // Default: "html"
settings?: { ... },
state?: { ... },
packages: [ ... ]

@@ -132,3 +128,3 @@ }

Some [TS types](src/types.ts) are exposed to be used in development. They can be accessed like this:
The `Settings` interface is exposed to be used in development. It can be accessed like this:

@@ -141,10 +137,4 @@ ```js

The following are probably the only types you will need during development:
### `Settings<T = Package>`
Types for the imported settings object from the settings file. You'll want to use them on your `frontity.settings.ts` file.
### `Package`
Types for each package within a settings object.
{
"extends": "./tsconfig.json",
"extends": "../../tsconfig.json",
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"]
"exclude": ["node_modules", "**/__tests__/*"],
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
"noEmit": false,
"allowJs": false,
"isolatedModules": false
}
}
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