# fl-stencil-cli

> This project is a CLI to create your own **web-components library / website** project using [Web-Components](http

Latest version **1.0.2-8** (published 2020-08-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install fl-stencil-cli
pnpm add fl-stencil-cli
yarn add fl-stencil-cli
bun add fl-stencil-cli
```

Provides the command `flcli`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2-8 |
| Published | 2020-08-13 |
| First published | 2019-11-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 352.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Flowrome |
| Maintainers | flowrome |
| Keywords | web components, stencil, web app, custom elements, components, typescript, es6, node, cli, pwa, progressive web app |

## Links

- npm: https://www.npmjs.com/package/fl-stencil-cli
- Repository: https://github.com/Flowrome/fl-cli
- Homepage: https://github.com/Flowrome/fl-cli#readme
- Issues: https://github.com/Flowrome/fl-cli/issues
- npm.io page: https://npm.io/package/fl-stencil-cli

## Dependencies (10)

- [ncp](https://npm.io/package/ncp.md) ^2.0.0
- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [husky](https://npm.io/package/husky.md) ^3.0.8
- [lodash](https://npm.io/package/lodash.md) ^4.17.14
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.0
- [prompts](https://npm.io/package/prompts.md) ^2.2.1
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.3
- [prettier](https://npm.io/package/prettier.md) ^1.18.2
- [cli-spinner](https://npm.io/package/cli-spinner.md) ^0.2.10
- [get-installed-path](https://npm.io/package/get-installed-path.md) ^4.0.8

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.2-8 (latest) — 2020-08-13
- 1.0.2-7 — 2020-06-12
- 1.0.2-6 — 2020-06-06
- 1.0.2-5 — 2020-06-06
- 1.0.2-4 — 2020-06-06
- 1.0.2-3 — 2020-06-05
- 1.0.2-2 — 2020-06-05
- 1.0.2-1 — 2020-06-04
- 1.0.2 — 2020-06-04
- 1.0.1-15 — 2020-04-15
- 1.0.1-14 — 2020-03-05
- 1.0.1-12 — 2020-01-21
- 1.0.1-11 — 2020-01-04
- 1.0.1-10 — 2019-12-12
- 1.0.1-9 — 2019-11-21
- … 6 more at https://npm.io/package/fl-stencil-cli/versions

## README

# FLOWROME STENCIL CLI

<a href="https://github.com/Flowrome"><img src="./images/logo-bw-little.png" align="left" hspace="" vspace="" style="margin-right: 10px"></a> This project is a CLI to create your own **web-components library / website** project using [Web-Components](https://www.webcomponents.org/), [Stencil](https://stenciljs.com/), [Stencil/router](https://github.com/ionic-team/stencil-router) , [SCSS](https://sass-lang.com/), [Typescript](https://www.typescriptlang.org/) and [JSX](https://it.reactjs.org/docs/introducing-jsx.html).<br><br><br><br>

## INSTALLATION

```
npm i fl-stencil-cli -g
```

## USAGE

- **TO CREATE PROJECT SCAFFOLD**:
  - ```
      flcli project [PROJECT_NAME]
    ```
- **TO CREATE A PAGE (you need to be inside a fl-project)**:
  - ```
      flcli page [PAGE_NAME]
    ```
- **TO CREATE A MOLECULE (you need to be inside a fl-project)**:
  - ```
      flcli molecule [MOLECULE_NAME]
    ```

## SCAFFOLD STRUCTURE

```bash
|-- app-name
    |-- .editorconfig
    |-- .gitignore
    |-- .prettierrc
    |-- LICENSE
    |-- directoryList.md
    |-- fl-stencil-config.json
    |-- fl-stencil-env-chooser.js
    |-- fl-stencil-md-reader.js
    |-- package-lock.json
    |-- package.json
    |-- readme.md
    |-- stencil.config.ts
    |-- tsconfig.json
    |-- tslint.json
    |-- .stencil
        |-- ... // STENCIL CACHE
    |-- dist
        |-- ... // FOLDER THAT CONTAINS THE BUILDED WEB COMPONENTS
    |-- node_modules
        |-- ...
    |-- loader
        |-- cdn.js
        |-- index.cjs.js
        |-- index.d.ts
        |-- index.es2017.mjs
        |-- index.mjs
        |-- node-main.js
        |-- package.json
    |-- src
        |-- components.d.ts
        |-- index.html
        |-- index.ts
        |-- assets
            |-- fonts
                |-- raleway_thin-webfont.eot
                |-- raleway_thin-webfont.ttf
                |-- raleway_thin-webfont.woff
                |-- ...
            |-- images
                |-- logo-bw-little.png
                |-- ...
            |-- mocks
                |-- readmes.json
                |-- ...
        |-- components
            |-- app
                |-- app.e2e.ts
                |-- app.scss
                |-- app.spec.ts
                |-- app.tsx
                |-- readme.md
            |-- markdown-reader
                |-- markdown-reader.e2e.ts
                |-- markdown-reader.scss
                |-- markdown-reader.spec.ts
                |-- markdown-reader.tsx
                |-- readme.md
            |-- molecules
                |-- fl-test.molecule
                    |-- fl-test.molecule.e2e.ts
                    |-- fl-test.molecule.scss
                    |-- fl-test.molecule.spec.ts
                    |-- fl-test.molecule.tsx
                |-- ...
            |-- page
                |-- test.page
                    |-- test.page.e2e.ts
                    |-- test.page.scss
                    |-- test.page.spec.ts
                    |-- test.page.tsx
                |-- welcome.page
                    |-- readme.md
                    |-- welcome.page.e2e.ts
                    |-- welcome.page.scss
                    |-- welcome.page.spec.ts
                    |-- welcome.page.tsx
                |-- ...
        |-- envs
            |-- env.dev.ts
            |-- env.prod.ts
            |-- env.ts
        |-- styles
            |-- _common.scss
            |-- _fonts-face.scss
            |-- _functions.scss
            |-- _layout.scss
            |-- _local-styles.scss
            |-- _mixins.scss
            |-- _reset.scss
            |-- _styles.scss
            |-- _themes.scss
            |-- _variables.scss
        |-- utils
            |-- ...
    |-- www
        |-- ... // FOLDER THAT CONTAINS THE WEBSITE

```

## COMPONENTS

Initial components generated by the cli are:

- **APP**: App starter component, it contains the Routing structure of your application and it's the component you need to include inside the **index.html** file.
- **MARKDOWN-READER**: This component is needed to visualize the readme of the molecule/page, its route is

```
../md-reader?id=[FILE_NAME_OF_COMPONENT]
```

You can also create those components type:

- **PAGES**: Pages are the main components of the application, they contain the semantically correct structure you should have in the HTML for a page: **body -> header, body -> main -> section**. Those components can be generated using

```node
    flcli page page-name
```

- **MOLECULES**: Those are the standalone components that will accept **@Props and @Events**, they shouldn't have the main logic but they should output someething readable by the father. They have this nomenclature [PREFIX_YOU_CHOOSED_AT_START]-[NAME]-molecule. Those components can be generated using

```node
    flcli molecule molecule-name
```

## SCRIPTS

Those are the scripts available inside the project:

- **`npm start`**: this script start the app in his localhost (starting at **localhost:3333**) and it could be used with this modifier: **env=envName** to choose inside the envs folder which env is used while starting the app.
  You can use those evolution:

```node
    npm run start-dev /* equivalent of npm start env=dev */
    npm run start-prod /* equivalent of npm start env=prod */
```

- **`npm run build`**: this script build your components in the distribution folder (**./dist**), it could be used with this modifier: **env=envName** to choose inside the envs folder which env is used while starting the app.
  You can use those evolution:

```node
    npm run build-dev /* equivalent of npm run start-dev compile */
    npm run build-prod /* equivalent of npm run start-prod compile */
```

- **`npm run readme`**: This script compile the auto-readme of your components keeping the precedent one you already wrote. to recompile the default readme just delete the current one and run this script

## ENVIRONMENTS

You can use every environm ent you want, just create an env file inside **./src/envs** folder with this nomenclature `env.**[ENV_NAME]**.ts`. You can access to the file importing:

```js
import { Environment } from '@env';
```

after that remember to launch the start or build script with:

```node
npm run start/build env=[ENV_NAME]
```

## STORYBOOK

Storybook is implemented by default, you can write your own stories inside each molecule, they should keep the suffix `*.stories.js`.
By default only the molecule folder is red, you can change it by modifying the `stories-compiler.js` file by adding your own patterns:

```js
const patterns = [
  `${__dirname}${pathDivider}..${pathDivider}src${pathDivider}components${pathDivider}molecules${pathDivider}**${pathDivider}*.stories.js`,
];
```

To launch storybook you have to run these two scripts (in two instances of terminal):

- `npm run build-for-storybook`
- `npm run storybook`

You can wrap the using [concurrently](https://www.npmjs.com/package/concurrently)
Stencil can use only Storybook for HTML version, so you won't write in JSX but you will write in plain JS.

To center your items in Storybook preview you can use the decorator `centered` inside `.storybook/decorators/centered.js`:

```js
import { centered } from 'path/to/.storybook/decorators/centered'

export default {
  title: 'MyMoleculeName',
  decorators: [..., centered],
  includeStories: ['MyMoleculeNameStory'],
  parameters: {
    notes: {
      markdown: readme
    }
  }
};
```

## DISTRIBUTION (aka dist)

Inside **`dist`** folder you have your minified components for your ui-library (ready to publish on npm), build with `npm run build/build-[ENV]`.

## PARALLEL BUILDS (aka builds/[BUILD-NAME])

Inside **`builds/[BUILD-NAME]`** folder you will find the parallel builds you defined inside the `fl-stencil-config.json` to have the builds (ready to be published inside npm) you should run `npm run build-prod-dupes`, you can configure the builds you want inside the configuration JSON, these builds let you create differents package of your application removing components/folder or modifying files in your current project. Use the templates folder to re/write a file for your different builds.

## PUBLISHING (aka www)

Inside **`www`** folder you have your minified website ready for production, build with `npm run build/build-[ENV]`.

## TESTING

You can use the **Unit** or **e2e** as [Stencil](https://stenciljs.com/docs/testing-overview) allows. the **.spec** and **.e2e** files are automatically generated by the flcli scripts, obviusly you can edit them as you want, at the start of the project you can choose which one to include.

## THANKS TO

- [Web-Components](https://www.webcomponents.org/)
- [Stencil](https://stenciljs.com/)
- [Stencil/router](https://github.com/ionic-team/stencil-router)
- [SCSS](https://sass-lang.com/)
- [Typescript](https://www.typescriptlang.org/)
- [JSX](https://it.reactjs.org/docs/introducing-jsx.html).

## CONTACT ME

If you have any question about the project please contact me at:

- [email](mailto:romeonupieri@gmail.com): Please include in the subject [FLCLI]
- [telegram](https://t.me/Flowrome)

## FOLLOW ME

Discover latest updates through my Telegram channel:

- [FLCLI](https://t.me/flstencilcli)

---
_Source: https://npm.io/package/fl-stencil-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
