-
Notifications
You must be signed in to change notification settings - Fork 438
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
Folder structure changes to support TypeScript #858
Comments
As a part of this work, we need to change the publish behavior to only deploy contents of the /dist folder. |
Per our discussion today, node_modules should be at the Function App root, not in the dist folder. |
I've been looking at what can be achieved with the code as it currently is and local running/debugging with Typescript and a folder structure similar to above can certainly be done (although there are manual set up steps). As you say, retooling is required to preserve CLI deployment. |
This is irrelevant/complete |
@mbaroody - how did you create your functions? we changed our approach to using the scriptFile property on function.json, which should reference the correct .js output in "dist" (this section has more information). and what are the errors that you're running into? |
@mhoeger sorry for the lack of details. here are the relavant files/outputs here is my folder structure
contents of host.json
contents of src/HttpTrigger/function.json
turns out that the
but
this is a hacky solution, have any other suggestions? |
The main constraint that it looks like you ran into is that "function.json" files have to be in their own individual files one level above the root. Instead of moving the function.json files, you could move. the "host.json" and "local.settings.json" files into src. func commands can then be run with the The TypeScript project template that we settled on (the template that automatically gets generated with VS Code or the func CLI) doesn't bother moving files, but uses the Hope this context is helpful and let me know if things aren't working! |
@mhoeger this is the simplest i've settled on {
"name": "",
"version": "",
"config": {
"buildDir": "dist",
"srcDir": "src",
"azurefunctions_name": "function-app-name"
},
"scripts": {
"build": "tsc",
"postbuild": "copyfiles -u 1 $npm_package_config_srcDir/**/*.json $npm_package_config_srcDir/*.json $npm_package_config_buildDir && copyfiles package.json $npm_package_config_buildDir",
"publish": "npm run test && npm run build && npm install --prefix $npm_package_config_buildDir --production && yes no | func azure functionapp publish $npm_package_config_azurefunctions_name --publish-local-settings --prefix $npm_package_config_buildDir",
"start": "npm run build && func start --script-root $npm_package_config_buildDir",
"test": "jest",
"coverage": "jest --coverage"
}
} thanks! |
Proposed folder structure for TS Apps:
FunctionApp
--/src
----/Function1
------index.ts
------function.json
----host.json
----extensions.csproj
--/dist
----/Function1
------index.js
------function.json
----host.json
----package.json
----/node_modules
----/bin
--local.settings.json
--tsconfig.json
--package.json
Here, /src and /dist will be configurable. Above subject to minor change (hopefully with bundling extension.csproj moves to /bin, for instance.)
The text was updated successfully, but these errors were encountered: