refactor: repo (#1070)

This commit is contained in:
Mo
2022-06-07 07:18:41 -05:00
committed by GitHub
parent 4c65784421
commit f4ef63693c
1102 changed files with 5786 additions and 3366 deletions

View File

@@ -1,5 +1,9 @@
# git
.git/
.gitignore
.eslintcache
node_modules
public/assets
dist
packages/web-server/public/assets
packages/web-server/tmp
packages/web-server/vendor/bundles

View File

@@ -5,7 +5,7 @@ queries:
- uses: ./.github/codeql/custom-queries/javascript
paths:
- app/assets/javascripts
- packages/web/src/javascripts
paths-ignore:
- bin

View File

@@ -11,10 +11,14 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.8
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Bundle
run: yarn bundle
- name: Build
run: yarn build
- name: ESLint
run: yarn lint
- name: Test

View File

@@ -15,10 +15,14 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.8
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Bundle
run: yarn bundle
- name: Build
run: yarn build
- name: ESLint
run: yarn lint
- name: Test
@@ -35,7 +39,7 @@ jobs:
- uses: actions/checkout@v2
- name: Copy robots.txt
run: cp public/robots.txt.development public/robots.txt
run: cp packages/web-server/public/robots.txt.development packages/web-server/public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master

View File

@@ -12,10 +12,14 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.8
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Bundle
run: yarn bundle
- name: Build
run: yarn build
- name: ESLint
run: yarn lint
- name: Test

View File

@@ -14,10 +14,14 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.8
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Bundle
run: yarn bundle
- name: Build
run: yarn build
- name: ESLint
run: yarn lint
- name: Test
@@ -33,7 +37,7 @@ jobs:
- uses: actions/checkout@v2
- name: Copy robots.txt
run: cp public/robots.txt.production public/robots.txt
run: cp packages/web-server/public/robots.txt.production packages/web-server/public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master

50
.gitignore vendored
View File

@@ -1,54 +1,30 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
.eslintcache
# OS & IDE
.DS_Store
.vscode
.idea
node_modules
# Ignore bundler config.
/.bundle
packages/web-server/log/*
!packages/web-server/log/.gitkeep
packages/web-server/tmp
packages/web-server/config/cap.yml
packages/web-server/app/assets/templates/generated/
packages/web-server/public/assets
packages/web-server/public/robots.txt
packages/web-server/public/uploads/*
packages/!web-server/public/uploads/.keep
packages/web-server/vendor
# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
packages/web/dist
/config/cap.yml
/app/assets/templates/generated/
/node_modules
/.sass-cache
# Ignore ENV variables config
.env
.ssh
dump.rdb
# Ignore compiled assets
/public/assets
# Ignore robots.txt - generated before image creation
/public/robots.txt
# Ignore user uploads
/public/uploads/*
!/public/uploads/.keep
.vscode
/dist
# Yarn
yarn-error.log
package-lock.json
codeqldb
coverage

View File

@@ -1,5 +1,9 @@
FROM ruby:2.7.4-alpine3.14
ARG USERNAME=snjs
ARG UID=1001
ARG GID=$UID
RUN apk add --update --no-cache \
alpine-sdk \
nodejs-current \
@@ -8,19 +12,26 @@ RUN apk add --update --no-cache \
yarn \
tzdata
RUN addgroup -S $USERNAME -g $GID && adduser -D -S $USERNAME -G $USERNAME -u $UID
WORKDIR /app/
COPY package.json yarn.lock Gemfile Gemfile.lock /app/
RUN chown -R $UID:$GID .
USER $USERNAME
COPY --chown=$UID:$GID package.json yarn.lock /app/
COPY --chown=$UID:$GID packages/web/package.json /app/packages/web/package.json
COPY --chown=$UID:$GID packages/web-server/package.json /app/packages/web-server/package.json
RUN yarn install --pure-lockfile
RUN gem install bundler && bundle install
COPY --chown=$UID:$GID . /app
COPY . /app/
RUN gem install bundler
RUN yarn bundle
RUN bundle exec rails assets:precompile
RUN yarn build
EXPOSE 3000

View File

@@ -1,29 +0,0 @@
{
"extends": "../../../node_modules/@standardnotes/config/src/tsconfig.json",
"compilerOptions": {
"skipLibCheck": true,
"target": "ES2019",
"module": "commonjs",
"moduleResolution": "node",
"allowJs": true,
"noEmit": true,
"strict": true,
"isolatedModules": false,
"esModuleInterop": true,
"resolveJsonModule": true,
"declaration": true,
"newLine": "lf",
"declarationDir": "../../../dist/@types",
"baseUrl": ".",
"jsx": "react-jsx",
"typeRoots": ["./Types/External", "../../../node_modules/@types"],
"paths": {
"%/*": ["../templates/*"],
"@/*": ["./*"],
"@Controllers/*": ["./controllers/*"],
"@Views/*": ["./views/*"],
"@Services/*": ["Services/*"],
"@node_modules/*": ["../../../node_modules/*"]
}
}
}

View File

@@ -1,9 +0,0 @@
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets')
# Recursively add all files and folders in 'dist'.
Rails.application.config.assets.paths << Rails.root.join('dist')
files = Dir.glob('dist/**/*').map! { |file| file.sub('dist/', '') }
Rails.application.config.assets.precompile += files

View File

@@ -1,8 +1,7 @@
version: '3.8'
services:
app:
build:
context: .
build: .
command: start-local
env_file: .env
restart: unless-stopped

View File

@@ -6,24 +6,22 @@ COMMAND=$1 && shift 1
case "$COMMAND" in
'start' )
echo "Prestart Step 1/1 - Removing server lock"
rm -f /app/tmp/pids/server.pid
rm -f /app/packages/web-server/tmp/pids/server.pid
echo "Starting Server..."
bundle exec rails s -b 0.0.0.0
yarn start
;;
'start-local' )
echo "Prestart Step 1/5 - Removing server lock"
rm -f /app/tmp/pids/server.pid
echo "Prestart Step 2/5 - Cleaning assets"
bundle exec rails assets:clobber
echo "Prestart Step 3/5 - Installing dependencies"
echo "Prestart Step 1/4 - Removing server lock"
rm -f /app/packages/web-server/tmp/pids/server.pid
echo "Prestart Step 2/4 - Cleaning assets"
yarn clean
echo "Prestart Step 3/4 - Installing dependencies"
yarn install --pure-lockfile
echo "Prestart Step 4/5 - Creating Webpack bundle"
yarn run bundle
echo "Prestart Step 5/5 - Compiling assets"
bundle exec rails assets:precompile
echo "Prestart Step 4/4 - Building"
yarn build
echo "Starting Server..."
bundle exec rails s -b 0.0.0.0
yarn start:web
;;
* )

6
lerna.json Normal file
View File

@@ -0,0 +1,6 @@
{
"packages": ["packages/*"],
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true
}

View File

@@ -1,94 +1,30 @@
{
"name": "standard-notes-web",
"version": "3.20.4",
"license": "AGPL-3.0-or-later",
"repository": {
"type": "git",
"url": "https://github.com/standardnotes/web"
"name": "@standardnotes/app-monorepo",
"private": true,
"author": "Standard Notes",
"workspaces": [
"packages/*"
],
"engines": {
"node": ">=12.19.0 <17.0.0"
},
"scripts": {
"start": "webpack-dev-server --config webpack.dev.js",
"watch": "webpack -w --config webpack.dev.js",
"watch:desktop": "webpack -w --config webpack.dev.js --env platform='desktop'",
"bundle": "webpack --config webpack.prod.js && cp -r node_modules/@standardnotes/components/dist/ public/components && yarn tsc",
"bundle:desktop": "webpack --config webpack.prod.js --env platform='desktop'",
"bundle:desktop:beta": "webpack --config webpack.prod.js --env platform='desktop' --env public_beta='true'",
"setup": "bundle install && yarn install --frozen-lockfile && bundle exec rails assets:precompile && yarn bundle",
"lint": "eslint --fix app/assets/javascripts",
"tsc": "tsc --project app/assets/javascripts/tsconfig.json",
"test": "jest --config app/assets/javascripts/jest.config.js --coverage",
"prepare": "husky install",
"postinstall": "yarn run ncu -loglevel verbose --packageFile package.json",
"upgrade:snjs": "ncu -u '@standardnotes/*' && yarn"
"bootstrap": "lerna bootstrap",
"prebuild": "cp -r node_modules/@standardnotes/components/dist/ packages/web-server/public/components/",
"lint": "lerna run lint --parallel",
"test": "lerna run test --parallel",
"clean": "lerna run clean",
"build": "lerna run build",
"start:web": "lerna run start --scope=@standardnotes/web-server",
"start:web:localhost": "lerna run start:no-binding --scope=@standardnotes/web-server",
"prepare": "husky install"
},
"devDependencies": {
"@babel/core": "^7.17.9",
"@babel/plugin-transform-react-jsx": "^7.17.3",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@standardnotes/config": "^2.4.3",
"@types/jest": "^27.4.1",
"@types/react": "^17.0.42",
"@types/react-dom": "^18.0.5",
"@types/wicg-file-system-access": "^2020.9.5",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-loader": "^8.2.5",
"circular-dependency-plugin": "^5.2.2",
"css-loader": "^6.7.1",
"dotenv": "^16.0.0",
"@types/node": "^17.0.21",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"html-webpack-plugin": "^5.5.0",
"husky": "^7.0.4",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.5.1",
"lint-staged": ">=12",
"mini-css-extract-plugin": "^2.6.0",
"node-sass": "^7.0.1",
"npm-check-updates": "^12.5.9",
"prettier": "^2.6.2",
"sass-loader": "^12.6.0",
"svg-jest": "^1.0.1",
"ts-jest": "^27.1.4",
"ts-loader": "^9.2.8",
"typescript": "4.6.3",
"typescript-eslint": "0.0.1-alpha.0",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.8.1",
"webpack-merge": "^5.8.0"
"lerna": "^3.22.1",
"@standardnotes/config": "^2.4.3"
},
"dependencies": {
"@reach/alert": "^0.16.0",
"@reach/alert-dialog": "^0.16.2",
"@reach/checkbox": "^0.16.0",
"@reach/dialog": "^0.16.2",
"@reach/disclosure": "^0.16.2",
"@reach/listbox": "^0.16.2",
"@reach/tooltip": "^0.16.2",
"@reach/visually-hidden": "^0.16.0",
"@standardnotes/components": "1.8.3",
"@standardnotes/filepicker": "1.16.11",
"@standardnotes/icons": "^1.1.8",
"@standardnotes/sncrypto-web": "1.10.1",
"@standardnotes/snjs": "^2.115.6",
"@standardnotes/stylekit": "5.29.3",
"@standardnotes/services": "^1.13.11",
"@zip.js/zip.js": "^2.4.10",
"mobx": "^6.5.0",
"mobx-react-lite": "^3.3.0",
"qrcode.react": "^3.0.1",
"react": "^18.1.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dnd-touch-backend": "^16.0.1",
"react-dom": "^18.1.0"
},
"lint-staged": {
"app/**/*.{js,ts,jsx,tsx}": "eslint --cache --fix",
"app/**/*.{js,ts,jsx,tsx,css,md}": "prettier --write"
}
"dependencies": {}
}

View File

@@ -0,0 +1,2 @@
---
BUNDLE_PATH: "vendor/bundle"

View File

@@ -96,12 +96,16 @@ GEM
mini_mime (>= 0.1.1)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.7.1)
minitest (5.15.0)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
newrelic_rpm (7.2.0)
nio4r (2.5.8)
nokogiri (1.13.1)
mini_portile2 (~> 2.7.0)
racc (~> 1.4)
nokogiri (1.13.1-x64-mingw32)
racc (~> 1.4)
nokogiri (1.13.1-x86_64-darwin)
@@ -225,4 +229,4 @@ DEPENDENCIES
web-console (= 3.5.1)
BUNDLED WITH
2.2.15
2.3.15

View File

@@ -41,11 +41,11 @@
</script>
<% if Rails.env.development? %>
<%= javascript_include_tag "javascripts/app.js", debug: true %>
<%= javascript_include_tag "app.js", debug: true %>
<% else %>
<%= javascript_include_tag "javascripts/app.js", debug: false %>
<%= javascript_include_tag "app.js", debug: false %>
<% end %>
<%= stylesheet_link_tag "stylesheets/app.css", media: "all", debug: false %>
<%= stylesheet_link_tag "app.css", media: "all", debug: false %>
</head>

View File

@@ -0,0 +1,6 @@
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.1'
Rails.application.config.assets.paths << Rails.root.join('..', 'web', 'dist')
Rails.application.config.assets.precompile += ['app.js', 'app.css']

View File

@@ -0,0 +1,19 @@
{
"name": "@standardnotes/web-server",
"version": "1.0.0",
"license": "AGPL-3.0-or-later",
"author": "Standard Notes",
"description": "Ruby on Rails web server for hosting the web application",
"engines": {
"node": ">=12.19.0 <17.0.0"
},
"scripts": {
"start": "bundle exec rails s -b 0.0.0.0",
"start:no-binding": "bundle exec rails s",
"clean": "bundle exec rails assets:clobber",
"build": "bundle install && bundle exec rails assets:precompile"
},
"dependencies": {
"@standardnotes/web": "^3.20.4"
}
}

View File

@@ -56,8 +56,8 @@
},
"org.standardnotes.advanced-markdown-editor": {
"version": "1.5.0",
"base64": "b7fc53d452af61ef48e7ca9f12c2003bcf743c3eaea62983d6af6827f42c7468",
"binary": "2ee6af9195dbb8427fffc347d4e09063b379ca9347b602e77b1717459d64987e"
"base64": "efec7575f3c6a9bbc5a7be555f6a1738af10c4d4144f146265e0a5e7ea49796d",
"binary": "b7c8874bb58be1d17103511f19325530f461e2b2cb3bbac87719525662907504"
},
"org.standardnotes.minimal-markdown-editor": {
"version": "1.3.9",
@@ -71,8 +71,8 @@
},
"org.standardnotes.simple-task-editor": {
"version": "1.3.10",
"base64": "2da772eb55106dd5a79859e7866fcd36df83cd473435a2473fd81c2cdce3acb7",
"binary": "9c772c6eab7f5e694c11d72032f4fbf924eb3f152cc35453bcaac39850897f5d"
"base64": "dfcfa7373928a940b94f0779d1995698b9cae8ce770a2d7aa8ac6c0937b3a4e2",
"binary": "94e0153beb4c9e97d96ac7b9202b6f46c4cfd560075dda183258d5353e61e0a3"
},
"org.standardnotes.token-vault": {
"version": "2.0.10",
@@ -96,7 +96,7 @@
},
"org.standardnotes.markdown-visual-editor": {
"version": "1.0.6",
"base64": "0d79d9e8ca471973f93f405933600769efe5a149d14a39124bcb2a034bdb3b18",
"binary": "d8e59dc53473df006eff1f8fcf12d96ab6b919d422e3fdfede8638314868da4f"
"base64": "13497d3939fbec67cf0baa0f7c182112f0d13474a3e7f4750790823f78688a47",
"binary": "fc6e37d7250d14b245facb760aece51d006fd321d9ac2f153c5a571565411311"
}
}

Some files were not shown because too many files have changed in this diff Show More