Add Angular2 instructions to Netbeans IDE - netbeans

I used to use Netbeans during my work. Now I want to start using Angular2.
I'm following tutorial from angular.io. I've created template HTML file with content (only relevant line):
<div *ngFor="let hero of heroes" (click)="gotoDetail(hero)">
And NB shows me errors about *ngFor and (click):
Attribute "*ngfor" is not realizable as XML 1.0. (Rule Category: Attributes)
Attribute "(click)" is not realizable as XML 1.0. (Rule Category: Attributes)
Attribute "*ngfor" not allowed on element "div" at this point. (Rule Category: Elements)
Attribute "(click)" not allowed on element "div" at this point. (Rule Category: Elements)
How can I teach NB that those are correct? I've already installed plugin to support TypeScript.
In my test project I downloaded node packages:
c:\proj> npm list --depth=0
angular2-quickstart#1.0.0 C:\a2
+-- angular2#2.0.0-beta.17
+-- concurrently#2.0.0
+-- es6-shim#0.35.0
+-- lite-server#2.2.0
+-- reflect-metadata#0.1.2
+-- rxjs#5.0.0-beta.6
+-- systemjs#0.19.26
+-- typescript#1.8.10
+-- typings#0.8.1
`-- zone.js#0.6.12

Unfortunately NetBeans does not support Angular 2 template syntax, so you will receive (wrong) warnings/errors and no codecompletion support.
You can use the TypeScript plugin and typings to get support for the TypeScript/JavaScript parts of the application. Feel free to open a NetBeans issue with the request, I will vote for it as well.
Edit:
There is already an issue filed to request that feature: https://netbeans.org/bugzilla/show_bug.cgi?id=257587 if you upvote it, it might get implemented.

Related

Azure Pipeline Release Artefact linked ARM templates

We have our ARM templates in a build folder alongside our code. In our pipeline we publish our build folder as an artefact. We have master templates.
We want to run our ARM templates from a Release Pipeline, however our master templates can't find our linked templates, we get the following errors:
##[error]InvalidTemplateSpec: The relative path 'arm-kv/1.0.0.0/azuredeploy.json' could not be resolved. Please ensure the parent deployment references either an external URI or a template spec ID. The relativePath property cannot be used when creating a template deployment with a local file.
The folder structure of the created artefact is as follows;
Builds/
+-- ARM/
+-- parameters/
| +-- azuredeploy-rg-parameters.json ## parameters file
|
+-- arm-kv
| +-- 1.0.0.0/
| +-- azuredeploy.json ##(linked key vault template)
|
|- arm-storage
| +-- 1.0.0.0/
| +-- azuredeploy.json ##(linked storage template)
|
+-- azuredeploy-rg.json ##(main template)
What is the correct syntax for referencing the subfolder/templates? We've tried
arm-kv/1.0.0.0/azuredeploy.json (relative path)
./arm-kv/1.0.0.0/azuredeploy.json
/builds/arm/arm-kv/1.0.0.0/azuredeploy.json (the full artefact path)
When you run the task you are probably in the $(System.DefaultWorkingDirectory) context. This is the folder where artifacts are downloaded. Please check what you have exacelty there by adding a step and listing files.
Once you have it change your working directory for your ARM deployment step to $(System.DefaultWorkingDirectory)/builds/arm (it could be slightly different and this is why former step is needed to verify the path). Once you set it correctly you will get azuredeploy-rg.json in the root and all linked templates will become discoverable.

How to use babel-cli directory paths?

EDIT: Answered, below.
Also: If you are reading this you are probably new to web dev and you should consider using webpack for this instead of babel alone
I have what seems like a very simple problem but I can't solve it.
I have a directory structure
Project
|
+-- scripts
|
|
+-- src / src.js
|
|
+-- compiled / compiled.js
And I have been trying to get the following command to work when my terminal is located in the scripts folder.
C:\Users\me\JavaScriptProjects\survey\scripts>npx babel ./src/src.js --out-file ./compiled/compiled.js presets=env,react --watch
But it simply keeps returning:
C:\Users\me\JavaScriptProjects\survey\scripts>npx babel ./src/src.js --out-file ./compiled/compiled.js presets=env,react --watch
presets=env,react doesn't exist
I have tried permutations of removing the ./, replacing it with only /, going into src dir and replacing src/src.js with src.js and then doing ../compiled/compiled.js and many other permutations, but it just keeps saying it doesn't exist.
Even if I add both files to the same directory it's giving the same error.
Most annoying part is it was working fine yesterday.
Thanks in advance.
Solved.
The following has worked from within the src dir after trying for around an hour. I don't know what I've done differently, would love it if someone can point it out.
Thanks.
C:\Users\me\JavaScriptProjects\survey\scripts\src>npx babel src.js --out-file=../compiled/compiled.js --presets=env,react --watch
It could be that you have a babel.config.json file in the \scripts\src folder and that if you move to the \scripts folder to run npx, then it can't see the config file and so doesn't see react.
Project
|
+-- scripts
|
+-- src / src.js
+-- src / babel.config.json
|
+-- compiled / compiled.js

Eclipse 2020-09 (4.17.0) on OS X 10.13 keeps wanting me to put .gitignore and .DS_store on the path

I just upgraded to Eclipse 2020-09 (4.17.0) on OS X 10.13.
I have a large existing repository of java projects and I've installed the javascript and GWT plugins for Eclipse.
The problem is this: whenever I do almost anything (ex. save a file I'm working on), I get an error:
An error has occurred. See error log for more details. Path must include project and resource name: /.gitignore
specifically, the error comes from jface:
Problems occurred when invoking code from plug-in: "org.eclipse.jface".
the top of the error code is:
java.lang.IllegalArgumentException: Path must include project and resource name: /.gitignore
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:66)
at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2128)
at org.eclipse.core.internal.resources.Container.getFile(Container.java:196)
at org.eclipse.egit.ui.internal.staging.StagingViewContentProvider.getFile(StagingViewContentProvider.java:139)
at org.eclipse.egit.ui.internal.staging.StagingEntry.getFile(StagingEntry.java:213)
at org.eclipse.egit.ui.internal.staging.StagingEntry.getProblemSeverity(StagingEntry.java:244)
at org.eclipse.egit.ui.internal.decorators.ProblemLabelDecorator.decorateImage(ProblemLabelDecorator.java:84)
at org.eclipse.jface.viewers.DecoratingLabelProvider.getImage(DecoratingLabelProvider.java:101)
But, there's a .gitignore in both the repo root and the project root and the project path settings are:
PARENT_LOC /Users/brian/git/JavaCodeFromSVN
PROJECT_LOC /Users/brian/git/JavaCodeFromSVN/jsAipotu
WORKSPACE_LOC /Users/brian/git/JavaCodeFromSVN
So I can't figure out what the problem is or how to fix it.
I can work in eclipse but it's really annoying to get these messages all the time.
I'm sure it's something obvious but I'm just not seeing it.
Might anyone be able to help? It seems that every time I upgrade Eclipse, it's a headache of one kind or another. Perhaps, someday, I'll learn my lesson and not upgrade :(
thanks
Brian
I think I may have fixed the problem. Here's what I did that made this go away.
Right-click the project: Team -> advanced -> Clean... and let it clean all it found (lots of .gitignores etc)
At that point, I was getting warnings about .DS_Store pretty consistently.
I followed the directions at https://intellipaat.com/community/9089/how-can-i-remove-dsstore-files-from-a-git-repository-gitignore-dsstore (By Debashis Borgohain)
they are:
Remove existing .DS_Store files from the repo. In the top level repo directory:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
Create or update the .gitignore file at the top of the repo to contain a listing for .DS_Store. WHen set like this, even if Mac OS re-creates the .DS_Store files, they will be ignored by git when you commit changes, etc. Here is one way:
echo .DS_Store >> .gitignore
Commit the revised .gitignore
git add .gitignore
git commit -m '.DS_Store banished!'
to get rid of all the .DS_Store files, tell git to ignore them, and now it seems happy.
I got this error because I have a Maven project with sub-projects, and I made my Maven (base) project folder equal to the workspace folder:
πŸ“ eclipse-workspace = maven base project folder = root of Git repo
+-- πŸ“ subproject_1
| +-- πŸ“ pom.xml (of subproject)
+-- πŸ“ subproject_2
| +-- πŸ“ pom.xml (of subproject)
+-- πŸ“ pom.xml (of base project)
The first error was, that the base project could not be imported as a project. I thought this was meaningless, since the base project doesn’t contain code in my case, it is only a container. However, it seems Eclipse requires the base project to be a folder in the workspace:
πŸ“ eclipse-workspace
+-- πŸ“ project (base project) = root of Git repo
+-- πŸ“ subproject_1
| +-- πŸ“ pom.xml (of subproject)
+-- πŸ“ subproject_2
| +-- πŸ“ pom.xml (of subproject)
+-- πŸ“ pom.xml (of base project)

GWT module xml source element to specify single class

I have a GWT application (FooGwtApp) and a library module (FooLib) used as a dependency in FooGwtApp. The package structure of FooLib looks like this:
packageFoo.ImportantClass
packageFoo.UnimportantClass
packageBar.OtherClass
I want ImportantClass (and only ImportantClass) to be compiled to JS by the GWT compiler. Moving ImportantClass to another package is not an option.
I created ImportantClass.gwt.xml within packageFoo with the following content:
<module>
<inherits name="com.google.gwt.user.User"/>
<source path="" includes="**/ImportantClass*"/>
</module>
Next I put an inherited reference to the ImportantClass module definition in FooGwtApp.gwt.xml (this seems to work: the IDE recognizes it, and is able to parse the reference to ImportantClass.gwt.xml).
Now If I put references to ImportantClass into FooGwtApp's client code, the GWT compiler fails, because it does not find ImportantClass on the source path:
No source code is available for type packageFoo.ImportantClass; did you forget to inherit a required module?
I likely messed up sommething in the source path / includes attribute in ImportantClass.gwt.xml - either defining the current package as root package with path="" is not a valid notation or something's wrong with the includes attribute. Or both. Or neither.
Can you give me a clue about where it all went wrong?
It turns out the problem was not in ImportantClass.gwt.xml, but in other Maven related stuff:
ImportantClass.gwt.xml should be placed under src/main/resources/packageFoo, not src/main/java/packageFoo, otherwise it won't be packaged into the binary jar.
GWT compiler compiles from Java source to Javascript source. This means we don't just need ImportantClass.class in FooLib.jar, but also its source. Best solution for this is to use maven-source-plugin in FooLib's pom.xml and also to import the FooLib dependency into FooGwtApp with sources classifier.
On the latter topic, see the following SO answers:
Maven: Distribute source code with with jar-with-dependencies
How to properly include Java sources in Maven?
After fixing the above problems, the source path declaration present in the question works.

Can I specify the output folder for assets?

I have a project with this structure:
src
|- index.pug
| - layout
| |- index.less
| - scripts
| |- index.js
For now, when I run parcel build src/index.pug, all the files are bundled and I've got this on the distribution folder:
dist
|- index.html
|- index.12345.css
|- index.12345.js
When I was spected something like:
dist
|- index.html
|- layout
| |- index.12345.css
|- scripts
| |- index.12345.js
So, my question is: Can I specify the output path for my css, js and images using ParcelJS?
Parcel doesn't support this feature out of the box, but I've developed a plugin for it. Check it out https://www.npmjs.com/package/parcel-plugin-custom-dist-structure
It is suitable for all types of web/node development projects, it will generate the dist structure you specify while also handle your imports.
Let me know what you think!
With version 1 it's not supported. This is supposed to be available in version 2 through user plugins. See https://github.com/parcel-bundler/parcel/issues/233