Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
organic-dna-repo-loader
Advanced tools
Utility module for loading repo dna accordingly to stem skeleton 2.1 structure.
Utility module for loading repo dna accordingly to stem skeleton v2.1 & v3.x.x structure.
Features:
/dna
folderdna
folder in them
index
as its root dna branchorganic-dna-loader@1.x.x
cells/node_modules/lib/load-root-dna
as per stem skeleton 2.1 concept.cells/packages/lib/load-root-dna
as per stem skeleton 3.0.0 concept.$ npm i organic-dna-repo-loader
Loads <root>/dna
and any cell dna found with glob pattern <root>/cells/**/dna
into memory by apply mode
on the loaded DNA chunks before resolving.
root
: String, a full path to folder containing dna
and cells
foldersmode
: String, optional mode or combination of modes to instruct DNA folding, see organic-dna-cellmodes for more info.skipExistingLoaderUsage
: Boolean, defualts to false
. If set to true will not use existing loader found at <repo>/cells/node_modules/lib/load-root-dna.js
// /sample-repo-with-cell-paths
// | - cells/cell1/dna/index.yaml
// | - dna/branch.json
// | - dna/common.yaml
# cells/cell1/dna/index.yaml
cellInfo: v1
cellPaths: # Array of path relative paths to cells
- 'cells/cell1'
// usage
const loadDNA = require('organic-dna-repo-loader')
const dna = await loadDNA(process.cwd() + '/sample-repo')
expect(dna).toDeepEqual({
branch: {
property: "value"
},
cells: {
cell1: {
build: {
myProperty: "value"
}
}
},
common: {
property: "value"
}
})
:warning: this method doesn't scale well with increased amount of cells to search for, so it is useful up to 20 cells.
// /sample-repo
// | - cells/cell1/dna/index.yaml
// | - dna/branch.json
// | - dna/common.yaml
const loadDNA = require('organic-dna-repo-loader')
const dna = await loadDNA(process.cwd() + '/sample-repo')
expect(dna).toDeepEqual({
branch: {
property: "value"
},
cells: {
cell1: {
build: {
myProperty: "value"
}
}
},
common: {
property: "value"
}
})
The implementation is designed to check for existence of <repo>/cells/node_modules/lib/load-root-dna.js
and if it is present to require that instead of the original logic.
It is expected that this existing dna loader module exports the following
module.exports = async function (mode) {
return DNA
}
ie, it should accept mode
, load the respective repo DNA and return it as Promise.
Usually the existing dna loader can be implemented using organic-dna-repo-loader
as its first step like so:
const loadDNA = require('organic-dna-repo-loader')
module.exports = async function (mode) {
let repoDNA = loadDNA({
root: __dirname, // or any other way to indicate repo's root folder
mode,
skipExistingLoaderUsage: true
})
// augment repoDNA ...
return repoDNA
}
FAQs
Utility module for loading repo dna accordingly to stem skeleton 2.1 structure.
The npm package organic-dna-repo-loader receives a total of 35 weekly downloads. As such, organic-dna-repo-loader popularity was classified as not popular.
We found that organic-dna-repo-loader 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.