Skip to content

Commit b7bfee7

Browse files
committed
update docs to use docker compose exec and improve formatting consistency
1 parent bfc8681 commit b7bfee7

File tree

1 file changed

+82
-53
lines changed

1 file changed

+82
-53
lines changed

README.md

Lines changed: 82 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +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+
1112
# Chooser
1213

1314
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.
1415

16+
1517
## About
1618

1719
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/).
1820

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

23+
2124
### Roadmap
2225

2326
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).
2427

28+
2529
## Code of conduct
2630

2731
[`CODE_OF_CONDUCT.md`][org-coc]:
@@ -35,45 +39,66 @@ Tasks, issues, and discussion related to the release of the new chooser are trac
3539
[code_of_conduct]: https://opensource.creativecommons.org/community/code-of-conduct/
3640
[reporting_guide]: https://opensource.creativecommons.org/community/code-of-conduct/enforcement/
3741

42+
43+
## Contributing
44+
45+
See [`CONTRIBUTING.md`][org-contrib].
46+
47+
[org-contrib]: https://github.com/creativecommons/.github/blob/main/CONTRIBUTING.md
48+
49+
3850
## Getting Started
3951

52+
4053
## Using Docker
4154

42-
Before proceeding, ensure you have Docker installed on your local machine. If not, download and install Docker Desktop by visiting [Docker's official website](https://www.docker.com/products/docker-desktop) and follow the installation instructions.
55+
Before proceeding, ensure you have Docker installed on your local machine. If
56+
not, download and install Docker Desktop by visiting [Docker's official
57+
website](https://www.docker.com/products/docker-desktop) and follow the
58+
installation instructions.
59+
60+
To deploy the Creative Commons Chooser application using Docker, follow these
61+
steps:
4362

44-
To deploy the Creative Commons Chooser application using Docker, follow these steps:
4563

4664
### Step 1: Install Docker Desktop
4765

48-
First, ensure you have Docker Desktop installed on your local machine. Open Docker Desktop app on your local machine and follow the installation instructions.
66+
First, ensure you have Docker Desktop installed on your local machine. Open
67+
Docker Desktop app on your local machine and follow the installation
68+
instructions.
69+
4970

5071
### Step 2: Clone the Repository
5172

5273
Clone the Creative Commons Chooser repository to your local machine:
5374

54-
```bash
75+
```shell
5576
git clone https://github.com/creativecommons/chooser.git
5677
```
5778

79+
5880
### Step 3: Navigate to the Project Directory
5981

6082
Navigate into the project directory:
6183

62-
```bash
84+
```shell
6385
cd chooser
6486
```
6587

88+
6689
### Step 4: Build and Run the Docker Container
6790

68-
In order to have the code up and running on your machine, build the Docker container using docker-compose:
91+
In order to have the code up and running on your machine, build the Docker
92+
container using docker-compose:
6993

70-
```bash
71-
docker-compose up
94+
```shell
95+
docker compose up
7296
```
7397

7498
If there is `node_modules` directory, it will perform a clean install from
7599
`package-lock.json`.
76100

101+
77102
### Step 5: Access the Application
78103

79104
Once the container is running, you can access the Creative Commons Chooser application by navigating to the following URL in your web browser:
@@ -82,33 +107,24 @@ Once the container is running, you can access the Creative Commons Chooser appli
82107
http://localhost:8080
83108
```
84109

85-
## Manual Setup
86-
87-
### Prerequisite
88-
[nodeJS](https://nodejs.org/en/blog/release/v14.17.3) version 14 or below, as the version above 14 may give error.
89110

90-
### Commands
91-
Run the following commands in order to have the code up and running on your machine:
111+
### Building as web component
92112

93-
Clean install dependencies from package-lock.json:
94-
``` bash
95-
npm ci
113+
To build the project as a web component, run:
114+
```shell
115+
docker compose exec web npm run build-component
96116
```
97117

98-
Build and serve assets with hot-reload
99-
```bash
100-
npm run serve
101-
```
102-
103-
You should now have the application running and accessible at <http://localhost:8080> (note: will run on a different port if 8080 is occupied, most common alternative port is 8081).
104-
105-
## Building as web component
118+
This will create a file in the `dist` folder named `license-chooser.min.js`. It
119+
can be used to load the web-component in any JS project. There is also a sample
120+
`demo.html` created.
106121

107-
To build the project as a web component, run the command `npm run build-component`. This will create a file in the `dist` folder named `license-chooser.min.js`. It can be used to load the web-component in any JS project. There is also a sample `demo.html` created.
122+
To be able to use the file it should either be rendered statically from the
123+
integrater's web-app or be published on a CDN. Following code can be used to
124+
integrate this in other apps.
108125

109-
To be able to use the file it should either be rendered statically from the integrater's web-app or be published on a CDN. Following code can be used to integrate this in other apps.
110-
111-
Note: the Chooser component depends on Vue 2.x, as can be seen in the following example.
126+
Note: the Chooser component depends on Vue 2.x, as can be seen in the following
127+
example.
112128

113129
```
114130
<script src="https://cdn.jsdelivr.net/npm/vue@2.x.x"></script>
@@ -117,48 +133,61 @@ Note: the Chooser component depends on Vue 2.x, as can be seen in the following
117133
<license-chooser></license-chooser>
118134
```
119135

120-
If the web component is intended to be built without header and footer, run `VUE_APP_CC_OUTPUT=embedded npm run build-component`
121-
122-
## Contributing
123-
124-
For information on contributing, please see [Creative Commons' Contribution Guidelines](https://opensource.creativecommons.org/contributing-code/)
125-
126-
If you create a PR for your work, but you are not finished yet, please include `WIP:` in the beginning of your PR title. When your work on your PR is completed, and you are ready for a final review, please remove the `WIP:` prefix from the title to indicate that your work is done.
127-
128-
Here's a [handy link](https://github.com/creativecommons/chooser/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22+-label%3A%22in+progress%22) that will show you all open issues in this repo that have the `help wanted` tag, but do not have the `in progress` tag.
129-
All issues in this list are up for grabs!
130-
If it says "No results matched your search", then there are no issues currently up for grabs.
131-
132-
*If no progress has been made on an issue for seven days after assignment, the assignment will be removed to allow others to contribute.*
136+
If the web component is intended to be built without header and footer, run
137+
```shell
138+
docker compose exec web VUE_APP_CC_OUTPUT=embedded npm run build-component
139+
```
133140

134-
See [`CONTRIBUTING.md`][org-contrib].
135-
136-
[org-contrib]: https://github.com/creativecommons/.github/blob/main/CONTRIBUTING.md
137141

138142
## Running Tests
139143

140144
You can run tests by executing:
145+
```shell
146+
docker compose exec web npm run test
147+
```
141148

142-
```bash
143-
npm run test
149+
For running tests on a web-component build, run:
150+
```shell
151+
docker compose exec npm run test-component
144152
```
145-
For running tests on a web-component build, run `npm run test-component`. It starts a server with the `dist/demo.html` on which tests can be run.
153+
154+
It starts a server with the `dist/demo.html` on which tests can be run.
146155

147156

148157
## CSS Build
149158

150-
The Chooser uses PostCSS plugin for PurgeCSS to make CSS bundle size smaller. It automatically removes unused CSS based on the classes found in the final built bundle. Some styles for dynamic components or dynamically-imported files can also be removed. If you find that the built site misses some styles, you can manually add the necessary classes or Regex expressions to the `safelist` array in the `postcss.config.js` file.
159+
The Chooser uses PostCSS plugin for PurgeCSS to make CSS bundle size smaller.
160+
It automatically removes unused CSS based on the classes found in the final
161+
built bundle. Some styles for dynamic components or dynamically-imported files
162+
can also be removed. If you find that the built site misses some styles, you
163+
can manually add the necessary classes or Regex expressions to the `safelist`
164+
array in the `postcss.config.js` file.
165+
151166

152167
## Deployment
153168

154-
The chooser is deployed to GitHub Pages. The source files for the beta deployment are contained in the `./docs/` dir, and are live. Any changes to this directory's contents will be automatically deployed, so please take care when making modifications to this location.
169+
The chooser is deployed to GitHub Pages. The source files for the beta
170+
deployment are contained in the `./docs/` dir, and are live. Any changes to
171+
this directory's contents will be automatically deployed, so please take care
172+
when making modifications to this location.
173+
174+
To update the dist bundle, run:
175+
```shell
176+
docker compose exec npm run build
177+
```
178+
This will also automatically copy the generated files from `./dist/` to
179+
`./docs/`.
155180

156-
To update the dist bundle, run ```$ npm run build```. This will also automatically copy the generated files from `./dist/` to `./docs/`.
157181

158182
## Output Modes
159183

160-
The site can be built in two different modes: `embedded` and `standalone`. `Embedded` mode removes the header and footer from the application, resulting in the following appearance:
184+
The site can be built in two different modes: `embedded` and `standalone`.
185+
`Embedded` mode removes the header and footer from the application, resulting
186+
in the following appearance:
161187

162188
<img src="static/embedded-screenshot.png" alt="Application built in embedded mode">
163189

164-
To build into embedded mode, set the environment variable `VUE_APP_CC_OUTPUT=embedded` on your server before building. If `VUE_APP_CC_OUTPUT` is unset or set to a different value, the app will build in the default `standalone` mode, with its own header and footer.
190+
To build into embedded mode, set the environment variable
191+
`VUE_APP_CC_OUTPUT=embedded` on your server before building. If
192+
`VUE_APP_CC_OUTPUT` is unset or set to a different value, the app will build in
193+
the default `standalone` mode, with its own header and footer.

0 commit comments

Comments
 (0)