File tree Expand file tree Collapse file tree 5 files changed +32
-12
lines changed
Expand file tree Collapse file tree 5 files changed +32
-12
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ const properties = require('properties');
1313import { depVersions } from './utils/dep-versions' ;
1414import { t } from './utils/i18n' ;
1515import { tempDir } from './utils/constants' ;
16+ import { checkLockFiles } from './utils/check-lockfile' ;
17+ import { addGitIgnore } from './utils/add-gitignore' ;
1618
1719let bsdiff ;
1820let hdiff ;
@@ -913,6 +915,9 @@ export const commands = {
913915 platform,
914916 } ) ;
915917
918+ checkLockFiles ( ) ;
919+ addGitIgnore ( ) ;
920+
916921 const bundleParams = await checkPlugins ( ) ;
917922 const sourcemapPlugin = bundleParams . sourcemap ;
918923 const isSentry = bundleParams . sentry ;
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import updateNotifier from 'update-notifier';
55import { printVersionCommand } from './utils' ;
66import pkg from '../package.json' ;
77import { t } from './utils/i18n' ;
8- import { addGitIgnore } from './utils/add-gitignore' ;
98
109updateNotifier ( { pkg } ) . notify ( {
1110 isGlobal : true ,
@@ -33,7 +32,6 @@ const commands = {
3332} ;
3433
3534async function run ( ) {
36- addGitIgnore ( ) ;
3735 await printVersionCommand ( ) ;
3836 if ( process . argv . indexOf ( '-v' ) >= 0 || process . argv [ 2 ] === 'version' ) {
3937 process . exit ( ) ;
Original file line number Diff line number Diff line change 11import fs from 'node:fs' ;
2- import path from 'node:path' ;
2+ // import path from 'node:path';
33import { credentialFile , tempDir } from './constants' ;
44
55export function addGitIgnore ( ) {
66 const shouldIgnore = [ credentialFile , tempDir ] ;
77
8- const gitignorePath = path . join ( process . cwd ( ) , '.gitignore' ) ;
8+ const gitignorePath = '.gitignore' ;
99
1010 if ( ! fs . existsSync ( gitignorePath ) ) {
1111 return ;
@@ -16,7 +16,7 @@ export function addGitIgnore() {
1616 const gitignoreLines = gitignoreContent . split ( '\n' ) ;
1717
1818 for ( const line of gitignoreLines ) {
19- const index = shouldIgnore . indexOf ( line ) ;
19+ const index = shouldIgnore . indexOf ( line . trim ( ) ) ;
2020 if ( index !== - 1 ) {
2121 shouldIgnore . splice ( index , 1 ) ;
2222 }
Original file line number Diff line number Diff line change 1+ import fs from 'node:fs' ;
2+ import { t } from '../../lib/utils/i18n' ;
3+
4+ const lockFiles = [
5+ 'package-lock.json' ,
6+ 'yarn.lock' ,
7+ 'pnpm-lock.yaml' ,
8+ 'bun.lockb' ,
9+ 'bun.lock' ,
10+ ] ;
11+
12+ const existingLockFiles : string [ ] = [ ] ;
13+ export function checkLockFiles ( ) {
14+ for ( const file of lockFiles ) {
15+ if ( fs . existsSync ( file ) ) {
16+ existingLockFiles . push ( file ) ;
17+ }
18+ }
19+ if ( existingLockFiles . length === 0 ) {
20+ console . warn ( t ( 'lockFilesNotFound' ) ) ;
21+ } else if ( existingLockFiles . length > 1 ) {
22+ console . warn ( t ( 'multipleLockFilesFound' ) ) ;
23+ }
24+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments