feat: switch from npm to yarn (#500)
* feat: switch from npm to yarn * fix: build * fix: replace yarn run with yarn * fix: nodejs version install in Docker image * fix: initialize mobx state Co-authored-by: Karol Sójko <karolsojko@gmail.com>
This commit is contained in:
2
.babelrc
2
.babelrc
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
"@babel/typescript",
|
"@babel/preset-typescript",
|
||||||
"@babel/preset-env"
|
"@babel/preset-env"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
|||||||
4
.github/workflows/beta.yml
vendored
4
.github/workflows/beta.yml
vendored
@@ -17,10 +17,10 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: yarn install --pure-lockfile
|
||||||
|
|
||||||
- name: Typescript
|
- name: Typescript
|
||||||
run: npm run tsc
|
run: yarn tsc
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
|
||||||
|
|||||||
4
.github/workflows/dev.yml
vendored
4
.github/workflows/dev.yml
vendored
@@ -17,10 +17,10 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: yarn install --pure-lockfile
|
||||||
|
|
||||||
- name: Typescript
|
- name: Typescript
|
||||||
run: npm run tsc
|
run: yarn tsc
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
|
||||||
|
|||||||
4
.github/workflows/pr.yml
vendored
4
.github/workflows/pr.yml
vendored
@@ -13,6 +13,6 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: yarn install --pure-lockfile
|
||||||
- name: Typescript
|
- name: Typescript
|
||||||
run: npm run tsc
|
run: yarn tsc
|
||||||
|
|||||||
4
.github/workflows/prod.yml
vendored
4
.github/workflows/prod.yml
vendored
@@ -18,10 +18,10 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: yarn install --pure-lockfile
|
||||||
|
|
||||||
- name: Typescript
|
- name: Typescript
|
||||||
run: npm run tsc
|
run: yarn tsc
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -42,3 +42,7 @@ dump.rdb
|
|||||||
/dist/stylesheets
|
/dist/stylesheets
|
||||||
/dist/fonts
|
/dist/fonts
|
||||||
/dist/@types
|
/dist/@types
|
||||||
|
|
||||||
|
# Yarn
|
||||||
|
yarn-error.log
|
||||||
|
package-lock.json
|
||||||
|
|||||||
11
Dockerfile
11
Dockerfile
@@ -1,4 +1,4 @@
|
|||||||
FROM ruby:2.7.1-alpine
|
FROM ruby:2.7.1-alpine3.12
|
||||||
|
|
||||||
ARG UID=1000
|
ARG UID=1000
|
||||||
ARG GID=1000
|
ARG GID=1000
|
||||||
@@ -7,10 +7,11 @@ RUN addgroup -S webapp -g $GID && adduser -D -S webapp -G webapp -u $UID
|
|||||||
|
|
||||||
RUN apk add --update --no-cache \
|
RUN apk add --update --no-cache \
|
||||||
alpine-sdk \
|
alpine-sdk \
|
||||||
nodejs \
|
nodejs-current \
|
||||||
python2 \
|
python2 \
|
||||||
git \
|
git \
|
||||||
nodejs-npm \
|
nodejs-npm \
|
||||||
|
yarn \
|
||||||
tzdata
|
tzdata
|
||||||
|
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
@@ -19,17 +20,17 @@ RUN chown -R $UID:$GID .
|
|||||||
|
|
||||||
USER webapp
|
USER webapp
|
||||||
|
|
||||||
COPY --chown=$UID:$GID package.json package-lock.json Gemfile Gemfile.lock /app/
|
COPY --chown=$UID:$GID package.json yarn.lock Gemfile Gemfile.lock /app/
|
||||||
|
|
||||||
COPY --chown=$UID:$GID vendor /app/vendor
|
COPY --chown=$UID:$GID vendor /app/vendor
|
||||||
|
|
||||||
RUN npm ci
|
RUN yarn install --pure-lockfile
|
||||||
|
|
||||||
RUN gem install bundler && bundle install
|
RUN gem install bundler && bundle install
|
||||||
|
|
||||||
COPY --chown=$UID:$GID . /app/
|
COPY --chown=$UID:$GID . /app/
|
||||||
|
|
||||||
RUN npm run bundle
|
RUN yarn bundle
|
||||||
|
|
||||||
RUN bundle exec rails assets:precompile
|
RUN bundle exec rails assets:precompile
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,10 @@ This repo contains the core code used in the web app, as well as the Electron-ba
|
|||||||
|
|
||||||
**Instructions:**
|
**Instructions:**
|
||||||
|
|
||||||
|
1. Ensure you have [Yarn](https://classic.yarnpkg.com) installed
|
||||||
1. Clone the repo
|
1. Clone the repo
|
||||||
1. `npm run setup`
|
1. `yarn setup`
|
||||||
1. `npm start`
|
1. `yarn start`
|
||||||
|
|
||||||
Then open your browser to `http://localhost:3001`.
|
Then open your browser to `http://localhost:3001`.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "ES2019",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ class ActionsMenuState {
|
|||||||
|
|
||||||
export class SyncState {
|
export class SyncState {
|
||||||
inProgress = false;
|
inProgress = false;
|
||||||
errorMessage?: string;
|
errorMessage?: string = undefined;
|
||||||
humanReadablePercentage?: string;
|
humanReadablePercentage?: string = undefined;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
makeObservable(this, {
|
makeObservable(this, {
|
||||||
|
|||||||
13118
package-lock.json
generated
13118
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -7,24 +7,23 @@
|
|||||||
"url": "https://github.com/standardnotes/web"
|
"url": "https://github.com/standardnotes/web"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm run submodules && npm install",
|
"setup": "yarn submodules && yarn install",
|
||||||
"start": "webpack-dev-server --progress --config webpack.dev.js",
|
"start": "webpack-dev-server --progress --config webpack.dev.js",
|
||||||
"watch": "webpack -w --config webpack.dev.js",
|
"watch": "webpack -w --config webpack.dev.js",
|
||||||
"watch:desktop": "webpack -w --config webpack.dev.js --env.platform='desktop'",
|
"watch:desktop": "webpack -w --config webpack.dev.js --env.platform='desktop'",
|
||||||
"bundle": "webpack --config webpack.prod.js && npm run tsc",
|
"bundle": "webpack --config webpack.prod.js && yarn tsc",
|
||||||
"bundle:desktop": "webpack --config webpack.prod.js --env.platform='desktop'",
|
"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'",
|
"bundle:desktop:beta": "webpack --config webpack.prod.js --env.platform='desktop' --env.public_beta='true'",
|
||||||
"build": "bundle install && npm ci && bundle exec rails assets:precompile && npm run bundle",
|
"build": "bundle install && yarn install --pure-lockfile && bundle exec rails assets:precompile && yarn bundle",
|
||||||
"submodules": "git submodule update --init --force",
|
"submodules": "git submodule update --init --force",
|
||||||
"lint": "eslint --fix app/assets/javascripts/**/*.js",
|
"lint": "eslint --fix app/assets/javascripts/**/*.js",
|
||||||
"tsc": "tsc --project app/assets/javascripts/tsconfig.json"
|
"tsc": "tsc --project app/assets/javascripts/tsconfig.json"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.10.5",
|
"@babel/core": "^7.12.9",
|
||||||
"@babel/core": "^7.11.1",
|
|
||||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||||
"@babel/preset-env": "^7.11.0",
|
"@babel/preset-env": "^7.12.7",
|
||||||
"@babel/preset-typescript": "^7.10.4",
|
"@babel/preset-typescript": "^7.12.7",
|
||||||
"@types/angular": "^1.7.0",
|
"@types/angular": "^1.7.0",
|
||||||
"@types/chai": "^4.2.11",
|
"@types/chai": "^4.2.11",
|
||||||
"@types/lodash": "^4.14.149",
|
"@types/lodash": "^4.14.149",
|
||||||
@@ -60,7 +59,7 @@
|
|||||||
"sass-loader": "^8.0.2",
|
"sass-loader": "^8.0.2",
|
||||||
"serve-static": "^1.14.1",
|
"serve-static": "^1.14.1",
|
||||||
"sn-stylekit": "2.1.0",
|
"sn-stylekit": "2.1.0",
|
||||||
"ts-loader": "^8.0.2",
|
"ts-loader": "^8.0.11",
|
||||||
"typescript": "^3.9.7",
|
"typescript": "^3.9.7",
|
||||||
"typescript-eslint": "0.0.1-alpha.0",
|
"typescript-eslint": "0.0.1-alpha.0",
|
||||||
"webpack": "^4.44.1",
|
"webpack": "^4.44.1",
|
||||||
@@ -71,7 +70,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bugsnag/js": "^7.5.1",
|
"@bugsnag/js": "^7.5.1",
|
||||||
"@standardnotes/sncrypto-web": "^1.2.9",
|
"@standardnotes/sncrypto-web": "^1.2.9",
|
||||||
"@standardnotes/snjs": "^2.0.16",
|
"@standardnotes/snjs": "^2.0.20",
|
||||||
"mobx": "^6.0.1"
|
"mobx": "^6.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ const webpack = require('webpack');
|
|||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
module.exports = (env = {
|
module.exports = (
|
||||||
platform: 'web'
|
env = {
|
||||||
}) => ({
|
platform: 'web',
|
||||||
|
}
|
||||||
|
) => ({
|
||||||
entry: './app/assets/javascripts/index.ts',
|
entry: './app/assets/javascripts/index.ts',
|
||||||
output: {
|
output: {
|
||||||
filename: './javascripts/app.js'
|
filename: './javascripts/app.js',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
@@ -19,28 +21,37 @@ module.exports = (env = {
|
|||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
// Options similar to the same options in webpackOptions.output
|
// Options similar to the same options in webpackOptions.output
|
||||||
filename: './stylesheets/app.css',
|
filename: './stylesheets/app.css',
|
||||||
ignoreOrder: true // Enable to remove warnings about conflicting order
|
ignoreOrder: true, // Enable to remove warnings about conflicting order
|
||||||
})
|
}),
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.js'],
|
extensions: ['.ts', '.js'],
|
||||||
alias: {
|
alias: {
|
||||||
'%': path.resolve(__dirname, 'app/assets/templates'),
|
'%': path.resolve(__dirname, 'app/assets/templates'),
|
||||||
'@': path.resolve(__dirname, 'app/assets/javascripts'),
|
'@': path.resolve(__dirname, 'app/assets/javascripts'),
|
||||||
'@Controllers': path.resolve(__dirname, 'app/assets/javascripts/controllers'),
|
'@Controllers': path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'app/assets/javascripts/controllers'
|
||||||
|
),
|
||||||
'@Views': path.resolve(__dirname, 'app/assets/javascripts/views'),
|
'@Views': path.resolve(__dirname, 'app/assets/javascripts/views'),
|
||||||
'@Services': path.resolve(__dirname, 'app/assets/javascripts/services'),
|
'@Services': path.resolve(__dirname, 'app/assets/javascripts/services'),
|
||||||
'@node_modules': path.resolve(__dirname, 'node_modules'),
|
'@node_modules': path.resolve(__dirname, 'node_modules'),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.(js|ts)$/,
|
test: /\.(js|ts)$/,
|
||||||
exclude: /(node_modules|snjs)/,
|
exclude: /(node_modules|snjs)/,
|
||||||
use: {
|
use: [
|
||||||
loader: 'babel-loader'
|
'babel-loader',
|
||||||
}
|
{
|
||||||
|
loader: 'ts-loader',
|
||||||
|
options: {
|
||||||
|
transpileOnly: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.s?css$/,
|
test: /\.s?css$/,
|
||||||
@@ -49,12 +60,12 @@ module.exports = (env = {
|
|||||||
loader: MiniCssExtractPlugin.loader,
|
loader: MiniCssExtractPlugin.loader,
|
||||||
options: {
|
options: {
|
||||||
publicPath: '../', // The base assets directory in relation to the stylesheets
|
publicPath: '../', // The base assets directory in relation to the stylesheets
|
||||||
hmr: process.env.NODE_ENV === 'development'
|
hmr: process.env.NODE_ENV === 'development',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
'css-loader',
|
'css-loader',
|
||||||
'sass-loader'
|
'sass-loader',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
@@ -63,36 +74,34 @@ module.exports = (env = {
|
|||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
name: '[name].[ext]',
|
name: '[name].[ext]',
|
||||||
outputPath: 'fonts/'
|
outputPath: 'fonts/',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.html$/,
|
test: /\.html$/,
|
||||||
exclude: [
|
exclude: [path.resolve(__dirname, 'index.html')],
|
||||||
path.resolve(__dirname, 'index.html'),
|
|
||||||
],
|
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'ng-cache-loader',
|
loader: 'ng-cache-loader',
|
||||||
options: {
|
options: {
|
||||||
prefix: 'templates:**'
|
prefix: 'templates:**',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.pug$/,
|
test: /\.pug$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'apply-loader'
|
loader: 'apply-loader',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
loader: 'pug-loader'
|
loader: 'pug-loader',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user