{"action":"closed","issue":{"url":"https://api.github.com/repos/Azure/autorest.typescript/issues/14","repository_url":"https://api.github.com/repos/Azure/autorest.typescript","labels_url":"https://api.github.com/repos/Azure/autorest.typescript/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/Azure/autorest.typescript/issues/14/comments","events_url":"https://api.github.com/repos/Azure/autorest.typescript/issues/14/events","html_url":"https://github.com/Azure/autorest.typescript/issues/14","id":279109864,"number":14,"title":"Generated files seems to contain incorrect file names/paths","user":{"login":"andrew-buckley","id":14007220,"avatar_url":"https://avatars2.githubusercontent.com/u/14007220?v=4","gravatar_id":"","url":"https://api.github.com/users/andrew-buckley","html_url":"https://github.com/andrew-buckley","followers_url":"https://api.github.com/users/andrew-buckley/followers","following_url":"https://api.github.com/users/andrew-buckley/following{/other_user}","gists_url":"https://api.github.com/users/andrew-buckley/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew-buckley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew-buckley/subscriptions","organizations_url":"https://api.github.com/users/andrew-buckley/orgs","repos_url":"https://api.github.com/users/andrew-buckley/repos","events_url":"https://api.github.com/users/andrew-buckley/events{/privacy}","received_events_url":"https://api.github.com/users/andrew-buckley/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-12-04T19:01:24Z","updated_at":"2018-04-13T00:02:16Z","closed_at":"2018-04-13T00:02:16Z","author_association":"MEMBER","body":"When generating a client using: `autorest --typescript --output-folder=./ --input-file=./iothub.json  --generate-metadata=true --typescript.azure-arm=\r\ntrue` I end up having to make several changes before I can successfully run `npm run-script build`.\r\n\r\nThe first error I get is this:\r\n```\r\nnpm run-script build\r\n\r\n> @ build F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\r\n> npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js\r\n\r\nerror TS5058: The specified path does not exist: 'tsconfig.node.json'.\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! @ build: `npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js`\r\nnpm ERR! Exit status 1\r\nnpm ERR!\r\nnpm ERR! Failed at the @ build script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     C:\\Users\\andbuc\\AppData\\Roaming\\npm-cache\\_logs\\2017-12-04T18_54_27_484Z-debug.log\r\n```\r\n\r\nLooking at the generated output, neither 'tsconfig.node.json' nor 'tsconfig.browser.json' exist. Only 'tsconfig.json' exists. So after making this change to the 'tsc' script in the 'package.json' file I get this:\r\n```\r\nnpm run-script build\r\n\r\n> @ build F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\r\n> npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js\r\n\r\ntsconfig.json(19,20): error TS5024: Compiler option 'declaration' requires a value of type boolean.\r\nerror TS18003: No inputs were found in config file 'F:/Projects/Ecosystem/azure-rest-api-specs/specification/iothub/resource-manager/Microsoft.Devices/2017-07-01/tsconfig.json'. Specified 'include' paths were '[\"./lib/**/*.ts\",\"./test/**/*.ts\"]' and 'exclude' paths were '[\"node_modules\"]'.\r\ntsconfig.json(19,5): error TS5052: Option 'declarationDir' cannot be specified without specifying option 'declaration'.\r\ntsconfig.json(20,5): error TS5052: Option 'declarationDir' cannot be specified without specifying option 'declaration'.\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 2\r\nnpm ERR! @ build: `npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js`\r\nnpm ERR! Exit status 2\r\nnpm ERR!\r\nnpm ERR! Failed at the @ build script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     C:\\Users\\andbuc\\AppData\\Roaming\\npm-cache\\_logs\\2017-12-04T18_54_55_385Z-debug.log\r\n```\r\n\r\nIn order to fix the above, the following changes were necessary in the 'tsconfig.json' file:\r\n\r\n1. Change `\"declaration\": \"true\"` to `\"declaration\": true`\r\n2. Change the `\"include\"` array to have the correct directory of the generated TS files (it currently points to `\"./lib/**/*.ts\", \"./test/**/*.ts\"`.\r\n\r\nNext, I get the following:\r\n```\r\nnpm run-script build\r\n\r\n> @ build F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\r\n> npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js\r\n\r\nHash: 9f83505885a3f824ef10\r\nVersion: webpack 3.10.0\r\nTime: 32ms\r\n\r\nERROR in Entry module not found: Error: Can't resolve './lib/iotHubClient.ts' in 'F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01'\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 2\r\nnpm ERR! @ build: `npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js`\r\nnpm ERR! Exit status 2\r\nnpm ERR!\r\nnpm ERR! Failed at the @ build script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     C:\\Users\\andbuc\\AppData\\Roaming\\npm-cache\\_logs\\2017-12-04T18_56_48_028Z-debug.log\r\n```\r\n\r\nIn order to fix ths above, the following changes were necessary in the 'webpack.config.js' file:\r\n\r\n1. Change `entry: './lib/iotHubClient.ts'` to `entry: './output/iotHubClient.ts'`\r\n\r\nNext, I get the following:\r\n```\r\nnpm run-script build\r\n\r\n> @ build F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\r\n> npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js\r\n\r\nts-loader: Using typescript@2.6.2 and F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\\tsconfig.json\r\nHash: 789ccfc2de768b8c2696\r\nVersion: webpack 3.10.0\r\nTime: 3554ms\r\n                                     Asset       Size  Chunks                    Chunk Names\r\n                     iotHubClientBundle.js     365 kB       0  [emitted]  [big]  main\r\n                 iotHubClientBundle.js.map     681 kB       0  [emitted]         main\r\n             typings\\lib\\iotHubClient.d.ts    2.19 kB          [emitted]\r\n             typings\\lib\\models\\index.d.ts    39.3 kB          [emitted]\r\n           typings\\lib\\models\\mappers.d.ts      58 kB          [emitted]\r\n  typings\\lib\\operations\\certificates.d.ts    18.4 kB          [emitted]\r\n         typings\\lib\\operations\\index.d.ts  194 bytes          [emitted]\r\ntypings\\lib\\operations\\iotHubResource.d.ts    77.5 kB          [emitted]\r\n    typings\\lib\\operations\\operations.d.ts    4.11 kB          [emitted]\r\n   [0] ./output/models/mappers.ts 60.8 kB {0} [built]\r\n   [3] ./output/iotHubClient.ts 3.68 kB {0} [built]\r\n   [4] ./output/models/index.ts 232 bytes {0} [built]\r\n   [5] ./output/operations/index.ts 538 bytes {0} [built]\r\n   [6] ./output/operations/operations.ts 14.2 kB {0} [built]\r\n   [7] ./output/operations/iotHubResource.ts 223 kB {0} [built]\r\n   [8] ./output/operations/certificates.ts 59.5 kB {0} [built]\r\n    + 2 hidden modules\r\nERROR: ENOENT: no such file or directory, open 'F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\\bundle.js'\r\n    at Object.fs.openSync (fs.js:646:18)\r\n    at Object.fs.readFileSync (fs.js:551:33)\r\n    at read_file (F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\\node_modules\\uglify-es\\bin\\uglifyjs:320:19)\r\n    at F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\\node_modules\\uglify-es\\bin\\uglifyjs:167:37\r\n    at Array.forEach (<anonymous>)\r\n    at Object.<anonymous> (F:\\Projects\\Ecosystem\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\Microsoft.Devices\\2017-07-01\\node_modules\\uglify-es\\bin\\uglifyjs:166:31)\r\n    at Module._compile (module.js:635:30)\r\n    at Object.Module._extensions..js (module.js:646:10)\r\n    at Module.load (module.js:554:32)\r\n    at tryModuleLoad (module.js:497:12)\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! @ build: `npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js`\r\nnpm ERR! Exit status 1\r\nnpm ERR!\r\nnpm ERR! Failed at the @ build script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     C:\\Users\\andbuc\\AppData\\Roaming\\npm-cache\\_logs\\2017-12-04T18_58_48_219Z-debug.log\r\n```\r\n\r\nIn order to fix ths above, the following changes were necessary in the 'package.json' file:\r\n\r\n1. Change `\"build\": \"npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o bundle.min.js bundle.js\"` to `\"build\": \"npm -s run-script tsc && webpack && node node_modules/uglify-es/bin/uglifyjs --source-map -c -m -o iotHubClientBundle.min.js iotHubClientBundle.js\"`\r\n\r\nOnly then am I able to get `npm run-script build` to complete successfully and produce a bundled typescript sdk for Azure ARM."}}
{"actor":{"display_login":"RikkiGibson"}}