Skip to content

Commit f7f8d00

Browse files
authored
Merge pull request #1 from dijitali/chore/run-full-lint-format
Run full lint format and build
2 parents 51ab382 + 494f34a commit f7f8d00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+15831
-3089
lines changed

.babelrc

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
2-
"presets": [
3-
[ "@babel/preset-env", {
4-
"targets": { "node": "10" }
5-
} ]
6-
],
7-
"plugins": [ "@babel/plugin-transform-modules-commonjs" ],
8-
"env": {
9-
"test": {
10-
"plugins": ["transform-require-context"]
11-
}
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": { "node": "10" }
127
}
8+
]
9+
],
10+
"plugins": ["@babel/plugin-transform-modules-commonjs"],
11+
"env": {
12+
"test": {
13+
"plugins": ["transform-require-context"]
14+
}
15+
}
1316
}

.github/workflows/lint_and_test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Use Node.js 14
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: '14'
20+
node-version: '14'
2121

2222
- name: Clean install NPM packages from package-lock.json
2323
run: npm ci
@@ -28,7 +28,7 @@ jobs:
2828
- name: Test
2929
run: npm run test:unit
3030
env:
31-
CI: true
31+
CI: true
3232

3333
# https://github.com/cypress-io/github-action
3434
- name: Cypress run

.prettierrc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
singleQuote: true,
3-
semi: true,
4-
trailingComma: 'all',
2+
"singleQuote": true,
3+
"semi": true,
4+
"trailingComma": "all"
55
}

README.md

+37-46
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,24 @@
88
![GitHub Repo stars](https://img.shields.io/github/stars/creativecommons/chooser?style=social)
99
![GitHub forks](https://img.shields.io/github/forks/creativecommons/chooser?style=social)
1010

11-
1211
# Chooser
1312

1413
The Creative Commons License Chooser is meant to help people learn about CC licenses, and select the license that best fits their needs. The new version in this repo places greater importance on usability, and an educational experience of the six CC licenses.
1514

16-
1715
## About
1816

1917
Repository containing the source code for the new Creative Commons License Chooser. The new chooser is still in beta, and a beta deployment can be found [here](https://chooser-beta.creativecommons.org/).
2018

2119
This site is built using [Vue.js](https://vuejs.org/) (and vue-cli).
2220

23-
2421
### Roadmap
2522

2623
Tasks, issues, and discussion related to the release of the new chooser are tracked with the [`Launch Milestone`](https://github.com/creativecommons/chooser/milestone/1).
2724

28-
2925
## Code of conduct
3026

3127
[`CODE_OF_CONDUCT.md`][org-coc]:
28+
3229
> The Creative Commons team is committed to fostering a welcoming community.
3330
> This project and all other Creative Commons open source projects are governed
3431
> by our [Code of Conduct][code_of_conduct]. Please report unacceptable
@@ -39,115 +36,112 @@ Tasks, issues, and discussion related to the release of the new chooser are trac
3936
[code_of_conduct]: https://opensource.creativecommons.org/community/code-of-conduct/
4037
[reporting_guide]: https://opensource.creativecommons.org/community/code-of-conduct/enforcement/
4138

42-
4339
## Contributing
4440

4541
See [`CONTRIBUTING.md`][org-contrib].
4642

4743
[org-contrib]: https://github.com/creativecommons/.github/blob/main/CONTRIBUTING.md
4844

49-
5045
## Using Docker
5146

52-
5347
### Containers
5448

5549
The [`docker-compose.yml`](docker-compose.yml) file defines the following
5650
containers:
51+
5752
1. **chooser-web** - simple NGINX container serving [`docs/`](docs)
5853
- [localhost:8888](http://localhost:8888/)
5954
2. **chooser-node** - Node14 container
6055
- [localhost:8080](http://localhost:8080/)
6156
- (requires **Run Node development server**, below)
6257

63-
6458
### Docker desktop required
6559

6660
Before proceeding, ensure you have Docker installed on your local machine. If
6761
not, download and install Docker Desktop by visiting [Docker's official
6862
website](https://www.docker.com/products/docker-desktop) and follow the
6963
installation instructions.
7064

71-
7265
### Startup containers
7366

7467
The containers can be started with:
68+
7569
```shell
7670
docker compose up
7771
```
72+
7873
(See [Docker Compose overview | Docker Docs](https://docs.docker.com/compose/)
7974
for more information on managing containes with `docker compose`.)
8075

81-
8276
### Initial setup
8377

8478
Before the chooser-node container can be used effectively, a clean install of
8579
NPM packages from `package-lock.json` is required:
80+
8681
```shell
8782
docker compose exec chooser-node npm ci
8883
```
89-
**This step generally only needs to be done once.**
9084

85+
**This step generally only needs to be done once.**
9186

9287
### Run Node development server
9388

9489
1. Startup containers (see above)
9590
2. Complete initial setup (see above)
9691
3. Run Node development server
97-
```shell
98-
docker compose exec chooser-node npm run serve
99-
```
92+
```shell
93+
docker compose exec chooser-node npm run serve
94+
```
10095
- [localhost:8080](http://localhost:8080/)
10196

102-
10397
### Create production (standalone) build
10498

10599
1. Startup containers (see above)
106100
2. Complete initial setup (see above)
107101
3. Run Node development server
108-
```shell
109-
docker compose exec chooser-node npm run build
110-
```
111-
- (this automatically copies the generated files from [`dist/`](dist) to
112-
[`docs/`](docs))
102+
```shell
103+
docker compose exec chooser-node npm run build
104+
```
105+
- (this automatically copies the generated files from [`dist/`](dist) to
106+
[`docs/`](docs))
113107

114108
The chooser is deployed to GitHub Pages. The source files for the beta
115109
deployment are contained in the `./docs/` dir, and are live. Any changes to
116110
this directory's contents will be automatically deployed, so please take care
117111
when making modifications to this location.
118112

119-
120113
### Create standalone (production) build
121114

122115
1. Startup containers (see above)
123116
2. Complete initial setup (see above)
124117
3. Run Node development server
125-
```shell
126-
docker compose exec chooser-node npm run build
127-
```
128-
- (this automatically copies the generated files from [`dist/`](dist) to
129-
[`docs/`](docs))
118+
```shell
119+
docker compose exec chooser-node npm run build
120+
```
121+
- (this automatically copies the generated files from [`dist/`](dist) to
122+
[`docs/`](docs))
130123

131124
The chooser is deployed to GitHub Pages. The source files for the beta
132125
deployment are contained in the `./docs/` dir, and are live. Any changes to
133126
this directory's contents will be automatically deployed, so please take care
134127
when making modifications to this location.
135128

136129
For an embedded standalone build (no header nor footer), run:
130+
137131
```shell
138132
docker compose exec chooser-node VUE_APP_CC_OUTPUT=embedded npm run build
139133
```
140-
**(please _don't_ commit embedded builds to `docs/`)**
141134

135+
**(please _don't_ commit embedded builds to `docs/`)**
142136

143137
### Create a web component build
144138

145139
1. Startup containers (see above)
146140
2. Complete initial setup (see above)
147141
3. Run Node development server
148-
```shell
149-
docker compose exec chooser-node npm run build-component
150-
```
142+
```shell
143+
docker compose exec chooser-node npm run build-component
144+
```
151145

152146
This will create a file in the [`dist/`](dist) folder named
153147
`license-chooser.min.js`. It can be used to load the web-component in any JS
@@ -168,41 +162,39 @@ example.
168162
```
169163

170164
For an embedded web component build (no header nor footer), run:
165+
171166
```shell
172167
docker compose exec chooser-node VUE_APP_CC_OUTPUT=embedded npm run build-component
173168
```
174169

175-
176170
## Perform unit tests on standalone or embedded build
177171

178172
1. Startup containers (see above)
179173
2. Complete initial setup (see above)
180-
2. Run unit tests
181-
```shell
182-
docker compose exec chooser-node npm run test:unit
183-
```
174+
3. Run unit tests
175+
```shell
176+
docker compose exec chooser-node npm run test:unit
177+
```
184178

185179
## Perform unit tests on web-component build
186180

187181
1. Startup containers (see above)
188182
2. Complete initial setup (see above)
189183
3. Create a web component build (see above)
190-
2. Run unit tests
191-
```shell
192-
docker compose exec chooser-node npm run test-component
193-
```
184+
4. Run unit tests
185+
```shell
186+
docker compose exec chooser-node npm run test-component
187+
```
194188
- It starts a server with the `dist/demo.html` on which tests can be run.
195189

196-
197190
## Perform Cypress tests
198191

199192
1. Startup containers (see above)
200193
2. Run Cypress tests
201-
```shell
202-
docker run -it -v $PWD:/e2e -w /e2e -e CYPRESS_baseUrl=http://host.docker.internal:8888 cypress/included:latest
203-
```
204-
- (This will download the cypress/included image when first run)
205-
194+
```shell
195+
docker run -it -v $PWD:/e2e -w /e2e -e CYPRESS_baseUrl=http://host.docker.internal:8888 cypress/included:latest
196+
```
197+
- (This will download the cypress/included image when first run)
206198

207199
## CSS Build
208200

@@ -213,7 +205,6 @@ can also be removed. If you find that the built site misses some styles, you
213205
can manually add the necessary classes or Regex expressions to the `safelist`
214206
array in the `postcss.config.js` file.
215207

216-
217208
## Embedded screenshot
218209

219210
The site can be built in two different modes: `embedded` and `standalone`.

cypress.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { defineConfig } = require('cypress')
1+
const { defineConfig } = require('cypress');
22

33
module.exports = defineConfig({
44
project: 'creativecommons-chooser',
@@ -9,10 +9,10 @@ module.exports = defineConfig({
99
// We've imported your old cypress plugins here.
1010
// You may want to clean this up later by importing these.
1111
setupNodeEvents(on, config) {
12-
return require('./tests/cypress/plugins/index.js')(on, config)
12+
return require('./tests/cypress/plugins/index.js')(on, config);
1313
},
1414
baseUrl: 'http://localhost:8080/',
1515
specPattern: 'tests/cypress/integration//**/*.cy.{js,jsx,ts,tsx}',
1616
supportFile: 'tests/cypress/support/index.js',
1717
},
18-
})
18+
});

docker-compose.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
version: '2.4'
44

55
services:
6-
76
chooser-web:
87
build: .
98
ports:

0 commit comments

Comments
 (0)