Passed
Push — main ( 006f41...5dc5e5 )
by Andrii
02:46
created

__typing__/produce.ts   A

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 24
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 20
mnd 1
bc 1
fnc 1
dl 0
loc 24
bpm 1
cpm 2
noi 0
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A produce.ts ➔ produce 0 9 2
1
import postcss from "postcss"
2
//@ts-expect-error
3
import postcssDTs = require("postcss-d-ts")
4
import {readFileSync} from "fs"
5
6
const producer = postcss([postcssDTs()])
7
8
produce([
9
  "bootstrap3/dist/css/bootstrap.css",
10
  "bootstrap4/dist/css/bootstrap.css",
11
  "material10/dist/material-components-web.css"
12
])
13
14
async function produce(sources: string[]) {
15
  for (let i = sources.length; i--;) {
16
    const p = sources[i]
17
    , name = p.replace(/\/.*$/, "")
18
    , path = require.resolve(p)
19
  
20
    await producer.process(readFileSync(path).toString(), {
21
      from: `${__dirname}/${name}.css`
22
    })  
23
  }
24
}