LearnNewsExamplesServices
Frontmatter
id3259
titlebuildScripts/createClass: import paths inside the workspace scope
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 4, 2022, 9:27 AM
updatedAtJul 4, 2022, 12:31 PM
githubUrlhttps://github.com/neomjs/neo/issues/3259
authortobiu
commentsCount4
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 4, 2022, 9:47 AM

buildScripts/createClass: import paths inside the workspace scope

Closed v8.1.0 enhancement
tobiu
tobiu commented on Jul 4, 2022, 9:27 AM

framework related base class imports are missing the node_modules/neo.mjs/src part.

will take a look into this.

tobiu added the enhancement label on Jul 4, 2022, 9:27 AM
tobiu assigned to @tobiu on Jul 4, 2022, 9:27 AM
tobiu
tobiu Jul 4, 2022, 9:38 AM
const
      __dirname   = fileURLToPath(new URL('../', import.meta.url)),
      cwd         = process.cwd(),
      requireJson = path => JSON.parse(fs.readFileSync((path))),
      packageJson = requireJson(path.join(__dirname, 'package.json')),
      insideNeo   = packageJson.name === 'neo.mjs',

we had __dirname = path.resolve() before and this explains, why insideNeo now always stays true which collides with the import paths.

@ThorstenSuckow I guess the change is required for the drop logic, but we need a way to "unbreak" the default mode. i will create a workaround, but it would be appreciated if you could double-check it as well.

tobiu referenced in commit 1707ffc - "buildScripts/createClass: import paths inside the workspace scope #3259" on Jul 4, 2022, 9:46 AM
tobiu
tobiu Jul 4, 2022, 9:47 AM

I kept the packageJson variable as it is, but adjusted the framework check: insideNeo = process.env.npm_package_name === 'neo.mjs',

this should not affect the drop mode.

tobiu closed this issue on Jul 4, 2022, 9:47 AM
ThorstenSuckow
ThorstenSuckow Jul 4, 2022, 12:29 PM

We should probably add more test cases for this in the future. Is the insideNeo an indicator for the location from which the script was executed?

tobiu
tobiu Jul 4, 2022, 12:31 PM

correct. as long as you don't use the name neo.mjs as the package name of your workspace, it is a safe bet.