Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: release-notes-generator run failure #2752

Merged
merged 3 commits into from Jun 12, 2023
Merged

Conversation

jeffmaury
Copy link
Contributor

Relates to #1458

What does this PR do?

Fixes error while running the release-notes-generator

Screenshot/screencast of this PR

N/A

What issues does this PR fix or reference?

Fixes #1458

How to test this PR?

  1. cd tools
  2. yarn build
  3. node dist/release-notes-generator.js

Relates to containers#1458

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
@jeffmaury jeffmaury requested review from a team and benoitf as code owners June 6, 2023 13:37
@jeffmaury jeffmaury requested review from cdrage and lstocchi and removed request for a team June 6, 2023 13:37
Copy link
Collaborator

@benoitf benoitf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep the default

but probably replace package.json with build task being

  "scripts": {
    "build": "vite build"
  },

a vite.config.js file with

/**********************************************************************
 * Copyright (C) 2023 Red Hat, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
 ***********************************************************************/

import {join} from 'path';
import {builtinModules} from 'module';

const PACKAGE_ROOT = __dirname;

/**
 * @type {import('vite').UserConfig}
 * @see https://vitejs.dev/config/
 */
const config = {
  mode: process.env.MODE,
  root: PACKAGE_ROOT,
  envDir: process.cwd(),
  resolve: {
    alias: {
      '/@/': join(PACKAGE_ROOT, 'src') + '/',
    },
  },
  build: {
    sourcemap: 'inline',
    target: 'esnext',
    outDir: 'dist',
    assetsDir: '.',
    minify: process.env.MODE === 'production' ? 'esbuild' : false,
    lib: {
      entry: 'src/release-notes-generator.ts',
      formats: ['cjs'],
    },
    rollupOptions: {
      external: [
        ...builtinModules.flatMap(p => [p, `node:${p}`]),
      ],
      output: {
        entryFileNames: '[name].js',
      },
    },
    emptyOutDir: true,
    reportCompressedSize: false,
  },
};

export default config;

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
@@ -3,10 +3,11 @@
"version": "1.0.0",
"description": "Generates release notes",
"main": "index.js",
"type": "module",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why you need to use 'module' there ? (and generate a .cjs file instead of a .js file)

you want to avoid the use of a vite.config.js file ?

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
@cdrage cdrage merged commit 46371b0 into containers:main Jun 12, 2023
7 checks passed
@jeffmaury jeffmaury deleted the GH-1458 branch June 12, 2023 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release note automation
3 participants