Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
[WIP] Upgrade yarn and moon (#138)
Browse files Browse the repository at this point in the history
* upgrade yarn and moon succesfully

* update tasks and dockerfile

* testing

* Replace swc with tsup for node builds
Fix circular dependency issues in models build
Update type imports
Remove unused packages

* Add missing plugin file

* Update node builds to use tsc
Update models to use reference import to prevent circular deps issues
Update all release scripts to use node 16

* remove project reference from landping page moon

* Fix landing page outputs
Fix jest test config

* cypress blue team command

* remove types

* add types back in to tsconfig

* Fix client mobx store loading errors

* pin moon to 1.8

* upgrade moon and locked all resolutions to 1.9.2

* Update lock file

---------

Co-authored-by: Austin Golding <austin.golding.dev@icloud.com>
  • Loading branch information
sang2925 and GoldingAustin authored Jul 12, 2023
1 parent 952757e commit 32241f8
Show file tree
Hide file tree
Showing 114 changed files with 4,232 additions and 4,266 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/consistent-type-imports": [
"warn",
{
"prefer": "type-imports",
"fixStyle": "separate-type-imports",
"disallowTypeAnnotations": true
}
],
"import/no-anonymous-default-export": ["error"]
}
}
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ jobs:
with:
name: RedEye
path: artifacts

97 changes: 48 additions & 49 deletions .moon/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,6 @@ fileGroups:
# This setting requires a map, where the key is a unique name for the task,
# and the value is an object of task parameters.
tasks:
run-cypress:
local: true
command:
- cypress
- run
- --config-file
- cypress.config.js
env:
CYPRESS_BASE_URL: http://localhost:3500
platform: node
options:
runInCI: false
start-cypress:
local: true
command:
- cypress
- open
- --config-file
- cypress.config.js
env:
CYPRESS_BASE_URL: http://localhost:3500
platform: node
options:
runInCI: false
test-jest:
command: 'jest . --coverage --reporters="jest-junit" --passWithNoTests'
inputs:
Expand All @@ -92,6 +68,16 @@ tasks:
platform: node
options:
runInCI: false
lint-global:
command: 'eslint --config $workspaceRoot/.eslintrc.json --ignore-path $workspaceRoot/.gitignore src --fix --max-warnings 0'
inputs:
- '@globs(sources)'
- '@globs(tests)'
- '.eslintignore'
- '.eslintrc.json'
platform: node
options:
runInCI: false
format:
command:
- prettier
Expand Down Expand Up @@ -144,18 +130,35 @@ tasks:

# Library mode commands
build-library:
command: 'cross-env npx -c "tsup-node ./src/index.ts --minify --format esm && tsc --emitDeclarationOnly --outDir dist"'
command: 'noop'
inputs:
- '@globs(sources)'
- '@globs(assets)'
- '@globs(tests)'
- 'tsconfig.json'
outputs:
- dist
- 'tsconfig.tsbuildinfo'
deps:
- ^:build
- ~:build-client-library
- ~:typecheck
env:
NODE_ENV: production
platform: node
options:
runDepsInParallel: false
runInCI: false
build-client-library:
command: 'tsup-node ./src/index.ts --minify --format esm'
inputs:
- '@globs(sources)'
- '@globs(assets)'
- 'tsconfig.json'
outputs:
- dist
env:
NODE_ENV: production
deps:
- ^:build
- ~:clean-dist
platform: node
options:
Expand All @@ -171,62 +174,57 @@ tasks:
env:
NODE_ENV: production
platform: node
local: true
options:
runInCI: false
cache: false

# Node commands

## Build with SWC and type checking
build-node:
command: 'noop'
build-node-library:
command: 'tsc --project tsconfig.json --module commonjs --sourceMap --outDir @out(0)'
inputs:
- '@globs(sources)'
- '@globs(tests)'
- '@globs(assets)'
- 'tsconfig.json'
outputs:
- dist
- 'tsconfig.tsbuildinfo'
deps:
- ^:build
- ~:build-swc
- ~:typecheck
env:
NODE_ENV: production
deps:
- ~:clean-dist
platform: node
options:
runDepsInParallel: false
runInCI: false

## Build with SWC and clean dist
build-swc:
command: 'swc src -d @out(0) --copy-files'
build-node:
command: 'noop'
inputs:
- '@globs(sources)'
- '.swcrc'
outputs:
- dist
- '@globs(tests)'
- 'tsconfig.json'
deps:
- ~:clean-dist
- ^:build
- ~:build-node-library
env:
NODE_ENV: production
platform: node
options:
runDepsInParallel: false
runInCI: false

start-node:
env:
NODE_ENV: development
command: 'nodemon --ext ts --watch src --exec "swc src -d dist && yarn node ./dist/index.js" --ignore "src/**/*.test.ts"'
local: true
command: 'tsup-node src/index.ts --sourcemap --watch --onSuccess "yarn node --enable-source-maps dist/index.js" --ignore-watch "src/**/*.test.ts"'
inputs:
- '@globs(sources)'
- '@globs(tests)'
- 'tsconfig.json'
platform: node
local: true
options:
runInCI: false

# Release Commands

release-all:
command: 'noop'
deps:
Expand Down Expand Up @@ -303,6 +301,7 @@ tasks:
platform: node
options:
runInCI: false
cache: false

## Typecheck
typecheck:
Expand Down
2 changes: 1 addition & 1 deletion .moon/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ node:

# The version of the package manager (above) to use.
yarn:
version: '3.2.3'
version: '3.5.1'

# Add `node.version` as a constraint in the root `package.json` `engines`.
addEnginesConstraint: true
Expand Down
6 changes: 3 additions & 3 deletions .moon/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ $schema: 'https://moonrepo.dev/schemas/workspace.json'

# Extend and inherit an external configuration file. Must be a valid HTTPS URL or file system path.
# extends: './shared/workspace.yml'
runner:
implicitDeps:
- '^:build'
# runner:
# implicitDeps:
# - '^:build'
# REQUIRED: A map of all projects found within the workspace, or a list or file system globs.
# When using a map, each entry requires a unique project ID as the map key, and a file system
# path to the project folder as the map value. File paths are relative from the workspace root,
Expand Down
7 changes: 7 additions & 0 deletions .yarn/plugins/@ArTs/plugin-http-proxy.cjs

Large diffs are not rendered by default.

783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.3.cjs

This file was deleted.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.1.cjs

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
enableTelemetry: false

logFilters:
- code: YN0013
level: discard
- code: YN0013
level: discard

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.2.3.cjs
plugins:
- path: .yarn/plugins/@ArTs/plugin-http-proxy.cjs
spec: 'https://github.com/arontsang/yarn-plugin-http-proxy/releases/latest/download/index.cjs'

yarnPath: .yarn/releases/yarn-3.5.1.cjs
1 change: 1 addition & 0 deletions applications/client/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extends:
- prettier
rules:
react-hooks/exhaustive-deps: 0 # Disabled for mobx
react/no-unknown-property: 0 # Disabled for css and cy-test
import/prefer-default-export: 0 # Prefer named exports
import/no-default-export: 2 # Prefer named exports
no-console: 1 # Warn about console logs, use window.console.log if the log should be available in production
Expand Down
9 changes: 2 additions & 7 deletions applications/client/src/components/Mitre/readme.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@



# Download MITRE ATT&CK Framework Json

https://github.com/mitre/cti/blob/master/enterprise-attack/enterprise-attack.json




This data may need to be updated periodically

- Visit https://mitre-attack.github.io/attack-navigator/
- Select "Create New Layer" > "Enterprise"
- In the top toolbar under "Selection Controls" click "Search & MultiSelect" (the search icon 🔎)
- In the right panel, under "Techniques" click "Select All."
- With all techniques selected, In the top toolbar under "Layer Controls" click "Download layer as json" (the down arrow icon ⬇)
- replace the `layer.json` file with the newly downloaded one.
- replace the `layer.json` file with the newly downloaded one.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const ToggleHiddenDialog = observer<Props>(
const dialogTitle = isHidingFinal
? `Cannot hide final ${infoType.toLowerCase()}${bulk ? 's' : ''}`
: // : `${verb} this ${infoType.toLowerCase()}?`;
`${verb} ${bulk ? 'these' : 'this'} ${infoType.toLowerCase()}${bulk ? 's' : ''}?`;
`${verb} ${bulk ? 'these' : 'this'} ${infoType.toLowerCase()}${bulk ? 's' : ''}?`;

return (
<DialogEx onClose={onClose} title={dialogTitle} {...props}>
Expand Down
3 changes: 1 addition & 2 deletions applications/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"validProperties": ["r", "dominant-baseline"]
}
}
],
"types": ["react/next"]
]
},
"include": ["src"],
"references": [
Expand Down
6 changes: 1 addition & 5 deletions applications/landing-page/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tasks:
inputs:
- '@group(astro)'
outputs:
- 'dist'
- 'dist-landing'
start-astro:
local: true
deps:
Expand All @@ -22,7 +22,3 @@ tasks:
runInCI: false
runDepsInParallel: false
command: 'astro dev'
# Disable project references
toolchain:
typescript:
syncProjectReferences: false
2 changes: 2 additions & 0 deletions applications/redeye-e2e/.env.blue
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

SERVER_BLUE_TEAM=true
48 changes: 30 additions & 18 deletions applications/redeye-e2e/moon.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
dependsOn:
- 'server'
- 'client'

tasks:
open-cy:
command: 'concurrently "yarn start:client" "yarn start:server" "yarn moon run redeye-e2e:start-cypress"'
start:
local: true
command:
- cypress
- open
- --config-file
- cypress.config.js
env:
CYPRESS_BASE_URL: http://localhost:3500
options:
runFromWorkspaceRoot: true
open-cy-blue:
command: 'concurrently "yarn start:server" "yarn start:client" "yarn moon run redeye-e2e:start-cypress"'
runInCI: false

run:
local: true
options:
runFromWorkspaceRoot: true
command:
- cypress
- run
- --config-file
- cypress.config.js
env:
SERVER_BLUE_TEAM: 'true'
cy-ci-chrome-redteam:
local: true
command: 'concurrently "yarn start:server" "yarn start:client" "yarn moon run redeye-e2e:run-cypress -- --headed --browser=chrome"'
CYPRESS_BASE_URL: http://localhost:3500
platform: node
options:
runFromWorkspaceRoot: true
cy-ci-firefox-redteam:
runInCI: false

open-cy:
command: 'noop'
deps:
- 'client:start-dev'
- 'server:start-dev'
- 'redeye-e2e:start'
local: true
command: 'concurrently "yarn start:server" "yarn start:client" "yarn moon run redeye-e2e:run-cypress -- --browser=firefox --headed --spec **/**/e2e/redteam/**/**/**"'
options:
runFromWorkspaceRoot: true
cy-ci-chrome-blueteam:

open-cy-blue:
command: 'concurrently "yarn start:server" "yarn start:client" "yarn moon run redeye-e2e:start"'
local: true
command: 'concurrently "yarn start:server" "yarn start:client" "yarn moon run redeye-e2e:run-cypress -- --headed --browser=chrome --spec **/**/e2e/blueteam/**/**/**"'
options:
runFromWorkspaceRoot: true
env:
Expand Down
2 changes: 2 additions & 0 deletions applications/server/.env.blue
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

SERVER_BLUE_TEAM=true
Loading

0 comments on commit 32241f8

Please sign in to comment.