-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
refactor: remove hand-written index files #5440
Conversation
2edfa24
to
84b2d30
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Here are the steps I performed to verify that this change does not break our source-code editing experience in VS Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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š <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
b88c3d9
to
8608ea7
Compare
The first commit moves
if (require.main === module)
code from/index.js
tosrc/index.ts
. This is a preparation to allow us to remove/index.js
file 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.PORT
line (+undefined
returnsNaN
).I am also slightly changing exports to improve ergonomics - the type
ApplicationOptions
is 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.json
metadata.In the third commit I am updating project templates in
packages/cli
to 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 clean
to remove alldist
foldersVerify 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 test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈