Skip to content

Commit 1715c83

Browse files
authored
WEBDEV-7210: Update dev dependencies (#81)
* Update dev dependencies * Dev dep updates * Update deps * Update readme * Update CI scripts
1 parent dab07c8 commit 1715c83

13 files changed

+11521
-5708
lines changed

.github/workflows/ci.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-node@v4
16+
with:
17+
node-version: latest
1618

1719
- name: Install dependencies
18-
run: yarn install
20+
run: npm install
1921

2022
- name: Run tests
21-
run: yarn run test
23+
run: npm run test
2224

2325
- uses: codecov/codecov-action@v5
2426
with:

.github/workflows/gh-pages-main.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ jobs:
1717
with:
1818
persist-credentials: false
1919
- uses: actions/setup-node@v4
20+
with:
21+
node-version: latest
22+
2023

2124
- name: Install dependencies
22-
run: yarn install
23-
25+
run: npm install
26+
2427
- name: Create build files for gh-pages deploy
25-
run: yarn ghpages:build
28+
run: npm run ghpages:build
2629

2730
# Reference: https://github.com/JamesIves/github-pages-deploy-action
2831
- name: Deploy 🚀

.github/workflows/pr-preview.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ jobs:
2323
- name: Checkout
2424
uses: actions/checkout@v4
2525
- uses: actions/setup-node@v4
26+
with:
27+
node-version: latest
28+
2629

2730
- name: Install and Build
2831
run: |
29-
yarn install
30-
yarn ghpages:build
32+
npm install
33+
npm run ghpages:build
3134
3235
# Reference: https://github.com/rossjrw/pr-preview-action
3336
- name: Deploy preview
@@ -38,7 +41,7 @@ jobs:
3841
umbrella-dir: pr
3942
preview-branch: ${{ env.PREVIEW_BRANCH }}
4043
comment: false
41-
44+
4245
- uses: marocchino/sticky-pull-request-comment@v2
4346
if: steps.preview-step.outputs.deployment-action == 'deploy'
4447
with:
@@ -48,7 +51,7 @@ jobs:
4851
:---:
4952
| <p></p> :rocket: View preview at <br> ${{ steps.preview-step.outputs.preview-url }}demo/ <br><br>
5053
| <h6>Built to branch [`${{ env.PREVIEW_BRANCH }}`](${{ github.server_url }}/${{ github.repository }}/tree/${{ env.PREVIEW_BRANCH }}) at ${{ steps.preview-step.outputs.action-start-time }}. <br> Preview will be ready when the [GitHub Pages deployment](${{ github.server_url }}/${{ github.repository }}/deployments) is complete. <br><br> </h6>
51-
54+
5255
- uses: marocchino/sticky-pull-request-comment@v2
5356
if: steps.preview-step.outputs.deployment-action == 'remove'
5457
with:

.gitignore

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
/node_modules/
1414
/npm-debug.log
1515

16-
## testing
17-
/coverage/
18-
1916
## temp folders
2017
/.tmp/
2118

@@ -35,5 +32,4 @@ storybook-static
3532
logs
3633
*.log
3734
npm-debug.log*
38-
yarn-debug.log*
39-
yarn-error.log*
35+
npm-error.log*

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
coverage

README.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ This is a base template for creating Typescript WebComponents. It is based off o
2020

2121
## Local Demo with `web-dev-server`
2222
```bash
23-
yarn start
23+
npm run start
2424
```
2525
To run a local development server that serves the basic demo located in `demo/index.html`
2626

2727
## Testing with Web Test Runner
2828
To run the suite of Web Test Runner tests, run
2929
```bash
30-
yarn run test
30+
npm run test
3131
```
3232

3333
To run the tests in watch mode (for &lt;abbr title=&#34;test driven development&#34;&gt;TDD&lt;/abbr&gt;, for example), run
3434

3535
```bash
36-
yarn run test:watch
36+
npm run test:watch
3737
```
3838

3939
## Releasing alpha and production tagged packages to NPM
@@ -42,12 +42,12 @@ yarn run test:watch
4242
- run: **`npm version prerelease --preid=wedev-1234`**
4343
- this command will help auto-increment your alpha package tags inside your jira ticket namespace. refer to [npm versioning docs](https://docs.npmjs.com/cli/v11/commands/npm-version) & [guides for more info on command options](- this command will help auto-increment your alpha package tags inside your jira ticket namespace)
4444
- run: **`npm publish --tag alpha`** our most used development tags are: alpha, canary
45-
45+
4646
### Releasing production level package
4747
We like to create a pull request specifically after the expected changes are merged into the main branch.
4848
Steps:
4949
- create PR with version number as branch name. Ex, if the next version is 3.2.1, your git command will be: `git checkout -b v3.2.1`
50-
- in the new branch, run the following:
50+
- in the new branch, run the following:
5151
1. **`git pull --tags`** to fetch all git tags
5252
2. **`npm version X.X.X`** to set the new tag WITH the commit git tagged
5353
3. **`git push --tags`**
@@ -57,28 +57,28 @@ Steps:
5757
## Linting with ESLint, Prettier, and Types
5858
To scan the project for linting errors, run
5959
```bash
60-
yarn run lint
60+
npm run lint
6161
```
6262

6363
You can lint with ESLint and Prettier individually as well
6464
```bash
65-
yarn run lint:eslint
65+
npm run lint:eslint
6666
```
6767
```bash
68-
yarn run lint:prettier
68+
npm run lint:prettier
6969
```
7070

7171
To automatically fix many linting errors, run
7272
```bash
73-
yarn run format
73+
npm run format
7474
```
7575

7676
You can format using ESLint and Prettier individually as well
7777
```bash
78-
yarn run format:eslint
78+
npm run format:eslint
7979
```
8080
```bash
81-
yarn run format:prettier
81+
npm run format:prettier
8282
```
8383

8484
## Tooling configs
@@ -119,9 +119,9 @@ git commit --allow-empty -m "Initializing gh-pages branch"
119119
git push origin gh-pages
120120
```
121121

122-
### Additional setup
122+
### Additional setup
123123

124-
- Go to repo `Settings` -> sidebar `Pages`
124+
- Go to repo `Settings` -> sidebar `Pages`
125125
- In the `Source` drop-down, choose the branch where you want to host your Github Pages and the `directory` where it was hosted
126126
- We'll use `gh-pages` branch for this but you can use other branch name for this
127127
- Just make sure that's the branch where the `index.html` that you want to host lives in
@@ -134,17 +134,17 @@ git push origin gh-pages
134134

135135
You can update the current Github Page without pushing a commit by running:
136136
```
137-
yarn run ghpages:publish
137+
npm run ghpages:publish
138138
```
139139

140140
This build script does the following, see `package.json`:
141-
- `ghpages:publish`
141+
- `ghpages:publish`
142142
- This executes `ghpages:prepare` in the current branch you are currently working on
143-
- Note: The branch name is required so that it will not override the whole Github Pages directory
143+
- Note: The branch name is required so that it will not override the whole Github Pages directory
144144
- You can check it by navigating through the branch name files directory you set from the [step to setup `gh-pages` branch](#steps-to-setup-gh-pages)
145145
- You can checkout how it looks like in one of our projects here: [https://github.com/internetarchive/iaux-collection-browser/tree/gh-pages](https://github.com/internetarchive/iaux-collection-browser/tree/gh-pages)
146-
147-
- `ghpages:prepare`
146+
147+
- `ghpages:prepare`
148148
- This executes `ghpages:build` that builds the project dependencies and generates `vite` build from it
149149
- We use [vite](https://vitejs.dev/) to bundle and generate the static assets that we host in Github Pages
150150
- See `vite.config.ts` related to this
@@ -155,7 +155,7 @@ This build script does the following, see `package.json`:
155155
- This generates a commit message formatted from the most recent commit message of the branch
156156
- Push the commit to `gh-pages` branch that we setup earlier
157157

158-
The live demo app URL from current branch will look something like this:
158+
The live demo app URL from current branch will look something like this:
159159
`https://<organization_name_or_username>.github.io/<repo_name>/<branch_name>/demo`
160160

161161
## Automatic Deploy of Demo App
@@ -168,11 +168,11 @@ Things that trigger automatic site generation:
168168
- a pull request against `main`
169169
- See workflow: `pr-preview.yml`
170170
- The URL for your Pull Request will be deleted after merging to main but you can update that in the config
171-
- When you create a Pull Request, if your code passes codecov unit tests, it will be always served live at base URL/pull request number.
171+
- When you create a Pull Request, if your code passes codecov unit tests, it will be always served live at base URL/pull request number.
172172
- Example: `https://<organization_name_or_username>.github.io/<repo_name>/pr/<pr-number>/demo`
173173
- Note that `demo` is another directory where the `index.html` lives in
174174
- You are free to playaround with it and set your desired file directory/structure on your end
175175

176-
Another thing to note: pushing a branch up alone will not trigger site creation.
176+
Another thing to note: pushing a branch up alone will not trigger site creation.
177177

178-
Happy devving ^_^ 🥳 🎉
178+
Happy devving ^_^ 🥳 🎉

coverage/.placeholder

Whitespace-only changes.

eslint.config.mjs

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
2+
import html from 'eslint-plugin-html';
3+
import tsParser from '@typescript-eslint/parser';
4+
import path from 'node:path';
5+
import { fileURLToPath } from 'node:url';
6+
import js from '@eslint/js';
7+
import { FlatCompat } from '@eslint/eslintrc';
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all,
15+
});
16+
17+
export default [
18+
...compat.extends('plugin:@typescript-eslint/recommended'),
19+
{
20+
plugins: {
21+
'@typescript-eslint': typescriptEslint,
22+
html,
23+
},
24+
25+
languageOptions: {
26+
parser: tsParser,
27+
},
28+
29+
settings: {
30+
'import/resolver': {
31+
node: {
32+
extensions: ['.ts', '.tsx'],
33+
moduleDirectory: ['node_modules', 'src', 'demo'],
34+
},
35+
},
36+
},
37+
38+
rules: {
39+
'@typescript-eslint/no-unsafe-function-type': 'warn',
40+
'@typescript-eslint/no-unused-vars': 'warn',
41+
'@typescript-eslint/no-explicit-any': 'warn',
42+
},
43+
},
44+
{
45+
ignores: ['**/*.js', '**/*.mjs'],
46+
},
47+
{
48+
files: ['**/*.test.ts'],
49+
rules: {
50+
'@typescript-eslint/no-unused-expressions': 'off',
51+
},
52+
},
53+
];

0 commit comments

Comments
 (0)