|
1 | | -# A template repository for TypeScript and Components.js |
2 | | - |
3 | | -This repository can help you get started with a new TypeScript project |
4 | | -which generates Components.js components for its classes. |
5 | | - |
6 | | -It has support for testing, linting, pre-commit checks, CI, releasing new versions, and keeping dependencies up to date. |
7 | | -Each of these will be explained below. |
8 | | - |
9 | | -## DO THIS FIRST |
10 | | - |
11 | | -* Add a `name` field to the `package.json` |
12 | | -* In the `package.json`, replace `$PACKAGE_NAME` with the name chosen in the previous step. |
13 | | -* Add a `repository` to the `package.json`. This is not strictly required, |
14 | | - but otherwise the generated `CHANGELOG.md` will not contain links. |
15 | | -* (Optional) Add a `description` to the `package.json`. |
16 | | -* (Optional) Add the `-r` parameter to the `build:components` script. |
17 | | - This determines the prefix that will be used for paths generated by the Components.js generator, |
18 | | - otherwise this is determined automatically based on your package name. |
19 | | -* (Optional) Replace this README with your own and add some fancy [badges](https://shields.io/badges/npm-version). |
20 | | - |
21 | | -## Testing |
22 | | - |
23 | | -The repo uses `jest` for testing. |
24 | | -Tests are expected in the following format: `/test/(unit|integration)/.*\.test\.ts$`, |
25 | | -so your tests need to end on `.test.ts` and should be in (a subfolder of) `test/unit` or `test/integration`. |
26 | | -This can be changed in `jest.config.js`. |
27 | | - |
28 | | -Note that the `test` folder has its own tsconfig.json. |
29 | | -This is necessary to make sure those files are not built but are covered by the linter. |
30 | | - |
31 | | -Coverage will be generated when testing, |
32 | | -but no coverage restrictions are set. |
33 | | -If you want to ensure 100% code coverage, |
34 | | -add the following to your `jest.config.js`: |
35 | | - |
36 | | -```text |
37 | | -coverageThreshold: { |
38 | | - './src': { |
39 | | - branches: 100, |
40 | | - functions: 100, |
41 | | - lines: 100, |
42 | | - statements: 100, |
43 | | - } |
44 | | -``` |
45 | | - |
46 | | -## Linting |
47 | | - |
48 | | -Linting is done using [opinionated-eslint-config](https://github.com/joachimvh/opinionated-eslint-config). |
49 | | -See the documentation there if you want to make changes. |
50 | | - |
51 | | -Besides that, there is also markdown linting which is defined by the settings in `.markdownlint-cli2.cjs`. |
52 | | -The `.github` folder has its own settings for markdown linting to prevent issues with the templates discussed below. |
53 | | - |
54 | | -## Committing |
55 | | - |
56 | | -Before committing, the build, lint, and test scripts will be run. |
57 | | - |
58 | | -Commit messages are expected to be in the [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) format. |
59 | | -Unfortunately this can only be checked automatically after the pre-commit checks, |
60 | | -so make sure you have it right the first time. |
61 | | -The rules for this are specified in `commitlint.config.js`. |
62 | | - |
63 | | -## Continuous Integration |
64 | | - |
65 | | -`.github/workflows/test.yml` contains a GitHub CI file that will trigger linting and testing for PRs and new commits. |
66 | | - |
67 | | -## Releasing |
68 | | - |
69 | | -To release a new version, run `npm run release -- -r major/minor/patch`, |
70 | | -with `major`, `minor`, or `patch` chosen based on [Semantic Versioning](https://semver.org/). |
71 | | -This will create, or update, `CHANGELOG.md` based on the commits since the previous release, |
72 | | -and tag the release. |
73 | | -In the case of a major release, |
74 | | -it will also update the context entries of all Components.js configurations in the `config` folder, |
75 | | -and update the necessary Components.js fields in the `package.json`. |
76 | | -After this you still have to manually push the commit and tag to GitHub. |
77 | | - |
78 | | -The format of the changelog is defined in `.versionrc.json`. |
79 | | - |
80 | | -You can do an alpha release using, for example, `npm run release -- -r major --prerelease alpha`. |
81 | | - |
82 | | -You can do a dry-run to see the results by adding the `--dry-run` option. |
83 | | - |
84 | | -If you want to update the contexts of Components.js configurations in other folders than `config`, |
85 | | -you will need to add those in `scripts/upgradeConfig.ts`. |
86 | | - |
87 | | -## GitHub |
88 | | - |
89 | | -Templates are included for PRs and new issues. |
90 | | - |
91 | | -If you want to add issue templates, this can be done in `.github/ISSUE_TEMPLATE`. |
92 | | - |
93 | | -If you want users to only be able to use those templates, |
94 | | -create `.github/ISSUE_TEMPLATE/config.yml` and add `blank_issues_enabled: false`. |
95 | | - |
96 | | -If you enable discussions, you can direct uses there when creating a new issue |
97 | | -by adding the following to the same `.github/ISSUE_TEMPLATE/config.yml`: |
98 | | - |
99 | | -```yaml |
100 | | -contact_links: |
101 | | - - name: ❓ Question |
102 | | - url: https://github.com/$MY_ORG/$MY_REPO/discussions/new/choose |
103 | | - about: A question or discussion about the project |
104 | | -``` |
105 | | -
|
106 | | -## Dependabot |
107 | | -
|
108 | | -A Dependabot config is included in `.github/dependabot.yml` |
109 | | -to get notified when new major releases of libraries get released. |
110 | | -You still have to manually add Dependabot to your repository |
111 | | -as described [here](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide). |
112 | | -If you also want to be notified of minor/patch releases you will have to update the configuration. |
113 | | - |
114 | | -## Removing Components.js |
115 | | - |
116 | | -This template is made for repositories that want to support Components.js, |
117 | | -but in case you do not want to do that, this can be removed with the following steps: |
118 | | - |
119 | | -* In `package.json` |
120 | | - * Remove all fields starting with `lsd:`. |
121 | | - * Change the `build` script to only perform the steps of `build:ts` and remove `build:components`. |
122 | | - * Remove the `componentsjs-generator` dependency. |
123 | | - * In the `commit-and-tag-version` settings, remove the `postbump` step. |
124 | | -* Remove the `config/dummy.json`, `scripts/upgradeConfig.ts`, and `.componentsignore` files. |
| 1 | +# RDF Vocabulary |
0 commit comments