Skip to content

Commit d743cc6

Browse files
committed
update contributing doc
1 parent 5f8ed88 commit d743cc6

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,38 @@ cd apexcharts.js
3333
npx browser-sync start --server --files "." --directory --startPath "/samples"
3434
```
3535

36+
To test Content Security Policy (CSP) related features, you should use a specific configuration file. Run `browser-sync` with the `--config` flag:
37+
38+
```bash
39+
npx browser-sync start --config browser-sync-config.js
40+
```
41+
42+
This command uses the `browser-sync-config.js` file to set up the necessary `Content-Security-Policy` headers. Here is the content of the configuration file:
43+
44+
`browser-sync-config.js`
45+
46+
```js
47+
const TEST_NONCE =
48+
'47ebaa88ef82ffb86e4ccb0eab1c5ec6bd76767642358e8cf99487673d5904b5'
49+
50+
const cspPolicies = [`style-src 'self' 'nonce-${TEST_NONCE}'`]
51+
52+
module.exports = {
53+
server: {
54+
baseDir: '.',
55+
directory: true,
56+
},
57+
files: ['.'],
58+
startPath: '/samples',
59+
middleware: [
60+
function (req, res, next) {
61+
res.setHeader('Content-Security-Policy', cspPolicies.join('; '))
62+
next()
63+
},
64+
],
65+
}
66+
```
67+
3668
And start working on a feature or fix. Changes in source code should be immediately visible in the browser due to automatic reload on changes.
3769

3870
### Start a dependent new project
@@ -125,16 +157,4 @@ This way, when later working on a feature or fix, `npm run test` command will de
125157

126158
We'd love for you to contribute your changes back to `apexcharts.js`! To do that, it would be great if you could commit your changes to a separate feature branch and open a Pull Request for those changes.
127159

128-
Point your feature branch to use the `main` branch as the base of this PR. The exact commands used depends on how you've setup your local git copy, but the flow could look like this:
129-
130-
```sh
131-
# Inside your own copy of `apexcharts.js` package...
132-
git checkout --branch feature/branch-name-here upstream/main
133-
# Then hack away, and commit your changes:
134-
git add -A
135-
git commit -m "Few words about the changes I did"
136-
# Push your local changes back to your fork
137-
git push --set-upstream origin feature/branch-name-here
138-
```
139-
140-
After these steps, you should be able to create a new Pull Request for this repository. If you hit any issues following these instructions, please open an issue and we'll see if we can improve these instructions even further.
160+
Point your feature branch to use the `main`

0 commit comments

Comments
 (0)