chore: remove parcel completely and grunt

This commit is contained in:
Audric Ackermann 2023-03-29 16:29:09 +11:00
parent 8a0074d2bd
commit 51df7d80bb
9 changed files with 193 additions and 1696 deletions

View File

@ -76,7 +76,7 @@ is no automatic restart mechanism. Alternatively, keep the developer tools open
```
yarn build-everything:watch # runs until you stop it, re-generating built assets on file changes
# Once this command is waiting for changes, you will need to run in another terminal `yarn parcel-util-worker` to fix the "exports undefined" error on start.
# Once this command is waiting for changes, you will need to run in another terminal `yarn worker:utils && yarn worker:libsession` to fix the "exports undefined" error on start.
# If you do change the sass while this command is running, it won't pick it up. You need to either run `yarn sass` or have `yarn sass:watch` running in a separate terminal.
```

View File

@ -1,41 +0,0 @@
/* eslint-disable more/no-then, no-console */
module.exports = grunt => {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
gitinfo: {}, // to be populated by grunt gitinfo
});
Object.keys(grunt.config.get('pkg').devDependencies).forEach(key => {
if (/^grunt(?!(-cli)?$)/.test(key)) {
// ignore grunt and grunt-cli
grunt.loadNpmTasks(key);
}
});
function updateLocalConfig(update) {
const environment = process.env.SIGNAL_ENV || 'production';
const configPath = `config/local-${environment}.json`;
let localConfig;
try {
localConfig = grunt.file.readJSON(configPath);
} catch (e) {
//
}
localConfig = {
...localConfig,
...update,
};
grunt.file.write(configPath, `${JSON.stringify(localConfig)}\n`);
}
grunt.registerTask('getCommitHash', () => {
grunt.task.requires('gitinfo');
const gitinfo = grunt.config.get('gitinfo');
const hash = gitinfo.local.branch.current.SHA;
updateLocalConfig({ commitHash: hash });
});
grunt.registerTask('date', ['gitinfo']);
grunt.registerTask('default', ['date', 'getCommitHash']);
};

View File

@ -1,2 +0,0 @@
// because grunt.cmd is totally flakey on windows
require('grunt').cli();

View File

@ -0,0 +1,33 @@
var fs = require('fs');
var _ = require('lodash');
var execSync = require('child_process').execSync;
const updateLocalConfig = () => {
var environment = process.env.SIGNAL_ENV || 'production';
var configPath = `config/local-${environment}.json`;
var localConfig;
var hash = '';
try {
// TODO make sure that this works well on windows and macOS builds
var stdout = execSync('git rev-parse HEAD').toString();
console.info('"git rev-parse HEAD" result: ', stdout && stdout.trim());
if (!_.isEmpty(stdout)) {
hash = stdout.trim();
}
var rawdata = fs.readFileSync(configPath);
localConfig = JSON.parse(rawdata);
} catch (e) {
console.error('updateLocalConfig failed with', e.message);
}
localConfig = {
...localConfig,
commitHash: hash,
};
var toWrite = `${JSON.stringify(localConfig)}\n`;
fs.writeFileSync(configPath, toWrite);
};
updateLocalConfig();

View File

@ -13,14 +13,6 @@
"url": "https://github.com/oxen-io/session-desktop.git"
},
"main": "ts/mains/main_node.js",
"targets": {
"sass": {
"source": "stylesheets/manifest.scss",
"distDir": "stylesheets/dist/",
"optimize": true,
"sourceMap": true
}
},
"resolutions": {
"minimist": "^1.2.6",
"getobject": "^1.0.0",
@ -39,12 +31,11 @@
},
"scripts": {
"start-prod": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron .",
"build-everything": "yarn clean && yarn protobuf && grunt && yarn sass && tsc && yarn worker:utils && yarn worker:libsession",
"build-everything:watch": "yarn clean && yarn protobuf && grunt && yarn sass && yarn worker:utils && yarn worker:libsession && tsc -w",
"watch": "yarn clean && yarn protobuf && grunt && concurrently 'yarn build-everything:watch' 'yarn sass:watch'",
"build-everything": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && tsc && yarn worker:utils && yarn worker:libsession",
"build-everything:watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn worker:utils && yarn worker:libsession && tsc -w",
"watch": "yarn clean && yarn protobuf && yarn update-git-info && concurrently 'yarn build-everything:watch'",
"protobuf": "pbjs --target static-module --wrap commonjs --out ts/protobuf/compiled.js protos/*.proto && pbts --out ts/protobuf/compiled.d.ts ts/protobuf/compiled.js --force-long",
"sass": "rimraf 'stylesheets/dist/' && parcel build --target sass --no-autoinstall --no-cache",
"sass:watch": "rimraf 'stylesheets/dist/' && parcel watch --target sass --no-autoinstall --no-cache",
"sass": "rimraf 'stylesheets/dist/' && webpack --config=./sass.config.js",
"clean": "rimraf 'ts/**/*.js' 'ts/*.js' 'ts/*.js.map' 'ts/**/*.js.map' && rimraf tsconfig.tsbuildinfo;",
"lint-full": "yarn format-full && eslint . && tslint --format stylish --project .",
"format-full": "prettier --list-different --write \"*.{css,js,json,scss,ts,tsx}\" \"./**/*.{css,js,json,scss,ts,tsx}\"",
@ -68,6 +59,7 @@
"ready": "yarn build-everything && yarn lint-full && yarn test",
"postinstall": "yarn patch-package && yarn electron-builder install-app-deps && yarn rebuild-curve25519-js",
"rebuild-curve25519-js": "cd node_modules/curve25519-js && yarn install && yarn build && cd ../../",
"update-git-info": "node ./build/updateLocalConfig.js",
"worker:utils": "webpack --config=./utils.worker.config.js",
"worker:libsession": "webpack --config=./libsession.worker.config.js"
},
@ -102,13 +94,11 @@
"glob": "7.1.2",
"image-type": "^4.1.0",
"ip2country": "1.0.1",
"jsbn": "1.1.0",
"libsodium-wrappers-sumo": "^0.7.9",
"linkify-it": "3.0.2",
"lodash": "^4.17.20",
"long": "^4.0.0",
"mic-recorder-to-mp3": "^2.2.2",
"minimist": "^1.2.6",
"moment": "^2.29.4",
"mustache": "2.3.0",
"nan": "2.14.2",
@ -145,7 +135,6 @@
"uuid": "8.3.2"
},
"devDependencies": {
"@parcel/transformer-sass": "2.5.0",
"@playwright/test": "1.16.3",
"@types/backbone": "1.4.2",
"@types/better-sqlite3": "7.4.0",
@ -205,20 +194,13 @@
"eslint-plugin-more": "^1.0.5",
"events": "^3.3.0",
"file-loader": "^6.2.0",
"grunt": "1.5.3",
"grunt-cli": "1.4.3",
"grunt-contrib-concat": "2.1.0",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-watch": "1.1.0",
"grunt-exec": "3.0.0",
"grunt-gitinfo": "0.1.9",
"jsdom": "^19.0.0",
"jsdom-global": "^3.0.2",
"mini-css-extract-plugin": "^2.7.5",
"mocha": "10.0.0",
"node-gyp": "9.0.0",
"node-loader": "^2.0.0",
"nyc": "^15.1.0",
"parcel": "2.5.0",
"patch-package": "^6.4.7",
"playwright": "1.16.3",
"postcss-loader": "^7.0.2",
@ -226,7 +208,8 @@
"prettier": "1.19.0",
"process": "^0.11.10",
"run-script-os": "^1.1.6",
"sass-loader": "^13.2.0",
"sass": "^1.60.0",
"sass-loader": "^13.2.2",
"sinon": "9.0.2",
"style-loader": "^3.3.1",
"ts-loader": "^9.4.2",
@ -235,7 +218,7 @@
"tslint-microsoft-contrib": "6.0.0",
"tslint-react": "3.6.0",
"typescript": "^4.6.3",
"webpack": "^5.75.0",
"webpack": "^5.76.3",
"webpack-cli": "^5.0.1"
},
"engines": {

41
sass.config.js Normal file
View File

@ -0,0 +1,41 @@
const path = require('path');
// eslint-disable-next-line import/no-extraneous-dependencies
const sass = require('sass'); // Prefer `dart-sass`
// eslint-disable-next-line import/no-extraneous-dependencies
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
output: {
path: path.resolve(__dirname, 'stylesheets', 'dist'),
},
entry: './stylesheets/manifest.scss',
mode: 'production',
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
// Creates `main.css` compiling all of the compiled css files
MiniCssExtractPlugin.loader,
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
{
loader: 'sass-loader',
options: {
implementation: sass,
},
},
],
},
],
},
plugins: [].concat(
new MiniCssExtractPlugin({
filename: 'manifest.css',
})
),
};

View File

@ -1,11 +1,11 @@
// Modules
@import '../node_modules/react-h5-audio-player/lib/styles.css';
@import '../node_modules/react-contexify/dist/ReactContexify.min.css';
@import '../node_modules/react-toastify/dist/ReactToastify.css';
@import 'react-h5-audio-player/lib/styles.css';
@import 'react-contexify/dist/ReactContexify.min.css';
@import 'react-toastify/dist/ReactToastify.css';
@import '../node_modules/sanitize.css/sanitize.css';
@import '../node_modules/sanitize.css/forms.css';
@import '../node_modules/sanitize.css/typography.css';
@import 'sanitize.css/sanitize.css';
@import 'sanitize.css/forms.css';
@import 'sanitize.css/typography.css';
// Global Settings and Mixins
@import 'session_constants';

View File

@ -1775,7 +1775,7 @@ function updateToSessionSchemaVersion30(currentVersion: number, db: BetterSqlite
// or just start a conf sync job on app start
} catch (e) {
console.error(`failed to create initial wrapper: `, e.stack);
throw e;
// if we get an exception here, most likely no users are logged in yet. We can just continue the transaction and the wrappers will be created when a user creates a new account.
}
// for manually flagging conversations as :unread"

1721
yarn.lock

File diff suppressed because it is too large Load Diff