Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-430: Fix PNPM link error and reapply #103 #109

Merged
merged 8 commits into from
Jan 29, 2024
21 changes: 15 additions & 6 deletions Lombiq.VueJs/Assets/Scripts/helpers/process-helpers.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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.`);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down