To run locally..
ts-node needs to be installed. You'll also need to install express, react, and react-dom.
- Make
tsConfig.jsona sibling toserver.tsx - run like so
$ NODE_PORT=8888 ts-node server.tsx - open http://localhost:8888/ in a browser.
| // I found bad advice online on how to use Next.js behind passenger https://www.phusionpassenger.com/ | |
| // yarn start or npm start won't work. This file is derived from the code that runs when you | |
| // run the yarn start command. Tested only in my particular setup where the file is required | |
| // to be called app.js. This file is TS, so you'll need to transpile to JS in your build, | |
| // eg change package json build script to (you'll need a tsconfig.server.json file): | |
| // "build": "next build && tsc --project ./tsconfig.server.json", | |
| import http from 'http'; | |
| import next from 'next'; |
To run locally..
ts-node needs to be installed. You'll also need to install express, react, and react-dom.
tsConfig.json a sibling to server.tsx$ NODE_PORT=8888 ts-node server.tsx| // relay/scripts/getBabelOptions.js | |
| const fbjsPreset = require('babel-preset-fbjs/configure')({ | |
| autoImport: options.autoImport || false, | |
| objectAssign: false, | |
| inlineRequires: false, // <-- FALSE! | |
| stripDEV: options.env === 'production' | |
| }); |
| [].slice.call(document.getElementsByTagName('script')).filter(script => /example.com/.test(script.src)).map(script => script.src); |
| # To run and debug jest tests using webstorm's configurations | |
| # create a new Node.js configuration and configure it this way: | |
| Node interpreter: /path/to/bin/node | |
| Working Directory: /path/to/project | |
| Javascript file: ./node_modules/.bin/jest | |
| Application parameters: -i # ensures all tests run in 1 process |
| const Router = new AmpersandRouter({ | |
| // define all of the routes in our application. | |
| // AmpersandRouter will invoke the method named when a route is | |
| // matched on either page load or a browser back/forward click | |
| routes: { | |
| '/my/order/receipt/:orderId': 'loadReceipt' | |
| '/my/order/:orderId': 'loadOrder', | |
| '/my/orders': 'loadOrders', | |
| }, | |
| initialize(options) { |
| function (state = {}, action) { | |
| switch (action.type) { | |
| case 'VIEW_ORDERS': | |
| return { | |
| ...state, | |
| pageType: 'orders', | |
| orderId: null | |
| }; | |
| case 'VIEW_ORDER': | |
| return { |
| #!/usr/bin/env bash | |
| # AWS domain | |
| DOMAIN=${AWS_DOMAIN} | |
| # Set CI_TEST to true to exit the script before build commences. | |
| TEST=${CI_TEST:-'false'} | |
| # Defaults for testing (variables supplied by Jenkins when in that environment). | |
| GIT_URL=${GIT_URL:-"[email protected]:foo/foo-bar-baz-qux.git"} |
| // NOTE* The notations below assume that there is only 1 size per image, ie. new dynamically sized images are already working : | |
| // POST a new image : | |
| // soa/inventory-3/2/image | |
| // payload : multi part form-data | |
| // return value : | |
| { | |
| id : '123', | |
| original : '/path/to/original.jpeg', | |
| master : '/path/to/master.jpeg', |
| var moduleDir = require.resolve('module/package').replace('package.json', ''); |