refactor: remove hand-written index files #5440
Conversation
2edfa24 to
84b2d30
Compare
agnes512
left a comment
There was a problem hiding this comment.
👍
Here are the steps I performed to verify that this change does not break our source-code editing experience in VS Code
raymondfeng
left a comment
There was a problem hiding this comment.
I tried on VScode. It seems to be working.
|
@bajtos Please investigate why CI is failing. |
84b2d30 to
d74b237
Compare
d74b237 to
834d6cd
Compare
Done in 834d6cd. I searched for all occurrences of the string |
These failures are weird, I am not able to reproduce them in my working copy. I had to follow up the exact steps performed by Travis CI (starting from 2e32364 is fixing the problem. Strangely enough, after fixing Mocha failures, I see linting errors now, in code that seem to be unrelated to my changes 😠 |
|
Possibly related: typescript-eslint/typescript-eslint#1573 |
I think this problem is caused by our |
67c8beb to
07b499e
Compare
|
I tried to configure |
07b499e to
b88c3d9
Compare
|
@raymondfeng I added three new commits, PTAL:
I am not very happy about b88c3d9, but then it's affecting only one of the parallel jobs on CI, so it shouldn't make things any worse. I have some ideas how to improve our eslint setup so that the build step is hopefully not needed, but I prefer to leave them out of scope of this pull request and explore them after this PR is landed. |
Use `package.json` metadata like `main`, `server` and `types` to redirect package consumers to `dist/index.js` and `dist/index.d.ts` instead. - This is the first commit where I am moving logic from `/index.js` to `src/index.js` only. Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
b88c3d9 to
8608ea7
Compare

The first commit moves
if (require.main === module)code from/index.jstosrc/index.ts. This is a preparation to allow us to remove/index.jsfile entirely. It leaves the repository in a broken state, but that's fine because the next commit fixes the problem and will be squashed into this one before landing.This change has a nice benefit that it enables TypeScript compiler checks for the code building app config, it discovered a possible problem in
+process.env.PORTline (+undefinedreturnsNaN).I am also slightly changing exports to improve ergonomics - the type
ApplicationOptionsis exported together with the main application class, so that consumers don't need to import the options from@loopback/context.In the next step, I am committing the outcome of running an automated script (see https://gist.github.com/bajtos/68672a8229bd03fddad5a4ad1442061f) to remove top-level index files and update
package.jsonmetadata.In the third commit I am updating project templates in
packages/clito match the new style.Finally I am updating documentation, tutorials and README files in
example/*.Resolves #2613, resolves #2609
Verification
Here are the steps I performed to verify that this change does not break our source-code editing experience in VS Code:
Run
npm run cleanto remove alldistfoldersVerify that VSCode is still able to understand relations between source code artifacts defined in one package (e.g.
context) and used elsewhere (e.g.example-todo), as described in https://github.com/strongloop/loopback-next/blob/master/docs/site/VSCODE.md:Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated👉 Check out how to submit a PR 👈