I am quite new to developing plugins for Office. I am hitting a brick wall and would really appreciate some help:
When I side-load my plugin, the plugin loads for the first time, but then it is stuck and any changes I make don't register, and Word doesn't load the new updates from the updated functions.js
If I delete (move) the manifest file, the plugin still appears in Word; where is this stored, and how can I get rid of it?
When I put debug flags in my code to do console.log ... where does this actually output to ? My functions are all set to buttons on the toolbar and I don't use the home.html to open a taskpane.
The add-in is cached by Office. To remove the cached data delete the content of the folder %localappdata%\Microsoft\Office\16.0\Wef
If you have npx installed you can remove add-ins via npx office-toolbox remove
install npx using npm install -g npx
I want to make some changes to the source code of xterm.js and test them before making a PR. I have been unsuccessful in generating a working 'distribution.'
(Apologies if my terminology is incorrect -- I am pretty new to web development)
Setup
I set up a simple test website with the following index.html
<!doctype html>
<html>
<head>
<script src="%PUBLIC_URL%/xterm.js"></script>
</head>
<body>
<div id="terminal"></div>
<script>
console.log(Terminal);
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
</script>
</body>
</html>
In the location %PUBLIC_URL% I will place a JS source file xterm.js from either:
node_modules/xterm/dist/xterm.js - as added through npm
xterm.js/lib/xterm.js - as built from the GitHub repository
To build a local copy of xterm.js I took these steps:
git clone https://github.com/xtermjs/xterm.js.git xterm-local
cd xterm-local
npm install
npm run package
(Note: if you are following along at home I could not build xterm.js on Windows or Mac -- I only got through these steps using Ubuntu 18.04)
The commands all run successfully and the last one creates xterm-local/lib which contains xterm.js. I use that file to replace the copy that can be obtained from the NPM installation.
Results
Normal
When using the NPM dist/xterm.js I successfully see my terminal element rendered and the log reads
ƒ Terminal(options) {
this._core = new Terminal_1.Terminal(options);
this._addonManager = new AddonManager_1.AddonManager();
}
Using local build
When using my locally built output from xterm-local/lib/xterm.js there is no terminal element rendered, there is an error: Uncaught TypeError: Terminal is not a constructor and the log reads
{Terminal: ƒ, __esModule: true}
Terminal: ƒ e(e)
__esModule: true
__proto__: Object
Expectations
I would expect that after building my local copy of xterm.js that I could use it interchangeably with the NPM distribution. However I am curious why the command npm run package does not generate the dist folder but a lib folder instead. Are there additional steps that I am missing to make my own useable copy of xterm.js?
I've reached a semi-acceptable solution so I'd like to share what I can.
This is not the demo you are looking for
Thanks to user Peter I found my way to xterm.js' wiki page about contributing (not to be confused with the CONTRIBUTING.md file in the repo itself). It was hard to find because to an uninitiated individual this line in the repo's CONTRIBUTING.md document:
Get the xterm.js demo running.
seems to refer to the demo that can be found on xtermjs.org with these simple instructions:
First you need to install the module, we ship exclusively through npm so you need that installed and then add xterm.js as a dependency by running:
npm install xterm
To start using xterm.js on your browser, add the xterm.js and xterm.css to the head of your html page. Then create a onto which xterm can attach itself. Finally instantiate the Terminal object and then call the open function with the DOM object of the div.
<head>
<link rel="stylesheet" href="node_modules/xterm/dist/xterm.css" />
<script src="node_modules/xterm/dist/xterm.js"></script>
</head>
<body>
<div id="terminal"></div>
<script>
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
</script>
</body> </html> ```
However that is not the case. Instead they are talking about running the demo application that lives in xterm.js/demo
Running the real demo
The xterm.js maintainers are very very very much more experienced than me. They've provided so many ways to build and run the demo that it can be daunting. Eventually the SourceLair option worked out for me despite my aversion to giving them my credit card info.
First make a fork of the xterm.js repo - this is important because you want to be able to change the source code!
Handy as it may be this 'shortcut' https://lair.io/xtermjs/xtermjs kind of doesn't help. What you really want to do is go to SourceLair, create a new project based on your own fork of xterm and choose the preset 'Node' environment. That will allow you to both test the changes you make (by using the web server tool) AND save your changes (because you used your own fork instead of using the upstream repo)
Go to SourceLair
Start a new project by cloning a repo
Provide your repo URL
Wait for initialization (git clone, yarn install, webkit compilation etc)
Create a new branch for your changes (in the Terminal git checkout -b [name_of_your_new_branch])
Make your changes
Test them out in the Public URL of the project
Commit and push your changes back to your repo
(if you want to skip using the web editors then you could make changes to your repo and pull those changes into Source Lair for testing)
Challenges with other methods
Just FYI.
Docker: It was easy to use this pre-configured image but it was not easy to make the changes I needed to from within the container.
Foreman (Procfile runners): never heard of 'em... too little time to waste (this is a hobby, mind you!)
Linux / MacOSX: On linux I could build but could not test (my only linux is a VPS that I just SSH into) and on Mac I could (presumably) test but not build (because at time of writing the node-gyp dependency failed hard)
If all you need is to run and see how it feels, use node-pty package that's built on top of xtermjs
https://github.com/microsoft/node-pty/tree/master/examples/electron
TL;DR:
My project has dependency of "dep": "snapshot" where 'snapshot' is a tag. Running npm install does not fetch new version of "dep".
Full story:
So just recently I started with a JS project, and... to make a long story short i setup my own private repo via a locally installed Nexus.
Let's call my project myProj1.
I added the Nexus registry in my .npmrc like so:
registry=http://nexus:8081/nexus/content/groups/npm-all/
All is fine, I try and release snapshot versions before i release any production ready code.
This includes running npm-snapshot X where X is my snapshot number. (It's basically a plugin that changes the package.json version tag to something like 1.0.0-SNAPSHOT.24 (if X = 24)
I then run
npm publish --tag=snapshot --registry=http://nexus:8081/nexus/content/npm-internal
and it pushes the code to my Nexus, and all seems fine. The tag "snapshot" in my nexus registry is updated to the recently published version. (1.0.0-SNAPSHOT.24)
I then have another project which has a dependency on the above module in it's package.json specified as such:
"dependencies": {
"myProj1": "snapshot"
}
So I run npm install in the project root, and lo' and behold, the dependency get's downloaded perfectly, everything is awesome!
Now here comes my issue:
I then decide to update some stuff in myProj1, making me release another snapshot version with the same command above. (causing the newly published artifact to be versioned 1.0.0-SNAPSHOT.25) My Nexus is awesome and publishes the new dependency like it should, also updating the dist-tag "snapshot" to the newly built version.
HOWEVER, when i run npm install from my other project, believing I should be getting a newer version of myProj1, nothing happens. It doesn't fetch the newer snapshot version. Why's that?
Have I misunderstood having a dependency on a dist-tag? Can I do this some other way?
Regards
I am using XCode 5.0.2 and Cordova 3.4.0-0.1.3 - What I find is after creating the project using the Cordova CLI and opening in XCode, no changes to the index.html file and index.js file are ever carried over to the simulator when I click run.
I have to open terminal and issues a Cordova Build command and then run the simulator and it works
I followed all the instructions here:
Phonegap - developing and launching app on simulator
xcode 4 + phonegap ... not update JS upon build?
And none of it works! any one a have a solution to this, because having to switch back and forth is becoming a pain.
You can add a pre-action script to your XCode project's build. To do this:
Select Product > Scheme > Edit Scheme from the menu (or ⌘ < on keyboard)
Select Build > Pre-actions from the left
Click + and select "New Run Script Action"
Add a script like this:
cd /path/to/your/cordova/project/
cordova prepare ios > xcode-prepare-results.txt
Now XCode should always run cordova prepare before building your project so you don't have to jump to terminal. You can see the output of prepare in the file xcode-prepare-results.txt.
Note, that depending on how your cordova executable is set up and which shell you use, you might have to either change the shell or modify your PATH in order for the script to find cordova.
So after much searching I seem to have found a solution that works, here is what I did. After looking at other Stackoverflow questions I found someone that said this worked for them.
Find the file called copy-www-build-step.sh.
Mine was in
[project_folder]/platforms/ios/cordova/lib/copy-www-build-step.sh
In that file, find the lines beginning rsync -a "...
Add -c to the rsync lines, so they ready rsync -a -c "...
Well I tried that and it did not work on its own. I also tried the answer from Ville and that pulled closer but no cigar. Finally I took what the command from Ville and put it in the copy-www-build-step.sh file
so my top line is now
cd /path/to/your/cordova/project/
cordova prepare
SRC_DIR="www/"
DST_DIR="$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www"
COPY_HIDDEN=
ORIG_IFS=$IFS
IFS=$(echo -en "\n\b")
.....
.....
.....etc etc
And now I make change , and click run , bam all is updated. I hope this helps someone else.
Other answers in this thread either didn't work for me or screwed up cordova plugins e.g. InAppBrowser, so i finally came up with this:
Edit the file copy-www-build-step.sh and add the following row in the beginning:
cp -fR ../../www/ www/
so it should look like:
...
cp -fR ../../www/ www/ # new code
SRC_DIR="www/"
...
This way your code will be updated properly and your plugins will work
I also edited the copy-www-build-step.sh file, however you don't want to use an absolute path from your User folder. If you are working with other developers you would have to change that every time you check out code.
It's not a big deal, just change:
SRC_DIR="www/"
To:
SRC_DIR="../../www/"
UPDATE
Worked for me on Cordova and Phonegap.
To have the source files automatically copied from the www source directory to the platforms/ios/www directory when you click the Run button in XCode:
In XCode, choose Product->Scheme->Edit Scheme...
Expand the triangle for Build->Pre-actions
Click the "+" to create a new Pre-action
You can leave the "Shell" setting blank.
Set "Provide build settings from" to the project you are building. This is important.
In the script area enter:
cd ${PROJECT_DIR}/../..
echo "--- Start ---" > xcode-prepare-ios-results.txt
echo "Running cordova prepare ios command..."
pwd >> xcode-prepare-ios-results.txt
cordova prepare ios --verbose >> xcode-prepare-ios-results.txt
echo "--- Finished ---" >> xcode-prepare-ios-results.txt
This works for me with XCode 8.2 and Apache Cordova 6.x
I suggest you clean before build your xcode project. And one more thing, make sure you build again your project using cordova build, not inside xcode because it's totally different.
cordova build yourproject
#Ksliman
I modified you code a bit to work on my system and make slight bit more generic.
top of file copy-www-build-step.sh
## New Code Begin ###
cd ../../
PATH=${PATH}:/usr/local/bin
cordova prepare ios
## New Code End ###
SRC_DIR="www/"
simply type:
cordova prepare
on your terminal and run your project again in Xcode
Simple solutions is to build the app with cordova using:
sudo cordova build ios
Then go to xcode > Product > Clean
Then go to xcode > Run (Play Button)
Run "cordova prepare ios" during the building phases:
Open Xcode.
Select your project.
Go to "Build Phases".
Go on "+" to add a "New Run Script Phase".
Move this section before "Copy www directory".
Add the following lines (for Mac):
cd /Users/*/YOUR_PROJECT_FOLDER (Change your project folder)
/Users/*/.nvm/versions/node/v?.?.?/bin/node node_modules/cordova/bin/cordova prepare ios (Change the path to node version)
After "Play" the www-folder will automatically refresh!
All I had to do was to include the full absolute src path for my project. For example:
From your project directory, vim platforms/ios/cordova/lib/copy-www-build-step.sh
change SRC_DIR to the absolute path of your www, SRC_DIR="/Users/michael/Documents/Development/SampleMobileApp/www/"
Save, build, and you should be good to go.
I found that sometimes Cordova gets confused... you need to do a "cordova platform rm ios" (just leave your plugins alone), and then do a "cordova platform add iOS", which will reinstall all your plugins into your platform... then try your build again.
Every time I use cordova build its overrides content in my platform specific www file. So I use cordova compile instead.
From help:
compile <platforms> compiles platform project without preparing it
It is important to just compile the changes not to build entire projects especially if you creating mobile app for many platforms and you have to do some platform specific improvements.
For me, there was an error in my code. I simply needed to run npm start to locate it.
If you are directly changing html from the Xcode, then you should change the code/html of the staging folder, not main folder
In the staging folder you will get same structure which you have in the main folder, but it will reflected directly in the xcode (iOS) build
Staging folder
Note: The changes you made in the xcode will be replace when you build again from the cordova build/run, so please copy your changes in the main folder before doing firing cordova commands
You can get more information from this answer: Purpose of Staging folder in PhoneGap 3.4? Only changes to index.html in this folder get recognized?
This is the correct solution taken from:
Cordova + Xcode 7.3 (html + Javascript) not changed or updated when build and emulate
I am new to ExtJS. I tried installing it as per the steps given here.
But I am getting one error while running this command.
sencha create jsb -a http://localhost:8080/helloext/index.html -p app.jsb3
Error msg :
C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\helloext>sencha create jsb -a http://localhost:8080/helloext/index.html -p app.jsb3 'sencha' is not
recognized as an internal or external command, operable program or
batch file.
What is the problem ?
PS : I already done with the prior steps of installing Apache Server and unzipping ExtJS SDK.
Thanks.
Windows is not finding the sencha executable.
Are you sure you downloaded the Sencha Tools SDK? (Current version is 1.2.3beta). The link from that tutorial shows a page with an obvious link to download the ExtJS library, and less obvious link for the Sencha SDK. Try downloading and installing this from here. Then see if typing "sencha" on the command line does something sensible.
I dont have time to reaad te tutorial but I will let you know how I get started using extjs. I download the library and extract the folder. Name the folder extjs. Then in my webroot or whatever you prefer I make a directory called lib and place extjs inside of it. Then when i create a html document I reference the library by using <script type="text/javascript" src="/lib/extjs/ext-all.js></script>. This is how you can call it up in order to use it. If you have a "app/js" file simply reference it after the example I gave you above so that it is loaded after the ext-all.js file.