-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateBlock.sh
44 lines (37 loc) · 1.01 KB
/
createBlock.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FILE_NAME=$(tr '[:upper:]' '[:lower:]'<<<${1})
CAPITALIZE_FILE_NAME="$(tr '[:lower:]' '[:upper:]' <<<"${FILE_NAME:0:1}")${FILE_NAME:1}"
COMPONENT_DIRECTORY="./design-system/src/components/${FILE_NAME}"
# Create a component folder
mkdir -p "$COMPONENT_DIRECTORY";
# Create a component
cat > "${COMPONENT_DIRECTORY}/${FILE_NAME}.tsx" << EOF
import { Component } from '@stencil/core';
@Component({
tag: 'wz-${FILE_NAME}',
styleUrl: '${FILE_NAME}.scss',
shadow: false,
})
export class ${CAPITALIZE_FILE_NAME} {
render() {
return (
<div>
</div>
);
}
}
EOF
# Create a e2e test file
cat > "${COMPONENT_DIRECTORY}/${FILE_NAME}.e2e.ts" << EOF
import { newE2EPage } from '@stencil/core/testing';
describe('wz-${FILE_NAME}', () => {
it('should render a wz-${FILE_NAME} component', async () => {
const page = await newE2EPage();
await page.setContent('<wz-${FILE_NAME}></wz-${FILE_NAME}>');
});
});
EOF
# Create a css file
cat > "${COMPONENT_DIRECTORY}/${FILE_NAME}.scss" << EOF
wz-${FILE_NAME}{
}
EOF