File tree 5 files changed +32
-12
lines changed
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');
13
13
import { depVersions } from './utils/dep-versions' ;
14
14
import { t } from './utils/i18n' ;
15
15
import { tempDir } from './utils/constants' ;
16
+ import { checkLockFiles } from './utils/check-lockfile' ;
17
+ import { addGitIgnore } from './utils/add-gitignore' ;
16
18
17
19
let bsdiff ;
18
20
let hdiff ;
@@ -913,6 +915,9 @@ export const commands = {
913
915
platform,
914
916
} ) ;
915
917
918
+ checkLockFiles ( ) ;
919
+ addGitIgnore ( ) ;
920
+
916
921
const bundleParams = await checkPlugins ( ) ;
917
922
const sourcemapPlugin = bundleParams . sourcemap ;
918
923
const isSentry = bundleParams . sentry ;
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import updateNotifier from 'update-notifier';
5
5
import { printVersionCommand } from './utils' ;
6
6
import pkg from '../package.json' ;
7
7
import { t } from './utils/i18n' ;
8
- import { addGitIgnore } from './utils/add-gitignore' ;
9
8
10
9
updateNotifier ( { pkg } ) . notify ( {
11
10
isGlobal : true ,
@@ -33,7 +32,6 @@ const commands = {
33
32
} ;
34
33
35
34
async function run ( ) {
36
- addGitIgnore ( ) ;
37
35
await printVersionCommand ( ) ;
38
36
if ( process . argv . indexOf ( '-v' ) >= 0 || process . argv [ 2 ] === 'version' ) {
39
37
process . exit ( ) ;
Original file line number Diff line number Diff line change 1
1
import fs from 'node:fs' ;
2
- import path from 'node:path' ;
2
+ // import path from 'node:path';
3
3
import { credentialFile , tempDir } from './constants' ;
4
4
5
5
export function addGitIgnore ( ) {
6
6
const shouldIgnore = [ credentialFile , tempDir ] ;
7
7
8
- const gitignorePath = path . join ( process . cwd ( ) , '.gitignore' ) ;
8
+ const gitignorePath = '.gitignore' ;
9
9
10
10
if ( ! fs . existsSync ( gitignorePath ) ) {
11
11
return ;
@@ -16,7 +16,7 @@ export function addGitIgnore() {
16
16
const gitignoreLines = gitignoreContent . split ( '\n' ) ;
17
17
18
18
for ( const line of gitignoreLines ) {
19
- const index = shouldIgnore . indexOf ( line ) ;
19
+ const index = shouldIgnore . indexOf ( line . trim ( ) ) ;
20
20
if ( index !== - 1 ) {
21
21
shouldIgnore . splice ( index , 1 ) ;
22
22
}
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