mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-03 19:36:20 +00:00 
			
		
		
		
	Merge branch 'main' into fix/protect-assets-backup
This commit is contained in:
		
						commit
						8e7ea5e7c7
					
				@ -24,7 +24,7 @@
 | 
			
		||||
    "@strapi/provider-upload-cloudinary": "4.10.1",
 | 
			
		||||
    "@strapi/strapi": "4.10.1",
 | 
			
		||||
    "@vscode/sqlite3": "5.1.2",
 | 
			
		||||
    "better-sqlite3": "8.0.1",
 | 
			
		||||
    "better-sqlite3": "8.3.0",
 | 
			
		||||
    "lodash": "4.17.21",
 | 
			
		||||
    "mysql": "2.18.1",
 | 
			
		||||
    "mysql2": "3.2.0",
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@
 | 
			
		||||
    "@strapi/plugin-i18n": "4.10.1",
 | 
			
		||||
    "@strapi/plugin-users-permissions": "4.10.1",
 | 
			
		||||
    "@strapi/strapi": "4.10.1",
 | 
			
		||||
    "better-sqlite3": "8.0.1"
 | 
			
		||||
    "better-sqlite3": "8.3.0"
 | 
			
		||||
  },
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "A Strapi developer"
 | 
			
		||||
 | 
			
		||||
@ -98,7 +98,7 @@
 | 
			
		||||
    "inquirer": "8.2.5",
 | 
			
		||||
    "jest": "29.0.3",
 | 
			
		||||
    "jest-circus": "29.0.3",
 | 
			
		||||
    "jest-cli": "29.0.3",
 | 
			
		||||
    "jest-cli": "29.5.0",
 | 
			
		||||
    "jest-environment-jsdom": "29.0.3",
 | 
			
		||||
    "jest-watch-typeahead": "2.2.2",
 | 
			
		||||
    "lerna": "6.5.1",
 | 
			
		||||
 | 
			
		||||
@ -477,7 +477,7 @@
 | 
			
		||||
  "content-manager.components.DraggableCard.edit.field": "Modifier {item}",
 | 
			
		||||
  "content-manager.components.DraggableCard.move.field": "Déplacer {item}",
 | 
			
		||||
  "content-manager.components.DynamicTable.row-line": "ligne {number}",
 | 
			
		||||
  "content-manager.components.DynamicZone.ComponentPicker-label": "Choisir un compoosant",
 | 
			
		||||
  "content-manager.components.DynamicZone.ComponentPicker-label": "Choisir un composant",
 | 
			
		||||
  "content-manager.components.DynamicZone.add-component": "Ajouter un composant à {componentName}",
 | 
			
		||||
  "content-manager.components.DynamicZone.delete-label": "Supprimer {name}",
 | 
			
		||||
  "content-manager.components.DynamicZone.error-message": "Le composant contient une ou des erreurs",
 | 
			
		||||
 | 
			
		||||
@ -51,7 +51,7 @@
 | 
			
		||||
    "tar": "6.1.13",
 | 
			
		||||
    "tar-stream": "2.2.0",
 | 
			
		||||
    "uuid": "9.0.0",
 | 
			
		||||
    "ws": "8.11.0"
 | 
			
		||||
    "ws": "8.13.0"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@tsconfig/node16": "1.0.3",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								packages/core/strapi/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								packages/core/strapi/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -90,7 +90,6 @@ pids
 | 
			
		||||
logs
 | 
			
		||||
results
 | 
			
		||||
build
 | 
			
		||||
!**/lib/commands/actions/build
 | 
			
		||||
node_modules
 | 
			
		||||
.node_history
 | 
			
		||||
package-lock.json
 | 
			
		||||
 | 
			
		||||
@ -98,5 +98,3 @@ __tests__
 | 
			
		||||
jest.config.js
 | 
			
		||||
testApp
 | 
			
		||||
coverage
 | 
			
		||||
 | 
			
		||||
!**/lib/commands/actions/build
 | 
			
		||||
 | 
			
		||||
@ -11,5 +11,5 @@ module.exports = ({ command }) => {
 | 
			
		||||
    .command('build')
 | 
			
		||||
    .option('--no-optimization', 'Build the admin app without optimizing assets')
 | 
			
		||||
    .description('Build the strapi admin app')
 | 
			
		||||
    .action(getLocalScript('build'));
 | 
			
		||||
    .action(getLocalScript('build-command')); // build-command dir to avoid problems with 'build' being commonly ignored
 | 
			
		||||
};
 | 
			
		||||
@ -5,7 +5,7 @@ const { Command } = require('commander');
 | 
			
		||||
const strapiCommands = {
 | 
			
		||||
  'admin/create-user': require('./actions/admin/create-user/command'),
 | 
			
		||||
  'admin/reset-user-password': require('./actions/admin/reset-user-password/command'),
 | 
			
		||||
  build: require('./actions/build/command'),
 | 
			
		||||
  build: require('./actions/build-command/command'), // in 'build-command' to avoid problems with 'build' being commonly ignored
 | 
			
		||||
  'configuration/dump': require('./actions/configuration/dump/command'),
 | 
			
		||||
  'configuration/restore': require('./actions/configuration/restore/command'),
 | 
			
		||||
  console: require('./actions/console/command'),
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,7 @@ import _ from 'lodash';
 | 
			
		||||
import stopProcess from './utils/stop-process';
 | 
			
		||||
import { trackUsage, captureStderr } from './utils/usage';
 | 
			
		||||
import mergeTemplate from './utils/merge-template.js';
 | 
			
		||||
import tryGitInit from './utils/git';
 | 
			
		||||
 | 
			
		||||
import packageJSON from './resources/json/common/package.json';
 | 
			
		||||
import { createDatabaseConfig, generateDbEnvariables } from './resources/templates/database';
 | 
			
		||||
@ -184,6 +185,12 @@ export default async function createProject(
 | 
			
		||||
 | 
			
		||||
  await trackUsage({ event: 'didCreateProject', scope });
 | 
			
		||||
 | 
			
		||||
  // Init git
 | 
			
		||||
  if (await tryGitInit(rootPath)) {
 | 
			
		||||
    console.log('Initialized a git repository.');
 | 
			
		||||
    console.log();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  console.log();
 | 
			
		||||
  console.log(`Your application was created at ${chalk.green(rootPath)}.\n`);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										34
									
								
								packages/generators/app/src/utils/git.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								packages/generators/app/src/utils/git.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
import execa from 'execa';
 | 
			
		||||
 | 
			
		||||
async function isInGitRepository(rootDir: string) {
 | 
			
		||||
  try {
 | 
			
		||||
    await execa('git', ['rev-parse', '--is-inside-work-tree'], { stdio: 'ignore', cwd: rootDir });
 | 
			
		||||
    return true;
 | 
			
		||||
  } catch (_) {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function isInMercurialRepository(rootDir: string) {
 | 
			
		||||
  try {
 | 
			
		||||
    await execa('hg', ['-cwd', '.', 'root'], { stdio: 'ignore', cwd: rootDir });
 | 
			
		||||
    return true;
 | 
			
		||||
  } catch (_) {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default async function tryGitInit(rootDir: string) {
 | 
			
		||||
  try {
 | 
			
		||||
    await execa('git', ['--version'], { stdio: 'ignore' });
 | 
			
		||||
    if ((await isInGitRepository(rootDir)) || (await isInMercurialRepository(rootDir))) {
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    await execa('git', ['init'], { stdio: 'ignore', cwd: rootDir });
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
  } catch (_) {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user