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

demplate-addons

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

demplate-addons - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

package.json
{
"name": "demplate-addons",
"version": "0.0.7",
"version": "0.0.8",
"author": {

@@ -5,0 +5,0 @@ "email": "efim@dezh.in",

@@ -5,4 +5,33 @@ #!/usr/bin/env node

const fsExtra = require('fs-extra');
const fs = require('fs');
const fs = require('node:fs');
const { exec } = require('node:child_process');
const dirPath = './node_modules/demplate-addons/addons/';
const ifYarn = () => fs.existsSync('./yarn.lock');
const mergeJson = (from, to) => {
const rawDataAddon = fs.readFileSync(from);
const rawDataPackage = fs.readFileSync(to);
const {
package: {
dependencies = {},
devDependencies = {}
}
} = JSON.parse(rawDataAddon);
const packageJson = JSON.parse(rawDataPackage);
fs.writeFileSync(to, JSON.stringify({
...packageJson,
dependencies: {
...(packageJson.dependencies || {}),
...dependencies
},
devDependencies: {
...(packageJson.devDependencies || {}),
...devDependencies
}
}, null, 2));
}
inquirer

@@ -15,3 +44,3 @@ .prompt([

choices: [
...fs.readdirSync('./node_modules/demplate-addons/addons/', {withFileTypes: true})
...fs.readdirSync(dirPath, {withFileTypes: true})
.filter(dirent => dirent.isDirectory())

@@ -30,26 +59,12 @@ .map(dirent => dirent.name),

default:
fsExtra.copySync(`./node_modules/demplate-addons/addons/${addon}/template`, '.', {
fsExtra.copySync(`${dirPath}${addon}/template`, '.', {
overwrite: true
});
const rawDataAddon = fs.readFileSync(`node_modules/demplate-addons/addons/${addon}/template.json`);
const rawDataPackage = fs.readFileSync(`./package.json`);
const {
package: {
dependencies = {},
devDependencies = {}
}
} = JSON.parse(rawDataAddon);
const packageJson = JSON.parse(rawDataPackage);
fs.writeFileSync('./package.json', JSON.stringify({
...packageJson,
dependencies: {
...(packageJson.dependencies || {}),
...dependencies
},
devDependencies: {
...(packageJson.devDependencies || {}),
...devDependencies
}
}, null, 2));
mergeJson(`${dirPath}${addon}/template.json`, `./package.json`);
if (ifYarn()) {
exec('yarn')
} else {
exec('npm install')
}
}
});
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