Dmitry Masanov
01/19/2021, 1:12 PMstalbert
01/19/2021, 1:26 PMDmitry Masanov
01/19/2021, 1:30 PMstalbert
01/19/2021, 1:32 PMdeploy.xml
stalbert
01/19/2021, 1:32 PMstalbert
01/19/2021, 1:33 PMDmitry Masanov
01/19/2021, 1:34 PMstalbert
01/19/2021, 1:34 PMstalbert
01/19/2021, 1:34 PMstalbert
01/19/2021, 1:34 PMDmitry Masanov
01/19/2021, 1:35 PMDmitry Masanov
01/19/2021, 1:36 PMstalbert
01/19/2021, 1:36 PMDmitry Masanov
01/19/2021, 1:37 PMstalbert
01/19/2021, 1:38 PMstalbert
01/19/2021, 1:39 PMstalbert
01/19/2021, 1:40 PMlib
section may need to be updated if you are using bulit-ins from newer ECMAScript versionsDmitry Masanov
01/19/2021, 1:44 PMDmitry Masanov
01/19/2021, 1:59 PMimport * as log from "N/log"
When I try to compile the file I get:
libs % tsc Logger.ts
Logger.ts522 - error TS2307: Cannot find module ‘N/log’ or its corresponding type declarations.
5 import * as log from “N/log”stalbert
01/19/2021, 2:05 PMpaths
section of tsconfig.json. It's assuming you have done npm install
beforehandDmitry Masanov
01/19/2021, 2:05 PMstalbert
01/19/2021, 2:05 PMDmitry Masanov
01/19/2021, 2:08 PMstalbert
01/19/2021, 2:08 PMstalbert
01/19/2021, 2:09 PMstalbert
01/19/2021, 2:09 PMnode_modules/.bin/tsc
stalbert
01/19/2021, 2:09 PMDmitry Masanov
01/19/2021, 2:12 PMstalbert
01/19/2021, 2:12 PMtsc
without passing the filenameDmitry Masanov
01/19/2021, 2:13 PMstalbert
01/19/2021, 2:14 PMallowjs:true
option in tsconfig.jsonstalbert
01/19/2021, 2:16 PMtsc
it compiles ONLY the files you pass on the command line - which will only succeed if you have no dependencies in your source file at all. In your case you do have dependencies (on N/log for example) so it fails to find definitions for that... since all you gave the compiler was the Logger.ts
file alone.stalbert
01/19/2021, 2:16 PMtsc
without a file argument, it uses tsconfig.json
to drive which files are including in the compilation.Dmitry Masanov
01/19/2021, 2:17 PMstalbert
01/19/2021, 2:17 PMstalbert
01/19/2021, 2:18 PMDmitry Masanov
01/19/2021, 2:19 PMstalbert
01/19/2021, 2:20 PMts-jest
I let it do most of the workDmitry Masanov
01/19/2021, 2:21 PMDmitry Masanov
01/19/2021, 2:21 PMstalbert
01/19/2021, 2:22 PMDmitry Masanov
01/19/2021, 2:23 PMstalbert
01/19/2021, 2:23 PMstalbert
01/19/2021, 2:24 PMDmitry Masanov
01/19/2021, 2:24 PMstalbert
01/19/2021, 2:24 PMstalbert
01/19/2021, 2:24 PMjest.fn()
stalbert
01/19/2021, 2:25 PMlog.js
under __mocks__
stalbert
01/19/2021, 2:25 PMDmitry Masanov
01/19/2021, 2:26 PMstalbert
01/19/2021, 2:28 PMstalbert
01/19/2021, 2:29 PMDmitry Masanov
01/19/2021, 2:30 PMstalbert
01/19/2021, 2:30 PMsave()
method does need a little jest.fn()
but the rest is just a plain object literal. It makes setting up test data easier and more clear (imho)Dmitry Masanov
01/19/2021, 2:31 PM__mocks__.N.logs.js
Dmitry Masanov
01/19/2021, 2:31 PMExtendApps Inc.
01/19/2021, 2:33 PMDmitry Masanov
01/19/2021, 2:34 PMDmitry Masanov
01/19/2021, 2:36 PMstalbert
01/19/2021, 3:05 PMExtendApps Inc.
01/19/2021, 3:11 PMstalbert
01/19/2021, 3:16 PMDmitry Masanov
01/19/2021, 3:18 PMRehan Ali
01/19/2021, 3:29 PMRoc127
01/19/2021, 10:08 PMDmitry Masanov
01/20/2021, 11:43 AMDmitry Masanov
01/21/2021, 12:32 PM{
"compilerOptions": {
"allowJs": false,
"strictNullChecks": true,
"module": "umd",
"moduleResolution": "node",
"target": "ES2018",
"sourceMap": false,
"newLine": "LF",
"experimentalDecorators": true,
"baseUrl": "./",
"outDir": "src/FileCabinet/SuiteScripts/SecondProject",
"lib":["es5","es2015.promise", "dom"],
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
"N/*": [
"node_modules/@hitc/netsuite-types/N/*"
],
"libs/*": [
"../libs/*"
],
}
},
"exclude":[
"node_modules", "__mocks__"],
}
Dmitry Masanov
01/21/2021, 12:38 PMDmitry Masanov
01/21/2021, 12:39 PMstalbert
01/21/2021, 1:39 PMoutDir
?Dmitry Masanov
01/21/2021, 1:41 PM"outDir": "src/FileCabinet/SuiteScripts/SecondProject",
stalbert
01/21/2021, 1:44 PMDmitry Masanov
01/21/2021, 1:47 PMstalbert
01/21/2021, 1:48 PM"outDir": "."
?stalbert
01/21/2021, 1:48 PMDmitry Masanov
01/21/2021, 1:49 PMstalbert
01/21/2021, 1:50 PMgulp
or similar.Dmitry Masanov
01/21/2021, 1:50 PMstalbert
01/21/2021, 1:53 PMDmitry Masanov
01/21/2021, 1:54 PMDmitry Masanov
01/21/2021, 1:58 PMDmitry Masanov
01/21/2021, 2:12 PMDmitry Masanov
01/21/2021, 2:37 PMstalbert
01/21/2021, 2:44 PMDmitry Masanov
01/21/2021, 2:45 PMstalbert
01/21/2021, 2:46 PMstalbert
01/21/2021, 2:48 PMDmitry Masanov
01/21/2021, 2:48 PMstalbert
01/21/2021, 2:49 PMdeploy.xml
over the lifespan of different effortsDmitry Masanov
01/21/2021, 2:50 PMstalbert
01/21/2021, 2:50 PMstalbert
01/21/2021, 2:54 PMrelease-foo
will have deploy.xml configured exactly as needed for that particular release). This has been a compromise to keep our SDF project count small and usually stick with a simple single deploy.xml that just evolves over time. At any point in time deploy.xml only contains a small subset of the total - only those artifacts needing deployment for a specific effort/customization.stalbert
01/21/2021, 2:55 PMstalbert
01/21/2021, 2:56 PMDmitry Masanov
01/21/2021, 2:57 PMstalbert
01/21/2021, 2:57 PMtsconfig.json
files around, you might want to take advantage of the inheritance feature so that you can define common properties in a top level tsconfig.json
and others can just define what they need.stalbert
01/21/2021, 2:58 PMDmitry Masanov
01/21/2021, 2:59 PMstalbert
01/21/2021, 3:00 PMstalbert
01/21/2021, 3:01 PMstalbert
01/21/2021, 3:02 PMstalbert
01/21/2021, 3:03 PMstalbert
01/21/2021, 3:04 PMDmitry Masanov
01/21/2021, 3:11 PMstalbert
01/21/2021, 3:50 PMstalbert
01/21/2021, 3:51 PMDmitry Masanov
01/21/2021, 3:54 PMstalbert
01/21/2021, 3:56 PMDmitry Masanov
01/21/2021, 3:57 PMstalbert
01/21/2021, 3:59 PMobject:import
- sure - that's the easiest way to get things into the project AFAIK. In fact, that's one of the commands where I tend to use the webstorm plugin because it provides a more pleasant UI for searching/importing