You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, a {N} project has to follow a few conventions in order to be built with {N} CLI. For example, the source code should be in a folder named app, the application resources should be in app/App_Resources and so on.
The project structure should be configurable per project. For example, a project can have a .tns-cli.json file inside the project where the following can be specified:
This is particularly important when building apps with Angular 5. The package @angular/common contains localization files (~17Mb) which will get deployed on the device even if they are not used.
Both paths must be relative to the project root(where the "package.json" file and "platforms" directory are located) in order everything to work as expected.
If appResourcesPath is omitted the CLI will assume that they are at their default location - folder called App_Resources inside the folder containing the rest of the app files.
If appPath is omitted CLI will assume the application files are located inside a folder called "app" inside the project folder.
Examples:
Lets say the project is located at "/d/work/myapplication".
1 "nsconfig.json" content:
{
"appPath": "test/src"
}
Will result in app located at "/d/work/myapplication/test/src" and resources located at "/d/work/myapplication/test/src/App_Resources".
2 "nsconfig.json" content:
{
"appResourcesPath": "resources"
}
Will result in app located at "/d/work/myapplication/app" and resources located at "/d/work/myapplication/resources".
Will result in app located at "/d/work/myapplication/test/src" and resources located at "/d/work/myapplication/resources".
4 If no "nsconfig.json" file is present the app folder will be "/d/work/myapplication/app" and resources folder will be at "/d/work/myapplication/app/App_Resources"
The option folders/files to be included/excluded in the app and to be watched during livesync (related to #887) is still not implemented. Its discussion/implementation is moved in the separate issue.
Still does not work for me. It seems like the nsconfig.json has no effect:
It seems like it still searches for the default app folder
Error: ENOENT: no such file or directory, lstat '/Volumes/Storage/Git/midday/apps/mobile/app'
at Object.fs.lstatSync (fs.js:961:11)
at Object.module.exports.parseDir (/Volumes/Storage/Git/midday/apps/mobile/node_modules/sass-graph/sass-graph.js:153:10)
at Object.watcher.reset (/Volumes/Storage/Git/midday/apps/mobile/node_modules/node-sass/lib/watcher.js:17:21)
at watch (/Volumes/Storage/Git/midday/apps/mobile/node_modules/node-sass/bin/node-sass:254:20)
at run (/Volumes/Storage/Git/midday/apps/mobile/node_modules/node-sass/bin/node-sass:313:5)
at Object.<anonymous> (/Volumes/Storage/Git/midday/apps/mobile/node_modules/node-sass/bin/node-sass:397:3)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
It seems that nativescript-dev-sass plugin is throwing an exception. Could you please verify that you are using the latest version of nativescript-dev-sass - 1.3.6. There were some modifications to the plugin to support projects with nsconfig.json. I apologize that I forgot to include this in the initial feature description.
You will also need the RC versions of NativeScript CLI and Android Runtime.
I am glad that everything worked as expected. Most probably the full re-install was necessary for the recreation of the hooks of the plugins (they contain some changes for supporting nsconfig.json).
Not sure where I'm going wrong. I'm not well versed with NS-CLI. I have nsconfig.json that looks like this { "appPath": "build", "appResourcesPath": "build/App_Resources" }
when I to build it I get the following error
ERROR in app/vendor.ts(2,7): error TS2451: Cannot redeclare block-scoped variable 'application'. app/vendor.ts(4,7): error TS2451: Cannot redeclare block-scoped variable 'appCssContext'. build/vendor.ts(2,7): error TS2451: Cannot redeclare block-scoped variable 'application'. build/vendor.ts(4,7): error TS2451: Cannot redeclare block-scoped variable 'appCssContext'.
Not sure why CLI is using the app folder.
Activity
dolanmiu commentedon Feb 18, 2018
Agreed.
I like to have my projects under
src/app, just like how@angular/clidoes itKristianDD commentedon Mar 19, 2018
Currently a file named "nsconfig.json" will be respected. The valid values inside it are as follows:
Both paths must be relative to the project root(where the "package.json" file and "platforms" directory are located) in order everything to work as expected.
If
appResourcesPathis omitted the CLI will assume that they are at their default location - folder called App_Resources inside the folder containing the rest of the app files.If
appPathis omitted CLI will assume the application files are located inside a folder called "app" inside the project folder.Examples:
Lets say the project is located at "/d/work/myapplication".
1 "nsconfig.json" content:
Will result in app located at "/d/work/myapplication/test/src" and resources located at "/d/work/myapplication/test/src/App_Resources".
2 "nsconfig.json" content:
Will result in app located at "/d/work/myapplication/app" and resources located at "/d/work/myapplication/resources".
3 "nsconfig.json" content:
Will result in app located at "/d/work/myapplication/test/src" and resources located at "/d/work/myapplication/resources".
4 If no "nsconfig.json" file is present the app folder will be "/d/work/myapplication/app" and resources folder will be at "/d/work/myapplication/app/App_Resources"
The option folders/files to be included/excluded in the app and to be watched during livesync (related to #887) is still not implemented. Its discussion/implementation is moved in the separate issue.
dolanmiu commentedon Mar 30, 2018
Still does not work for me. It seems like the
nsconfig.jsonhas no effect:It seems like it still searches for the default app folder
My
nsconfig.jsonis:KristianDD commentedon Apr 2, 2018
Hi @dolanmiu,
It seems that
nativescript-dev-sassplugin is throwing an exception. Could you please verify that you are using the latest version ofnativescript-dev-sass- 1.3.6. There were some modifications to the plugin to support projects withnsconfig.json. I apologize that I forgot to include this in the initial feature description.You will also need the RC versions of NativeScript CLI and Android Runtime.
dolanmiu commentedon Apr 3, 2018
I am using
nativescript-dev-sass1.3.2I am using a mac and only got iOS setup at the moment, would that be a problem?
KristianDD commentedon Apr 4, 2018
Hi @dolanmiu,
Having only iOS setup is a valid option and you should not have any problems.
Is your project working normally with
nsconfig.jsonwhen you updatenativescript-dev-sassto1.3.6and NativeScript CLI torctag?dolanmiu commentedon Apr 8, 2018
Thanks, setting
nativescript-dev-sassto1.3.6andnativescripttorcseems to workI had weird installation issues though, I had to delete
node_modulesand fully re-installKristianDD commentedon Apr 16, 2018
Hi @dolanmiu,
I am glad that everything worked as expected. Most probably the full re-install was necessary for the recreation of the hooks of the plugins (they contain some changes for supporting
nsconfig.json).Thank you for trying this feature.
slolam commentedon May 10, 2018
Hi,
Not sure where I'm going wrong. I'm not well versed with NS-CLI. I have nsconfig.json that looks like this
{ "appPath": "build", "appResourcesPath": "build/App_Resources" }when I to build it I get the following error
ERROR in app/vendor.ts(2,7): error TS2451: Cannot redeclare block-scoped variable 'application'. app/vendor.ts(4,7): error TS2451: Cannot redeclare block-scoped variable 'appCssContext'. build/vendor.ts(2,7): error TS2451: Cannot redeclare block-scoped variable 'application'. build/vendor.ts(4,7): error TS2451: Cannot redeclare block-scoped variable 'appCssContext'.Not sure why CLI is using the app folder.
tns version: 4.0.0
Thanks in anticpation.
dolanmiu commentedon Nov 20, 2018
Another request,
Is it possible to add
buildPathtonsconfig.json?So that, we can do:
"buildPath": "dist", just like how@angular/clidoes it?Yes, a solution would be to hide the built files etc in VSCode, but it does not seem ideal.