|
1 | 1 | # generator-biojs-webcomponents [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]
|
2 |
| -Generates the scaffold for a BioJS component automatically so you don't have to do it yourself. |
| 2 | +Generates the scaffold for a BioJS component automatically so you don't have to do it yourself. |
| 3 | + |
| 4 | +This guide is for using the generator to make new components and upgrade existing ones. See [Section I](#i-getting-started) for getting started with the generator and installing it and [Section II](#ii-description-of-your-projects-folder-structure) for description of your project's directory after running the generator. Once you install the generator and run it, you will be asked some questions, you can read more about them in [Section III](#iii-workflow-and-questions). |
| 5 | + |
| 6 | +For contributing to this project, see the [Contribution guide](CONTRIBUTING.md). |
3 | 7 |
|
4 | 8 | ### What this tool currently does
|
5 | 9 |
|
@@ -33,7 +37,7 @@ Step 2b: Generate your new project.
|
33 | 37 | yo @biojs/biojs-webcomponents
|
34 | 38 | ```
|
35 | 39 |
|
36 |
| -After running this, you will be asked some questions about the details of your project, after which the required dependencies will be automatically installed. |
| 40 | +After running this, you will be asked some questions about the details of your project, after which the required dependencies will be automatically installed. You can read more about the whole workflow and the questions asked [here](#iii-workflow-and-questions). |
37 | 41 |
|
38 | 42 | Once it's complete, look at your new README file for build instructions, and check out `src/index.js`
|
39 | 43 | and `examples/index.html` to get started - there are instructions in the code.
|
@@ -87,59 +91,105 @@ Other files are starter files for your project. Generally, you do not need to ed
|
87 | 91 |
|
88 | 92 | If you face any issue, feel free to contact us at [Gitter](https://gitter.im/biojs).
|
89 | 93 |
|
90 |
| -## III. Contribute |
| 94 | +## III. Workflow and Questions |
| 95 | + |
| 96 | +After running ```yo @biojs/biojs-webcomponents``` in your terminal, you will be asked - |
| 97 | + |
| 98 | +```bash |
| 99 | +? What do you want to do today? |
| 100 | +> Upgrade an existing component to a Web Component |
| 101 | + Make a new Web Component |
| 102 | +``` |
| 103 | + |
| 104 | +Based on your choice, you will be asked different questions. Read more - |
91 | 105 |
|
92 |
| -To contribute, clone this repository, install yeoman and run the code. |
| 106 | +### Upgrade an existing component to a Web Component |
93 | 107 |
|
94 |
| -Step 1: Clone the repository. |
| 108 | +A) Import the build file of your existing component into the project's directory. |
95 | 109 |
|
96 |
| -a) Using HTTPS - |
| 110 | +1) You can import the build file from your local computer. |
| 111 | +2) If you do not have the build file in your computer, you can import it from your component's package on npm. |
97 | 112 |
|
98 | 113 | ```bash
|
99 |
| -git clone https://github.com/biojs/generator-biojs-webcomponents.git |
| 114 | +? We need the build file (generally index.js, main.js or componentName.js) for this, |
| 115 | + import it using one of the options - |
| 116 | + 1) Tell us the path of the file on your local machine and we will import it in the project. |
| 117 | + 2) Tell us the npm package name, version, etc. and we will import it. |
100 | 118 | ```
|
101 | 119 |
|
102 |
| -b) Using SSH - |
| 120 | +Import from your local machine - |
| 121 | + |
| 122 | +B) Enter the path of your build file. |
103 | 123 |
|
104 | 124 | ```bash
|
105 |
| -git clone [email protected]:biojs/generator-biojs-webcomponents.git |
| 125 | +Please enter the path of the build file. |
106 | 126 | ```
|
107 | 127 |
|
108 |
| -Step 2: Go to generator's directory |
| 128 | +The generator will make a directory named ```component-dist``` in your component's directory. Your build file will be imported in this directory. If this directory (component-dist) already exists, you can enter ```skip``` and enter the path of the build file in the next question (given below). |
109 | 129 |
|
110 | 130 | ```bash
|
111 |
| -cd generator-biojs-webcomponents |
| 131 | +Please enter the path of the build file, we will paste it into the existing directory. |
112 | 132 | ```
|
113 | 133 |
|
114 |
| -Step 3: Install yeoman |
| 134 | +Import from your compnent's package on npm - |
| 135 | + |
| 136 | +C) You have to enter the package name (case sensitive) of your component, the generator will show you the description of your package and ask whether the description shown is correct or not. |
115 | 137 |
|
116 | 138 | ```bash
|
117 |
| -npm install -g yo |
| 139 | +Enter the package name (case sensitive). |
| 140 | +Press enter if the package description shown is correct. |
118 | 141 | ```
|
119 | 142 |
|
120 |
| -Step 4: Symlink the package |
| 143 | +If the description shown is incorrect, press ```N``` and you will go back to step A where you can choose to enter the package name again or import the file from local storage. |
121 | 144 |
|
122 | 145 | ```bash
|
123 |
| -npm link |
| 146 | +? What do you want to do? |
| 147 | + 1) Enter package name again. |
| 148 | + 2) Import the file locally from your computer. |
124 | 149 | ```
|
125 | 150 |
|
126 |
| -Step 5: Go out of the generator's directory. Run and test the generator locally. |
| 151 | +If the description shown is correct, press ```Enter``` or ```Y```. You will be asked about the version of the package you want to import from. |
127 | 152 |
|
128 | 153 | ```bash
|
129 |
| -cd .. |
130 |
| -mkdir test-biojs-generator |
131 |
| -cd test-biojs-generator |
132 |
| -yo biojs-webcomponents |
| 154 | +Great! We will import the latest version of your file from the npm package, if you don't want this, |
| 155 | +enter the version. |
133 | 156 | ```
|
134 | 157 |
|
135 |
| -Note: If you have installed the generator-biojs-webcomponents globally, there is no need to worry, this method will still work. You do not need to uninstall anything. |
| 158 | +You can press ```Enter``` if you want to import from the latest version or you can enter the version you need. If the version exists, you will be shown a URL which will redirect you to your package's directory. |
| 159 | + |
| 160 | +```bash |
| 161 | +This URL - https://www.jsdelivr.com/package/npm/<your-package-name>?version=<your-package-version> |
| 162 | +contains the directory of the package, please find the build file (generally in the dist or build |
| 163 | +folder) and paste the link here, we will download it for you. |
| 164 | +``` |
136 | 165 |
|
137 |
| -### To-do / roadmap. |
| 166 | +After going to this URL, you can find the build file in the root folder or a separate folder named build or dist. The build file is generally named index.js, package_name.js, index.min.js or package_name.min.js. |
138 | 167 |
|
139 |
| -See [issues](issues) for more details - we still need the following: |
| 168 | +You have to copy the URL/link to the build file and enter it and the generator will download it for you in a directory named ```component-dist```. If this directory (component-dist) already exists then enter ```skip``` and enter the URL in the next question (given below). |
140 | 169 |
|
141 |
| -1. Scaffolder for _new_ browser tools (i.e. not just a wrapper for older tools) |
142 |
| -2. Scaffolder for command line tools. |
| 170 | +```bash |
| 171 | +This URL - https://www.jsdelivr.com/package/npm/<your-package-name>?version=<your-package-version> |
| 172 | +contains the directory of the package, please find the build file (generally in the dist or build |
| 173 | +folder) and paste the link here, we will download it for you in the existing folder. |
| 174 | +``` |
| 175 | +
|
| 176 | +D) After successfully importing the build file, you will be asked the same questions (questions A and B in the next section) about your component as asked while [making a new one](#make-a-new-web-component). |
| 177 | +
|
| 178 | +### Make a new Web Component |
| 179 | +
|
| 180 | +A) Enter computer package name. This should contain only small alphabets and hyphen ( - ) between the words. You can't use CAPITAL letters, number, space, any other special character(s) and hyphen at beginning or end. |
| 181 | +
|
| 182 | +```bash |
| 183 | +Computer package name? This is a computer name with NO capital letters or special |
| 184 | +characters apart from the hyphen ( - ) . |
| 185 | +``` |
| 186 | +
|
| 187 | +B) Enter human name for the project. This can only contain letters (small and capital) and spaces, no other special characters or numbers. |
| 188 | +
|
| 189 | +```bash |
| 190 | +Thanks! Now, give me a human name for the project with only letters and NO special |
| 191 | +characters apart from the whitespace (space). e.g. \"Genome Browser\" |
| 192 | +``` |
143 | 193 |
|
144 | 194 | ## License
|
145 | 195 |
|
|
0 commit comments