GithubHelp home page GithubHelp logo

generator-lens-ext's People

Contributors

chenhunghan avatar nokel81 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

generator-lens-ext's Issues

Generated package.json does not include a lint script

This is a new issue from lensapp/lens#1215 (comment) in the generator repo.

Your generator also doesn't lint anything by default, even though it installs eslint! These are the generated scripts:

	"scripts": {
		"start": "webpack --watch",
		"build": "npm run clean && webpack",
		"clean": "rm -rf ./dist",
		"test": "jest"
	},

You should add this:

"lint": "eslint"

and then change "test" to this:

"test": "yarn lint && jest"

Generator does not provide dev build out of the box

Making a new issue from lensapp/lens#1215 (comment) on the generator repo.

This is what it outputs today (I just installed it and ran it) for the Webpack.config.js file:

/* eslint @typescript-eslint/no-var-requires: "off" */

const path = require("path");

module.exports = [
  {
    entry: "./main.ts",
    context: __dirname,
    target: "electron-main",
    mode: "production",
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          use: "ts-loader",
          exclude: /node_modules/,
        },
      ],
    },
    externals: [
      {
        "@k8slens/extensions": "var global.LensExtensions",
        "mobx": "var global.Mobx",
        "react": "var global.React"
      }
    ],
    resolve: {
      extensions: [".tsx", ".ts", ".js"],
    },
    output: {
      libraryTarget: "commonjs2",
      filename: "main.js",
      path: path.resolve(__dirname, "dist"),
    },
  },
  {
    entry: "./renderer.tsx",
    context: __dirname,
    target: "electron-renderer",
    mode: "production",
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          use: "ts-loader",
          exclude: /node_modules/,
        },
      ],
    },
    externals: [
      {
        "@k8slens/extensions": "var global.LensExtensions",
        "react": "var global.React",
        "mobx": "var global.Mobx"
      }
    ],
    resolve: {
      extensions: [".tsx", ".ts", ".js"],
    },
    output: {
      libraryTarget: "commonjs2",
      globalObject: "this",
      filename: "renderer.js",
      path: path.resolve(__dirname, "dist"),
    },
    node: {
      __dirname: false,
      __filename: false
    }
  },
];

There are only production build configurations in there. So right out of the box, there are no dev tools used, all the code is minified, no source maps. In other words, no debugging (or at least, no sane debugging with breakpoints and code you can read).

I think all you would need to add is this to your generator:

    // in BOTH main and renderer entry configs, REPLACE this:
    mode: "production",

    // with this:
    mode: process.env.NODE_ENV || 'production',
    devtool: process.env.NODE_ENV !== 'production' ? 'eval-source-map' : undefined,

Then you can run NODE_ENV=development yarn start to start a watch on a development build with source maps and all the things you need to start debugging in DevTools right away.

Actually, you should just change the generated package.json's start script to be this and make it even easier on your extension developers:

start: "NODE_ENV=development webpack --watch"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.