How to change path for build project in angular? - build

Here my project name is angulardemo so I build project using this command
ng build --prod --base-href /angulardemo/
so this command build project and create dist folder and inside dist folder create anglulardemo named folder and inside angulardemo folder create below files
3rdpartylicenses.txt
favicon.ico
index.html
main.95e7fd4eb2e659e65554.js
polyfills.1ef83d22ada557f4a131.js
runtime.ec2944dd8b20ec099bf3.js
styles.3ff695c00d717f2d2a11.css
but I want to create this files directly in dist folder don't want create angulardemo folder inside dist folder how It is possible ?

You can change output path in angular.json
{
"projects": {
"my-app-name": {
"architect": {
"options": {
"outputPath": "dist", <-----here

With the new version of angular (v6+) and the angular CLI it goes inside the dist directory/yourproject by default.
Although you can change build options inside angular.json:
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",

Related

Bazel project how to copy candidate directories during build stage

I have a cpp project with the later file struct
MyProject
WORKSPACE
-directory_a
—mylib.cpp
—interface.h
—BUILD
-directory_b
—mylib.cpp
—interface.h
—BUILD
—directoryC
—main.cpp
—BUILD
In main.cpp , the I have a simple include code as
#include directory_real/interface.h
// do something
void main(){
// say hello world
}
During building , I want to use genrule (or something like copy_directory) to rename my directory_b | directory_a into the ‘driectory_real’ based on some flags (In this case, try to move directory_b into directory_real). The build file in the root I wrote is like the code next:
load("#bazel_skylib//rules:copy_directory.bzl", "copy_directory")
copy_directory("copy_directory_into_real","directory_b","directory_real")
cc_binary(
name = "test",
srcs = [
"main.cpp",
],
visibility = ["//visibility:public"],
deps = [
"//directory_real:mylib",
],
)
However, when bazel build //directoryC:test, the error occurs
ERROR: no such package 'directory_real': BUILD file not found in any of the following directories.
Anything wrong?
How can I wrote a correct bazel file to do this

I am having an issue with pylint within visual studio code workspace settings

Every single one of the immport statements I make within the project files are giving an error:
[Python] unresolved import 'user.models'
with this statement:
from users.models import Detail
Here is my workspace settings.json file within my .vscode folder:
{
"python.pythonPath": "/Applications/Python3/bin/python3",
"editor.formatOnSave": true,
"python.linting.pep8Enabled": true,
"python.linting.pylintPath": "pylint",
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"],
"python.venvPath": "${workspaceFolder}/backend/env/bin/python3",
"python.linting.pylintEnabled": true,
"python.linting.pep8Args": [
"--ignore-E501"
],
"git.ignoreLimitWarning": true
}
pyling_django should be pylint_django, and you need to make sure your python path is correct, and your ENV is activated.

'copies' in gyp is not copying the entire folder when the target is windows

I am writing a GYP file for my project. When I use 'copies' to copy a directory, the content does not get copied in windows platform (target as 'win'). But, coping a single file using 'copies' is successful (I am able to copy a single file; but not a folder.)
However, the content gets copied (individual files as well as folders) in other platforms (Linux, mac).
Below is the snippet from my gyp file.
##### Variables section
'unitTestContentFoldersWin':
[
'<(PACKAGE_ROOT)/dependencies/resources',
],
'unitTest1':
[
'<(PACKAGE_ROOT)/dependencies/resources/abc.txt',
],
##### Target is 'win'
'copies':
[
{
# This does not work !
'destination': '<(PACKAGE_ROOT)/build/bin/',
'files': ['<#(unitTestContentFoldersWin)'],
},
{
# This works !
'destination': '<(PACKAGE_ROOT)/build/bin/',
'files': ['<#(unitTest1)'],
},
],
Try to add a slash at the end of directory path to copy the whole directory :
'unitTestContentFoldersWin':
[
'<(PACKAGE_ROOT)/dependencies/resources/',
],
As I remember, gyp copies also support asterisk mask to copy entries of the directory:
'unitTestContentFoldersWin':
[
'<(PACKAGE_ROOT)/dependencies/resources/*',
],

Webpack - Cannot import Vue from instance saved in another directory

I am learning to integrate Vue.js in to a Django project (multi-page application). My goal is to be able to split my frontend code up among my different apps within my project
However, I am unable to create a Vue instance from my profiles app because webpack fails to find Vue during import.
The error
ERROR in ../apps/profiles/frontend/profiles/browse.js
Module not found: Error: Can't resolve 'vue' in '/home/me/dev/myproject/apps/profiles/frontend/profiles'
My django project structure (truncated)
manage.py
myproject/
webpack.config.js
frontend/
home.js
components/
Home.vue
node_modules/
apps/
profiles/
frontend/
profiles/
browse.js
Multiple entry points in webpack.config.js
entry: {
'vendor': [
"vue",
"vue-resource",
],
'home': [
'./frontend/home.js',
'webpack/hot/only-dev-server',
'webpack-dev-server/client?http://' + dev_server_addr + ':' + dev_server_port,
],
'profiles_browse': [
'../apps/profiles/frontend/profiles/browse.js',
'webpack/hot/only-dev-server',
'webpack-dev-server/client?http://' + dev_server_addr + ':' + dev_server_port,
],
},
Also vue is resolved as an alias in webpack.config.js
resolve: {
alias: {
'vue$': 'vue/dist/vue.common.js',
},
},
My browse.js Vue instance
import Vue from 'vue' <-- Error occurs here
new Vue({
el: '#browse',
data: {
foobar: "hello browse"
},
delimiters: [
"[[", "]]"
]
});
And finally my django template for profiles browse
<div id="browse">
[[ foobar ]]
</div>
{% render_bundle 'vendor' %}
{% render_bundle 'profiles_browse' %}
I had thought that since vue has an alias defined that I would be able to import it from anywhere.
Does anyone have any suggestions on how to best use webpack to split up modules spanning different directories within a project?
A successful approach that I discovered from a blog post is to use npm to install my Django app's js modules into my project's node_modules directory.
For instance, in my project's package.json I add the following file reference to my dependencies:
"dependencies": {
"profiles": "file:../apps/profiles/frontend",
...
},
This will work if apps/profiles/frontend has defined its own package.json file.
Now my project's webpack.config.js entry points will be:
entry: {
'vendor': [
"vue",
"vue-resource",
],
'home': [
'./frontend/home.js',
'webpack/hot/only-dev-server',
'webpack-dev-server/client?http://' + dev_server_addr + ':' + dev_server_port,
],
'profiles_browse': [
'./node_modules/profiles/browse.js',
'webpack/hot/only-dev-server',
'webpack-dev-server/client?http://' + dev_server_addr + ':' + dev_server_port,
],
},
Notice that profiles_browse refers to a file within node_modules.
Within my browse.js files I can import Vue without error.

Ember-Cli SASS Settings

I am using ember-cli-sass instead of broccoli-ruby-sass
These are the steps i have done
npm install --save-dev ember-cli-sass
bower install --save foundation
I am getting this error in the console after i started the ember server
I don't understand why it says "File not found: /app/styles/app.scss"
i don't have any app.scss a part from
I am missing something in the configuration, what's the problem exactly?
I am using three sass file
_global.sass
_music.sass
_player.sass
i import them in app.sass
#import global
#import player
#import music
i was reading the https://www.npmjs.com/package/ember-cli-sass and it says
Specify some include paths in config/environment.js:
ENV.sassOptions = {
includePaths: [
'bower_components/foundation/scss'
]
}
I am bit confused about these settings, i need some advices
I think you are getting the error because you may not have changed the name of your app.css file to app.scss
You your app/styles folder you should have a file called app.scss in that file I would put your imports
// app.scss
#import 'foundation';
#import 'global';
#import 'player';
#import 'music';
Then you need to add:
ENV.sassOptions = {
includePaths: [
'bower_components/foundation/scss'
]
}
To your config/environment.js like this:
module.exports = function(environment) {
var ENV = {
modulePrefix: 'test-sass',
environment: environment,
baseURL: '/',
locationType: 'auto',
sassOptions: {
includePaths: [
'bower_components/foundation/scss'
]
},
EmberENV: {
FEATURES: {
.....
If you are looking to use foundation in your ember-cli app use the ember-cli addon: https://www.npmjs.com/package/ember-cli-foundation-sass
I think ember-cli-sass by default looks for sass files with extension .scss. If you are using file extension of .sass, you need to specify it in sassOptions.
ENV.sassOptions = {
includePaths: [
'bower_components/foundation/scss'
],
extension: 'sass'
}
Check https://github.com/aexmachina/ember-cli-sass