yeoman

Issue with with 'use strict' and underscore.js

我的未来我决定 提交于 2021-02-07 06:09:44
问题 I've written an app using Yeoman and backbone.js. At the top of every js file I have specified 'use strict'; and when I run my grunt tasks jshint does not encounter any errors. I am able to build my app with grunt without issue however when I try to run the uglified js I get the following error: Uncaught SyntaxError: Strict mode code may not include a with statement I've searched the code base and the only things using a with statement is underscore. I'm new to strict mode so I'm not sure how

Issue with with 'use strict' and underscore.js

╄→尐↘猪︶ㄣ 提交于 2021-02-07 06:07:24
问题 I've written an app using Yeoman and backbone.js. At the top of every js file I have specified 'use strict'; and when I run my grunt tasks jshint does not encounter any errors. I am able to build my app with grunt without issue however when I try to run the uglified js I get the following error: Uncaught SyntaxError: Strict mode code may not include a with statement I've searched the code base and the only things using a with statement is underscore. I'm new to strict mode so I'm not sure how

Issue with with 'use strict' and underscore.js

≡放荡痞女 提交于 2021-02-07 06:07:13
问题 I've written an app using Yeoman and backbone.js. At the top of every js file I have specified 'use strict'; and when I run my grunt tasks jshint does not encounter any errors. I am able to build my app with grunt without issue however when I try to run the uglified js I get the following error: Uncaught SyntaxError: Strict mode code may not include a with statement I've searched the code base and the only things using a with statement is underscore. I'm new to strict mode so I'm not sure how

Yeoman Prompts with Rx Interface

心不动则不痛 提交于 2021-01-28 20:10:02
问题 I'm trying to write a Yeoman generator, and I really don't enjoy the documented interface for writing prompts. The Reactive Interface seems like it would be much easier to write branching and looping interfaces. However when I write mine like so: prompting: function () { var prompts = [{ type: 'input', name: 'howdy', message:'howdy' }]; prompts = Rx.Observable.from(prompts); this.prompt(prompts, function(answers) { this.log(answers); }.bind(this)); }, I get this error: events.js:85 throw er;

如何编写 VS Code 扩展

痞子三分冷 提交于 2020-08-09 14:42:13
通过为流行的代码编辑器编写自己的扩展来添加缺失的功能。 Visual Studio Code(VS Code)是微软为 Linux、Windows 和 macOS 创建的跨平台代码编辑器。遗憾的是,微软版本的 VS Code 是在 Microsoft Software License 下发布的,这不是一个开源的许可证。然而,它的源代码是开源的,在 MIT 许可证下由 VSCodium 项目发布。 VSCodium 和 VS Code一样,支持扩展、内嵌式 Git 控制、GitHub 集成、语法高亮、调试、智能代码补完、代码片段等。换句话说,对于大多数用户来说,使用 VS Code 和 VSCodium 没有什么区别,而且后者是完全开源的! 什么是 VS Code 扩展? 扩展extension可以让你为 VS Code 或 VSCodium 添加功能。你可以在 GUI 中或从终端安装扩展。 你也可以构建自己的扩展。有几个你可能想学习如何构建扩展的原因: 想要添加一些功能: 如果缺失你想要的功能,你可以创建一个扩展来添加它。 为了乐趣和学习: 扩展 API 允许你探索 VSCodium 是如何工作的,这是一件有趣的事情。 为了提高您的技能: 创建扩展可以提高你的编程技能。 为了成名: 创建一个对他人有用的扩展可以提高你的公众形象。 安装工具 在你开始之前,你必须已经安装了 Node

Windows版Git中的文件名太长

耗尽温柔 提交于 2020-08-05 02:59:25
问题: I'm using Git-1.9.0-preview20140217 for Windows. 我正在Windows上使用 Git-1.9.0-preview20140217 。 As I know, this release should fix the issue with too long filenames. 据我所知,此版本应解决文件名过长的问题。 But not for me. 但是不适合我。 Surely I'm doing something wrong: I did git config core.longpaths true and git add . 当然,我做错了:我做了 git config core.longpaths true 和 git add . and then git commit . 然后 git commit 。 Everything went well. 一切顺利。 But when I now do a git status , I get a list of files with Filename too long , for example: 但是,当我现在执行 git status ,会得到文件 Filename too long 的文件列表,例如: node_modules/grunt-contrib-imagemin

Vue 使用typescript, 优雅的调用swagger API

荒凉一梦 提交于 2020-07-29 11:11:50
Swagger 是一个规范和完整的框架,用于生成、描述、调用和可视化 RESTful 风格的 Web 服务,后端集成下Swagger,然后就可以提供一个在线文档地址给前端同学。 前端如何优雅的调用呢? 入门版 根据文档,用axios自动来调用 // 应用管理相关接口 import axios from '../interceptors.js' // 获取应用列表 export const getList = (data) => { return axios({ url: '/app/list?sort=createdDate,desc', method: 'get', params: data }) } 这里的问题是,有多少个接口,你就要编写多少个函数,且数据结构需要查看文档获取。 进阶版本 使用typescript,编写API,通过Type定义数据结构,进行约束。 问题: 还是需要手写 优雅版本 swagger 其实是一个json-schema描述文档,我们可以基于此,自动生成。 很早之前,写过一个插件 generator-swagger-2-t , 简单的实现了将swagger生成typescript api。 今天,笔者对这个做了升级,方便支持后端返回的泛型数据结构。 安装 需要同时安装 Yeoman 和 -swagger-2-ts npm install -g

How to generate unit tests from a JS module automatically?

≯℡__Kan透↙ 提交于 2020-07-08 20:40:40
问题 I have inherited a project with multiple JavaScript files. Each of them has a bunch of functions; the files are defined in AMD style. For instance: math.js define([], function () { return { func1: function (a, b) { return a + b; }, func2: function (c, d) { return c + d; }, }; }); I would like to generate a new file in the tests folder with the name ( math.js ) that will contain the boilerplate code for the unit tests in tdd style for the intern framework. I have used the intern-generator, a

Yeoman invoke generator by code with args

六月ゝ 毕业季﹏ 提交于 2020-07-06 19:40:08
问题 I've having yeoman generator with sub generator. I need to invoke the sub generator via code and I use the code below which is working, I see that the sub generator is invoked and I got the question in the terminal. docs: https://yeoman.io/authoring/integrating-yeoman.html var yeoman = require('yeoman-environment'); var env = yeoman.createEnv(); env.lookup(function () { env.run('main:sub',err => { console.log('done' ,err); }); }); The sub generator have only one question prompting() { const

Yeoman invoke generator by code with args

浪尽此生 提交于 2020-07-06 19:38:40
问题 I've having yeoman generator with sub generator. I need to invoke the sub generator via code and I use the code below which is working, I see that the sub generator is invoked and I got the question in the terminal. docs: https://yeoman.io/authoring/integrating-yeoman.html var yeoman = require('yeoman-environment'); var env = yeoman.createEnv(); env.lookup(function () { env.run('main:sub',err => { console.log('done' ,err); }); }); The sub generator have only one question prompting() { const