0.6.0 • Published 3 years ago

monkeyspan v0.6.0

Weekly downloads
19
License
MIT
Repository
github
Last release
3 years ago

MonkeySpan

Lang:TypeScript CSS:PostCSS Build:Rollup Compiler:Babel Jest Code Coverage:100% code style: prettier npm Build status Storybook

About

An example of how to make a React component package. 🐒

Tinker with this component in Storybook.

See this package in action in this CodeSandbox. 🏜

Tooling

Usage

import { MonkeySpan } from "monkeyspan";

function App() {
  return (
    <div>
      <MonkeySpan label="a monkey emoji">🐵</MonkeySpan>
    </div>
  );
}

export default App;

Contributing

Please note that this project follows the practices of Semantic Versioning and maintaining a CHANGELOG.

Making Changes

  1. Ensure you have the necessary dependencies installed:

    npm install
  2. Make your changes

  3. Test them in Storybook and/or using a separate app (e.g npx create-react-app demo):

    If you want to test your changes in a separate app, Yalc is a fantastic tool for linking purposes.

    # in this project's root directory, run
    yalc publish
    
    # then in the root directory of the app you're using to demo this package, run:
    yalc add monkeyspan && npm run start

    You should now be able to use the package in that app, e.g.

    import { MonkeySpan } from "monkeyspan";
  4. Make sure your changes haven't broken anything:

    Run the tests and linting.

    npm run test

    Ensure the build will generate successfully.

    npm run build
  5. Commit your changes, open a pull request (npm run pr:create), and merge them to the main branch.

  6. See Publishing Releases.

Available Scripts

CommandParamsExamplePurpose
buildnonenpm run buildRuns npm run build:types && npm run build:rollup
build:linknonenpm run build:linkGenerates a production build, then publishes it locally via yalc, and copies to your clipboard the command to run to complete the link within an app directory via npm run build && npx yalc publish && echo \"yalc add monkeyspan\" | pbcopy.
build:storybooknonenpm run build:storybookGenerates a build for storybook using build-storybook.
build:storybook:docsnonenpm run build:storybook:docsGenerates a build for storybook docs using build-storybook --docs.
build:rollupnonenpm run build:rollupGenerates a build and source map (./dist/bundle.js, ./dist/bundle.es.js & ./dist/bundle.js.map) using Rollup & Babel.
build:typesnonenpm run build:typesRuns npx tsc --project ./tsconfig.build.json --emitDeclarationOnly, which runs the typescript compiler to generate types files.
cleannonenpm run cleanRuns npm run clean:eslint && npm run clean:css && npm run clean:prettier
clean:artifactsnonenpm run clean:artifactsRuns rm -rv ./dist ; rm -rv .babel-config-test ; rm -rv storybook-static, which attempts to delete artifacts created by other scripts.
clean:cssnonenpm run clean:cssRuns npx stylelint 'src/**/*.css' --fix, which attempts to resolve all stylelint issues in the project.
clean:eslintnonenpm run clean:eslintRuns npx eslint --fix ., which attempts to resolve all eslint issues in the project.
clean:prettiernonenpm run clean:prettierRuns npx prettier --write ., which attempts to resolve all prettier issues in the project.
pr:createnonegh pr create --web --fillPushes your branch up, opens your browser at the create PR page for your branch, and fills in commit log info automatically.
storybooknonenpm run storybookStarts storybook on port 6006 via start-storybook -p 6006.
storybook:docsnonenpm run storybook:docsStarts storybook on port 6006 in docs mode via start-storybook -p 6006 --docs.
storybook:nocachenonenpm run storybook:nocacheStarts storybook on port 6006 without manager caching via start-storybook -p 6006 --no-manager-cache.
tag--valuenpm run tag --value=1.2.3Runs npm run tag:create --value=<value> and npm run tag:release --value=<value>
tag:create--valuenpm run tag:create --value=1.2.3Runs npx json -I -f ./package.json -e 'this.version=\"$npm_config_value\"' && npm i && git ci -am \"$npm_config_value\" && git tag $npm_config_value, which updates the package.json version to the value provided, updates the package-lock.json, generates a commit for the changes, and tags the commit using the value provided.
tag:release--valuenpm run tag:release --value=1.2.3Runs git push origin $npm_config_value && gh release create $npm_config_value --title $npm_config_value --notes-file ./CHANGELOG.md, which pushes the tag value provided to GitHub, then produces a release for it using the gh cli. You will need the gh cli for this command to work.
testnonenpm run testRuns npm run test:eslint && npm run test:css && npm run test:prettier && npm run test:types && npm run test:code
test:babelnonenpm run test:babelRuns npx babel src/ --out-dir .babel-config-test --extensions ".ts,.tsx,.js,.jsx", providing a glimpse at how babel's current config transforms the src code. Find the output in .babel-config-test/.
test:codenonenpm run test:codeRuns the test suite via npx jest.
test:cssnonenpm run test:cssRuns stylelint suite via npx stylelint 'src/**/*.css'.
test:eslintnonenpm run test:eslintRuns npx eslint ., providing info about issues.
test:prettiernonenpm run test:prettierRuns npx prettier --check ., providing info about issues.
test:typesnonenpm run test:typesRuns npx tsc --project ./tsconfig.eslint.json --noEmit, which checks for typescript errors without emitting any files.

Publishing Releases

Please note that the following should be done on the main branch, except for under certain circumstances, e.g. patching an older version than the last.

In order to generate a release, you need to produce a new package version and a corresponding tag for said version.

For example, let's say you want to add a component or feature to this package.

To do so, you'd simply follow the instructions in Making Changes, then produce your version via:

  1. Determine what type of changes you've made per Semantic Versioning to identify what the next version for this package will be. Check the package.json's current version to begin.
  2. Add an entry to the CHANGELOG.
  3. Run the following command with your new version in place of <VERSION>:

    npm run tag --value=<VERSION>

    If it was successful, you'll get a link like https://github.com/tonytino/monkeyspan/releases/tag/<VERSION> at the end of output.

  4. Go to the URL provided by the script output to see your new release in GitHub.

  5. Go to the Actions tab for this project and you should see a job running for your release, which, if successful, will upload your new version of this package to npm.

0.6.0

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.3.2

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago