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

@amplicode/create-amplicode

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplicode/create-amplicode - npm Package Compare versions

Comparing version 0.10.8 to 0.10.9

64

dist/index.js

@@ -1531,3 +1531,3 @@ #!/usr/bin/env node

module.exports = JSON.parse('{"name":"@amplicode/create-amplicode","version":"0.10.8","description":"Create amplicode app","keywords":["code","typescript","react","generate"],"bin":{"create-amplicode":"dist/index.js"},"files":["dist/*","templates/*"],"dependencies":{"ejs":"^3.1.9","minimist":"^1.2.8"},"devDependencies":{"@types/ejs":"^3.1.5","@types/minimist":"^1.2.5","@types/node":"^20.11.2","copy-webpack-plugin":"^12.0.1","ts-loader":"^9.5.1","typescript":"^5.2.2","webpack":"^5.89.0","webpack-cli":"^5.1.4"},"scripts":{"build":"webpack","watch":"webpack --watch","generate:ra":"npm run build && node ./dist/index.js --appName ra-test --template react-admin --serverUrl localhost:8080 --restBasePath /rest --schema \'[{\\"entity\\":\\"owners\\",\\"screens\\":[\\"list\\",\\"edit\\"]}]\' --targetDir ../test-ra-app","test":"echo \\"Error: no test specified\\" && exit 1"},"publishConfig":{"access":"public"},"repository":"https://github.com/Amplicode/amplicode-create-app","author":"Amplicode","license":"Apache-2.0"}');
module.exports = JSON.parse('{"name":"@amplicode/create-amplicode","version":"0.10.9","description":"Create amplicode app","keywords":["code","typescript","react","generate"],"bin":{"create-amplicode":"dist/index.js"},"files":["dist/*","templates/*"],"dependencies":{"ejs":"^3.1.9","minimist":"^1.2.8"},"devDependencies":{"@types/ejs":"^3.1.5","@types/minimist":"^1.2.5","@types/node":"^20.11.2","copy-webpack-plugin":"^12.0.1","ts-loader":"^9.5.1","typescript":"^5.2.2","webpack":"^5.89.0","webpack-cli":"^5.1.4"},"scripts":{"build":"webpack","watch":"webpack --watch","generate:ra":"npm run build && node ./dist/index.js --appName ra-test --template react-admin --serverUrl localhost:8080 --restBasePath /rest --schema \'[{\\"entity\\":\\"owners\\",\\"screens\\":[\\"list\\",\\"edit\\"]}]\' --targetDir ../test-ra-app","test":"echo \\"Error: no test specified\\" && exit 1"},"publishConfig":{"access":"public"},"repository":"https://github.com/Amplicode/amplicode-create-app","author":"Amplicode","license":"Apache-2.0"}');

@@ -1579,3 +1579,3 @@ /***/ })

appName: argv.appName,
targetDir: argv.targetDir || '.',
targetDir: argv.targetDir || ".",
template: argv.template,

@@ -1587,16 +1587,16 @@ serverUrl: argv.serverUrl,

const RENAME_FILES = {
_gitignore: '.gitignore',
_gitignore: ".gitignore",
};
const EJS_EXT = '.ejs';
const EJS_EXT = ".ejs";
const DEFAULT_VERSIONS = {
"raStorybookVersion": {
raStorybookVersion: {
packageName: "@amplicode/amplicode-ra-storybook",
defaultVersion: "0.9.5"
defaultVersion: "0.9.14",
},
"muiStorybook": {
muiStorybook: {
packageName: "@amplicode/amplicode-mui-storybook",
defaultVersion: "0.9.4"
}
defaultVersion: "0.9.6",
},
};
const getTemplateDir = () => path.resolve(__dirname, '..', 'templates', ANSWERS.template);
const getTemplateDir = () => path.resolve(__dirname, "..", "templates", ANSWERS.template);
const getTargetDir = () => path.resolve(__dirname, ANSWERS.targetDir);

@@ -1611,3 +1611,3 @@ const checkRequiredArgs = () => {

}
['appName', 'template', 'serverUrl'].forEach(required => {
["appName", "template", "serverUrl"].forEach((required) => {
if (!Object.keys(argv).includes(required)) {

@@ -1622,3 +1622,3 @@ console.log(`Required argument "${required}" is not provided. Type --help for more information.`);

if (!ANSWERS.appName || !isValid) {
console.log('Please specify valid appName. Use lower case and dashes only.');
console.log("Please specify valid appName. Use lower case and dashes only.");
process.exit(1);

@@ -1653,3 +1653,3 @@ }

const withHttpProtocol = (serverUrl) => {
if (!serverUrl.startsWith('http')) {
if (!serverUrl.startsWith("http")) {
return `http://${serverUrl}`;

@@ -1664,3 +1664,3 @@ }

catch (error) {
console.log('Invalid serverUrl. Please specify valid serverUrl. E.g: http://localhost:8080');
console.log("Invalid serverUrl. Please specify valid serverUrl. E.g: http://localhost:8080");
process.exit(1);

@@ -1683,8 +1683,13 @@ }

generatorVersion: packageJson.version,
...Object.fromEntries(Object.entries(DEFAULT_VERSIONS)
.map(([varName, { defaultVersion, packageName }]) => {
...Object.fromEntries(Object.entries(DEFAULT_VERSIONS).map(([varName, { defaultVersion, packageName }]) => {
try {
let lastVersion = child_process.execSync(`npm view ${packageName} version`)
let lastVersion = child_process
.execSync(`npm view ${packageName} version`)
.toString()
.replace(/\r?\n/g, '');
.replace(/\r?\n/g, "");
lastVersion =
lastVersion?.length > 0 &&
lastVersion.match(/\d{0,2}\.\d{0,2}\.\d{0,2}/)
? lastVersion
: defaultVersion;
return [varName, lastVersion];

@@ -1695,7 +1700,6 @@ }

}
}))
})),
};
let templateDir = getTemplateDir();
const files = collectFilesRecursive(templateDir)
.map(filePath => path.relative(templateDir, filePath));
const files = collectFilesRecursive(templateDir).map((filePath) => path.relative(templateDir, filePath));
for (const file of files) {

@@ -1705,3 +1709,3 @@ let targetFileName = RENAME_FILES[file] ?? file;

targetFileName = file.substring(0, file.length - EJS_EXT.length);
const template = fs.readFileSync(path.join(templateDir, file), 'utf-8');
const template = fs.readFileSync(path.join(templateDir, file), "utf-8");
const appData = ejs.render(template, templateData);

@@ -1719,3 +1723,3 @@ ensureDirectory(path.dirname(path.join(getTargetDir(), targetFileName)));

const files = fs.readdirSync(basePath);
return files.flatMap(fileName => {
return files.flatMap((fileName) => {
let filePath = path.join(basePath, fileName);

@@ -1730,3 +1734,3 @@ let stats = fs.statSync(filePath);

const getResources = () => {
if (!ANSWERS.schema || typeof ANSWERS.schema !== 'string') {
if (!ANSWERS.schema || typeof ANSWERS.schema !== "string") {
return [];

@@ -1738,3 +1742,3 @@ }

if (!Array.isArray(parsedSchema) ||
parsedSchema.some(resource => typeof resource !== 'object' || !resource.entity)) {
parsedSchema.some((resource) => typeof resource !== "object" || !resource.entity)) {
resources = null;

@@ -1756,8 +1760,8 @@ }

async function installDependencies() {
let npmInstall = child_process.spawn('npm', ['install'], {
let npmInstall = child_process.spawn("npm", ["install"], {
cwd: getTargetDir(),
stdio: ['inherit', 'inherit', 'inherit']
stdio: ["inherit", "inherit", "inherit"],
});
await new Promise(resolve => {
npmInstall.on('exit', (code) => {
await new Promise((resolve) => {
npmInstall.on("exit", (code) => {
resolve(undefined);

@@ -1780,3 +1784,3 @@ });

}
console.log('Process template');
console.log("Process template");
processTemplate();

@@ -1783,0 +1787,0 @@ process.exit(0);

{
"name": "@amplicode/create-amplicode",
"version": "0.10.8",
"version": "0.10.9",
"description": "Create amplicode app",

@@ -5,0 +5,0 @@ "keywords": ["code", "typescript", "react", "generate"],

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