nodemon not watching for changes in tsx files - nodemon

I'm trying to test my typescript react app, and I have nodemon running jasmine tests on .ts files, but I can't get .tsx to trigger the watch action.
My package.json has a fairly simple
"test": "cross-env NODE_ENV=test jasmine-ts **/*.spec.ts*",
"test-watch": "nodemon -e ts -w ./ -x npm run test",
I thought the * at the end of the spec.ts* would tell nodemon to re-run on .ts as well as .tsx but that doesn't seem to work.
Neither does .tsx?

turns out the correct way to write this for nodemon is
"test-watch": "nodemon -e ts,tsx -w ./ -x npm run test",

Related

How to modify a deployed create-react-app on Github Pages?

I deployed a create-react-app on GitHub Pages using a mix of these 2 tutorials (https://create-react-app.dev/docs/deployment & https://github.com/gitname/react-gh-pages). It's working just fine.
But this webpage is supposed to evolve regularly, I have some content to add.
Is there a way to modify the deployed app? How can I push the changes I would make in my local directory to gh-pages (production mode)? Do I need to run npm build again after my additions?
For the moment I have the development mode on master branch. I think it's the build mode on gh-pages, although I don't have any other branch.
Thank you for your help.
What I did to deploy:
Terminal
$ npm install --save gh-pages
$ git init
$ git remote add origin https://github.com/REMOTE
$ npm run deploy
Package.json
{
"homepage": "https://USER-PAGE.github.io/",
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -b master -d build",
},
"devDependencies": {
"gh-pages": "^2.1.1"
}
}
To modify the site just make the changes and then git add, commit and push like one would normally do to the required branch.
Then again run the command:
npm run deploy

Aborting AWS operations/ installing Anaconda with numbapro

Two part question, would really appreciate help on either part. I'm attempting to install Anaconda followed by numbapro on AWS EB. My options.config in .ebextensions looks like this:
commands:
00_download_conda:
command: 'wget http://repo.continuum.io/archive/Anaconda2-4.3.0-Linux-x86_64.sh'
test: test ! -d /anaconda
01_install_conda:
command: 'bash Anaconda2-4.3.0-Linux-x86_64.sh'
command: echo 'Finished installing Anaconda'
test: test ! -d /anaconda
02_install_cuda:
command: 'export PATH=$PATH:$HOME/anaconda2/bin'
command: echo 'About to install numbapro'
command: 'conda install -c anaconda numbapro'
Whenever I attempt to deploy this I run into a timeout and when I try and manually stop the current processes from the console I get an error saying that the environment is not in a state where I can abort the current operation or view any log files.
There are a couple of problems here.
First, you need to make sure that you're properly indenting your YAML file, as YAML is sensitive to whitespace. Your file should look like this:
commands:
00_download_conda:
command: 'wget http://repo.continuum.io/archive/Anaconda2-4.3.0-Linux-x86_64.sh'
test: test ! -d /anaconda
01_install_conda:
command: 'bash Anaconda2-4.3.0-Linux-x86_64.sh'
...
Next, you can only have one command: entry per command. The echo commands aren't particularly valuable, as you can see what commands are being executed by looking at /var/log/eb-activity.log. You can also combine the export PATH line with conda install something like this:
PATH=$PATH:$HOME/anaconda2/bin conda install -c anaconda numbapro
If you're still having trouble after you clear up those items, check (or post here) eb-activity.log to see what's going on.
Refer to the documentation for more details.

Start up script to re-start the NodeJS app is not working

I'm trying to use the startup-script meta to automatically start my server when my instance resets.
The startup script runs, but the actual command I need doesn't work. What am I doing wrong in this script?
#! /bin/bash
echo "testing" > /tmp/test-script.txt # This WORKS
cd /../ && npm start # This does NOT work
If you look in your package.json file, it says "start": "command" and that is the command that is run when you use the npm start command. The command should be changed in package.json: "start": "node ./pathToStartUpScripts". For example in an Express.js project the start command would be "node ./bin/www" as that is where all the application start up scripts are written.

How do I run concurrent scripts when webpack watch fires?

Background
I currently have an npm script that looks something like
"dev":"yarn install && concurrently -k \"npm run webpack\" \"cd dist/ && node App.js\" \"npm run test\" \"npm run lint\""
Logically this runs webpack, starts the app, lints, and tests in parallel.
npm webpack in that script has --watch set
Note: this is for dev.
The Problems
This tries to run the app before it has webpacked
This won't re-run the app when webpack repacks due to watch
The Goal
Run npm run webpack once
When it outputs (meaning the watch fired and finished) run the other three commands
when something crashes inform me, don't waste time running stuff that won't work, but try again when I fix the file.
The Real Problem
I don't know what I don't know. I suspect the real answer will be in the webpack config itself potentially, or there's a better tool than concurrently/watch for my use case, or the core idea on how I've designed this is just crazy. Maybe I want to create a devServer.js that uses webpack dev middleware to serve these instead? how would that pull in linting and testing then?
I don't know what a beautiful version of this build would look like.
What I Really Need
A great tutorial/guide/blog post about how this 'Should' go.
Here's what I would do; perhaps there's a better way:
"scripts": {
"dev": "yarn install && concurrently -k \"npm run webpack\" \"npm run watch\"",
"watch": "onchange \"dist/**/" -- concurrently -k \"cd dist/ && node App.js\" \"npm run test\" \"npm run lint\""
}
This uses onchange. npm run dev starts webpack and onchange in parallel. onchange monitors for any file changes in dist/ and runs your tasks when any files change.
The limitation of this approach is that your tasks will not run until files change in dist. You can work around this by deleting dist/ before running webpack. (Use rimraf to do this in a cross-platform way.) Example:
"dev": "yarn install && rimraf dist && concurrently -k \"npm run webpack\" \"npm run watch\""
You can just use rm -rf dist if you don't care about Windows support.

How can I write a Groovy Jenkinsfile for a Django application to run my tests?

I have recently started using Jenkins and I am wanting to use Multibranch Pipelines so I can test the various feature branches in my project.
The project is using django 1.8. So far my Jenkinsfile looks like this and fails in the testing stage as django can not find my settings file even though it is there:
node {
// Mark the code checkout 'stage'....
stage 'Checkout'
// Get the code from a GitHub repository
git credentialsId: 'mycredentials', url: 'https://github.com/<user>/<project>/'
// Mark the code build 'stage'....
stage 'Build'
env.WORKSPACE = pwd()
sh 'virtualenv --python=python34 venv'
sh 'source venv/bin/activate'
sh 'pip install -r requirements.txt'
env.DJANGO_SETTINGS_MODULE = "<appname>.settings.jenkins"
// Start the tests
stage 'Test'
sh 'python34 manage.py test --keepdb'
}
venv/bin/activate does no more than setting up proper environmental paths.
You can do it on your own by adding at the beginning assuming that env.WORKSPACE is your project directory:
env.PATH="${env.WORKSPACE}/venv/bin:/usr/bin:${env.PATH}"
Later, if you want to call virtualenved python, just need to prepend it with specified path like here:
stage 'Test'
sh "${env.WORKSPACE}/venv/bin/python34 manage.py test --keepdb'
Or to call pip
sh "${env.WORKSPACE}/venv/bin/pip install -r requirements.txt"