Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nitunity/api-compiler

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nitunity/api-compiler - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

modules/support/pagination.js

32

modules/engine/index.js

@@ -6,25 +6,25 @@ const nunjucks = require('nunjucks')

module.exports.home = async (config) => {
let template = await nunjucks.render(`${config.views}/home/index.njk`, {})
fs.writeFileSync(`${config.cache}/home/index.html`, template.toString())
module.exports.home = async (config, object, counter) => {
let template = await nunjucks.render(`${config.views}/home/index.njk`, object)
fs.writeFileSync(`${config.cache}/home/index-${counter}.html`, template.toString())
}
module.exports.categories = async (config) => {
let template = await nunjucks.render(`${config.views}/categories/index.njk`, {})
module.exports.categories = async (config, object) => {
let template = await nunjucks.render(`${config.views}/categories/index.njk`, object)
fs.writeFileSync(`${config.cache}/categories/index.html`, template.toString())
}
module.exports.categoryPosts = async (config) => {
let template = await nunjucks.render(`${config.views}/categories/`, {})
fs.writeFileSync(`${config.cache}/categories/`, template.toString())
module.exports.categoryPosts = async (config, object, slug, counter) => {
let template = await nunjucks.render(`${config.views}/categories/single.njk`, object)
fs.writeFileSync(`${config.cache}/categories/index-${slug}-${counter}`, template.toString())
}
module.exports.post = async (config) => {
let template = await nunjucks.render(`${config.views}/posts`, {})
fs.writeFileSync(`${config.cache}/posts/`, template.toString())
module.exports.post = async (config, object, slug) => {
let template = await nunjucks.render(`${config.views}/posts`, object)
fs.writeFileSync(`${config.cache}/posts/index-${slug}`, template.toString())
}
module.exports.tags = async (config) => {
let template = await nunjucks.render(`${config.views}/tags/index.njk`, {})
module.exports.tags = async (config, object) => {
let template = await nunjucks.render(`${config.views}/tags/index.njk`, object)
fs.writeFileSync(`${config.cache}/tags/index.html`, template.toString())
}
module.exports.tagPosts = async (config) => {
let template = await nunjucks.render(`${config.views}/tags/`, {})
fs.writeFileSync(`${config.cache}/tags`, template.toString())
module.exports.tagPosts = async (config, object, slug, counter) => {
let template = await nunjucks.render(`${config.views}/tags/single.njk`, object)
fs.writeFileSync(`${config.cache}/tags/index-${slug}-${counter}`, template.toString())
}
const request = require('./request')
const destroy = require('./unlink')
const engine = require('./engine')
const paginator = require('./support/pagination')
module.exports.run = async (config) => {
//await destroy(config)
await destroy(config)
await call(config)

@@ -11,2 +12,3 @@ }

const call = (config) => {
let params = params()

@@ -20,3 +22,4 @@ request.home()

if (response.current_page !== response.last_page) {
engine.home(config)
params.posts = response
engine.home(config, params, counter)
.then(() => {

@@ -41,5 +44,6 @@ console.log('Home is ready')

.then((response) => {
engine.categories(config)
params.categories = response
engine.categories(config, params)
.then(() => {
console.log('Categories compiled')
console.log('Categories file compiled')
})

@@ -69,3 +73,5 @@ .catch(e => {

if (res.posts.current_page !== res.posts.last_page) {
engine.categoryPosts(config)
params.category = res
params.paginator = new paginator(res.posts, process.env.APP_URL + '/categories')
engine.categoryPosts(config, params, slug, counter)
.then(() => {

@@ -105,3 +111,4 @@ console.log('CategoryPosts is compiled')

.then((res) => {
engine.post(config)
params.post = res
engine.post(config, params)
.then(() => {

@@ -127,3 +134,4 @@ console.log(`Post-${slug} is compiled`)

.then((response) => {
engine.tags(config)
params.tags = response
engine.tags(config, params)
.then(() => {

@@ -151,3 +159,5 @@ console.log('Tags compiled')

.then((res) => {
engine.tagPosts(config)
params.tag = res
params.paginator = new paginator(res.posts, process.env.APP_URL + '/tags')
engine.tagPosts(config, params, slug, counter)
.then(() => {

@@ -172,1 +182,6 @@ console.log('TagPosts is compiled')

let params = async () => {
return {}
}
{
"name": "@nitunity/api-compiler",
"version": "0.1.2",
"version": "0.1.3",
"description": "This package is API for compiling HTML templates using Nunjucks template engine",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

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