Skip to content

Commit 2d6b8fe

Browse files
committed
fix(build): avoid overwriting the folder if destDir equals publicDir
1 parent e3b3df7 commit 2d6b8fe

6 files changed

+6
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
| Statements | Branches | Functions | Lines |
99
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
10-
| ![Statements](https://img.shields.io/badge/Coverage-Unknown%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-Unknown%25-brightgreen.svg) | ![Functions](https://img.shields.io/badge/Coverage-Unknown%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-Unknown%25-brightgreen.svg) |
10+
| ![Statements](https://img.shields.io/badge/Coverage-0%25-red.svg) | ![Branches](https://img.shields.io/badge/Coverage-0%25-red.svg) | ![Functions](https://img.shields.io/badge/Coverage-0%25-red.svg) | ![Lines](https://img.shields.io/badge/Coverage-0%25-red.svg) |
1111

1212
Looking for the old CLI extension? [nuxt-laravel](https://github.com/m2sd/nuxt-laravel/tree/legacy).
1313

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ module.exports = {
100100
// rootDir: null,
101101

102102
// A list of paths to directories that Jest should use to search for files in
103-
roots: ['<rootDir>/tests/unit', '<rootDir>/tests/integration'],
103+
roots: ['<rootDir>'],
104104

105105
// Allows you to use a custom runner instead of Jest's default test runner
106106
// runner: "jest-runner",

lib/module.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const laravelModule = function (_moduleOptions) {
181181
logger.info('Generating SPA for laravel...');
182182
// ensure the destination folder exists and overwrite it with the contents from the generation folder
183183
fs_extra_1.default.ensureDirSync(destDir);
184-
fs_extra_1.default.moveSync(generateDir, destDir, { overwrite: true });
184+
fs_extra_1.default.moveSync(generateDir, destDir, { overwrite: destDir !== publicDir });
185185
logger.success(`SPA created in: ${destDir}`);
186186
if (moduleOptions.dotEnvExport &&
187187
fs_extra_1.default.existsSync(path_1.default.join(laravelRoot, '.env'))) {

src/module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ const laravelModule: Module<Options> = function(_moduleOptions) {
279279

280280
// ensure the destination folder exists and overwrite it with the contents from the generation folder
281281
fs.ensureDirSync(destDir)
282-
fs.moveSync(generateDir, destDir, { overwrite: true })
282+
fs.moveSync(generateDir, destDir, { overwrite: destDir !== publicDir })
283283

284284
logger.success(`SPA created in: ${destDir}`)
285285

tsconfig.build.json

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"types": []
77
},
88
"exclude": [
9+
"jest.config.js",
910
"tests/**/*"
1011
]
1112
}

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"esModuleInterop": true
1515
},
1616
"include": [
17+
"jest.config.js",
1718
"src/**/*.ts",
1819
"tests/**/*.ts",
1920
"types/**/*.d.ts"

0 commit comments

Comments
 (0)