Code Monkey home page Code Monkey logo

git-scripts's People

Contributors

binsee avatar dependabot-preview[bot] avatar huan avatar windmemory avatar

Stargazers

 avatar

Watchers

 avatar  avatar

git-scripts's Issues

Does npm version really need tag ?

We seem to rarely use tags, and npm version in the push hook will create new tags by default. And tags only exist in the local record and will not be uploaded to the remote repo. The tags are displayed in the git log, which is annoying.

So I think tag should not be created in push hook.
The --no-git-tag-version flag can be added to npm version to skip creating tags.

image

unknown revision or path not in the working tree

image

问题原因:^在window是特殊字符。
解决方法:git reset –hard HEAD”^”或git reset –hard “HEAD^”或git reset –hard HEAD~1
如果你git log只有一个提交,会出现:

fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

const lastCommitMsg = checkReturn(shell.exec('git log --pretty=format:"%s" HEAD^0 -1', { silent : true })).stdout

refer to:

npm run lint may not output error messages when running errors

 ✘ binsee@shanmudeMBP15 > ~/CodeWork/puppet-xp > > fix-git-scripts ± > git push                   
[Step-1] Checking last commit... 

[Step-2] Checking lint... 

Error:
------------------------------------------



------------------------------------------

Failed to exec pre-push hook script
error: 无法推送一些引用到 'github.com:binsee/puppet-xp.git'

Running npm lint fails with no error message

  • check
 ✘ binsee@shanmudeMBP15 > ~/CodeWork/puppet-xp > > fix-git-scripts ± > npm run lint                     

> [email protected] lint
> npm run lint:es && npm run lint:ts && npm run lint:md


> [email protected] lint:es
> eslint "src/**/*.ts" "tests/**/*.spec.ts" --ignore-pattern tests/fixtures/

=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.5.0

YOUR TYPESCRIPT VERSION: 4.5.5

Please only submit bug reports when using the officially supported version.

=============

> [email protected] lint:ts
> tsc --isolatedModules --noEmit

examples/ding-dong-bot.ts:113:5 - error TS2339: Property 'talkerId' does not exist on type 'MessagePayload'.

113     talkerId,
        ~~~~~~~~

src/puppet-xp.ts:307:7 - error TS2322: Type '{ id: string; roomId: string; talkerId: string; text: string; timestamp: number; toId: string; type: PUPPET.type.Message.Unknown | PUPPET.type.Message.Audio | PUPPET.type.Message.Contact | ... 4 more ... | PUPPET.type.Message.Video; }' is not assignable to type 'MessagePayload'.
  Object literal may only specify known properties, and 'talkerId' does not exist in type 'MessagePayload'.

307       talkerId,
          ~~~~~~~~


Found 2 errors.
 ✘ binsee@shanmudeMBP15 > ~/CodeWork/puppet-xp > > fix-git-scripts ± > npm run lint:ts            

> [email protected] lint:ts
> tsc --isolatedModules --noEmit

examples/ding-dong-bot.ts:113:5 - error TS2339: Property 'talkerId' does not exist on type 'MessagePayload'.

113     talkerId,
        ~~~~~~~~

src/puppet-xp.ts:307:7 - error TS2322: Type '{ id: string; roomId: string; talkerId: string; text: string; timestamp: number; toId: string; type: PUPPET.type.Message.Unknown | PUPPET.type.Message.Audio | PUPPET.type.Message.Contact | ... 4 more ... | PUPPET.type.Message.Video; }' is not assignable to type 'MessagePayload'.
  Object literal may only specify known properties, and 'talkerId' does not exist in type 'MessagePayload'.

307       talkerId,
          ~~~~~~~~


Found 2 errors.
  • turn off display stdout
 ✘ binsee@shanmudeMBP15 > ~/CodeWork/puppet-xp > > fix-git-scripts ± > npm run lint:ts > /dev/null

So, error message for tsc --isolatedModules --noEmit not output to stderr, but output to stdout.

We need to be compatible with the message output to stdout when stderr has no message.

Upgrade guide

The new version (0.7.7) of git-has better readability and solves the push blocking problem.

Preview

  • Fail
    image

  • Success

image

Update steps:

  1. npm i -D @chatie/scripts@next
  2. npx git-scripts install
  3. Enjoy push

Use

Frist push branch

  • git push -u origin branch

or

  • git config --global push.default current
  • git push

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Cannot find module '../package.json'

~/puppet-xp   test ±  git push                 
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '../package.json'
Require stack:
- ~/puppet-xp/node_modules/@chatie/git-scripts/dist/bin/pre-push.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (~/puppet-xp/node_modules/@chatie/git-scripts/dist/bin/pre-push.js:48:24)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/binsee/CodeWork/puppet-xp/node_modules/@chatie/git-scripts/dist/bin/pre-push.js'
  ]
}
Failed to exec pre-push hook script
error: failed to push some refs to 'github.com:binsee/puppet-xp.git'

Show a hint for how to disable pre-push hook in the error message

RxJS has a very nice error message to let users know how to skip the pre-push hook, so do us.

husky > commit-msg hook failed (add --no-verify to bypass)

$ git commit -m 'fixx(fromEvent): clean fromEvent.ts code to make sure its clean'
husky > pre-commit (node v16.3.0)
✔ Preparing...
✔ Running tasks...
✔ Applying modifications...
✔ Cleaning up... 
husky > commit-msg (node v16.3.0)
INVALID COMMIT MSG: "fixx" is not allowed type ! Valid types are: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
fixx(fromEvent): clean fromEvent.ts code to make sure its clean
husky > commit-msg hook failed (add --no-verify to bypass)

CC @lucifer1004

Should we allow skipping lint checks?

In some projects, lint is problematic. And it may not be repaired in a short time, then push will be block.

E.g. #29

It would be useful to have a SKIP_LINT=1 option to skip lint checks.

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.