GithubHelp home page GithubHelp logo

luisreinoso / ng-filename-parser Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 299 KB

Angular file name convention parser

Home Page: https://www.npmjs.com/package/ng-filename-parser

License: MIT License

JavaScript 2.14% TypeScript 97.86%
angular parser typescript

ng-filename-parser's Introduction

ng filename parser

Angular file name convention parser

src/                                    project source code
|- app/
|  |- user/                             user module
|  |- components/                       dummy components
|  |  |- menu/
|  |  |  |- menu.component.html
|  |  |  |- menu.component.scss
|  |  |  |- menu.component.spec.ts
|  |  |  |- menu.component.ts
|  |  |  |- menu.stories.ts
|  |- pages/                            smart components
|  |  |- dashboard/
|  |  |  |- dashboard.page.html
|  |  |  |- dashboard.page.scss
|  |  |  |- dashboard.page.spec.ts
|  |  |  |- dashboard.page.stories.ts   also support dashboard.stories.ts
|  |  |  |- dashboard.page.ts
|  +- ...

Installation

npm install --save ng-filename-parser

Usage

Import required helper function.

import {
  getNgFilenameTokens,
  getStyleFile,
  getHtmlFile,
  getSpecFile,
  getTypescriptFile,
  getStorybookFile,
} from 'ng-filename-parser'

getNgFilenameTokens

Pass as argument the angular project filename to tokenizer to getNgFilenameTokens

const filename = '/home/angular/project/src/app/app.component.ts'
const tokens = getNgFilenameTokens(filename)

This will return:

{
  component: 'app',
  type: ['component']
}

getFiles functions

Based on filename tokens user could request filename of styles/ts/stories/spec files.

  • getStyleFile
  • getHtmlFile
  • getSpecFile
  • getTypescriptFile
  • getStorybookFile

Checkout testing files for more information.

Release

  • run npm run release

License

Luis Reinoso 2021 MIT License

ng-filename-parser's People

Contributors

luisreinoso avatar semantic-release-bot avatar

Watchers

 avatar  avatar

ng-filename-parser's Issues

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.