chore: remove parcel completely and grunt
parent
8a0074d2bd
commit
51df7d80bb
@ -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']);
|
|
||||||
};
|
|
@ -1,2 +0,0 @@
|
|||||||
// because grunt.cmd is totally flakey on windows
|
|
||||||
require('grunt').cli();
|
|
@ -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();
|
@ -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',
|
||||||
|
})
|
||||||
|
),
|
||||||
|
};
|
Loading…
Reference in New Issue