
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
A module script to create a default MVC pattern folder and file structure.
A module to create a default MVC pattern folder and file structure.
npm i mvccreate
This module is intended to be a one time 'run-and-done' step at the beginning of a project. The code has been updated to help prevent files being overwritten, but YOU SHOULD NOT run this module on an existing project.
It is recommended that you create an install.js script (do not use your main file). When you run the module, the default settings will set mvcCreate as a dev dependency. This module should never be ran in production.
const mvcCreate=require("mvccreate");
mvcCreate.mvcCreate();
Note: This will create all of the folders and files, with the option of creating a package.json. Here is what the default tree will look like:
- controllers
- - homeController.js
- models
- - homeModel.js
- public
- - css
- - images
- - js
- views
- - index.html
- main.js
- routes.js
- package.json (you will be provided an option to customize or skip)
- README.md
- .gitignore
The following can be used to setup the basics quickly from the command line or script:
npm i mvccreate
echo const mvcCreate=require("mvccreate"); >install.js
echo mvcCreate.mvcCreate(); >>install.js
node install.js
What if you want to build a slightly different MVC pattern or even another structure? No problem. Version 2.0+ allows you to add your own patterns. If you want to use your own package.json, just skip the creation step. Just define the pattern you want as follows:
const mvcCreate=require("mvccreate");
//Define dev-dependencies as an object (if you are not using your own package.json):
userDevDepsObj={
"mvccreate": "*",
"nodemon": "^2.0.4"
}
//Define regular dependencies as an object (if you are not using your own package.json):
userDepsObj={
"express": "^4.16.3",
"express-es6-template-engine": "^2.2.3"
}
//Define a folder structure:
userDirs=[
"config",
"public",
"public/images",
"public/js",
"public/css",
"funny",
"views",
"controllers",
"models"
];
//Define files matching the folder structure:
userFiles=[
"main.js",
"router.js",
"weird.js",
"funny/iJustWantThisOneOkay.js",
"views/index.html",
"models/homeModel.js",
"controllers/homeController.js",
"README.md",
".gitignore"
];
//Feed these to mvcCreate for breakfast:
mvcCreate.mvcCreate(userDevDepsObj, userDepsObj, userDirs, userFiles);
You can also just inject specific settings you would like to replace, if you like the defaults. For example if you just wanted to replace userFiles, just pass empty parameters for the other settings:
userFiles=[
"main.js",
"router.js",
"utils.js",
"weird.js",
"funny/iJustWantThisOneOkay.js",
"views/index.html",
"models/homeModel.js",
"controllers/homeController.js",
"README.md",
".gitignore"
];
mvcCreate.mvcCreate("", "", "", userFiles);
When you run the install.js script you created, you will be prompted with options to skip steps if you want. Finally, you will be prompted to create the package.json file. This process is a questionnaire similar to running the command 'npm init' but with a few more options. Finally, you will be given the option to install the dependencies. This step simply runs 'npm install' for you, installing what is configured in the package.json.
1.0.6 - This version was an early development of the process.
2.0.0 - This version enables user defined patterns and a package.json creation process similar to 'npm init' but with more features.
NPM Listing: https://www.npmjs.com/package/mvccreate
FAQs
A module script to create a default MVC pattern folder and file structure.
We found that mvccreate 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.