mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-05 10:30:55 +01:00
Cleanup, fix workflows
This commit is contained in:
parent
8f7f4a5127
commit
75b12dcab0
5 changed files with 7 additions and 123 deletions
|
@ -1,4 +1,4 @@
|
||||||
name: Webpack
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -17,4 +17,4 @@ jobs:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: package-lock.json
|
cache-dependency-path: package-lock.json
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npx webpack
|
- run: npm run build
|
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
|
@ -17,4 +17,4 @@ jobs:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: package-lock.json
|
cache-dependency-path: package-lock.json
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npx webpack && npm test
|
- run: npm run build && npm test
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
|
|
||||||
![][icons]
|
![][icons]
|
||||||
|
|
||||||
[![Webpack][webpackbadge]][webpack]
|
[![esbuild][buildbadge]][esbuild]
|
||||||
[![Tests][testsbadge]][tests]
|
[![Tests][testsbadge]][tests]
|
||||||
[![License][licensebadge]][license]
|
[![License][licensebadge]][license]
|
||||||
|
|
||||||
<!-- Links & Badges -->
|
<!-- Links & Badges -->
|
||||||
|
|
||||||
[icons]: https://skillicons.dev/icons?i=typescript,webpack,workers
|
[icons]: https://skillicons.dev/icons?i=typescript,workers
|
||||||
[webpack]: https://github.com/FixTweet/FixTweet/actions/workflows/webpack.yml
|
[build]: https://github.com/FixTweet/FixTweet/actions/workflows/build.yml
|
||||||
[webpackbadge]: https://github.com/FixTweet/FixTweet/actions/workflows/webpack.yml/badge.svg
|
[buildbadge]: https://github.com/FixTweet/FixTweet/actions/workflows/build.yml/badge.svg
|
||||||
[tests]: https://github.com/FixTweet/FixTweet/actions/workflows/tests.yml
|
[tests]: https://github.com/FixTweet/FixTweet/actions/workflows/tests.yml
|
||||||
[testsbadge]: https://github.com/FixTweet/FixTweet/actions/workflows/tests.yml/badge.svg
|
[testsbadge]: https://github.com/FixTweet/FixTweet/actions/workflows/tests.yml/badge.svg
|
||||||
[license]: https://github.com/FixTweet/FixTweet/blob/main/LICENSE.md
|
[license]: https://github.com/FixTweet/FixTweet/blob/main/LICENSE.md
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
"@microsoft/eslint-formatter-sarif": "^3.0.0",
|
"@microsoft/eslint-formatter-sarif": "^3.0.0",
|
||||||
"@sentry/esbuild-plugin": "^2.7.1",
|
"@sentry/esbuild-plugin": "^2.7.1",
|
||||||
"@sentry/integrations": "^7.65.0",
|
"@sentry/integrations": "^7.65.0",
|
||||||
"@sentry/webpack-plugin": "^2.7.1",
|
|
||||||
"@types/jest": "^29.5.4",
|
"@types/jest": "^29.5.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
||||||
"@typescript-eslint/parser": "^6.6.0",
|
"@typescript-eslint/parser": "^6.6.0",
|
||||||
|
@ -36,8 +35,6 @@
|
||||||
"ts-jest": "^29.1.1",
|
"ts-jest": "^29.1.1",
|
||||||
"ts-loader": "^9.4.4",
|
"ts-loader": "^9.4.4",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"webpack": "^5.88.2",
|
|
||||||
"webpack-cli": "^5.1.4",
|
|
||||||
"wrangler": "^3.7.0"
|
"wrangler": "^3.7.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,113 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
const webpack = require('webpack');
|
|
||||||
const { sentryWebpackPlugin } = require('@sentry/webpack-plugin');
|
|
||||||
|
|
||||||
const gitCommit = require('child_process')
|
|
||||||
.execSync('git rev-parse --short HEAD')
|
|
||||||
.toString()
|
|
||||||
.trim();
|
|
||||||
const gitCommitFull = require('child_process')
|
|
||||||
.execSync('git rev-parse HEAD')
|
|
||||||
.toString()
|
|
||||||
.trim();
|
|
||||||
const gitUrl = require('child_process')
|
|
||||||
.execSync('git remote get-url origin')
|
|
||||||
.toString()
|
|
||||||
.trim();
|
|
||||||
const gitBranch = require('child_process')
|
|
||||||
.execSync('git rev-parse --abbrev-ref HEAD')
|
|
||||||
.toString()
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
// Get worker name from wrangler.toml
|
|
||||||
let workerName = 'fixtweet';
|
|
||||||
|
|
||||||
try {
|
|
||||||
workerName = require('fs')
|
|
||||||
.readFileSync('wrangler.toml')
|
|
||||||
.toString()
|
|
||||||
.match(/name ?= ?"(.+)"/)[1];
|
|
||||||
} catch(e) {
|
|
||||||
console.error(`Error reading wrangler.toml to find worker name, using 'fixtweet' instead.`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const releaseName = `${workerName}-${gitBranch}-${gitCommit}-${new Date()
|
|
||||||
.toISOString()
|
|
||||||
.substring(0, 19)}`;
|
|
||||||
|
|
||||||
require('dotenv').config();
|
|
||||||
|
|
||||||
let envVariables = [
|
|
||||||
'BRANDING_NAME',
|
|
||||||
'STANDARD_DOMAIN_LIST',
|
|
||||||
'DIRECT_MEDIA_DOMAINS',
|
|
||||||
'TEXT_ONLY_DOMAINS',
|
|
||||||
'INSTANT_VIEW_DOMAINS',
|
|
||||||
'HOST_URL',
|
|
||||||
'REDIRECT_URL',
|
|
||||||
'EMBED_URL',
|
|
||||||
'MOSAIC_DOMAIN_LIST',
|
|
||||||
'API_HOST_LIST',
|
|
||||||
'SENTRY_DSN',
|
|
||||||
'DEPRECATED_DOMAIN_LIST',
|
|
||||||
'DEPRECATED_DOMAIN_EPOCH'
|
|
||||||
];
|
|
||||||
|
|
||||||
let plugins = [
|
|
||||||
...envVariables.map(envVar => {
|
|
||||||
return new webpack.DefinePlugin({
|
|
||||||
[envVar]: JSON.stringify(process.env[envVar])
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
RELEASE_NAME: `'${releaseName}'`
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
if (process.env.SENTRY_AUTH_TOKEN) {
|
|
||||||
plugins.push(
|
|
||||||
sentryWebpackPlugin({
|
|
||||||
release: {
|
|
||||||
name: releaseName,
|
|
||||||
create: true,
|
|
||||||
vcsRemote: gitUrl,
|
|
||||||
setCommits: {
|
|
||||||
auto: true,
|
|
||||||
ignoreMissing: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
include: './dist',
|
|
||||||
urlPrefix: '~/',
|
|
||||||
ignore: ['node_modules', 'webpack.config.js'],
|
|
||||||
authToken: process.env.SENTRY_AUTH_TOKEN
|
|
||||||
})
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
console.log('No Sentry auth token found, skipping Sentry release upload.');
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: { worker: './src/server.ts' },
|
|
||||||
target: 'webworker',
|
|
||||||
devtool: 'source-map',
|
|
||||||
output: {
|
|
||||||
filename: '[name].js',
|
|
||||||
path: path.join(__dirname, 'dist')
|
|
||||||
},
|
|
||||||
mode: 'production',
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.ts', '.tsx', '.js'],
|
|
||||||
fallback: { util: false }
|
|
||||||
},
|
|
||||||
plugins: plugins,
|
|
||||||
optimization: { mangleExports: false },
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.tsx?$/,
|
|
||||||
loader: 'ts-loader',
|
|
||||||
options: { transpileOnly: true }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Add table
Reference in a new issue