Skip to content

Commit

Permalink
Chore: Update script names to latest conventions (#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoffan authored Apr 9, 2019
1 parent cbc57a1 commit b9eae0a
Show file tree
Hide file tree
Showing 5 changed files with 350 additions and 177 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ before_install:
- export PATH=$HOME/.yarn/bin:$PATH
jobs:
include:
- name: "Build"
script: yarn run ci
- name: "Code Lint"
script: yarn lint
- name: "Unit Tests"
script: yarn test
- name: "E2E Tests"
script: yarn test:e2e
- name: "Build"
script: npm-run-all clean build:i18n build:ci
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ To self-host the Box Content Preview library, follow these steps:
1. Either fork the repo and check out the version you want to host or download the specific version as a zip:
* Check out a specific version with `git checkout v2.5.0`
* Download a specific version as a zip from https://github.com/box/box-content-preview/releases
2. Install dependencies and build the library with `yarn install && yarn run prod`
2. Install dependencies and build the library with `yarn install && yarn prod`
3. Self-host everything except for the `dev` folder from the `/dist` folder. You must not alter the folder structure and `third-party` needs to be in the same folder as `2.4.0`. For example, if you self-host using a `box-assets` directory, these URLs must be accessible:
* https://cdn.YOUR_SITE.com/box-assets/2.4.0/en-US/preview.js
* https://cdn.YOUR_SITE.com/box-assets/third-party/text/0.114.0/papaparse.min.js
Expand Down Expand Up @@ -334,7 +334,7 @@ Development Setup
6. Add the upstream repo to your remotes `git remote add upstream git@github.com:box/box-content-preview.git`.
7. Verify your remotes are properly set up `git remote -v`. You should pull updates from the Box repo `upstream` and push changes to your fork `origin`.
8. Install dependencies `yarn install`
9. Test your first build! `yarn run build`
9. Test your first build! `yarn build`
10. To automatically rsync files after a Webpack build, add a build/rsync.json file with a `location` field. This file should look like:
```
{
Expand All @@ -353,13 +353,13 @@ Install the following plugins in your preferred editor

### Yarn commands

* `yarn run build` to generate resource bundles and JS webpack bundles.
* `yarn run start` to only generate JS webpack bundles on file changes.
* `yarn run start:dev` to launch a webpack-dev-server instance for local development.
* `yarn run test` launches karma tests with PhantomJS.
* `yarn run test -- --src=PATH/TO/SRC/FILENAME` launches test only for `src/lib/PATH/TO/SRC/__tests__/FILENAME-test.js` instead of all tests. For example, `yarn run test -- --src=viewers/media/MediaBase` launches tests for `src/lib/viewers/media/__tests__/MediaBase-test.js`. This also works for directories, e.g. `yarn run test -- --src=viewers/doc/`.
* `yarn run debug` launches karma tests with PhantomJS for debugging. Open the URL mentioned in the console.
* `yarn run debug -- --src=path/to/src/FILENAME` launches debugging for `src/lib/path/to/src/__tests__/FILENAME-test.js` instead of all tests. Open the URL mentioned in the console.
* `yarn build` to generate resource bundles and JS webpack bundles.
* `yarn start` to only generate JS webpack bundles on file changes.
* `yarn start:dev` to launch a webpack-dev-server instance for local development.
* `yarn test` launches karma tests with PhantomJS.
* `yarn test -- --src=PATH/TO/SRC/FILENAME` launches test only for `src/lib/PATH/TO/SRC/__tests__/FILENAME-test.js` instead of all tests. For example, `yarn test -- --src=viewers/media/MediaBase` launches tests for `src/lib/viewers/media/__tests__/MediaBase-test.js`. This also works for directories, e.g. `yarn test -- --src=viewers/doc/`.
* `yarn test:watch` launches karma tests with PhantomJS for debugging. Open the URL mentioned in the console.
* `yarn test:watch -- --src=path/to/src/FILENAME` launches debugging for `src/lib/path/to/src/__tests__/FILENAME-test.js` instead of all tests. Open the URL mentioned in the console.

For more script commands see `package.json`. Test coverage reports are available under reports/coverage.

Expand Down
2 changes: 1 addition & 1 deletion build/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ reset_to_master() {

build_lint_and_test() {
# The build command includes linting
yarn run build && yarn run test || return 1
yarn build && yarn test || return 1
}


Expand Down
297 changes: 151 additions & 146 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,148 +1,153 @@
{
"name": "box-content-preview",
"version": "2.5.0",
"description": "Box Content Preview UI Element",
"author": "Box (https://www.box.com/)",
"license": "SEE LICENSE IN LICENSE",
"repository": {
"type": "git",
"url": "git@github.com:box/box-content-preview.git"
},
"devDependencies": {
"@commitlint/cli": "^5.2.0",
"autoprefixer": "^7.2.1",
"axios": "^0.18.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.3",
"babel-loader": "^7.1.2",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-react-remove-properties": "^0.2.5",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-require-ignore": "^0.1.1",
"babel-preset-es2015": "^6.24.0",
"babel-preset-es2016": "^6.24.1",
"babel-preset-react": "^6.23.0",
"box-annotations": "^2.3.0",
"box-locales": "^0.0.1",
"box-react-ui": "^22.7.0",
"chai": "^4.2.0",
"chai-dom": "^1.8.1",
"conventional-changelog-cli": "^1.3.5",
"conventional-github-releaser": "^2.0.0",
"create-react-class": "^15.6.2",
"css-loader": "^0.28.7",
"cssnano-cli": "^1.0.5",
"cypress": "^3.1.5",
"eslint": "^4.12.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-chai-friendly": "^0.4.1",
"eslint-plugin-cypress": "^2.2.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "^1.1.5",
"fscreen": "^1.0.2",
"husky": "^0.14.3",
"i18n-webpack-plugin": "^1.0.0",
"jsuri": "^1.3.1",
"karma": "^3.1.4",
"karma-chai": "^0.1.0",
"karma-chai-dom": "^1.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-fixture": "^0.2.6",
"karma-html2js-preprocessor": "^1.1.0",
"karma-junit-reporter": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon": "^1.0.5",
"karma-sinon-chai": "^2.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.5",
"lint-staged": "^5.0.0",
"lodash": "^4.17.5",
"mocha": "^4.0.1",
"mock-local-storage": "^1.0.2",
"mojito-rb-gen": "^0.0.1",
"node-noop": "^1.0.0",
"node-sass": "4.9.3",
"npm-run-all": "^4.1.5",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"phantomjs-prebuilt": "^2.1.16",
"postcss-loader": "^2.0.9",
"postcss-sass": "^0.3.0",
"prettier": "^1.8.2",
"prettier-eslint-cli": "^4.4.2",
"raw-loader": "^0.5.1",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-virtualized": "^9.13.0",
"sass-loader": "^6.0.6",
"sinon": "^7.2.3",
"sinon-chai": "3.3.0",
"string-replace-loader": "^1.3.0",
"style-loader": "^0.19.0",
"stylelint": "^8.3.1",
"stylelint-config-standard": "^18.0.0",
"stylelint-order": "^0.7.0",
"stylelint-scss": "^2.2.0",
"wait-on": "^3.2.0",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.1",
"webpack-dev-server": "^2.11.3"
},
"engines": {
"node": ">=8.9.4",
"yarn": ">=1.10.0"
},
"scripts": {
"build": "yarn run clean && yarn run build-rb && yarn run lint && yarn run dev",
"build-ci": "./node_modules/.bin/webpack --progress --colors --config build/webpack.config.js",
"build-rb": "mojito-rb-gen -s src/i18n -o src/i18n/json -b en-US.properties",
"ci": "yarn install && yarn run clean && yarn run build-rb && yarn run lint && yarn run test && yarn run build-ci",
"clean": "rm -rf dist && rm -rf reports/coverage && rm -rf src/i18n/json",
"commitmsg": "commitlint -e",
"cy:open": "yarn cy:wait; yarn cypress open",
"cy:run": "yarn cy:wait; yarn cypress run --spec test/integration/**/*.test.js",
"cy:wait": "wait-on http-get://localhost:8000",
"debug": "yarn install && NODE_ENV=test ./node_modules/.bin/karma start build/karma.conf.js --no-single-run --auto-watch",
"dev": "yarn install && BABEL_ENV=dev NODE_ENV=dev ./node_modules/.bin/webpack --progress --colors --config build/webpack.config.js",
"lint": "NODE_ENV=dev ./node_modules/.bin/eslint src/lib && ./node_modules/.bin/stylelint 'src/lib/**/*.scss'",
"precommit": "lint-staged",
"prepush": "yarn run lint",
"prettier": "prettier-eslint \"src/lib/**/*.js\" --print-width 120 --single-quote --tab-width 4 --write",
"prod": "yarn run build-rb && BABEL_ENV=production NODE_ENV=production node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --progress --colors --config build/webpack.config.js",
"release": "yarn run clean && yarn run build-rb && yarn run lint && yarn run test && yarn run prod",
"start": "yarn install && BABEL_ENV=dev NODE_ENV=dev ./node_modules/.bin/webpack --watch --progress --colors --config build/webpack.config.js",
"start:dev": "yarn run build-rb && LANGUAGE=en-US BABEL_ENV=dev NODE_ENV=dev ./node_modules/.bin/webpack-dev-server --config build/webpack.config.js",
"test": "yarn install && NODE_ENV=test node --max_old_space_size=4096 ./node_modules/.bin/karma start build/karma.conf.js",
"test:e2e": "npm-run-all -p -r start:dev cy:run",
"test:e2e:open": "npm-run-all -p -r start:dev cy:open",
"upgrade-pdfjs": "./build/upgrade_pdfjs.sh && ./build/minify_pdfjs.sh",
"upgrade-annotations": "./build/upgrade_annotations.sh",
"major": "./build/release.sh -m",
"minor": "./build/release.sh -n",
"patch": "./build/release.sh -p"
},
"lint-staged": {
"tests/**/*.js": [
"prettier-eslint --print-width 120 --single-quote --tab-width 4 --write",
"git add"
],
"src/lib/**/*.js": [
"prettier-eslint --print-width 120 --single-quote --tab-width 4 --write",
"git add"
]
},
"resolutions": {
"mojito-rb-gen/merge": "1.2.1"
}
"name": "box-content-preview",
"version": "2.5.0",
"description": "Box Content Preview UI Element",
"author": "Box (https://www.box.com/)",
"license": "SEE LICENSE IN LICENSE",
"repository": {
"type": "git",
"url": "git@github.com:box/box-content-preview.git"
},
"devDependencies": {
"@commitlint/cli": "^5.2.0",
"autoprefixer": "^7.2.1",
"axios": "^0.18.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.3",
"babel-loader": "^7.1.2",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-react-remove-properties": "^0.2.5",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-require-ignore": "^0.1.1",
"babel-preset-es2015": "^6.24.0",
"babel-preset-es2016": "^6.24.1",
"babel-preset-react": "^6.23.0",
"box-annotations": "^2.3.0",
"box-locales": "^0.0.1",
"box-react-ui": "^22.7.0",
"chai": "^4.2.0",
"chai-dom": "^1.8.1",
"conventional-changelog-cli": "^1.3.5",
"conventional-github-releaser": "^2.0.0",
"create-react-class": "^15.6.2",
"css-loader": "^0.28.7",
"cssnano-cli": "^1.0.5",
"cypress": "^3.1.5",
"eslint": "^4.12.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-chai-friendly": "^0.4.1",
"eslint-plugin-cypress": "^2.2.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "^1.1.5",
"fscreen": "^1.0.2",
"husky": "^1.3.1",
"i18n-webpack-plugin": "^1.0.0",
"jsuri": "^1.3.1",
"karma": "^3.1.4",
"karma-chai": "^0.1.0",
"karma-chai-dom": "^1.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-fixture": "^0.2.6",
"karma-html2js-preprocessor": "^1.1.0",
"karma-junit-reporter": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon": "^1.0.5",
"karma-sinon-chai": "^2.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.5",
"lint-staged": "^5.0.0",
"lodash": "^4.17.5",
"mocha": "^4.0.1",
"mock-local-storage": "^1.0.2",
"mojito-rb-gen": "^0.0.1",
"node-noop": "^1.0.0",
"node-sass": "4.9.3",
"npm-run-all": "^4.1.5",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"phantomjs-prebuilt": "^2.1.16",
"postcss-loader": "^2.0.9",
"postcss-sass": "^0.3.0",
"prettier": "^1.8.2",
"prettier-eslint-cli": "^4.4.2",
"raw-loader": "^0.5.1",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-virtualized": "^9.13.0",
"sass-loader": "^6.0.6",
"sinon": "^7.2.3",
"sinon-chai": "3.3.0",
"string-replace-loader": "^1.3.0",
"style-loader": "^0.19.0",
"stylelint": "^8.3.1",
"stylelint-config-standard": "^18.0.0",
"stylelint-order": "^0.7.0",
"stylelint-scss": "^2.2.0",
"wait-on": "^3.2.0",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.1",
"webpack-dev-server": "^2.11.3"
},
"engines": {
"node": ">=8.9.4",
"yarn": ">=1.10.0"
},
"scripts": {
"build": "yarn setup && yarn clean && yarn build:i18n && yarn lint && yarn build:dev",
"build:ci": "yarn setup && yarn webpack --progress --colors --config build/webpack.config.js",
"build:dev": "BABEL_ENV=dev NODE_ENV=dev yarn webpack --progress --colors --config build/webpack.config.js",
"build:i18n": "mojito-rb-gen -s src/i18n -o src/i18n/json -b en-US.properties",
"build:prod": "BABEL_ENV=production NODE_ENV=production node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --progress --colors --config build/webpack.config.js",
"clean": "rm -rf dist && rm -rf reports/coverage && rm -rf src/i18n/json",
"cy:open": "yarn cy:wait; yarn cypress open",
"cy:run": "yarn cy:wait; yarn cypress run --spec test/integration/**/*.test.js",
"cy:wait": "wait-on http-get://localhost:8000",
"lint": "npm-run-all lint:*",
"lint:css": "NODE_ENV=dev yarn stylelint 'src/lib/**/*.scss'",
"lint:js": "NODE_ENV=dev yarn eslint src/lib",
"release": "yarn setup && yarn clean && yarn build:i18n && yarn lint && yarn test && yarn build:prod",
"release:major": "./build/release.sh -m",
"release:minor": "./build/release.sh -n",
"release:patch": "./build/release.sh -p",
"setup": "yarn install",
"start": "yarn setup && yarn build:dev --watch",
"start:dev": "yarn build:i18n && LANGUAGE=en-US BABEL_ENV=dev NODE_ENV=dev yarn webpack-dev-server --config build/webpack.config.js",
"test": "yarn setup && yarn clean && yarn build:i18n && NODE_ENV=test yarn karma start build/karma.conf.js",
"test:e2e": "npm-run-all -p -r start:dev cy:run",
"test:e2e:open": "npm-run-all -p -r start:dev cy:open",
"test:watch": "yarn test --no-single-run --auto-watch",
"upgrade:annotations": "./build/upgrade_annotations.sh",
"upgrade:pdfjs": "./build/upgrade_pdfjs.sh && ./build/minify_pdfjs.sh"
},
"lint-staged": {
"tests/**/*.js": [
"prettier-eslint --print-width 120 --single-quote --tab-width 4 --write",
"git add"
],
"src/lib/**/*.js": [
"prettier-eslint --print-width 120 --single-quote --tab-width 4 --write",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "yarn lint",
"commit-msg": "commitlint -e"
}
},
"resolutions": {
"mojito-rb-gen/merge": "1.2.1"
}
}
Loading

0 comments on commit b9eae0a

Please sign in to comment.