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

create-payload-app

Package Overview
Dependencies
Maintainers
1
Versions
469
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-payload-app - npm Package Compare versions

Comparing version 0.3.20 to 0.3.21

dist/lib/common-files/nodemon.json

8

dist/lib/create-project.test.js

@@ -65,3 +65,3 @@ "use strict";

it('creates static project', function () { return __awaiter(void 0, void 0, void 0, function () {
var expectedPayloadVersion, template, packageJsonPath, packageJson;
var expectedPayloadVersion, templateName, template, packageJsonPath, packageJson;
return __generator(this, function (_a) {

@@ -72,6 +72,6 @@ switch (_a.label) {

expectedPayloadVersion = _a.sent();
templateName = 'todo';
template = {
name: 'ts-todo',
name: templateName,
type: 'static',
language: 'typescript',
};

@@ -86,3 +86,3 @@ return [4 /*yield*/, (0, create_project_1.createProject)(args, projectDir, template, packageManager)];

expect(packageJson.name).toEqual(path_1.default.basename(projectDir));
expect(packageJson.description).toContain('ts-todo');
expect(packageJson.description).toContain(templateName);
// Check all common files are create

@@ -89,0 +89,0 @@ assertProjectFileExists('.npmrc');

@@ -44,3 +44,3 @@ "use strict";

var prompts_1 = __importDefault(require("prompts"));
function parseTemplate(args, validTemplates, language) {
function parseTemplate(args, validTemplates) {
return __awaiter(this, void 0, void 0, function () {

@@ -58,5 +58,3 @@ var templateName_1, template_1, filteredTemplates, response, template;

}
filteredTemplates = validTemplates
.filter(function (d) { return d.name.startsWith(language); })
.map(function (t) { return t.name.replace("".concat(language, "-"), ''); });
filteredTemplates = validTemplates.map(function (t) { return t.name; });
return [4 /*yield*/, (0, prompts_1.default)({

@@ -67,3 +65,3 @@ type: 'select',

choices: filteredTemplates.map(function (p) {
return { title: p, value: "".concat(language, "-").concat(p) };
return { title: p, value: p };
}),

@@ -75,5 +73,3 @@ validate: function (value) { return !!value.length; },

},
})
// const template = `${language}-${response.value}`
];
})];
case 1:

@@ -80,0 +76,0 @@ response = _a.sent();

@@ -75,3 +75,2 @@ "use strict";

type: 'static',
language: name.startsWith('js-') ? 'javascript' : 'typescript',
};

@@ -78,0 +77,0 @@ });

@@ -67,3 +67,3 @@ "use strict";

_a.sent();
return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, template.language, 'package.template.json'), 'utf8')];
return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, 'package.template.json'), 'utf8')];
case 3:

@@ -81,3 +81,3 @@ packageJsonTemplate = _a.sent();

_a.sent();
nodemon = path_1.default.resolve(commonFilesDir, template.language, 'nodemon.json');
nodemon = path_1.default.resolve(commonFilesDir, 'nodemon.json');
nodemonDest = path_1.default.resolve(projectDir, 'nodemon.json');

@@ -101,11 +101,11 @@ return [4 /*yield*/, fs_extra_1.default.copy(nodemon, nodemonDest)

_a.sent();
if (!(template.language === 'typescript')) return [3 /*break*/, 9];
tsconfig = path_1.default.resolve(commonFilesDir, template.language, 'tsconfig.json');
tsconfig = path_1.default.resolve(commonFilesDir, 'tsconfig.json');
tsconfigDest = path_1.default.resolve(projectDir, 'tsconfig.json');
return [4 /*yield*/, fs_extra_1.default.copy(tsconfig, tsconfigDest)];
return [4 /*yield*/, fs_extra_1.default.copy(tsconfig, tsconfigDest)
// docker-compose.yml
];
case 8:
_a.sent();
_a.label = 9;
case 9: return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, 'docker-compose.template.yml'), 'utf8')];
case 10:
return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, 'docker-compose.template.yml'), 'utf8')];
case 9:
dockerComposeTemplate = _a.sent();

@@ -118,6 +118,6 @@ dockerCompose = handlebars_1.default.compile(dockerComposeTemplate)(packageManager === 'yarn'

];
case 11:
case 10:
_a.sent();
return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, 'Dockerfile.template'), 'utf8')];
case 12:
case 11:
dockerfileTemplate = _a.sent();

@@ -128,3 +128,3 @@ dockerfile = handlebars_1.default.compile(dockerfileTemplate)(packageManager === 'yarn'

return [4 /*yield*/, fs_extra_1.default.writeFile(path_1.default.resolve(projectDir, 'Dockerfile'), dockerfile)];
case 13:
case 12:
_a.sent();

@@ -131,0 +131,0 @@ return [2 /*return*/];

@@ -49,3 +49,2 @@ "use strict";

var generate_secret_1 = require("./lib/generate-secret");
var parse_language_1 = require("./lib/parse-language");
var parse_project_name_1 = require("./lib/parse-project-name");

@@ -77,7 +76,7 @@ var parse_template_1 = require("./lib/parse-template");

return __awaiter(this, void 0, void 0, function () {
var _a, _b, templateArg, valid, _c, _d, projectName, language, validTemplates, template, databaseUri, payloadSecret, projectDir, packageManager, error_1;
var _a, _b, templateArg, valid, _c, _d, projectName, validTemplates, template, databaseUri, payloadSecret, projectDir, packageManager, error_1;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_e.trys.push([0, 16, , 17]);
_e.trys.push([0, 15, , 16]);
if (!this.args['--help']) return [3 /*break*/, 2];

@@ -108,38 +107,35 @@ _b = (_a = console).log;

projectName = _e.sent();
return [4 /*yield*/, (0, parse_language_1.parseLanguage)(this.args)];
return [4 /*yield*/, (0, templates_1.getValidTemplates)()];
case 7:
language = _e.sent();
return [4 /*yield*/, (0, templates_1.getValidTemplates)()];
validTemplates = _e.sent();
return [4 /*yield*/, (0, parse_template_1.parseTemplate)(this.args, validTemplates)];
case 8:
validTemplates = _e.sent();
return [4 /*yield*/, (0, parse_template_1.parseTemplate)(this.args, validTemplates, language)];
case 9:
template = _e.sent();
return [4 /*yield*/, (0, get_db_connection_1.getDatabaseConnection)(this.args, projectName)];
case 10:
case 9:
databaseUri = _e.sent();
return [4 /*yield*/, (0, generate_secret_1.generateSecret)()];
case 11:
case 10:
payloadSecret = _e.sent();
projectDir = projectName === '.' ? process.cwd() : "./".concat((0, slugify_1.default)(projectName));
return [4 /*yield*/, getPackageManager(this.args)];
case 12:
case 11:
packageManager = _e.sent();
if (!!this.args['--dry-run']) return [3 /*break*/, 15];
if (!!this.args['--dry-run']) return [3 /*break*/, 14];
return [4 /*yield*/, (0, create_project_1.createProject)(this.args, projectDir, template, packageManager)];
case 12:
_e.sent();
return [4 /*yield*/, (0, write_env_file_1.writeEnvFile)(projectName, databaseUri, payloadSecret)];
case 13:
_e.sent();
return [4 /*yield*/, (0, write_env_file_1.writeEnvFile)(projectName, databaseUri, payloadSecret)];
_e.label = 14;
case 14:
_e.sent();
_e.label = 15;
case 15:
(0, log_1.success)('Payload project successfully created');
console.log((0, messages_1.successMessage)(projectDir, packageManager));
return [3 /*break*/, 17];
case 16:
return [3 /*break*/, 16];
case 15:
error_1 = _e.sent();
console.log(error_1);
return [3 /*break*/, 17];
case 17: return [2 /*return*/];
return [3 /*break*/, 16];
case 16: return [2 /*return*/];
}

@@ -146,0 +142,0 @@ });

@@ -39,3 +39,3 @@ {

},
"version": "0.3.20",
"version": "0.3.21",
"devDependencies": {

@@ -42,0 +42,0 @@ "@types/command-exists": "^1.2.0",

@@ -18,3 +18,3 @@ # Create Payload App

Available templates: js-blank, js-blog, js-todo, ts-blank, ts-blog, ts-todo
Available templates: blank, blog, todo

@@ -21,0 +21,0 @@ --use-npm Use npm to install dependencies

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