Skip to content

Commit 4b707fa

Browse files
committed
Add github workflows and tests
1 parent a293549 commit 4b707fa

File tree

9 files changed

+280
-1
lines changed

9 files changed

+280
-1
lines changed

.github/release-drafter.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name-template: 'v$RESOLVED_VERSION 🦑'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
label: 'chore'
15+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
17+
version-resolver:
18+
major:
19+
labels:
20+
- 'major'
21+
minor:
22+
labels:
23+
- 'minor'
24+
patch:
25+
labels:
26+
- 'patch'
27+
default: patch
28+
template: |
29+
## Changes
30+
31+
$CHANGES

.github/workflows/main.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ci:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: install
12+
run: npm ci
13+
- name: test
14+
run: npm test
15+
- name: build
16+
run: npm run build
17+
- name: package
18+
run: npm run package
19+
- uses: actions/upload-artifact@v2
20+
with:
21+
name: vscode-tree-extension
22+
path: '*.vsix'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- master
8+
9+
jobs:
10+
update_release_draft:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# (Optional) GitHub Enterprise requires GHE_HOST variable set
14+
#- name: Set GHE_HOST
15+
# run: |
16+
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
17+
18+
# Drafts your next Release notes as Pull Requests are merged into "master"
19+
- uses: release-drafter/release-drafter@v5
20+
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
21+
with:
22+
config-name: release-drafter.yaml
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Deploy Extension
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [released]
7+
8+
9+
jobs:
10+
cd:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v1
15+
with:
16+
node-version: 14
17+
- run: npm ci
18+
- run: npm run build
19+
- run: npm publish --access public
20+
env:
21+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@structure-codes/utils",
3-
"version": "1.1.2",
3+
"version": "0.0.1",
44
"description": "A library to test if a filename is considered a to be a standard non-dotted dotfile",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

src/__tests__/tree.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { treeStringToJson } from "../treeStringToJson";
2+
import * as fs from "fs";
3+
import * as path from "path";
4+
5+
const dirPath = path.join(__dirname, "trees");
6+
const trees = fs.readdirSync(dirPath);
7+
trees.forEach((file) => {
8+
const treeString = fs.readFileSync(path.join(dirPath, file)).toString();
9+
test(`can read tree file: ${file}`, () => {
10+
const tree = treeStringToJson(treeString);
11+
expect(typeof tree).toBe("object");
12+
// Sample excerpt of object being used in testing
13+
// tree = {
14+
// "functions": {
15+
// "index": "2342fdsedf32",
16+
// },
17+
// "src": {
18+
// "index": "2342fdsedf32",
19+
// },
20+
// "static": {
21+
// "index": "2342fdsedf32",
22+
// },
23+
// };
24+
25+
// Number of parents
26+
const children: string[] = Object.keys(tree);
27+
expect(children.length).toBe(3);
28+
const lastChild: string = children[2];
29+
expect(lastChild).toBe("static");
30+
});
31+
});

src/__tests__/trees/tab-crlf.tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Be careful to keep this with CRLF line endings, if it gets messed up just unix2dos it
2+
###
3+
###
4+
├── functions
5+
├── src
6+
│ ├── articles
7+
│ ├── components
8+
│ │ ├── builder
9+
│ │ │ ├── center
10+
│ │ │ ├── left
11+
│ │ │ │ └── sections
12+
│ │ │ ├── lists
13+
│ │ │ └── right
14+
│ │ │ └── sections
15+
│ │ ├── dashboard
16+
│ │ ├── landing
17+
│ │ ├── router
18+
│ │ └── shared
19+
│ ├── constants
20+
│ ├── contexts
21+
│ ├── data
22+
│ ├── hooks
23+
│ ├── i18n
24+
│ │ └── locales
25+
│ ├── modals
26+
│ │ └── sections
27+
│ ├── pages
28+
│ │ ├── app
29+
│ │ └── r
30+
│ ├── styles
31+
│ ├── templates
32+
│ │ └── blocks
33+
│ │ ├── Awards
34+
│ │ ├── BirthDate
35+
│ │ ├── Certifications
36+
│ │ ├── Contact
37+
│ │ ├── Education
38+
│ │ ├── Heading
39+
│ │ ├── Hobbies
40+
│ │ ├── Languages
41+
│ │ ├── Objective
42+
│ │ ├── Projects
43+
│ │ ├── References
44+
│ │ ├── Skills
45+
│ │ └── Work
46+
│ └── utils
47+
└── static
48+
└── images
49+
├── screenshots
50+
└── templates

src/__tests__/trees/tab-lf.tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//
2+
//
3+
//
4+
├── functions
5+
├── src
6+
│ ├── articles
7+
│ ├── components
8+
│ │ ├── builder
9+
│ │ │ ├── center
10+
│ │ │ ├── left
11+
│ │ │ │ └── sections-asdf //sdfa
12+
│ │ │ ├── lists.sdf
13+
│ │ │ └── right
14+
│ │ │ └── sections
15+
│ │ ├── dashboard
16+
│ │ ├── landing
17+
│ │ ├── router
18+
│ │ └── shared
19+
│ ├── constants
20+
│ ├── contexts
21+
│ ├── data
22+
│ ├── hooks
23+
│ ├── i18n
24+
│ │ └── locales
25+
│ ├── modals
26+
│ │ └── sections
27+
│ ├── pages
28+
│ │ ├── app
29+
│ │ └── r
30+
│ ├── styles
31+
│ ├── templates
32+
│ │ └── blocks
33+
│ │ ├── Awards
34+
│ │ ├── BirthDate
35+
│ │ ├── Certifications
36+
│ │ ├── Contact
37+
│ │ ├── Education
38+
│ │ ├── Heading
39+
│ │ ├── Hobbies
40+
│ │ ├── Languages
41+
│ │ ├── Objective
42+
│ │ ├── Projects
43+
│ │ ├── References
44+
│ │ ├── Skills
45+
│ │ └── Work
46+
│ └── utils
47+
└── static
48+
└── images
49+
├── screenshots
50+
└── templates
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
##
2+
###
3+
###
4+
├── functions
5+
├── src
6+
│ ├── articles
7+
│ ├── components
8+
│ │ ├── builder
9+
│ │ │ ├── center
10+
│ │ │ ├── left
11+
│ │ │ │ └── sections
12+
│ │ │ ├── lists
13+
│ │ │ └── right
14+
│ │ │ └── sections
15+
│ │ ├── dashboard
16+
│ │ ├── landing
17+
│ │ ├── router
18+
│ │ └── shared
19+
│ ├── constants
20+
│ ├── contexts
21+
│ ├── data
22+
│ ├── hooks
23+
│ ├── i18n
24+
│ │ └── locales
25+
│ ├── modals
26+
│ │ └── sections
27+
│ ├── pages
28+
│ │ ├── app
29+
│ │ └── r
30+
│ ├── styles
31+
│ ├── templates
32+
│ │ └── blocks
33+
│ │ ├── Awards
34+
│ │ ├── BirthDate
35+
│ │ ├── Certifications
36+
│ │ ├── Contact
37+
│ │ ├── Education
38+
│ │ ├── Heading
39+
│ │ ├── Hobbies
40+
│ │ ├── Languages
41+
│ │ ├── Objective
42+
│ │ ├── Projects
43+
│ │ ├── References
44+
│ │ ├── Skills
45+
│ │ └── Work
46+
│ └── utils
47+
└── static
48+
└── images
49+
├── screenshots
50+
└── templates

0 commit comments

Comments
 (0)