Skip to content

Commit

Permalink
chore: template project base
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakrok09 committed Aug 25, 2024
1 parent f256719 commit a3dfe24
Show file tree
Hide file tree
Showing 65 changed files with 5,099 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions packages/serpenta-app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env node

import spawn from "cross-spawn";
import fs from "fs";
import path from "path";

const projectName = process.argv[2];

const currentDir = process.cwd();
const projectDir = path.resolve(currentDir, projectName);
fs.mkdirSync(projectDir, { recursive: true });

const templateDir = path.resolve(__dirname, 'template');
fs.cpSync(templateDir, projectDir, { recursive: true });

fs.renameSync(
path.join(projectDir, 'gitignore'),
path.join(projectDir, '.gitignore')
);

const projectPackageJson = require(path.join(projectDir, 'package.json'));

projectPackageJson.name = projectName;

fs.writeFileSync(
path.join(projectDir, 'package.json'),
JSON.stringify(projectPackageJson, null, 2)
);

spawn.sync('npm', ['install'], { stdio: 'inherit' });

console.log('Success! Your new project is ready.');
console.log(`Created ${projectName} at ${projectDir}`);
Loading

0 comments on commit a3dfe24

Please sign in to comment.