New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

create-remax-app

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-remax-app - npm Package Compare versions

Comparing version 1.5.0 to 2.0.0-alpha.1

temp/.DS_Store

2

lib/create/check-version.d.ts

@@ -10,3 +10,3 @@ export interface VersionValueType extends ObjectValueType {

declare const getLocalVersion: () => string;
declare const getLastVersion: (repoName: string) => Promise<any>;
declare const getLastVersion: (repoName: string) => Promise<string>;
declare const generatorSymbol: (count: number, symbol?: string) => string;

@@ -13,0 +13,0 @@ declare const generatorPrompt: ({ latestVersion, localVersion, repoName }: VersionValueType) => void;

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

return data.data;
});
}).catch(function (e) { });
};

@@ -92,10 +92,19 @@ exports.getResult = getResult;

var getLastVersion = function (repoName) { return __awaiter(void 0, void 0, void 0, function () {
var res, latestVersion;
var latestVersion, res, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, getResult("https://registry.npmjs.org/" + repoName)];
case 0:
latestVersion = '';
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, getResult("https://registry.npmjs.org/" + repoName)];
case 2:
res = _a.sent();
latestVersion = res['dist-tags'].latest;
return [2 /*return*/, latestVersion];
return [3 /*break*/, 4];
case 3:
e_1 = _a.sent();
return [3 /*break*/, 4];
case 4: return [2 /*return*/, latestVersion];
}

@@ -150,2 +159,4 @@ });

latestVersion = _a.sent();
if (!latestVersion)
return [2 /*return*/];
localVersion = getLocalVersion();

@@ -152,0 +163,0 @@ if (semver_1.default.lt(localVersion, latestVersion)) {

@@ -51,27 +51,22 @@ "use strict";

var chalk_1 = __importDefault(require("chalk"));
var clone_1 = __importDefault(require("./clone"));
var check_version_1 = require("./check-version");
var render_1 = __importStar(require("./render"));
exports.default = (function (argv, macros) { return __awaiter(void 0, void 0, void 0, function () {
var generatorValues, tmpPath, templateRepo, isClone, spinnerDownload_1;
var e_1, generatorValues;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, check_version_1.checkCurrentRepoVersion(macros.scriptName)];
case 0:
_a.trys.push([0, 3, , 4]);
if (!!argv.c) return [3 /*break*/, 2];
return [4 /*yield*/, check_version_1.checkCurrentRepoVersion(macros.scriptName)];
case 1:
_a.sent();
_a.label = 2;
case 2: return [3 /*break*/, 4];
case 3:
e_1 = _a.sent();
return [3 /*break*/, 4];
case 4:
generatorValues = render_1.pathAndRepoUrlGenerator(argv, macros);
tmpPath = generatorValues.tmpPath, templateRepo = generatorValues.templateRepo;
return [4 /*yield*/, check_version_1.checkCurrentTemplateVersion(macros, argv.t, tmpPath)];
case 2:
isClone = _a.sent();
if (isClone) {
spinnerDownload_1 = generatorOraStart(macros.download);
clone_1.default(templateRepo, tmpPath).then(function () {
spinnerDownload_1.stop();
render_1.default(generatorValues, macros);
});
}
else {
render_1.default(generatorValues, macros);
}
render_1.default(generatorValues, macros);
return [2 /*return*/];

@@ -78,0 +73,0 @@ }

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

var path_1 = __importDefault(require("path"));
var check_version_1 = require("./check-version");
var fs_extra_1 = __importDefault(require("fs-extra"));
var git_user_1 = __importDefault(require("./git-user"));

@@ -53,50 +53,78 @@ var utils_1 = require("../utils/utils");

exports.default = (function (renderObj, macros) { return __awaiter(void 0, void 0, void 0, function () {
var remaxTagName, templatePath, destPath, description, projectDirectory;
var templatePath, destPath, description, projectDirectory, newProjectDirectory, newDestPath, isExists;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, check_version_1.checkRepoVersion(macros.remaxRepo)];
case 1:
remaxTagName = _a.sent();
templatePath = renderObj.templatePath, destPath = renderObj.destPath, description = renderObj.description, projectDirectory = renderObj.projectDirectory;
metalsmith_1.default(process.cwd())
.metadata({
name: projectDirectory,
description: description,
remaxVersion: "^" + remaxTagName.replace(/^./, ''),
})
.source(templatePath)
.destination(destPath)
.clean(false)
.use(askQuestions({
name: { default: projectDirectory, type: 'string' },
author: { default: git_user_1.default(), type: 'string' },
description: { default: description, type: 'string' },
platform: {
default: 'wechat',
type: 'list',
choices: [
'wechat',
'alipay',
'toutiao'
]
}
}))
.use(filterPlatform())
.use(renderTemplateFiles())
.build(function (err) {
if (!err) {
console.log(chalk_1.default.green('create project success!'));
}
});
return [2 /*return*/];
templatePath = renderObj.templatePath, destPath = renderObj.destPath, description = renderObj.description, projectDirectory = renderObj.projectDirectory;
newProjectDirectory = projectDirectory;
newDestPath = destPath;
isExists = fs_extra_1.default.pathExistsSync(destPath);
if (isExists) {
console.log(chalk_1.default.red('此项目已存在,请变更名字后重试'));
return [2 /*return*/];
}
metalsmith_1.default(process.cwd())
.metadata({
name: newProjectDirectory,
description: description,
})
.source(templatePath)
.destination(newDestPath)
.clean(false)
.use(askQuestions({
name: { default: newProjectDirectory, type: 'string' },
author: { default: git_user_1.default(), type: 'string' },
description: { default: description, type: 'string' },
platform: {
default: macros.defaultPlatform,
type: 'list',
choices: macros.choices
}
}))
.use(filterPlatform(macros))
.use(renderTemplateFiles())
.use(removeFile())
.build(function (err) {
if (!err) {
console.log(chalk_1.default.green('create project success!'));
}
});
return [2 /*return*/];
});
}); });
var filterPlatform = function () {
var filterPlatform = function (macros) {
return function (_, metalsmith, done) {
var platform = metalsmith._metadata.platform;
metalsmith._metadata.platformTitle = utils_1.firstUpperCase(platform);
macros.choices.forEach(function (item) {
metalsmith._metadata[item] = item === platform ? true : false;
});
done();
};
};
var removeFile = function () {
return function (files, metalsmith, done) {
var platform = metalsmith._metadata.platform;
if (platform === 'wechat') {
Object.keys(files).forEach(function (file) {
if (file === 'mini.project.json') {
delete files[file];
}
});
}
else if (platform === 'toutiao') {
Object.keys(files).forEach(function (file) {
if (file === 'mini.project.json' || file === 'project.config.json') {
delete files[file];
}
});
}
else if (platform === 'ali') {
Object.keys(files).forEach(function (file) {
if (file === 'project.config.json') {
delete files[file];
}
});
}
done();
};
};
var askQuestions = function (prompts) {

@@ -103,0 +131,0 @@ return function (_, metalsmith, done) {

@@ -34,2 +34,8 @@ "use strict";

})
.option('c', {
alias: 'check',
default: false,
describe: 'ignore version check',
type: 'boolean'
})
.fail(function (msg, err) {

@@ -36,0 +42,0 @@ if (err)

@@ -13,3 +13,4 @@ declare const macros: {

defaultPlatform: string;
choices: string[];
};
export default macros;

@@ -12,6 +12,12 @@ "use strict";

descriptionTS: 'Remax Project With TypeScript',
tmpPathName: 'tmp',
tmpPathName: 'temp',
templatePathName: 'template',
defaultPlatform: 'wechat'
defaultPlatform: 'one',
choices: [
'one',
'wechat',
'ali',
'toutiao'
]
};
exports.default = macros;
{
"name": "create-remax-app",
"version": "1.5.0",
"version": "2.0.0-alpha.1",
"description": "Create Remax apps with no build configuration.",

@@ -29,8 +29,7 @@ "bin": {

"lib/**/*",
"bin/**/*"
"bin/**/*",
"temp/**/*"
],
"homepage": "https://github.com/remaxjs/create-remax-app#readme",
"dependencies": {
"@types/async": "^3.0.2",
"@types/inquirer": "^6.5.0",
"async": "^3.1.0",

@@ -42,2 +41,3 @@ "axios": "^0.19.0",

"degit": "^2.1.4",
"fs-extra": "^9.0.0",
"handlebars": "^4.4.3",

@@ -51,2 +51,5 @@ "inquirer": "^7.0.0",

"devDependencies": {
"@types/async": "^3.0.2",
"@types/fs-extra": "^8.1.0",
"@types/inquirer": "^6.5.0",
"@types/jest": "^24.0.23",

@@ -53,0 +56,0 @@ "@types/node": "^12.7.12",

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