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

Fix modules resolution #118

Merged
merged 3 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions openrewrite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ To be able to make changes to both these projects and make sure that they work t
1. Start by cloning both `openrewrite/rewrite-javascript` (this repo) and `moderneinc/rewrite-remote`
2. For both repos perform the following steps:
1. Run the build using `npm run build`
2. Copy the `package.json` file to the `dist` folder
3. Go into the `dist` folder and run `npm link`
4. This last step only needs to be done once
2. Run `npm link`. This last step only needs to be done once
3. Now `npm link` needs to be run in either project to link it into `node_modules`:
1. For `openrewrite/rewrite-javascript` run `npm link @openrewrite/rewrite-remote`
2. For `moderneinc/rewrite-remote` run `npm link @openrewrite/rewrite`
Expand Down
2 changes: 1 addition & 1 deletion openrewrite/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'^@openrewrite/rewrite/(.*)$': '<rootDir>/dist/$1',
'^@openrewrite/rewrite-remote(.*)$': '<rootDir>/node_modules/@openrewrite/rewrite-remote$1'
'^@openrewrite/rewrite-remote(.*)$': '<rootDir>/node_modules/@openrewrite/rewrite-remote/dist$1'
},
transform: {
'^.+\\.tsx?$': ['ts-jest', {
Expand Down
5 changes: 3 additions & 2 deletions openrewrite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions openrewrite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@
"license": "Apache-2.0",
"description": "OpenRewrite implementation for JavaScript.",
"homepage": "https://github.com/openrewrite/rewrite-javascript",
"main": "index.js",
"types": "index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": "./index.js",
"./core": "./core/index.js",
"./java": "./java/index.js",
"./java/tree": "./java/tree/index.js",
"./javascript": "./javascript/index.js",
"./javascript/tree": "./javascript/tree/index.js",
"./json": "./json/index.js",
"./yaml": "./yaml/index.js",
"./yaml/tree": "./yaml/tree/index.js"
".": "./dist/index.js",
"./core": "./dist/core/index.js",
"./java": "./dist/java/index.js",
"./java/tree": "./dist/java/tree/index.js",
"./javascript": "./dist/javascript/index.js",
"./javascript/tree": "./dist/javascript/tree/index.js",
"./json": "./dist/json/index.js",
"./yaml": "./dist/yaml/index.js",
"./yaml/tree": "./dist/yaml/tree/index.js"
},
"scripts": {
"build": "tsc --build tsconfig.build.json",
"postbuild": "cp package.json dist",
"dev": "tsc --watch -p tsconfig.json",
"test": "jest"
},
Expand Down
2 changes: 1 addition & 1 deletion openrewrite/test/javascript/testHarness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as J from "../../dist/java/tree";
import * as JS from "../../dist/javascript/tree";
import dedent from "dedent";
import {ReceiverContext, RemotePrinterFactory, RemotingContext, SenderContext} from "@openrewrite/rewrite-remote";
import * as deser from "@openrewrite/rewrite-remote/java/serializers";
import * as deser from "@openrewrite/rewrite-remote/java";
import {JavaScriptReceiver, JavaScriptSender} from "@openrewrite/rewrite-remote/javascript";
import net from "net";
import {JavaScriptParser, JavaScriptVisitor} from "../../dist/javascript";
Expand Down
5 changes: 3 additions & 2 deletions openrewrite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"module": "Node16",
"sourceMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"rootDir": "./src",
"outDir": "./dist",
"experimentalDecorators": true
"experimentalDecorators": true,
"moduleResolution": "node16"
},
"include": ["src/**/*"],
}