Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
hexo-generator-to-json
Advanced tools
Generate flatten, plain and reusable json data for state manage using.
Yeah.. This plugin has updated to 1.x
it based on the lib normalizr
, which is nearly-perfectly solve the problem of the multi-nested object when creating SPA and using some state manege lib such as Redux
, Vuex
and so on.
$ cd [your hexo blog folder]
$ npm install --save hexo-generator-to-json # or yarn add hexo-generator-to-json
the Hexo
will quickly scan the package.json
, and automatically run the generator that starts with hexo-
, when you run hexo generate
.
the .json
s will generated in the folder :root/public/api
const outputDir = {
public: {
api: {
config: [
'global.json', // _config.yml in hexo based dir
'theme.json' // _config.yml in theme based dir
],
posts: [
'index.json',
'entities.json',
{
exampleHashedKey1ForPost: [
'index.json', // basic information
'content.json' // other extracts fields
],
exampleHashedKey2ForPost: [
'index.json', // basic information
'content.json' // other extracts fields
],
// and so on...
}
],
pages: [
'index.json',
'entities.json',
{
exampleHashedKey1ForPage: [
'index.json', // basic information
'content.json' // other extracts fields
// and so on...
],
exampleHashedKey2ForPage: [
'index.json', // basic information
'content.json' // other extracts fields
// and so on...
],
// and so on...
}
],
tags: [
'entities.json',
'index.json'
],
categories: [
'entities.json',
'index.json'
]
}
}
};
export type selectors = (string|selector)[];
export interface selector {
path: string;
rename?: string;
childrenSelectors?: selectors
}
// toJson config in _config.yml
export interface rawToJsonConfig {
configs: boolean|{
global: selectors,
theme: selectors
};
posts: boolean|{
selectors: selectors,
extracts: string[]
};
pages: boolean|{
selectors: selectors,
extracts: string[]
};
tags: boolean|string[];
categories: boolean|string[];
enablePagination: boolean;
}
export interface toJsonConfig {
configs: {
global: selectors,
theme: selectors
};
posts: {
selectors: selectors,
extracts: string[]
};
pages: {
selectors: selectors,
extracts: string[]
};
tags: string[];
categories: string[];
enablePagination: boolean;
}
toJson:
enablePagination: ture # chunk the index.json array based on per_page in _config.yml
configs: false # donnot generate the global and theme config api.
pages:
selectors:
- title # string selector
- date
- updated
- comments
- excerpt
- more
- source
- permalink
- photos
- link
extracts: [content]
posts:
selectors:
- title
- date
- updated
- comments
- excerpt
- more
- source
- permalink
- photos
- link
- {path: tags, childrenSelectors: ['name', 'slug', 'permalink']} # object selector
- {path: categories, childrenSelectors: ['name', 'slug', 'permalink']}
extracts: [content]
tags: true # using default config
categories: true
FAQs
Generate flatten, plain and reusable json data for state manage using.
The npm package hexo-generator-to-json receives a total of 2 weekly downloads. As such, hexo-generator-to-json popularity was classified as not popular.
We found that hexo-generator-to-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.