小编Edg*_*rka的帖子

Webpack 无法编译 ts 3.7(可选链接,空合并)

我尝试使用typescript 3.7Optional Chaining、Nullish Coalescing 等功能。但是在转换时webpack给我一个错误。

app: Module parse failed: Unexpected token (50:40)
app: File was processed with these loaders:
app:  * ../../../node_modules/ts-loader/index.js
app: You may need an additional loader to handle the result of these loaders.
app: | export const Layout = (props) => {
app: |     const regionsResults = useQuery(regionsQuery, { fetchPolicy: 'cache-first' });
app: >     const regions = regionsResults.data?.regions ?? [];
app: |     const userItem = useQuery(usersProfileQuery, { fetchPolicy: 'cache-first' });
app: |     const …
Run Code Online (Sandbox Code Playgroud)

typescript webpack ts-loader

51
推荐指数
2
解决办法
1万
查看次数

Gradle无法使用BuildScopeServices.createInitScriptHandler()创建InitScriptHandler类型的服务

我在Centos 7终端中使用了gradle build命令,得到了输出:

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type InitScriptHandler using BuildScopeServices.createInitScriptHandler().

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Run Code Online (Sandbox Code Playgroud)

gradle

40
推荐指数
8
解决办法
7万
查看次数

使用JAX-RS在一个位置记录请求和响应

我有一个RESTEasy Web服务器,有很多方法.我希望实现logback来跟踪所有请求和响应,但我不想添加log.info()到每个方法.

也许有办法在一个地方捕获请求和响应并记录它.也许类似于RESTEasy上的HTTP请求流程链上的过滤器.

@Path("/rest")
@Produces("application/json")
public class CounterRestService {

    //Don't want use log in controler every method to track requests and responces
    static final Logger log = LoggerFactory.getLogger(CounterRestService.class); 

    @POST
    @Path("/create")
    public CounterResponce create(@QueryParam("name") String name) {
        log.info("create "+name)
        try {
            CounterService.getInstance().put(name);
            log.info("responce data"); // <- :((
            return new CounterResponce();
        } catch (Exception e){
            log.info("responce error data"); // <- :((
            return new CounterResponce("error", e.getMessage());
        }    
    }

    @POST
    @Path("/insert")
    public CounterResponce create(Counter counter) {
        try {
            CounterService.getInstance().put(counter);
            return new CounterResponce(); …
Run Code Online (Sandbox Code Playgroud)

java rest jax-rs resteasy

27
推荐指数
1
解决办法
3万
查看次数

更漂亮和 eslint 缩进不一起工作

我正在设置基于 vim 的打字稿开发环境,但在缩进管理方面存在问题。

在此处输入图片说明

可能 'eslint' 说:重新格式化indent: Expected indentation of 2 spaces but found 4.prettier

我的.eslintrc.js

module.exports = { 
  parser: '@typescript-eslint/parser', // Specifies the ESLint parser
  extends: [ 
    'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
    'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
    'prettier/@typescript-eslint',
    'plugin:prettier/recommended',
  ],
  parserOptions: { 
    ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
    sourceType: 'module', // Allows for the use of imports
    ecmaFeatures: { 
      jsx: true, // Allows …
Run Code Online (Sandbox Code Playgroud)

javascript vim typescript eslint prettier

23
推荐指数
5
解决办法
2万
查看次数

spring data jpa utf-8编码不起作用

我使用spring-data-jpamysql数据库.我的表格字符集是utf-8.我?useUnicode=yes&amp;characterEncoding=utf8还在application.properties文件中添加了mysql url.将"ąčęėį"这样的字符传递给控制器​​以将其保存在mysql中时出现问题.在mysql我得到了??? 分数.但是当我使用mysql控制台的例子时,update projects_data set data="?????" where id = 1;每个都运行良好.

application.properties:

# "root" as username and password.
spring.datasource.url = jdbc:mysql://localhost:3306/gehive?useUnicode=yes&amp;characterEncoding=utf8
spring.datasource.username = gehive
spring.datasource.password = pass

spring.datasource.driver-class-name=com.mysql.jdbc.Driver

# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1

# Show or not log for each sql query
spring.jpa.show-sql = true

# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update

# Naming …
Run Code Online (Sandbox Code Playgroud)

mysql spring jpa spring-data spring-data-jpa

15
推荐指数
3
解决办法
2万
查看次数

无法配置/注册 dockerized gitlab runner

我正在运行容器gitlab

我还尝试gitlab runner通过本文进行 dockerized 设置。

首先我尝试通过以下方式运行 gitlab runner:

docker run -d --name gitlab-runner --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
Run Code Online (Sandbox Code Playgroud)

日志说:

...
Listen address not defined, session server disabled  builds=0
ERROR: Failed to load config stat /etc/gitlab-runner/config.toml: no such file or directory  builds=0
ERROR: Failed to load config stat /etc/gitlab-runner/config.toml: no such file or directory  builds=0
...
Run Code Online (Sandbox Code Playgroud)

我还尝试通过这篇文章注册跑步者:

docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
Run Code Online (Sandbox Code Playgroud)

5步后:

Please enter the gitlab-ci …
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci-runner

10
推荐指数
1
解决办法
9177
查看次数

bash:tslint:找不到命令

我试过用tslint --fix但得到了bash: tslint: command not found....

我使用命令安装了tslint : yarn global add tslint typescript.

我的机器使用Centos 7.

javascript typescript tslint

7
推荐指数
1
解决办法
7212
查看次数

Graphql: "message": "ID 不能代表值: 5a72240cf31713598588b70f"

我用于基于应用程序moongose的工作。目前,我尝试实现基于API。mongodbnodejsGrapqhl

我的查询graphql架构如下所示:

const schema = buildSchema(`                                                 
    type Query {                                                            
      predictionModels(active: Boolean): [PredictionModel]
    },                                                                                   
    type PredictionModel {                                                                                                 
        _id: ID                                                                                                             
        title: String
        active: Boolean                                                                                                
    }                                                                                                      
`)  
Run Code Online (Sandbox Code Playgroud)

但是当我使用时:

query {
  predictionModels(active: true){
    _id
  }
}
Run Code Online (Sandbox Code Playgroud)

作为我得到的回应:

"errors": [
    {
      "message": "ID cannot represent value: 5a72240cf31713598588b70f",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "predictionModels",
        0,
        "_id"
      ]
    } ....
Run Code Online (Sandbox Code Playgroud)

预测模型猫鼬架构:

const predictionModelSchema = new Schema({                                                                              
    title: { type: String, require: true, unique: true …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb graphql

7
推荐指数
1
解决办法
9038
查看次数

Webpack 开发服务器登陆应用程序时返回 404

Webpack 开发服务器在未登陆索引页面时返回 404。

问题是当将示例登陆到localhost:8080/page应用程序请求bundle.js然后http://localhost:8080/page/bundle.js?08386a6ab2de89169893返回 404 时

http://localhost:8080/bundle.js?08386a6ab2de89169893当来自索引开发服务器的尝试请求返回 200 时

我的 webpack.config.js:

const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const webpack = require('webpack')
const CompressionPlugin = require('compression-webpack-plugin')
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default

const styledComponentsTransformer = createStyledComponentsTransformer()

const basePath = __dirname

module.exports = function(env, arg) {
  const base = {
    context: path.join(basePath, 'src'),
    entry: ['./index.tsx'],
    output: {
      path: path.join(basePath, 'dist'),
      filename: 'bundle.js',
    },
    module: {
      rules: [
        {
          test: /\.(graphql|gql)$/,
          exclude: /node_modules/,
          loader: 'graphql-tag/loader',
        }, …
Run Code Online (Sandbox Code Playgroud)

webpack webpack-dev-server

6
推荐指数
1
解决办法
8352
查看次数

gitlab-runner:无法连接到本地主机端口 80:连接被拒绝

我已经在容器gitlab上运行docker。另外,我已经gitlab-runner安装在我的 Cenots7 机器上。运行器配置使用docker执行器。

配置文件

concurrent = 1                                                                                                          
check_interval = 0                                                                                                      


[session_server]                                                                                                        
  session_timeout = 1800                                                                                                

[[runners]]                                                                                                             
  name = "test"                                                                                                         
  url = "http://localhost"                                                                                              
  token = "gQfiiD4PUyPs4TiXLX9-"                                                                                        
  executor = "docker"                                                                                                   
  log_level = "debug"                                                                                                   
  pre_clone_script = "ls -la"                                                                                           
  clone_url = "http://localhost/"                                                                                       
  [runners.docker]                                                                                                      
    tls_verify = false                                                                                                  
    image = "node"                                                                                       
    privileged = false                                                                                                  
    disable_entrypoint_overwrite = false                                                                                
    oom_kill_disable = false                                                                                            
    disable_cache = false                                                                                               
    volumes = ["/cache"]                                                                                                
    shm_size = 0                                                                                                        
    # network_mode = "gitlab_default"                                                                                   
    # pull_policy = "never"                                                                                            
  [runners.cache]                                                                                                       
    [runners.cache.s3] …
Run Code Online (Sandbox Code Playgroud)

gitlab docker

5
推荐指数
0
解决办法
4736
查看次数