diff --git a/Lombiq.VueJs/Assets/Scripts/helpers/process-helpers.js b/Lombiq.VueJs/Assets/Scripts/helpers/process-helpers.js index acbee4a6..b4b4ba72 100644 --- a/Lombiq.VueJs/Assets/Scripts/helpers/process-helpers.js +++ b/Lombiq.VueJs/Assets/Scripts/helpers/process-helpers.js @@ -1,5 +1,6 @@ -const { handleErrorObject, handleErrorMessage } = require('.nx/scripts/handle-error'); -const path = require('path'); +const fs = require('fs'); +const getProjectDirectory = require('.nx/scripts/get-project-directory'); +const { handleErrorObject, handleErrorMessage, handleWarningMessage } = require('.nx/scripts/handle-error'); async function executeFunctionByCommandLineArgument(functions) { const [functionName, argumentOptionsJson] = process.argv.slice(2); @@ -33,11 +34,19 @@ async function executeFunctionByCommandLineArgument(functions) { } function leaveNodeModule() { - const location = process.cwd().split(path.sep).slice(-2).join('/'); + const projectDirectory = getProjectDirectory(); - // Need to check both because Windows and Linux resolve the directory symlink between the two differently. - if (location === 'node_modules/lombiq-vuejs' || location === 'node_modules/.lv') { - process.chdir(path.resolve('..', '..')); + if (!projectDirectory) { + handleWarningMessage( + 'The project directory is not specified. Your environment may be misconfigured, see ' + + 'get-project-directory for information about what the script is looking for.'); + } + else if (fs.existsSync(projectDirectory)) { + process.chdir(projectDirectory); + } + else { + handleWarningMessage( + `The project directory according to get-project-directory.js (${projectDirectory}) is not found.`); } } diff --git a/Lombiq.VueJs/Assets/Scripts/helpers/vue-sfc-compiler-pipeline.js b/Lombiq.VueJs/Assets/Scripts/helpers/vue-sfc-compiler-pipeline.js index ae21287a..94df5265 100644 --- a/Lombiq.VueJs/Assets/Scripts/helpers/vue-sfc-compiler-pipeline.js +++ b/Lombiq.VueJs/Assets/Scripts/helpers/vue-sfc-compiler-pipeline.js @@ -16,8 +16,8 @@ const { executeFunctionByCommandLineArgument, leaveNodeModule } = require('./pro leaveNodeModule(); const defaultOptions = { - sfcRootPath: path.resolve('Assets', 'Scripts', 'VueComponents'), - sfcDestinationPath: path.resolve('wwwroot', 'vue'), + sfcRootPath: path.join('Assets', 'Scripts', 'VueComponents'), + sfcDestinationPath: path.join('wwwroot', 'vue'), vueJsNodeModulesPath: path.resolve(__dirname, '..', '..', '..', 'node_modules'), rollupAlias: {}, isProduction: false,