Projects STRLCPY gradejs Commits 5621c466
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■
    package.json
    skipped 21 lines
    22 22   "build:public-api": "yarn workspace @gradejs-public/public-api run build",
    23 23   "build:backend": "yarn build:shared && yarn build:public-api && yarn build:worker",
    24 24   "dev:start": "bash cli/local_start.sh",
    25  - "dev:start:web": "API_ORIGIN=https://api.staging.gradejs.com npm dev:start --prefix packages/web"
     25 + "dev:start:web": "PORT=3000 API_ORIGIN=https://api.staging.gradejs.com npm run dev:start --prefix packages/web"
    26 26   },
    27 27   "devDependencies": {
    28 28   "@swc/core": "^1.2.233",
    skipped 15 lines
  • ■ ■ ■ ■ ■ ■
    packages/web/src/server.tsx
    skipped 7 lines
    8 8  import { store } from './store';
    9 9  import { App } from './components/App';
    10 10  import path from 'path';
    11  -import { readFileSync } from 'fs';
     11 +import { readFileSync, readFile } from 'fs';
    12 12   
    13 13  const app = express();
    14 14  const layout = readFileSync(path.resolve(__dirname, 'static', 'index.html'), { encoding: 'utf-8' });
    15 15   
    16 16  app.use('/static', express.static(path.join(__dirname, 'static')));
     17 +app.get('/robots.txt', (_, res) =>
     18 + readFile(path.join(__dirname, '/robots.txt'), { encoding: 'utf-8' }, (err, data) => {
     19 + if (!err) {
     20 + res.send(data);
     21 + } else {
     22 + res.status(404);
     23 + res.send(null);
     24 + }
     25 + })
     26 +);
    17 27   
    18 28  app.get('*', (req, res) => {
    19 29   const html = ReactDOMServer.renderToString(
    skipped 20 lines
  • ■ ■ ■ ■
    packages/web/webpack/client.ts
    skipped 73 lines
    74 74   template: join(__dirname, '..', 'index.html'),
    75 75   }),
    76 76   new CopyPlugin({
    77  - patterns: [
    78  - { from: 'robots.txt', to: 'robots.txt' },
    79  - { from: 'src/assets/sharing-image.png', to: 'sharing-image.png' },
    80  - ],
     77 + patterns: [{ from: 'src/assets/sharing-image.png', to: 'sharing-image.png' }],
    81 78   }),
    82 79   ],
    83 80   output: {
    skipped 8 lines
  • ■ ■ ■ ■ ■
    packages/web/webpack/server.ts
    1 1  import { join } from 'path';
    2 2  import MiniCssExtractPlugin from 'mini-css-extract-plugin';
     3 +import CopyPlugin from 'copy-webpack-plugin';
    3 4  import { configCommon, pluginsCommon, srcDir } from './common';
    4 5  import { Configuration } from 'webpack';
    5 6   
    skipped 45 lines
    51 52   },
    52 53   ],
    53 54   },
    54  - plugins: pluginsCommon(mode, true),
     55 + plugins: [
     56 + ...pluginsCommon(mode, true),
     57 + new CopyPlugin({
     58 + patterns: [{ from: 'robots.txt', to: 'robots.txt' }],
     59 + }),
     60 + ],
    55 61   output: {
    56 62   filename: '[name].js',
    57 63   path: join(__dirname, '..', distDir),
    skipped 10 lines
Please wait...
Page is in error, reload to recover