GithubHelp home page GithubHelp logo

zce / caz Goto Github PK

View Code? Open in Web Editor NEW
2.4K 151.0 793.0 732 KB

A simple yet powerful template-based Scaffolding tools.

License: MIT License

JavaScript 1.56% TypeScript 98.44%
productivity scaffold scaffolding boilerplate starter-kit template caz zce generator

caz's Introduction

caz's People

Contributors

dependabot[bot] avatar lktslionel avatar renovate[bot] avatar zce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

caz's Issues

npm run build 生成的生产环境的代码无法触发form的submit事件

npm run build 生成的生产环境的代码无法触发form的submit事件

<form bindsubmit="xx">
...
<button class="weui-btn" type="primary" formType="submit">确定</button>			
...
</form>

不知道gulpfile.js中的uglify这段,是不是要加点什么进行过滤

.pipe(plugins.if(isProduction, plugins.uglify())) 

Bug: running caz removes local `node_modules/.bin/caz` entry

Prerequisites:

  1. Have caz as a top level devDependency in my workspaces based monorepo
  2. Have a local template that I want to use
  3. run npm exec -- caz .templates/my-template packages/my-new-package
  4. See the weird and slow "Installing template dependencies..." text
  5. Get the first prompt
  6. Cancel
  7. Try step 3 again, failure

Expected behaviour:

  1. It shouldn't install anything
  2. It shouldn't remove any existing dependencies

如何使用sass?

安装gulp-scss后编译报错:

'compile:scss' errored after 494 μs
TypeError: plugins.scss is not a function

Refactor import CommonJS modules

At present, all modules are imported directly using the import statement, such as:

import fs from 'fs'
import pkg from './package.json'

output code

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const package_1 = __importDefault(require("./package"));

__importDefault is too redundant.

Maybe import = require() is a better choice for the commonjs module, such as:

import fs = require('fs')
export const contents = fs.readFileSync(...)

output code

var fs_1 = require("./fs");
exports.contents = fs_1.readFileSync(...)

ref:

.less .xml 文件~

.less .xml 微信开发者工具识别不了~ 该怎么处理呢???求指教

Ensure the local template dir exists

At present, if you use the local template, if the specified template directory does not exist, should you prompt the user with some error information?

test

哈哈测试

撒旦法撒旦法

  • list item 1
  • list item 2
  1. item 1
  2. item2

Refactor 3.0

  • @clack/prompts
  • Improve template response speed
  • More template hosting solutions
  • Deno & Bun support

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency socks-proxy-agent to v8.0.3
  • chore(deps): update dependency @types/node to v20.12.7
  • chore(deps): update dependency typescript to v5.4.5
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update commitlint monorepo to v19 (major) (@commitlint/cli, @commitlint/config-conventional)
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency ini to v4.1.2 (ini, @types/ini)
  • chore(deps): update dependency ora to v8
  • chore(deps): update dependency tsup to v8
  • chore(deps): update dependency vitest to v1
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/main.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @commitlint/cli 17.7.1
  • @commitlint/config-conventional 17.7.0
  • @types/adm-zip 0.5.1
  • @types/ini 1.3.31
  • @types/lodash 4.14.198
  • @types/node 20.11.22
  • @types/semver 7.5.2
  • @types/validate-npm-package-name 4.0.0
  • adm-zip 0.5.10
  • cac 6.7.14
  • env-paths 3.0.0
  • fast-glob 3.3.1
  • husky 8.0.3
  • ini 4.1.1
  • lint-staged 14.0.1
  • lodash 4.17.21
  • node-fetch 3.3.2
  • ora 7.0.1
  • prompts 2.4.2
  • semver 7.5.4
  • socks-proxy-agent 8.0.2
  • ts-standard 12.0.2
  • tsup 7.2.0
  • typescript 5.2.2
  • validate-npm-package-name 5.0.0
  • vitest 0.34.4
  • node >=16

  • Check this box to trigger a request for Renovate to run again on this repository

Interpolation issue with ES2015 syntax and bash

Hey there!
First of all thank you for creating this tool.

As I was implementing a scaffold tool for a React App I noticed the following issue, which from what I can see it is located in: https://github.com/zce/caz/blob/main/src/render.ts

// With the code in https://github.com/zce/caz/blob/main/src/render.ts caz interpolates also valid Bash syntax and ES2015
// The problem is that it will throw an error for variables it tries to replace, but are not intended for interpolation and are just valid code. This is because lodash default behaviour is to try and replace also ${var} syntax.
result = _.template('${foo} something')({foo: 'bar'})
console.log(result) // prints bar something

// Fixing it would be something in the line of customising the interpolate setting to only work with <% %> wrapped variables.
const regexp = /<%=?([\s\S]+?)%>/
result = _.template('${foo} something escape', {interpolate: regexp})({foo: 'bar'})
console.log(result) // ${foo} something escape

// As you can see this is interpolated correctly, while valid ${var} is ignored. 
result = _.template('<%= foo %> something interpolated', {interpolate: regexp})({foo: 'bar'})
console.log(result) // bar something interpolated

This a related issue / question opened in lodash explaing further the solution proposed: lodash/lodash#4039
I would be willing to contribute, but I first would like to hear your opinion, granted I did not test yet this code with helpers functions.

Have a nice day!

只是写的很不ES6,不知为什么要这么写呢

douban.find('coming_soon', 1, 3)
      .then(d => this.setData({ movies: d.subjects, loading: false }))
      .catch(e => {
        console.error(e)
        this.setData({ movies: [], loading: false })
      })
module.exports = {
  find (type, page = 1, count = 20, search = '') {
    const params = { start: (page - 1) * count, count: count }
    return fetchApi(type, search ? Object.assign(params, { q: search }) : params)
      .then(res => res.data)
  },
  findOne (id) {
    return fetchApi('subject/' + id)
      .then(res => res.data)
  }
}

ES5+ES6,只是写的很不ES6 不知为什么要这么写呢

访问豆瓣api出现403

image
但是在浏览器访问这个接口是没问题的,卡到这两天了,网上各种搜都没找到解决方案,紧急!!!

Cannot create template in TypeScript

Hi,

I would like to create a custom template using TypeScript instead of JavaScript (using index.ts instead of index.js).
Since caz itself is written in TypeScript, I expected this to be supported out of the box.
But looks like it's not.
I could not find any example. All the existing templates are written in JavaScript.
It's a bit sad because the types already in caz.
I tried to modify the sample template to use TS (added required dependencies, etc).
But it fails to compile this empty template: index.ts

import { Template } from 'caz'

const templateDef: Template = {
  //...
}
export default templateDef

I get this error:

> tsc

node_modules/caz/lib/init/index.d.ts:1:44 - error TS2307: Cannot find module './types' or its corresponding type declarations.

1 import { Options, Context, Template } from './types';
                                             ~~~~~~~~~

Any idea/suggestion ?

分支说明还继续吗?

看了大神的教程获益匪浅,非常感谢!我感觉分支说明写的让我们这些新人能清晰的了解整个项目代码是怎么一步步写出来的,希望大神可以继续完成分支说明!

Allow optional installation of template dependencies

Hello,

I know that, by design, you prefer to have simple and lightweight templates. That's the reason why you "inherit" caz dependencies in the templates.

However, sometimes it may be desirable to allow the template to have its own dependencies.
I had the case where I just needed one additional library.
And I could not with the current implementation ;(

So, I forked your project to add the possiblity to optionally install template dependencies.
This is done by passing an additional flag in the command-line.
If you don't pass it, it keeps the current behaviour.

Would you be interested in merging this feature into the codebase ?
I think this would be better than having separate "forks" with different features.
If so, let me know, and I will submit a PR.

In the meantime, you can test this feature with the fork.
I already have one template using this feature:

npx ozeebee/caz ozeebee/cdk-project-template [project-name] --tpldeps

Thanks !

豆瓣请求 400 bad Request

{"msg":"Invalid request","code":999,"request":"GET /v2/isbn/9787508662091"}

你好 我使用你的接口去请求 但是你的网址为什么我在小程序上面 关掉了域名检测 会报这个错误

用chrome浏览器直接请求就不会。请问原因是?

怎么返回400了,错误请求

Request URL:https://douban.uieee.com/v2/movie/in_theaters
Request Method:GET
Status Code:400 Bad Request
Remote Address:47.93.58.139:443
Referrer Policy:no-referrer-when-downgrade

闪屏bug

bug
点击电影详情,先闪屏到 "我的",然后再进入详情

Print workflow log

Actual situation

At present, only the necessary information is output in the console, and there is no log for each work link, which is extremely unfriendly for users.

Expected results

Appropriate log output for key steps.

Support http request proxy configuration

  1. Support http request proxy configuration
# other options
proxy = sock5://127.0.0.1:1080
  1. Support http request proxy env
$ ALL_PROXY=socks5://127.0.0.1:1080 caz nm my-module

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

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.