Skip to content

Generate Ezvcard type definitions for node-java with TypeScript

License

Notifications You must be signed in to change notification settings

Maxim-Mazurok/ez-vcard-ts-java-types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate Ezvcard type definitions for node-java with TypeScript

Instructions for Windows 10:

  1. Install JDK 14

  2. Install Python 2

  3. Use node v6.17.1 (ts-java won't build on later versions)

  4. Add this to package.json:

    {
      "scripts": {
        "preinstall": "npm run npm-force-resolutions",
        "npm-force-resolutions": "npm-force-resolutions"
      },
      "resolutions": {
        "java": "github:joeferner/node-java#master",
        "find-java-home": "1.1.0"
      }
    }
  5. Remove node_modules and package-lock.json (just in case)

  6. Run npm i npm --save to upgrade to npm which understands package-lock.json

  7. Run npm i --ignore-scripts to generate package-lock.json

  8. Remove node_modules/java and node_modules/ts-java (to force reinstallation and re-running of build scripts)

  9. Run npm i --python=C:\Python27\python.exe

  10. In node_modules\ts-java\lib\ts-java-main.js remove classpath.push(rtJarPath); line. Instead, we'll download and add it to package.json. Make sure that it's a full and not stripped down version, use archive manager to look inside of jar, there should be a lot of folders. Or, grab one from this repo.

    {
      "ts-java": {
        "classpath": "rt.jar"
      }
    }
  11. Run node node_modules\ts-java\bin\ts-java.js and don't wait, go to the next step

  12. Don't wait for ts-java.js to finish, it will never finish for some reason. Instead, look for tsJavaModule.ts file to be created or updated. Once it's there - terminate script.

  13. ???

  14. Profit!

Usage with node-java instructions:

  1. See usage folder

  2. Make sure to replace

    var fullJarPath: string = path.join(__dirname, "", jarPath);
    _java.classpath.push(fullJarPath);

    with

    _java.classpath.push(jarPath);

    in case if you're using absolute paths to your jars.

  3. Don't forget to switch back to the latest NodeJS version (tested on v14.7.0) since we don't have to deal with outdated ts-java sources anymore

  4. Install deps from package.json

  5. Run npx ts-node .\index.ts

About

Generate Ezvcard type definitions for node-java with TypeScript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published