chrishasz / spgo

SPGo: A Lightweight, Open Source, SharePoint IDE for Visual Studio Code
https://www.chrishasz.com/spgo
MIT License
60 stars 11 forks source link

Question about usage scenarios #57

Closed kLeZ closed 4 years ago

kLeZ commented 6 years ago

Hi! I need some info on how to configure SPGo correctly for my scenario. I have some files and folders in a dist folder (I would map as the src folder, I imagine). This folder is filled with preprocessed files that can be loaded into sharepoint directly at that point. I need to load all the contents of the "source" folder into /_catalogs/masterpage/{my root folder with another name}/

So my local folder structure would be something like: /dist

While my remote folder would be something like: /_catalogs/masterpage/My.SP.Project/

How can I accomplish this setup with SPGo?

Thanks in advance.

sg-chrishasz commented 6 years ago

Hello @kLeZ

In order to accomplish what you are looking for, you should set up your remote folders like this:

"remoteFolders": [
        "/_catalogs/masterpage/My.SP.Project/**/*.*",
    ]

This will map all files within the /_catalogs/masterpage/My.SP.Project/ remote folder to your local workspace using the glob notation for "all files and folders".

If you want to only map specific folders (i.e. if there are some remote folders withing My.SP.Project that you don't want mapped locally), then you could use the following:

"remoteFolders": [
        "/_catalogs/masterpage/My.SP.Project/css/**/*.*",
        "/_catalogs/masterpage/My.SP.Project/fonts/**/*.*",
        "/_catalogs/masterpage/My.SP.Project/images/**/*.*",
        "/_catalogs/masterpage/My.SP.Project/js/**/*.*",
        "/_catalogs/masterpage/My.SP.Project/pagelayouts/**/*.*"
    ]

The src property is used when integrating your local workspace with source control to tell SPGo which folders will contain source files, but it does not change where SPGo looks for files on the server.

Please let me know if you have any other questions, or feel free to close this issue if everything is resolved.

kLeZ commented 6 years ago

Hi! Sorry for the late reply. What I'm searching is some way to map a local directory with a remote directory, and by now seems that SPGo is not properly able to do so.

I have a well structured project, with static assets as well as built assets (TypeScript and SASS). I'm looking for a way to map my build folder (output of some gulp, grunt, webpack, etc. tools) with the remote folder in SharePoint (with a different structure than the build directory). Shortly, I want to use SPGo as a dev deployment tool in the day by day work, leaving the full deployment part (the production install) to a later time. Can you explain me if SPGo is able to do this for me and how?

ruudsolidnl commented 5 years ago

Hi kLeZ, Did you resolve this? I have a similar issue with the SPGo configuration; I want the dist folder (the complete structure, so html, folder named "js" and the files in it) to be copied over to the site assets in the SharePoint site. However, it seems that using "sourceDirectory": "dist" is not working properly. Tried all kinds of variations with the wilcards in both soureDirectories and remoteFolders. Thanks!

b.t.w. I'm quite new on this npm stuff..

kLeZ commented 5 years ago

Hi @ruudsolidnl. No, all the configuration options and combinations I tried didn't work. In the mean time I changed job, so now I write code in another language for other platforms and other purposes.

chrishasz commented 4 years ago

@kLeZ @ruudsolidnl

I think I finally understand what you are requesting. If I udnerstand correctly, you are asking for the ability to use the Publish Workspace command to upload folder to SharePoint from outside of the src folder.

Am I (finally!) understanding this correctly?

If so, it is a great idea for supporting packaging/minifying and I'll add this to the backlog.

kLeZ commented 4 years ago

@kLeZ @ruudsolidnl

I think I finally understand what you are requesting. If I udnerstand correctly, you are asking for the ability to use the Publish Workspace command to upload folder to SharePoint from outside of the src folder.

Am I (finally!) understanding this correctly?

If so, it is a great idea for supporting packaging/minifying and I'll add this to the backlog.

Yes! Exactly that! I had a workflow where we wrote typescript code and sass stylesheets. Then transpiled those into packaged, minified and compressed single JS and CSS files outside src with gulp and webpack and some other tools. In that directory we generated assets and provisioning xml files accordingly. SPGo would had been integrated in that workflow by replacing the PNP provisioning for quick publishing. Enabling that workflow would help those already struggling to avoid the slow PNP provisioning in dev mode, especially when you need only one file instead of your sentire directory.

Thanks. kLeZ

chrishasz commented 4 years ago

Thank you for clarifying, @kLeZ! I think this is a great feature and I'd like your feedback on my planned approach:

Add a new config option called publishWorkspaceRoot as a companion to the publishWorkspaceGlobPattern option. When present in spgo.json, publishWorkspaceRoot will specify a directory relative to the root of the workspace for the Publish Workspace command to use as the root directory for publishing files to SharePoint.

Example: User wants to publish the full contents (files and subfolders, recursively) of the /dist folder to SharePoint every time the Publish Workspace command is executed.

Config: User would configure spgo.json with the following two options:

{
    "publishWorkspaceRoot" : "/dist",
    "publishWorkspaceGlobPattern" : "/**/*"
}

Let me know your thoughts!

kLeZ commented 4 years ago

Seems like a good implementation, and that would solve the issue I was having!

chrishasz commented 4 years ago

All- I've just released SPGo 1.6.0 to the VSCode marketplace. This build supports advanced publishing options, including the ability to publish from folders outside of the src folder.

more documentation here.

Please test it out and provide any feedback here.

Also, thanks for the patience, this was the hardest "easy" feature I've added to SPGo due to all of the assumptions I made in code related to the src directory. Enjoy!

chrishasz commented 4 years ago

Looks like this feature is working. I'm going to close this issue now.

Please create new issues for any additional bugs related to this feature.

nlvraghavendra commented 2 years ago

I've some scss files as part of the code which are compiled to scss. I want to ignore the .scss, .css.map files etc. when SPGo syncs the files. Is there a way to ignore some file extensions? Also I see that if a gulp task or a VS code extension (like Live-Sass) compiles the scss files and outputs the css files they are not getting uploaded to the SharePoint destination.