oracle / netsuite-suitecloud-sdk

SuiteCloud Software Development Kit (SuiteCloud SDK) are the set of tools that allow you to customize accounts and create SuiteApps through SuiteCloud Development Framework (SDF).
https://www.netsuite.com/
Universal Permissive License v1.0
201 stars 62 forks source link

[FR] Add compatiblity with transpilers. #671

Open gabrielgortabns opened 1 year ago

gabrielgortabns commented 1 year ago

Let say, I have transpiler, that transform some code in ./src/ directory to other code in ./build/ directory. It would be nice, to be able to trigger upload from ./src/ directory, that would upload transpiled version of code.

Possible solution:

Configuration/setting where user can specify that if they trigger upload in ./src/FileCabined/SuiteScripts/sample.ts it will upload ./build/FileCabined/SuiteScripts/sample.js... it could be defined via regex, or syntax like:

{
    "source": ["src/**/*.ts", "src/**/*.js"]
    "build": ["build/**/*.js"]
}

or function:

function pathUpdate(path) {
    return path.replace(/^build/, "src").replace(/.ts$/, ".js");
}

that can be part of suitecloud.config.js.

Rvice commented 1 year ago

Have you tried doing this via the tsconfig file? Create a base tsconfig.json then create your separate build ones

  "extends": "./tsconfig.json",
  "compilerOptions": {
    "paths": {
      "N": ["node_modules/@hitc/netsuite-types/N"],
      "N/*": ["node_modules/@hitc/netsuite-types/N/*"],
      "SuiteScripts/*": ["../SuiteScripts/*"]
    },
    "outDir": "./src/FileCabinet/SuiteScripts",
  },
  "exclude": [
    "node_modules",
        ... Other files/folders exclude from this build
   ]

then in your package file something like

    "build": "npm run build-scripts && npm run build-test",
    "build-scripts": "tsc -p tsconfig.build.json",
    "build-test": "tsc -p tsconfig.tests.json",
gabrielgortabns commented 1 year ago

yes but the issue is that while source files are in ./src/ files, and build files are in ./build/, I want to be able to execute for example command suitecloud.uploadfile without need to opening ./build/ folder (those are two different folders, but even if, I still can't execute upload in .ts file, bcs it would upload that TS file, not compiled JS version). RN, I must navigate to ./build/ as in ./src/ it throws error:

The file to upload should be in a supported folder inside the FileCabinet folder. For information about the supported folders, see https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4724963992.html.

also this doesn't help, as in my case, I also change some other parts of path to file.