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

strapi-generate-new

Package Overview
Dependencies
Maintainers
1
Versions
294
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strapi-generate-new - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

files/config/locales/de_DE.json

3

files/config/environments/development/security.json

@@ -37,4 +37,3 @@ {

"Content-Type",
"Authorization",
"DashboardToken"
"Authorization"
]

@@ -41,0 +40,0 @@ },

@@ -7,3 +7,3 @@ {

"timeout": 1000,
"workers": 1
"workers": 0
},

@@ -10,0 +10,0 @@ "logger": true,

@@ -12,3 +12,3 @@ {

"fileName": "default.db",
"migrate": "alter"
"migrate": "safe"
},

@@ -19,3 +19,3 @@ "permanent": {

"fileName": "permanent.db",
"migrate": "alter"
"migrate": "safe"
}

@@ -22,0 +22,0 @@ }

@@ -37,4 +37,3 @@ {

"Content-Type",
"Authorization",
"DashboardToken"
"Authorization"
]

@@ -41,0 +40,0 @@ },

{
"frontendUrl": "",
"reload": {
"timeout": 1000
"timeout": 1000,
"workers": 0
},

@@ -6,0 +7,0 @@ "logger": true,

{
"i18n": {
"defaultLocale": "en",
"defaultLocale": "en_US",
"modes": [

@@ -5,0 +5,0 @@ "query",

@@ -21,16 +21,16 @@ 'use strict';

const frameworkPkg = scope.strapiPackageJSON || {};
const userPkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'strapi-generate-users', 'package.json'))) || {};
const uploadPkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'strapi-generate-upload', 'package.json'))) || {};
const emailPkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'strapi-generate-email', 'package.json'))) || {};
let dependencies;
let devDependencies;
// To determine the Strapi dependency to inject
// in the newly created `package.json`.
const strapiVersionDependency = '^' + frameworkPkg.version;
const strapiVersionDependency = '~' + frameworkPkg.version;
return _.defaults(scope.appPackageJSON || {}, {
'name': scope.name,
'private': true,
'version': '0.1.0',
'description': 'A Strapi application.',
'dependencies': {
// Only add some dependencies if the application needs it.
if (!scope.dry) {
const userPkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'strapi-generate-users', 'package.json'))) || {};
const uploadPkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'strapi-generate-upload', 'package.json'))) || {};
const emailPkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'strapi-generate-email', 'package.json'))) || {};
dependencies = {
'anchor': getDependencyVersion(userPkg, 'anchor'),

@@ -46,6 +46,6 @@ 'async': getDependencyVersion(frameworkPkg, 'async'),

'socket.io': getDependencyVersion(frameworkPkg, 'socket.io'),
'strapi': strapiVersionDependency,
'waterline': getDependencyVersion(frameworkPkg, 'waterline')
},
'devDependencies': {
};
devDependencies = {
'strapi-generate': getDependencyVersion(frameworkPkg, 'strapi-generate'),

@@ -57,3 +57,15 @@ 'strapi-generate-api': getDependencyVersion(frameworkPkg, 'strapi-generate-api'),

'strapi-generate-users': getDependencyVersion(frameworkPkg, 'strapi-generate-users')
},
};
}
// Finally, return the JSON.
return _.merge(scope.appPackageJSON || {}, {
'name': scope.name,
'private': true,
'version': '0.1.0',
'description': 'A Strapi application.',
'dependencies': _.merge(dependencies || {}, {
'strapi': strapiVersionDependency
}),
'devDependencies': devDependencies || {},
'main': './server.js',

@@ -60,0 +72,0 @@ 'scripts': {

@@ -44,2 +44,16 @@ 'use strict';

// Only apply if the `--dry` flag is present.
// Rewrite the config to add the `dry` key and
// remove unucessary `databases.json` files.
if (scope.dry) {
const configPath = path.resolve(scope.rootPath, 'config', 'general.json');
const currentConfig = JSON.parse(fs.readFileSync(configPath));
const newConfig = _.merge(currentConfig, {
dry: true
});
fs.writeFileSync(configPath, JSON.stringify(newConfig, null, ' '));
fs.removeSync(path.resolve(scope.rootPath, 'config', 'environments', 'development', 'databases.json'));
fs.removeSync(path.resolve(scope.rootPath, 'config', 'environments', 'production', 'databases.json'));
}
// Create symlinks to all necessary node modules

@@ -49,68 +63,48 @@ // in the `node_modules` directory.

generatorDependencies: function (cb) {
let pkg;
let srcDependencyPath;
const generators = ['email', 'upload', 'users'];
fs.mkdir(path.resolve(scope.rootPath, 'node_modules'), cb);
_.forEach(generators, function (generator) {
pkg = JSON.parse(fs.readFileSync(path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-' + generator, 'package.json')));
_.forEach(pkg.dependencies, function (version, dependency) {
try {
require(path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-' + generator, 'node_modules', dependency));
srcDependencyPath = path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-' + generator, 'node_modules', dependency);
} catch (err) {
require(path.resolve(scope.strapiRoot, 'node_modules', dependency));
srcDependencyPath = path.resolve(scope.strapiRoot, 'node_modules', dependency);
}
const destDependencyPath = path.resolve(scope.rootPath, 'node_modules', dependency);
fs.symlink(srcDependencyPath, destDependencyPath, 'junction', function (symLinkErr) {
if (symLinkErr) {
nonFatalErrors.push(symLinkErr);
if (!scope.dry) {
let pkg;
let srcDependencyPath;
const generators = ['email', 'upload', 'users', 'admin'];
_.forEach(generators, function (generator) {
pkg = JSON.parse(fs.readFileSync(path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-' + generator, 'package.json')));
_.forEach(pkg.dependencies, function (version, dependency) {
try {
require(path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-' + generator, 'node_modules', dependency));
srcDependencyPath = path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-' + generator, 'node_modules', dependency);
} catch (err) {
require(path.resolve(scope.strapiRoot, 'node_modules', dependency));
srcDependencyPath = path.resolve(scope.strapiRoot, 'node_modules', dependency);
}
cb();
const destDependencyPath = path.resolve(scope.rootPath, 'node_modules', dependency);
fs.symlink(srcDependencyPath, destDependencyPath, 'junction', function (symLinkErr) {
if (symLinkErr) {
nonFatalErrors.push(symLinkErr);
}
cb();
});
});
});
});
} else {
cb();
}
},
emailDependencies: function (cb) {
const emailPkg = JSON.parse(fs.readFileSync(path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-email', 'package.json')));
_.forEach(emailPkg.dependencies, function (version, dependency) {
const srcDependencyPath = path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-email', 'node_modules', dependency);
const destDependencyPath = path.resolve(scope.rootPath, 'node_modules', dependency);
fs.symlink(srcDependencyPath, destDependencyPath, 'junction', function (symLinkErr) {
if (symLinkErr) {
nonFatalErrors.push(symLinkErr);
}
cb();
});
});
},
uploadDependencies: function (cb) {
const uploadPkg = JSON.parse(fs.readFileSync(path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-upload', 'package.json')));
_.forEach(uploadPkg.dependencies, function (version, dependency) {
const srcDependencyPath = path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-upload', 'node_modules', dependency);
const destDependencyPath = path.resolve(scope.rootPath, 'node_modules', dependency);
fs.symlink(srcDependencyPath, destDependencyPath, 'junction', function (symLinkErr) {
if (symLinkErr) {
nonFatalErrors.push(symLinkErr);
}
cb();
});
});
},
appDependencies: function (cb) {
const appPkg = JSON.parse(fs.readFileSync(path.resolve(scope.rootPath, 'package.json')));
delete appPkg.dependencies.strapi;
_.forEach(appPkg.dependencies, function (version, dependency) {
const srcDependencyPath = path.resolve(scope.strapiRoot, 'node_modules', dependency);
const destDependencyPath = path.resolve(scope.rootPath, 'node_modules', dependency);
fs.symlink(srcDependencyPath, destDependencyPath, 'junction', function (symLinkErr) {
if (symLinkErr) {
nonFatalErrors.push(symLinkErr);
}
cb();
if (!scope.dry) {
_.forEach(appPkg.dependencies, function (version, dependency) {
const srcDependencyPath = path.resolve(scope.strapiRoot, 'node_modules', dependency);
const destDependencyPath = path.resolve(scope.rootPath, 'node_modules', dependency);
fs.symlink(srcDependencyPath, destDependencyPath, 'junction', function (symLinkErr) {
if (symLinkErr) {
nonFatalErrors.push(symLinkErr);
}
cb();
});
});
});
} else {
cb();
}
},

@@ -117,0 +111,0 @@

@@ -8,8 +8,7 @@ 'use strict';

// Node.js core.
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
// Public node modules.
const _ = require('lodash');
const fs = require('fs-extra');

@@ -32,5 +31,2 @@ /**

// Generate random codes.
const dashboardToken = crypto.randomBytes(32).toString('hex');
// App info.

@@ -42,4 +38,3 @@ _.defaults(scope, {

year: (new Date()).getFullYear(),
license: 'MIT',
dashboardToken: dashboardToken
license: 'MIT'
});

@@ -60,4 +55,17 @@

// Only apply if the `--dry` flag is present.
// Do not generate APIs if the developer
// wants a dry application but still create an
// empty `api` directory.
if (scope.dry) {
delete this.targets['.'];
fs.mkdirs(path.resolve(scope.rootPath, 'api'), function (err) {
if (err) {
return cb.error('Impossible to create the `./api` directory.');
}
});
}
// Trigger callback with no error to proceed.
return cb.success();
};

@@ -12,3 +12,2 @@ 'use strict';

const packageJSON = require('../json/package.json.js');
const dashboardJSON = require('../json/dashboard.json.js');
const studioJSON = require('../json/studio.json.js');

@@ -27,4 +26,4 @@

// Call `users`, `upload` and `email` generators.
'.': ['users', 'upload', 'email'],
// Call `users`, `upload`, `email` and `admin` generators.
'.': ['users', 'upload', 'email', 'admin'],

@@ -52,6 +51,3 @@ // Main package.

// Copy dynamic SaaS files (for Studio and Dashboard).
'config/dashboard.json': {
jsonfile: dashboardJSON
},
// Copy dynamic SaaS files (Studio).
'config/studio.json': {

@@ -58,0 +54,0 @@ jsonfile: studioJSON

{
"name": "strapi-generate-new",
"version": "1.4.1",
"version": "1.5.0",
"description": "Generate a new Strapi application.",

@@ -16,8 +16,9 @@ "homepage": "http://strapi.io",

"dependencies": {
"fs-extra": "^0.26.2",
"lodash": "^3.10.1",
"winston": "^2.1.0"
"fs-extra": "~0.26.2",
"lodash": "~3.10.1",
"winston": "~2.1.1"
},
"devDependencies": {
"xo": "^0.11.0"
"pre-commit": "~1.1.2",
"xo": "~0.11.2"
},

@@ -62,2 +63,3 @@ "author": {

"no-invalid-this": 0,
"no-negated-condition": 0,
"no-throw-literal": 0,

@@ -64,0 +66,0 @@ "no-unused-expressions": 0,

@@ -6,3 +6,3 @@ # Strapi generate new application

```bash
$ strapi new <appName>
$ strapi new <appName> [--dry]
```

@@ -9,0 +9,0 @@

# <%= name %>
A quick description of <%= name %>.
## Resources
* How to contribute: See `CONTRIBUTING.md`
* License: See `LICENSE.md`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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