10 examples of 'create react app git' in JavaScript

Every line of 'create react app git' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
19function checkout(app, ref) {
20 return app.execInRepo(`git checkout ${ref}`);
21}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

34function setupGit() {
35 execSyncSilently(`git config --global push.default simple`);
36 execSyncSilently(`git config --global user.email "${process.env.GIT_EMAIL}"`);
37 execSyncSilently(`git config --global user.name "${process.env.GIT_USER}"`);
38 const remoteUrl = new RegExp(`https?://(\\S+)`).exec(execSyncRead(`git remote -v`))[1];
39 execSyncSilently(`git remote remove origin`);
40 execSyncSilently(`git remote add origin "https://${process.env.GIT_USER}:${process.env.GIT_TOKEN}@${remoteUrl}"`);
41 execSync(`git checkout master`);
42}
208function initGit() {
209 if (inputParams.init_git && inputParams.init_git.toLowerCase() === 'y') {
210 rimraf.sync('../.git');
211 exec('git init -q ..', function (err, stdout, stderr) {
212 if (err) {
213 console.log(err);
214 finishSetup();
215 } else {
216 exec("git add \"../*\" \"../.*\"", function (err, stdout, stderr) {
217 if (err) {
218 console.log(err);
219 }
220 finishSetup();
221 });
222 }
223 });
224 } else {
225 finishSetup();
226 }
227}
153function initGit() {
154 const gitInitOutput = /**@type {string} */ (sh.exec(`git init "${ROOT}"`, {
155 silent: true,
156 }).stdout)
157
158 log(kleur.green(gitInitOutput.replace(/(\n|\r)+/g, '')))
159}
22async run () {
23 await createForgaeProjectStructure(true);
24
25 await self.prepareProject();
26
27 console.log(`===== '${ self.name }' project successfully initialized. =====`);
28}
12function createRemote(gitclick) {
13 try {
14 var options = createRemote.parseArgv(argv);
15
16 return gitclick.load()
17 .then(function() {
18 return gitclick.createRepository(options.box, options.repository);
19 })
20 .then(function(repository) {
21 cli.printSuccess(repository.owner + '/' + repository.name + ' successfully created.');
22 cli.print('Clone URL: ' + repository.cloneUrl);
23 cli.print('SSH URL: ' + repository.sshUrl);
24 })
25 .catch(ProviderError, function(err) {
26 cli.printError('Your provider responded with an Error:');
27 cli.print(err.message);
28
29 if (err.errors) {
30 err.errors.forEach(function(e) {
31 cli.print('- ' + e.message);
32 });
33 }
34 })
35 .catch(BoxNotFoundError, function(err) {
36 cli.printError('Box \'' + options.box + '\' was not found.');
37 });
38 } catch(err) {
39 if (err instanceof ValidationError) {
40 return cli.printError(err.message);
41 }
42
43 throw err;
44 }
45}
21export function createTestApp(router, component) {
22 const providers = [];
23
24 if (router) {
25 providers.push({ name: 'router', useValue: router });
26 }
27
28 if (component) {
29 providers.push({ name: 'component', useValue: component });
30 }
31
32 return createApp({
33 name: 'TestApp',
34 providers
35 });
36}
124gitInit() {
125 if(this.abort) return;
126 var done = this.async();
127
128 this.log(chalk.bold('Adding files for initial commit'));
129 var child = exec('git add -A && git commit -m "Initial commit"', { cwd: 'dist' }, function (err, stdout, stderr) {
130 if(stdout.search('nothing to commit') >= 0) {
131 this.log('Re-pushing the existing "dist" build...');
132 } else if(err) {
133 this.log.error(err);
134 } else {
135 this.log(chalk.green('Done, without errors.'));
136 }
137 done();
138 }.bind(this));
139
140 child.stdout.on('data', data => {
141 this.log(data.toString());
142 });
143}
41function createApp() {
42 console.log();
43 console.log(
44 chalk.bold.cyan("Omi-Cli") +
45 (!isCn
46 ? " will creating a new omi app in "
47 : " 即将创建一个新的应用在 ") +
48 dest
49 );
50
51 vfs
52 .src(["**/*", "!node_modules/**/*"], {
53 cwd: tpl,
54 cwdbase: true,
55 dot: true
56 })
57 .pipe(template(dest, tpl))
58 .pipe(vfs.dest(dest))
59 .on("end", function() {
60 try {
61 // rename gitignore file as .gitignore if `gitignore` exist
62 // (this was actually exist in app-ts-old)
63 if (existsSync(join(dest, "gitignore"))) {
64 info("Rename", "gitignore -> .gitignore");
65 renameSync(join(dest, "gitignore"), join(dest, ".gitignore"));
66 }
67 if (customPrjName) {
68 try {
69 process.chdir(customPrjName);
70 } catch (err) {
71 console.log(error(err));
72 }
73 }
74 info(
75 "Install",
76 "We will install dependencies, if you refuse, press ctrl+c to abort, and install dependencies by yourself. :>"
77 );
78 console.log();
79 require("./install")(mirror, done);
80 } catch (e) {
81 console.log(error(e));
82 }
83 })
84 .resume();
85}
87function createApp(name) { return createEntryPoint('index', `apps/${name}`, name) }

Related snippets