Can I specify the output folder for assets? - parceljs

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

Related

How do I include and access package resources?

I have this folder structure:
my-package -
|- src/mypackage
|- resources/some-resources
|- setup.py
|- setup.cfg
I want to load some-resources from within mypackage. How do I do this?
I have read online I should update my setup.py to include:
setup(
...
package_data={"": ["resources"]},
include_package_data=True,
...
)
And that I should then be able to use pkg_resources to access my resource folder. But the examples seem like they are incomplete, e.g. pkg_resources.resource_listdir("mypackage", "") (one suggestion) just lists the python files in mypackage. So to reiterate - how do I include resources in my package, and then access them from my code?

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

How to change presentation of packages in Eclipse?

I need to work with Eclipse source. And I have many packages imported:
org.eclipse.core
org.eclipse.jdt
org.eclipse.jdt.core
org.eclipse.core.resources
etc
So I have all this packages in my project. How can I divide them by their tree? So they look like this in my project:
org
+
|- eclipse +
|- core
| +
| |- runtime
| |- resources
|- jdt
+
|- core
+
|- dom
Srinivas Thatiparthy's comment was close. There is an option "Package presentation" under another button that is next to the button similar to "-><-".

Java Servlet and JSP/JSF Help/Guidance

I've had very limited exposure to Java Web development side and suddenly been asked to work on a web application and learn to maintain it. I’m struggling to setup an environment to be able to test and debug existing code given to me.
I'm on windows XP. Using Eclipse and Tomcat 5.
The web app they've dumped at me has the following structure:
Parent_directory
|- src
|- mainapp
|- model
|- AssignT.java
|- LeavePerm.java
|- Invoice.java
|- ....
|- util
|- Dates.java
|- reports.java
|- .....
|- application.properties
|- DB.properties
|- log.properties
|- email.properties
|- ......
|- Webroot
|-images
|- 1.png
|- ......
|-jsp
|- index.jsp
|- email.jsp
|- assign.jsp
|- leave.jsp
|- .....
|-META-INF
|- context.xml
|- MAINFEST.MF
|-Scripts
|- display.js
|- info.js
|- dates.js
|-WEB-INF
|- classes
|- {EMPTY}
|- lib
|- {MANY .jar files}
|- faces.config.mex
|- faces.config.xml
|- web.xml
The web application is working but minor modifications need to be made hence why I need to be able to setup an environments with eclipse and tomcat 5 to be able to make those changes and test.
Having installed tomcat and tomcat eclipse plugin I've added the tomcat server in server tab so eclipse knows where tomcat is and able to start/stop it but cannot get it to load the above imported project and run it. Trying the "Add or Remove" option on the server tells me "there are no resources that can be added".
I would appreciate any help or guidance.
Thank you
Did you download package labelled "Eclipse for Java EE Developers"? If so, then it contains WTP and make sure the project as the facet "Dynamic Web Module" selected.
In eclipse Facets are used as markers for enabling user interface
elements.
How to activate a Facets:
Not a faceted project then go in Project > Properties > Project Facets Click on "Convert to faceted form...".
Already faceted project go in Project > Properties > Project Facets Select "Dynamic Web Module" with the proper version 2.3 or 2.5.
After you should be able to add the project to the tomcat server in the server tab.
More information on Dynamic Web projects and applications.