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

create-nocobase-app

Package Overview
Dependencies
Maintainers
1
Versions
529
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-nocobase-app - npm Package Compare versions

Comparing version 0.5.0-alpha.20 to 0.5.0-alpha.21

lib/utils/index.js

19

lib/AppGenerator/AppGenerator.js

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

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

@@ -46,2 +52,11 @@

class AppGenerator extends _utils().Generator {
constructor(...args) {
super(...args);
this.tplContext = {};
}
setTplContext(context) {
this.tplContext = context;
}
writing() {

@@ -52,6 +67,6 @@ var _this = this;

_this.copyDirectory({
context: {
context: _objectSpread({
version: require('../../package').version,
conventionRoutes: _this.args.conventionRoutes
},
}, _this.tplContext),
path: (0, _path().join)(__dirname, '../../templates/AppGenerator'),

@@ -58,0 +73,0 @@ target: _this.cwd

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

function _fs() {
const data = require("fs");
function _commander() {
const data = _interopRequireDefault(require("commander"));
_fs = function _fs() {
_commander = function _commander() {
return data;

@@ -35,3 +35,3 @@ };

function _path() {
const data = require("path");
const data = _interopRequireDefault(require("path"));

@@ -45,30 +45,125 @@ _path = function _path() {

function _ora() {
const data = _interopRequireDefault(require("ora"));
_ora = function _ora() {
return data;
};
return data;
}
var _utils2 = require("./utils");
function _execa() {
const data = _interopRequireDefault(require("execa"));
_execa = function _execa() {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const args = (0, _utils().yParser)(process.argv.slice(2), {
alias: {
version: ['v'],
help: ['h']
},
boolean: ['version']
});
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
if (args.version && !args._[0]) {
args._[0] = 'version';
const local = (0, _fs().existsSync)((0, _path().join)(__dirname, '../.local')) ? _utils().chalk.cyan('@local') : '';
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
const _require = require('../package.json'),
name = _require.name,
version = _require.version;
const packageJson = require('../package.json');
console.log(`${name}@${version}${local}`);
} else {
require('./').default({
cwd: process.cwd(),
args
}).catch(err => {
console.error(`Create failed, ${err.message}`);
console.error(err);
const program = new (_commander().default.Command)(packageJson.name).version(packageJson.version).option('--simple', 'create nocobase app without install dependencies').option('--quickstart', 'create quickstart nocobase app').arguments('<project-directory>').usage(`${_utils().chalk.green('<project-directory>')}`).action( /*#__PURE__*/function () {
var _ref = _asyncToGenerator(function* (directory, options) {
var _runner$stdout, _runner$stderr;
console.log(`Creating a new Nocobase application at ${_utils().chalk.green(directory)}.`);
console.log('Creating files.');
const fullPath = _path().default.join(process.cwd(), directory);
yield require('./index').default({
cwd: fullPath,
args: {},
tplContext: options.quickstart ? {
quickstart: true
} : {
quickstart: false
}
});
const cmd = _utils().chalk.cyan((0, _utils2.hasYarn)() ? 'yarn' : 'npm run');
if (options.simple) {
console.log();
console.log('Done. You can start by doing:');
console.log();
console.log(` ${_utils().chalk.cyan('cd')} ${directory}`);
console.log(` ${cmd} install`);
console.log(` ${cmd} nocobase init --import-demo`);
console.log(` ${cmd} start`);
console.log();
return;
}
const installPrefix = _utils().chalk.yellow('Installing dependencies:');
const loader = (0, _ora().default)(installPrefix).start();
const logInstall = (chunk = '') => {
loader.text = `${installPrefix} ${chunk.toString().split('\n').join(' ')}`;
};
const runner = (0, _utils2.runInstall)(fullPath);
runner === null || runner === void 0 ? void 0 : (_runner$stdout = runner.stdout) === null || _runner$stdout === void 0 ? void 0 : _runner$stdout.on('data', logInstall);
runner === null || runner === void 0 ? void 0 : (_runner$stderr = runner.stderr) === null || _runner$stderr === void 0 ? void 0 : _runner$stderr.on('data', logInstall);
yield runner;
loader.stop();
console.log(`Dependencies installed ${_utils().chalk.green('successfully')}.`);
console.log();
console.log(`Your application was created at ${_utils().chalk.green(directory)}.\n`);
if (options.quickstart) {
// Using Sqlite as Database
const prefix = _utils().chalk.yellow('Nocobase init');
const initLoader = (0, _ora().default)(prefix).start();
try {
const initLog = (chunk = '') => {
initLoader.text = `${prefix} ${chunk.toString().split('\n').join(' ')}`;
};
const init = (0, _utils2.runInit)(fullPath);
init.stderr.on('data', initLog);
init.stdout.on('data', initLog);
yield init;
initLoader.stop();
} catch (e) {
initLoader.stop();
console.log();
console.log(e.message);
process.exit(1);
}
console.log(`Running your application.`);
yield (0, _execa().default)('npm', ['run', 'start'], {
stdio: 'inherit',
cwd: fullPath
});
} else {
console.log();
console.log('You can start by doing:');
console.log();
console.log(` ${_utils().chalk.cyan('cd')} ${directory}`);
console.log(` ${cmd} nocobase init --import-demo`);
console.log(` ${cmd} start`);
console.log();
}
});
}
return function (_x, _x2) {
return _ref.apply(this, arguments);
};
}()).showHelpAfterError().parse(process.argv);
//# sourceMappingURL=cli.js.map

4

lib/index.js

@@ -29,3 +29,4 @@ "use strict";

cwd,
args
args,
tplContext
}) {

@@ -36,2 +37,3 @@ const generator = new _AppGenerator.default({

});
generator.setTplContext(tplContext);
yield generator.run();

@@ -38,0 +40,0 @@ });

{
"name": "create-nocobase-app",
"version": "0.5.0-alpha.20",
"version": "0.5.0-alpha.21",
"main": "lib/index.js",

@@ -18,3 +18,6 @@ "types": "lib/index.d.ts",

"dependencies": {
"@umijs/utils": "3.5.17"
"@umijs/utils": "3.5.17",
"commander": "^8.2.0",
"execa": "^5.1.1",
"ora": "^5.4.1"
},

@@ -24,3 +27,3 @@ "bin": {

},
"gitHead": "d80c875d5e3acacf2f682c954f3b6e63c0386340"
"gitHead": "181872cf075dd9e65f9f2ff0d1ff18c541e0d7cd"
}

@@ -14,8 +14,8 @@ import { defineConfig } from 'umi';

define: {
'process.env.API_URL': process.env.API_URL,
'process.env.API_PORT': process.env.API_PORT,
'process.env.API_URL': process.env.API_URL || "http://127.0.0.1",
'process.env.API_PORT': process.env.API_PORT || "13001",
},
proxy: {
'/api': {
'target': `http://localhost:${process.env.API_PORT}/`,
'target': `http://localhost:${process.env.API_PORT || "13001"}/`,
'changeOrigin': true,

@@ -22,0 +22,0 @@ 'pathRewrite': { '^/api': '/api' },

@@ -1,33 +0,8 @@

import Server from '@nocobase/server';
import path from 'path';
import Application from '@nocobase/server';
const start = Date.now();
const api = new Server({
database: {
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
host: process.env.DB_HOST,
port: process.env.DB_PORT as any,
dialect: process.env.DB_DIALECT as any,
dialectOptions: {
charset: 'utf8mb4',
collate: 'utf8mb4_unicode_ci',
},
pool: {
max: 5,
min: 0,
acquire: 60000,
idle: 10000,
},
logging: process.env.DB_LOG_SQL === 'on' ? console.log : false,
define: {},
sync: {
force: false,
alter: {
drop: false,
},
},
},
const api = new Application({
database: require('./config/db').default,
resourcer: {

@@ -52,9 +27,6 @@ prefix: '/api',

for (const plugin of plugins) {
api.plugin(
require(`${plugin}/lib/server`).default,
);
api.plugin(require(`${plugin}/lib/server`).default);
}
api.plugin(
require(`@nocobase/plugin-client/lib/server`).default, {
api.plugin(require(`@nocobase/plugin-client/lib/server`).default, {
dist: path.resolve(process.cwd(), './dist'),

@@ -66,9 +38,7 @@ importDemo: true,

// @ts-ignore
process.argv.push('start', '--port', process.env.API_PORT);
process.argv.push('start', '--port', process.env.API_PORT || '13001');
}
console.log(process.argv);
api.parse(process.argv).then(() => {
console.log(`Start-up time: ${(Date.now() - start) / 1000}s`);
});

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

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