Git Product home page Git Product logo

oscd-component's Introduction

<oscd-component>

Renaming the component

After instantiating this template repository, you will want to rename your component and then remove this section from the README.md file.

To find places where you have to search for and replace the string oscd-component you can use

$ git grep oscd-component
=>
README.md:# \<oscd-component>
README.md:npm i oscd-component
README.md:  import 'oscd-component';
README.md:<oscd-component></oscd-component>
index.html:    import './dist/oscd-component.js';
index.html:        <oscd-component .title=${title}>
index.html:        </oscd-component>
oscd-component.stories.ts:import './oscd-component.js';
oscd-component.stories.ts:  component: 'oscd-component',
oscd-component.stories.ts:  <oscd-component
oscd-component.stories.ts:    style="--oscd-component-text-color: ${textColor || 'black'}"
oscd-component.stories.ts:  </oscd-component>
oscd-component.spec.ts:import './oscd-component.js';
oscd-component.spec.ts:import type { OscdComponent } from './oscd-component.js';
oscd-component.spec.ts:      html`<oscd-component></oscd-component>`
oscd-component.spec.ts:      html`<oscd-component></oscd-component>`
oscd-component.spec.ts:      html`<oscd-component title="attribute title"></oscd-component>`
oscd-component.spec.ts:      html`<oscd-component></oscd-component>`
oscd-component.ts:@customElement('oscd-component')
oscd-component.ts:      color: var(--oscd-component-text-color, #000);
package.json:  "name": "oscd-component",
package.json:  "description": "Webcomponent oscd-component following open-wc recommendations",
package.json:  "main": "dist/oscd-component.js",
package.json:  "module": "dist/oscd-component.js",
package.json:    ".": "./dist/oscd-component.js"

In order to replace all instances of the string oscd-component in your repository at once, you can use a tool like git sed in order to execute a substitute expression on all files in the worktree:

git sed s/oscd-component/my-widget/g

Make sure to use a dash - in the new component name and to rename all files with names starting with oscd-component:

oscd-component.stories.ts
oscd-component.spec.ts
oscd-component.ts

This webcomponent follows the open-wc recommendation.

Installation

npm i oscd-component

Usage

<script type="module">
  import 'oscd-component';
</script>

<oscd-component></oscd-component>

Linting and formatting

To scan the project for linting and formatting errors, run

npm run lint

To automatically fix linting and formatting errors, run

npm run format

Testing with Web Test Runner

To execute a single test run:

npm run test

To run the tests in interactive watch mode run:

npm run test:watch

Demoing with Storybook

To run a local instance of Storybook for your component, run

npm run storybook

To build a production version of Storybook, run

npm run storybook:build

Tooling configs

For most of the tools, the configuration is in the package.json to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.

Local Demo with web-dev-server

npm start

To run a local development server that serves the basic demo located in demo/index.html

oscd-component's People

Contributors

jakobvogelsang avatar

Watchers

 avatar

oscd-component's Issues

Update README

As a template user I would like to get a heads up about the fact that web-test-runner uses the /dist folder to generate screenshot tests. So if I'm ever in the situation of updating a whole component/file's name I should make sure to delete the /dist folder before running the test:update script

Restructure template component

Some things need to change in order to succesfully use the template:

  • Releaseplease action needs to:
    • Include build
    • Change publish to publish --access public
    • For deployment, credentials need to be set
  • Folder structure is needed
    • demo/src/stories/test
  • .eslintrc file needs to be added
  • .npmignore file needs to be added
  • "skipLibCheck": true needs to be added to tsconfig.json

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.