Clean Publish is a tool for removing configuration files, fields and script for development from package.json
before publishing to npm
.
clean-publish
command copies project files (excluding configuration files) to a temporary folder, removes the extra and development script from package.json
, and calls npm publish
on the temporary folder.
Simple example:
node_modules
src
.eslintrc
.prettierrc
package.json
{
"name": "author",
"scripts": {
"lint": "eslint"
},
"dependencies": {},
"devDependencies": {}
}
node_modules
, .eslintrc
, .prettierrc
, lint
script and devDependecies
field was removed (empty objects will also be deleted).
src
package.json
{
"name": "author",
}
clean-publish
:$ npm install --save-dev clean-publish
# or
$ yarn add clean-publish --dev
clean-publish
script to package.json
:{
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
+ "publish": "clean-publish"
}
}
clean-docs
- keep only main section of README.md
.clean-comments
- clean inline comments from JS files.files
- list of files that you want to delete before publishingfields
- list of fields in the package.json
file that you want to delete before publishingexports
- list of exports conditions in the package.json
file that you want to delete before publishingwithout-publish
- clean project without npm publish
(tmp directory will not be deleted automatically)package-manager
- name of package manager to use (npm
by default)access
- whether the npm registry publishes this package as a public package, or restrictedbefore-script
- run script on the to-release dir before npm publish
temp-dir
- create temporary directory with given name.$ npm run clean-publish --files file1.js file2.js --fields scripts name
clear-package-json
is additional tool to work only with package.json
file.
$ npm run clear-package-json package.json -o package/package.json --fields scripts name
# or
$ npm run clear-package-json package.json > package/package.json
# or
$ cat package.json | npm run clear-package-json
# `fields` also will be getted from config file
# Clean each package using `package` temporary directory without publish it
lerna exec -- clean-publish --without-publish --temp-dir package
# Publish all packages from `package` subdirectory
lerna publish --contents package
Clean Publish also supports 3 ways to define config.
clean-publish
section to package.json
:"clean-publish": {
"files": ["file1.js", "file2.js"],
"packageManager": "yarn"
}
.clean-publish
config file:{
"files": ["file1.js", "file2.js"],
"packageManager": "yarn"
}
.clean-publish.js
config file:module.exports = {
"files": ["file1.js", "file2.js"],
"packageManager": "yarn"
}
- .circleci
- .github
- .vscode
docs
e2e
examples
fixtures
flow-typed
packages
scripts
types
website
- .babelrc
- .editorconfig
- .eslintignore
- .eslintrc.js
- .flowconfig
.gitignore
.npmignore
- .travis.yml
- .watchmanconfig
- .yarnrc
CHANGELOG.md
CONTRIBUTING.md
LICENSE
README.md
TestUtils.js
- appveyor.yml
crowdin.yaml
eslintImportResolver.js
jest
- jsconfig.json
- karma.conf.js
lerna.json
package.json
testSetupFile.js
- yarn.lock
package.json
{
"private": true,
- "devDependencies": {
- "ansi-regex": "^3.0.0",
- "ansi-styles": "^3.2.0",
- "babel-core": "^6.23.1",
- "babel-eslint": "^8.2.3",
- "babel-plugin-external-helpers": "^6.22.0",
- "babel-plugin-syntax-trailing-function-commas": "^6.13.0",
- "babel-plugin-transform-async-to-generator": "^6.16.0",
- "babel-plugin-transform-es2015-destructuring": "^6.23.0",
- "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
- "babel-plugin-transform-es2015-parameters": "^6.23.0",
- "babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
- "babel-plugin-transform-es2015-spread": "^6.22.0",
- "babel-plugin-transform-flow-strip-types": "^6.18.0",
- "babel-plugin-transform-inline-imports-commonjs": "^1.2.0",
- "babel-plugin-transform-runtime": "^6.23.0",
- "babel-plugin-transform-strict-mode": "^6.24.1",
- "babel-preset-env": "^1.4.0",
- "babel-preset-react": "^6.24.1",
- "babel-preset-react-native": "^4.0.0",
- "babel-register": "^6.26.0",
- "browserify": "^16.1.0",
- "chalk": "^2.0.1",
- "codecov": "^3.0.0",
- "debug": "^3.0.1",
- "eslint": "^4.19.1",
- "eslint-config-prettier": "^2.9.0",
- "eslint-plugin-babel": "^5.1.0",
- "eslint-plugin-flowtype": "^2.35.0",
- "eslint-plugin-import": "^2.6.0",
- "eslint-plugin-jest": "^21.0.0",
- "eslint-plugin-jsx-a11y": "^6.0.2",
- "eslint-plugin-markdown": "^1.0.0-beta.6",
- "eslint-plugin-prettier": "^2.3.1",
- "eslint-plugin-react": "^7.1.0",
- "eslint-plugin-relay": "~0.0.19",
- "execa": "^0.10.0",
- "flow-bin": "^0.75.0",
- "glob": "^7.1.1",
- "graceful-fs": "^4.1.11",
- "istanbul-api": "^1.3.1",
- "istanbul-lib-coverage": "^1.0.0",
- "jasmine-reporters": "^2.2.0",
- "jest-junit": "^5.1.0",
- "jest-simple-dot-reporter": "^1.0.2",
- "jquery": "^3.2.1",
- "karma": "^2.0.0",
- "karma-browserify": "^5.1.1",
- "karma-chrome-launcher": "^2.1.1",
- "karma-mocha": "^1.3.0",
- "left-pad": "^1.1.1",
- "lerna": "2.11.0",
- "micromatch": "^2.3.11",
- "mkdirp": "^0.5.1",
- "mocha": "^5.0.1",
- "mock-fs": "^4.4.1",
- "prettier": "^1.13.3",
- "prettylint": "^1.0.0",
- "progress": "^2.0.0",
- "readable-stream": "^2.3.6",
- "regenerator-runtime": "^0.11.0",
- "resolve": "^1.4.0",
- "rimraf": "^2.6.2",
- "rollup": "^0.56.2",
- "rollup-plugin-babel": "^3.0.2",
- "rollup-plugin-commonjs": "^8.2.1",
- "rollup-plugin-flow": "^1.1.1",
- "rollup-plugin-json": "^2.1.1",
- "rollup-plugin-node-builtins": "^2.1.1",
- "rollup-plugin-node-globals": "^1.1.0",
- "rollup-plugin-node-resolve": "^3.0.0",
- "slash": "^1.0.0",
- "string-length": "^2.0.0",
- "strip-ansi": "^4.0.0",
- "typescript": "^2.2.2",
- "watchify": "^3.9.0"
- },
"scripts": {
- "build-clean": "rm -rf ./packages/*/build ./packages/*/build-es5",
- "build": "node ./scripts/build.js",
- "clean-all": "rm -rf ./node_modules && rm -rf ./packages/*/node_modules && rm -rf ./e2e/*/*/node_modules && yarn build-clean",
- "jest": "node ./packages/jest-cli/bin/jest.js",
- "jest-coverage": "yarn jest --coverage",
- "lint": "eslint . --cache --ext js,md",
- "lint-es5-build": "eslint --no-eslintrc --no-ignore --env=browser packages/*/build-es5",
- "lint:md": "yarn --silent lint����ci --fix",
- "lint����ci": "prettylint '**/*.md' --ignore-path .gitignore",
"postinstall": "opencollective postinstall && yarn build",
"publish": "yarn build-clean && yarn build && lerna publish --silent",
- "test-ci-es5-build-in-browser": "karma start --single-run",
- "test-ci": "yarn jest-coverage -i --reporters jest-simple-dot-reporter jest-junit && yarn test-leak && node scripts/mapCoverage.js && codecov",
- "test-ci-partial": "yarn jest -i --reporters jest-simple-dot-reporter jest-junit",
- "test-pretty-format-perf": "node packages/pretty-format/perf/test.js",
- "test-leak": "yarn jest -i --detectLeaks jest-mock jest-diff jest-repl",
"test": "yarn typecheck && yarn lint && yarn jest",
- "typecheck": "flow check --include-warnings",
- "watch": "yarn build && node ./scripts/watch.js"
},
"workspaces": [
"packages/*",
"website",
"examples/*"
],
- "jest": {
- "modulePathIgnorePatterns": [
- "examples/.*",
- "packages/.*/build",
- "packages/.*/build-es5",
- "packages/jest-runtime/src/__tests__/test_root.*",
- "website/.*",
- "e2e/runtime-internal-module-registry/__mocks__"
- ],
- "collectCoverageFrom": [
- "**/packages/jest-*/**/*.js",
- "**/packages/eslint-*/**/*.js",
- "**/packages/pretty-format/**/*.js",
- "!**/bin/**",
- "!**/cli/**",
- "!**/perf/**",
- "!**/__mocks__/**",
- "!**/__tests__/**",
- "!e2e/**"
- ],
- "coverageReporters": [
- "json"
- ],
- "projects": [
- "<rootDir>",
- "<rootDir>/examples/*/"
- ],
- "transform": {
- "^.+\\.js$": "<rootDir>/packages/babel-jest"
- },
- "setupTestFrameworkScriptFile": "<rootDir>/testSetupFile.js",
- "snapshotSerializers": [
- "<rootDir>/packages/pretty-format/build/plugins/convert_ansi.js"
- ],
- "testEnvironment": "./packages/jest-environment-node",
- "testPathIgnorePatterns": [
- "/node_modules/",
- "/examples/",
- "/e2e/.*/__tests__",
- "\\.snap$",
- "/packages/.*/build",
- "/packages/.*/build-es5",
- "/packages/.*/src/__tests__/expect_util.js",
- "/packages/jest-cli/src/__tests__/test_root",
- "/packages/jest-cli/src/__tests__/__fixtures__/",
- "/packages/jest-cli/src/lib/__tests__/fixtures/",
- "/packages/jest-haste-map/src/__tests__/haste_impl.js",
- "/packages/jest-resolve-dependencies/src/__tests__/__fixtures__/",
- "/packages/jest-runtime/src/__tests__/defaultResolver.js",
- "/packages/jest-runtime/src/__tests__/module_dir/",
- "/packages/jest-runtime/src/__tests__/NODE_PATH_dir",
- "/packages/jest-snapshot/src/__tests__/plugins",
- "/packages/jest-validate/src/__tests__/fixtures/",
- "/packages/jest-worker/src/__performance_tests__",
- "/packages/pretty-format/perf/test.js",
- "/e2e/__tests__/iterator-to-null-test.js"
- ]
- },
- "prettier": {
- "bracketSpacing": false,
- "proseWrap": "never",
- "singleQuote": true,
- "trailingComma": "all"
- },
"dependencies": {
"opencollective": "^1.0.3"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/jest",
"logo": "https://opencollective.com/jest/logo.txt"
}
}
本来也是一个书的名字,也是很喜欢的一本书。 这里就写下自己多年coding的理解,阅读clean code的笔记,以及若干coding principle。 bjarne对于clean code的看法 straight forward less dependency clean code does one thing well 关于clean code自己的看法 在我看来,clean code在于
总结的口诀 大虫虫是魔鬼 -大类,大函数,大参数列表;重复代码,重复造轮子;魔鬼数字硬编码,常量应该统一定义,集中管理,便于理解和统一替换。 小虫抽风 一个小钦差 大重重是魔鬼 长虫发现数据链 -长类,长函数,长参数列表; 发散式变化,散弹式修改;switch惊悚现身,基本类型偏执;数据泥团,幼稚的数据类;过度耦合的消息链,依恋情节。 好莱坞的迪米特喜欢组合而不是继承 小技巧 将业务代码和非业务代
Publish:是将你的web程序发布到tomcat服务器上,这样通过浏览器就可以访问你的程序。 Clean:是指原先编译到tomcat服务器上的程序,先清除掉,然后再重新编译。 Clean Tomcat Work Directory:tomcat的工作目录,也就是tomcat把jsp转换为class文件的工作目录。 tomcat的工作原理是当浏览器访问某个jsp页面时,tomcat会在work目
Cleanup是做什么的? MSConfig Cleanup 是一款能够让使用者仔细审视自己计算机中在启动时究竟会执行哪些程序的免费软件,使用者能够通过 MSConfig Cleanup 为你所整里的清单,对开机时计算机所会执行到的程序一览无遗。根据这个列表,使用者能够判别究竟哪些程序是需要在开机时被执行的,而哪些是造成开机缓慢的无用程序。通过这样的一次大扫除,相信你的计算机启动速度就能够获得一定
为什么看这本书? 如这本书的名字意思,写出整洁的代码。整洁的代码,对以后的自己维护之前写的代码更加方便。代码混乱会导致难以维护,bug越修越多。 个人认为整洁的代码,就是别人没有改进的余地。 具体来说就是: 能够通过所有的测试 没有重复代码 体现系统中的全部设计理念 包括尽量少的实体,比如类、方法、函数等 整洁代码 有意义的命名 名副其实(有意义的命名,比如魔术数字) 避免误导(相似长名变量) 区
team rule: 团队开发一个项目之前,先商量好统一的代码格式,然后配置进ide中,使得项目的代码风格统一。 过程式代码难以添加新的数据结构,因为要修改所以函数;面向对象代码难以添加新的函数,因为要修改所有的类中增加新的函数。
执行go clean命令会删除掉执行其它命令时产生的一些文件和目录,包括: 在使用go build命令时在当前代码包下生成的与包名同名或者与Go源码文件同名的可执行文件。在Windows下,则是与包名同名或者Go源码文件同名且带有“.exe”后缀的文件。 在执行go test命令并加入-c标记时在当前代码包下生成的以包名加“.test”后缀为名的文件。在Windows下,则是以包名加“.test.
为什么要看这本书 我们无法舍弃代码的编写,因为代码是需求细节的实现,而有的细节是无法抽象的。所以就更加体现了好代码的重要性,因为混乱的代码,只会让你疲于维护。 在开始之初,就别抱着“将就”,“后面再改”,“先这样吧”的想法 因为 —稍后等于永不 第一章:整洁的意义 整洁的代码具体体现在 1.有单元测试和验收测试 2.使用有意义的命名 3.它只提供一种而非多种做一件事情的途径 (单一原则) 4.它
build 就是将工程src目录的内容全新输出到工程的classes目录下,全面覆盖旧的文件,需要编译的会编译后再输出 clean 就是把workspaces内对应工程的classes目录下的内容全部删除 publish 就是将工程内容全新发布到服务器,将之前的部署文件全部覆盖掉,另外如果将项目从服务器整个移除了,操作publish不会将已移除的项目自动部署到服务器上 publish是发布的意思,
类 1.类的组织 类从变量列表开始,公共静态常量先出现,私有静态变量,私有实体变量。很少有公共变量。 某个公共函数的私有工具函数紧随在公共函数之后,符合自顶向下原则。 封装 受保护变量或工具函数,好让测试能够访问。若同一程序包内的某个测试需要调用一个函数或变量,一般设定会受保护或在整个程序包内可访问,优先private,其次考虑protected。 2.类应当短小 函数,通过代码行衡量大小;类,通
今天下午没事,又下载了以前看过的MS Press的<Writing clean code>来看看,虽然说比较老了(92年写的),但很多东西依然有很强的借鉴意义,以下几点觉得很有感触: 1.使用assert 在函数中检查参数及某些值得合法性,因为assert只会在debug模式下起作用,所以不会有性能问题,有些人喜欢用错误处理来代替assert,这是不对的,会使程序变大变慢,assert的正确
Chapter 2 标识符 一、有意义 1.变量命名:首单词首字母小写,之后的每个单词首字母大写。函数命名第一个单词字母大写; 2.常量最好先宏定义再使用,单纯的数字常量不够明确。常量名称全大写,多个单词用“_”分隔。 3.timestamp时间戳,年月日时分秒 二、不应有误导性: 1.栈stack,列表list,队列queue,树tree 体现特定数据结构类型 2.慎用小写字母l,和大写字母O
1,使用以下命令清理系统垃圾 sudo apt-get autoclean --清理旧版本的软件缓存 sudo apt-get clean--清理所有软件缓存 sudo apt-get autoremove--删除系统不再使用的孤立软件 2,清理opera firefox的缓存文件: ls ~/.opera/cache4 ls ~/.mozilla/firefox/*.default/Cache
The Clean Code Blog 干净代码博客 First 19 May 2014 2014年5月19日 In the first Is TDD Dead? hangout, at time 30:25 @dhh makes a remarkable statement: 首先TDD死了吗?等下,在 30:25时候,@dhh发表了一个引人注目的声明: “…you’re not done un
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。 http://blog.csdn.net/topmvp - topmvp Even bad code can function. But if code isnt clean, it can bring a development organization to its knees. E
publish:是将你的web程序发布到tomcat服务器上,这样通过浏览器就可以访问你的程序。 clean:是指原先编译到tomcat服务器上的程序,先清除掉,然后再重新编译。 publish的作用就是发布。然后浏览效果。 clean的使用,一般publish提示有错误或更改没效果,clean一下就可以清除之前的编译。 如:我建了一个Hello.java的类。然后我publish,现在我把这个类
repo没有clean这个命令,如果需要清洁路径,删除没有追踪的文件,需要执行: repo forall -c "git clean -df" 将repo路径里的所有文件完全恢复到最初状态,需要执行: repo forall -c "git reset --hard HEAD" repo forall -c "git clean -df"
flutter clean flutter pub cache clean flutter pub get flutter clean一下,再次 flutter run/build
Code cleanup refers to the act of writing code so that it cleans up leftover data structures and other unwanted materials from memory and the filesystem. It is sometimes treated as a synonym of re
我有一些第三方jar依赖。因此,我使用maven-install-plugin将这些第三方jar安装到我的本地存储库(.m2/repository)中。这个插件一定要清理阶段。当我执行“MVN clean Install”时,在运行clean之前,它开始搜索依赖项,最终构建失败,因为它无法找到第三方JAR。但是当我单独运行mvn clean时,它会将文件安装在本地存储库中。随后当我运行mvn cl
clean 命令用于删除生成的书籍,和任何其他构建工件. mdbook clean clean命令可以将目录作为参数,用作本书的根目录,而不是当前工作目录. mdbook clean path/to/book --dest-dir(-d)选项允许您覆盖书籍的输出目录,该目录会删除。 为相对路径,(相对于书籍的根目录)。如果未指定,则默认为book.toml配置的build.build-dir字
执行 go clean 命令会删除掉执行其它命令时产生的一些文件和目录,包括: 在使用 go build 命令时在当前代码包下生成的与包名同名或者与Go源码文件同名的可执行文件。在 Windows 下,则是与包名同名或者 Go 源码文件同名且带有 .exe 后缀的文件。 在执行 go test 命令并加入 -c 标记时在当前代码包下生成的以包名加 .test 后缀为名的文件。在 Windows 下
命名 git-clean - 从工作树中删除未跟踪的文件 概要 git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>… 描述 通过从当前目录开始递归地移除不受版本控制的文件来清除工作树。 通常,只有Git未知的文件才会被删除,但是如果-x指定了该选项,则也会删除被忽略的文件。例如,这可以用于删除所有构建产品。
deep-clean A Kotlin script that nukes all build caches from Gradle/Android projects.Useful when Gradle or the IDE let you down �� �� h/t to @Takhion for the original idea, and to@holgerbrandl for KScr
Clean-macOS Clean-macOS is a simple script that can be used after a clean installationof macOS to configure and install all the apps you need. It uses dotfiles andshell scripts to speed up the configu