Frontmatter
| id | 3259 |
| title | buildScripts/createClass: import paths inside the workspace scope |
| state | Closed |
| labels | enhancement |
| assignees | tobiu |
| createdAt | Jul 4, 2022, 9:27 AM |
| updatedAt | Jul 4, 2022, 12:31 PM |
| githubUrl | https://github.com/neomjs/neo/issues/3259 |
| author | tobiu |
| commentsCount | 4 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jul 4, 2022, 9:47 AM |
buildScripts/createClass: import paths inside the workspace scope

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.

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.

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?

correct. as long as you don't use the name neo.mjs as the package name of your workspace, it is a safe bet.
framework related base class imports are missing the
node_modules/neo.mjs/srcpart.will take a look into this.