Skip to content

Commit

Permalink
feat(rush): Migrate to Rush (#1803)
Browse files Browse the repository at this point in the history
fix(website): WIP fixing website with Rush (#1814)

fixup pouchdb local file loading (#1823)

fix(website): WIP to show how to fix website FS (#1822)

fix(website): fixup neo-one source file loading into pouchDB (#1825)

feat(rush clean): add new rush clean command/script (#1824)

feat(rush): prepare rush for npm publishing (#1834)

fix(script): fix spencers scripts (#1827)

feat(CI): fixup e2e tests (#1833)

fix(rush): move smart-contract-lib tests to neo-one-smart-contract-test (#1850)

feat(rush): Add pack/release commands (#1854)

feat(rush): add initial changelog for migration

fix(rush): add git hooks back, add tsc command (#1845)

fix(rush): fixup e2e test snapshot

pin typescript 3.6.3 temporarily

feat(rush): switch to pnpm (#1864)

fix(rush): refine docker image copies (#1865)

fix(rush): revert back to yarn for website (#1868)

fix(rush): add/cleanup website prod cmds and compile scripts (#1844)

fix(rush): add appropriate path-mapping, add sourcemaps for dev (#1869)
  • Loading branch information
danwbyrne committed Dec 2, 2019
1 parent ab243da commit c43b9b3
Show file tree
Hide file tree
Showing 495 changed files with 11,794 additions and 7,263 deletions.
162 changes: 68 additions & 94 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,155 +1,138 @@
aliases:
- &restore-yarn-cache-10
keys:
- v5-yarn-10-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v8-yarn-10-{{ .Branch }}-{{ checksum "common/config/rush/yarn.lock" }}
# Fallback in case checksum fails
- v5-yarn-10-{{ .Branch }}-
- v8-yarn-10-{{ .Branch }}-

- &save-yarn-cache-10
paths:
- node_modules
- ~/.cache/yarn
key: v5-yarn-10-{{ .Branch }}-{{ checksum "yarn.lock" }}
- common/temp/node_modules
- common/temp/yarn-cache
key: v8-yarn-10-{{ .Branch }}-{{ checksum "common/config/rush/yarn.lock" }}

- &restore-yarn-cache-12
keys:
- v5-yarn-12-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v8-yarn-12-{{ .Branch }}-{{ checksum "common/config/rush/yarn.lock" }}
# Fallback in case checksum fails
- v5-yarn-12-{{ .Branch }}-
- v8-yarn-12-{{ .Branch }}-

- &save-yarn-cache-12
paths:
- node_modules
- ~/.cache/yarn
key: v5-yarn-12-{{ .Branch }}-{{ checksum "yarn.lock" }}
- common/temp/node_modules
- common/temp/yarn-cache
key: v8-yarn-12-{{ .Branch }}-{{ checksum "common/config/rush/yarn.lock" }}

- &filter-ignore-bors-tmp
branches:
ignore:
- staging.tmp
- trying.tmp

- &yarn |
yarn install --non-interactive --cache-folder ~/.cache/yarn --ignore-engines
- &install |
node common/scripts/install-run-rush.js install

- &lint
- &nit
working_directory: ~/neo-one
steps:
- checkout
- restore-cache: *restore-yarn-cache-12
- run: *yarn
- run: *install
- save-cache: *save-yarn-cache-12
- run:
name: Prettier
command: yarn nit
name: Changelog
command: node common/scripts/install-run-rush.js change -v
when: always
- run:
name: Typescript
command: yarn tsc
name: Lint
command: node common/scripts/install-run-rush.js lint -p 8
when: always
- run:
name: Lint
command: yarn lint
name: Prettier
command: node common/scripts/install-run-rush.js nit
when: always

- &build-e2e10
- &build-10
working_directory: ~/neo-one
steps:
- checkout
- restore-cache: *restore-yarn-cache-10
- run: *yarn
- run: *install
- save-cache: *save-yarn-cache-10
- run:
name: Build
command: yarn build:e2e
command: node common/scripts/install-run-rush.js rebuild
- persist_to_workspace:
root: ~/neo-one
paths:
- dist
- node_modules
- common/temp/node_modules
- packages/*/lib
- packages/*/node_modules

- &test10
working_directory: ~/neo-one
steps:
- checkout
- restore-cache: *restore-yarn-cache-10
- run: *yarn
- save-cache: *save-yarn-cache-10
- attach_workspace:
at: ./
- run:
name: Test
command: yarn test-ci $(circleci tests glob "packages/*/src/__tests__/**/*.test.ts" | circleci tests split --split-by=timings) --coverage
command: node common/scripts/install-run-rush.js test-ci --test-path-pattern '$(circleci tests glob packages/*/src/__tests__/**/*.test.ts)' --coverage
- run:
name: Upload Unit Test Coverage
command: yarn run codecov -f coverage/coverage-final.json -F unit
command: node common/scripts/install-run-rush.js upload-coverage -F unit
when: always
- store_test_results:
path: reports
parallelism: 2

- &e2e10
working_directory: ~/neo-one
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: E2E
command: yarn nyc --reporter json yarn e2e-ci $(circleci tests glob "packages/*/src/__e2e__/**/*.test.ts" | circleci tests split --split-by=timings)
- run:
name: Upload E2E Test Coverage
command: yarn run codecov -f coverage/coverage-final.json -F e2e
when: always
command: node common/scripts/install-run-rush.js e2e-ci --test-path-pattern '$(circleci tests glob packages/*/src/__e2e__/**/*.test.ts)'
# - run:
# name: Upload E2E Test Coverage
# command: node common/scripts/install-run-rush.js upload-coverage -F e2e
# when: always
- store_test_results:
path: reports
parallelism: 2

- &build-e2e12
- &build-12
working_directory: ~/neo-one
steps:
- checkout
- restore-cache: *restore-yarn-cache-12
- run: *yarn
- run: *install
- save-cache: *save-yarn-cache-12
- run:
name: Build
command: yarn build:e2e
command: node common/scripts/install-run-rush.js rebuild
- run:
name: Lint
command: node common/scripts/install-run-rush.js lint -p 8
- persist_to_workspace:
root: ~/neo-one
paths:
- dist
- node_modules
- common/temp/node_modules
- packages/*/lib
- packages/*/node_modules

- &test12
working_directory: ~/neo-one
steps:
- checkout
- restore-cache: *restore-yarn-cache-12
- run: *yarn
- save-cache: *save-yarn-cache-12
- attach_workspace:
at: ./
- run:
name: Test
command: yarn test-ci $(circleci tests glob "packages/*/src/__tests__/**/*.test.ts" | circleci tests split --split-by=timings) --coverage
command: node common/scripts/install-run-rush.js test-ci --test-path-pattern '$(circleci tests glob packages/*/src/__tests__/**/*.test.ts)' --coverage
- run:
name: Upload Unit Test Coverage
command: yarn run codecov -f coverage/coverage-final.json -F unit
command: node common/scripts/install-run-rush.js upload-coverage -F unit
when: always
- store_test_results:
path: reports
parallelism: 2

- &e2e12
working_directory: ~/neo-one
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: E2E
command: yarn nyc --reporter json yarn e2e-ci $(circleci tests glob "packages/*/src/__e2e__/**/*.test.ts" | circleci tests split --split-by=timings)
- run:
name: Upload E2E Test Coverage
command: yarn run codecov -f coverage/coverage-final.json -F e2e
when: always
command: node common/scripts/install-run-rush.js e2e-ci --test-path-pattern '$(circleci tests glob packages/*/src/__e2e__/**/*.test.ts)'
# - run:
# name: Upload E2E Test Coverage
# command: node common/scripts/install-run-rush.js upload-coverage -F e2e
# when: always
- store_test_results:
path: reports
parallelism: 2
Expand All @@ -167,50 +150,41 @@ jobs:
test10:
<<: *node10
<<: *test10
e2e10:
<<: *node10
<<: *e2e10
build-e2e10:
build-10:
<<: *node10
<<: *build-e2e10
<<: *build-10

test12:
<<: *node12
<<: *test12
e2e12:
build-12:
<<: *node12
<<: *e2e12
build-e2e12:
<<: *node12
<<: *build-e2e12
<<: *build-12

lint:
nit:
<<: *node12
<<: *lint
<<: *nit

workflows:
version: 2
test10:
jobs:
- build-e2e10:
- nit:
filters: *filter-ignore-bors-tmp
- build-10:
filters: *filter-ignore-bors-tmp
- test10:
filters: *filter-ignore-bors-tmp
- e2e10:
requires:
- build-e2e10
filters: *filter-ignore-bors-tmp
- lint:
filters: *filter-ignore-bors-tmp
- build-10

test12:
jobs:
- build-e2e12:
- nit:
filters: *filter-ignore-bors-tmp
- build-12:
filters: *filter-ignore-bors-tmp
- test12:
filters: *filter-ignore-bors-tmp
- e2e12:
requires:
- build-e2e12
filters: *filter-ignore-bors-tmp
- lint:
filters: *filter-ignore-bors-tmp
- build-12
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/node_modules**
**/lib*
**/package-deps.json
**/*.log
16 changes: 12 additions & 4 deletions .github/workflows/website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ jobs:
- name: Checkout Code
uses: actions/checkout@94d077c24971944d312dd9197c1bdfba62b39878
- name: Install Node
run: brew update-reset && brew update && export PATH="/usr/local/bin:$PATH" && brew unlink node@6 && brew install node
run: brew update-reset && brew update && brew unlink node@12 && brew install node@10 && brew link node@10 --force
- name: Install Chrome
run: brew cask install google-chrome
- name: Yarn Install
run: yarn install --non-interactive --ignore-engines
- name: Install Rush
run: npm i -g @microsoft/rush@latest
- name: Rush Install
run: rush install
- name: Rush Rebuild
run: rush rebuild
- name: Rush Link Root
run: rush link-root
- name: Run Cypress Express Test
run: yarn test:cypress-express
run: rush test-cypress --express
- name: Rush Unlink Root
run: rush unlink-root
- name: Store Cypress Screenshots
if: failure()
continue-on-error: true
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
/build/
/tmp
/packages/*/lib
/packages/*/dist
/packages/*/dist-ts
.rpt2_cache
/reports
.nyc_output
Expand All @@ -17,6 +15,7 @@
# Playground
/packages/neo-one-playground

# Website
/packages/neo-one-website/tmp
/packages/neo-one-website/build
/packages/neo-one-website/dist
Expand Down Expand Up @@ -77,3 +76,8 @@ cypress/screenshots

# React-Static Artifacts
/packages/neo-one-website/artifacts/

# Rush files
common/temp/**
package-deps.json
/packages/*/.rush
12 changes: 12 additions & 0 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');

const basePath = path.resolve(__dirname, '.git');

module.exports = {
hooks: {
'pre-commit': `rush check && rush lint:staged -p 16 && rush build && GIT_DIR=${basePath} rush change -v`,
'post-merge': 'rush install',
'post-rewrite': 'rush install',
'post-checkout': 'rush install',
},
};
19 changes: 19 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const path = require('path');

module.exports = {
'**/src/**/*.ts?(x)': (filenames) =>
filenames.reduce((acc, filename) => {
return acc.concat([
`${path.resolve(
__dirname,
'common',
'temp',
'node_modules',
'.bin',
'prettier',
)} --write ${filename}`,
`git add ${path.resolve(process.cwd(), filename)}`,
`node ./node_modules/@neo-one/build-tools/bin/neo-one-lint.js --staged --pattern \"${filename}\"`,
]);
}, []),
};
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{
"arrowParens": "always",
"printWidth": 120,
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.tsdk": "common/temp/node_modules/typescript/lib",
"typescript.format.insertSpaceBeforeFunctionParenthesis": false,
"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"typescript.format.enable": false,
Expand All @@ -15,6 +15,7 @@
"deepscan.enable": true,
"files.associations": {
"[Dd]ockerfile*": "dockerfile",
"docker-compose*": "yaml"
"docker-compose*": "yaml",
"*.d.ts.map": "json"
}
}
Loading

0 comments on commit c43b9b3

Please sign in to comment.