Skip to content

Commit 09b9695

Browse files
committed
feat: retire package folder
1 parent a03286e commit 09b9695

File tree

4 files changed

+42
-94
lines changed

4 files changed

+42
-94
lines changed

app/jobs/buildRelease.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ const updateReleaseBuild = async function(buildApi, pkg, release) {
8585
repoUrl: cleanRepoUrl(pkg.repoUrl, "https"),
8686
repoBranch: release.tag,
8787
packageName: pkg.name,
88-
packageVersion: release.version,
89-
packageFolder: pkg.packageFolder || ""
88+
packageVersion: release.version
9089
};
9190
let build = await queueBuild(buildApi, definitionId, parameters);
9291
// eslint-disable-next-line require-atomic-updates

docs/.vuepress/theme/layouts/PackageAdd.vue

-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ export default {
506506
description: repoInfo.description,
507507
repoUrl: repoInfo.html_url,
508508
repoBranch: form.branch.value,
509-
packageFolder: form.packageFolder.value,
510509
parentRepoUrl: repoInfo.parent ? repoInfo.parent.html_url : null,
511510
licenseSpdxId: form.licenseId.value,
512511
licenseName: form.licenseName.value,

docs/.vuepress/theme/layouts/PackageDetail.vue

+1-7
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,8 @@ export default {
407407
},
408408
packageInstallCli() {
409409
const name = this.$package.name;
410-
const repoUrl = this.$package.repoUrl;
411-
const repoBranch = this.$package.repoBranch;
412410
if (this.packageSucceededBuilds.length) return `openupm add ${name}`;
413-
else if (!this.$package.packageFolder) {
414-
let cli = `openupm add ${name}@${repoUrl}`;
415-
if (this.$package.repoBranch != "master") cli += `#${repoBranch}`;
416-
return cli;
417-
} else return "not available";
411+
else return "not available yet";
418412
},
419413
badgeVersionHtml() {
420414
return `<a href="${escape(this.badgeUrl)}"><img src="${escape(

docs/docs/adding-upm-package.md

+40-84
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,39 @@ sidebar: true
33
sidebarDepth: 2
44
showFooter: false
55
---
6-
# Adding Upm Package
6+
# Adding UPM Package
77

8-
## Upm Package Criteria
8+
## UPM Package Criteria
99

1010
OpenUPM requires the package repository fulfils below criteria
11-
- Containing the required `package.json` of upm package. The `package.json` can be placed at any folder.
12-
- Open source license. It is recommended to choose one from [spdx license list](https://spdx.org/licenses/), especially the one with OSI approved flag. For custom license (or dual licenses), it should be clear whether the package is commercial available.
13-
- Hosting on Github. For now only GitHub repository are supported, but generic git support is under consideration.
14-
- Git tags that conforms valid semver format, with or without the `v` prefix. i.e. `v1.1.0`, `1.1.0`, `1.1.1-preview`, `v2.0.0-preview.1`. Valid tags will be built as package releases. You can create git tags (though GitHub release feature) after adding a repository to the system.
11+
- The valid UPM structure. At least contains a `package.json` file, can be placed at a sub-folder.
12+
- An open source license. It is recommended to choose one from the [spdx license list](https://spdx.org/licenses/).
13+
- Hosting on Github. For now only GitHub repositories are supported, but the generic git support is under consideration.
14+
- Git tags that are valid semver, with/without the `v` prefix. i.e. `v1.1.0`, `1.1.0`, `1.1.1-preview`, `v2.0.0-preview.1`. Only valid tags are built. It is recommended to either using the GitHub release feature, or CI tools to create git tags.
15+
16+
## Understanding Different Folder Structures of UPM Repositories
17+
18+
There're three typical folder structures of UPM repositories. OpenUPM build pipelines can handle all of them.
19+
20+
- UPM package at the root path
21+
- UPM package at a sub-folder
22+
- UPM package at a sub-folder with UPM branch
23+
24+
### UPM Package at the Root Path
25+
26+
The `package.json` file is located at the root path of the master branch. It is the simplest case.
27+
28+
### UPM Package at a Sub-folder
29+
30+
The master branch is usually an Unity project (with Assets folder). The `package.json` file is located at a sub-folder, for example `Assets/package-name` or `Packages/com.namespace.package-name`. Git tags are based on the master branch. Build pipelines will detect the location of the `package.json` file, and handle it correctly.
31+
32+
### UPM Package at a Sub-folder with UPM Branch
33+
34+
The master branch is usually an Unity project (with Assets folder). The `package.json` file is located at a sub-folder, for example `Assets/package-name` or `Packages/com.namespace.package-name`. An `upm` branch is created from the package folder using the `git subtree split/push` command to make the `package.json` file placed at the root path. So the package can be installed by Unity Package Manager via git url. Git tags are based on the upm branch.
1535

1636
## Package YAML File
1737

18-
OpenUPM uses a yaml file to describe the package information. Here's an example.
38+
OpenUPM uses a yaml file to store the package information. Here's an example.
1939

2040
```yaml
2141
# package name
@@ -28,8 +48,6 @@ description: An unity package example
2848
repoUrl: 'https://github.com/favoyang/unity-package-example'
2949
# repository branch
3050
repoBranch: master
31-
# parent folder of package.json file
32-
packageFolder: ''
3351
# forked repository url
3452
parentRepoUrl: null
3553
# spdx license id
@@ -47,91 +65,29 @@ excludedFromList: false
4765
4866
## Using Package Add Form
4967
50-
Package hunter can use the [package add form](/packages/add/), to add package yaml file to the system easily. The form will guide you to fill necessary information, generate the yaml file, add to GitHub via web page and start a pull request.
68+
Package hunters can use the [package add form](/packages/add/), to submit the package yaml file. The form will guide you to fill required information, generate the yaml file, then submit to GitHub as pull request in the browser.
5169
5270
[![package add form](./images/package-add-form.png)](/packages/add/)
5371
54-
Once the pull request get merged, within a few minutes (for the CI to do the jobs):
55-
- You can visit the package at url `/packages/com.namespace.package-name`.
56-
- The package will be added to build pipelines, and results can be viewed from the **version history** and **build issues** sections on the package detail page.
72+
The pull request of adding new package will be merged automatically. The CI will do jobs to update the website and build pipelines. Within a few minutes you can view the package detail page at url `/packages/com.namespace.package-name`, and check the build result from the **version history** and **build issues** sections.
5773

5874
@flowstart
59-
form=>operation: Fill package form
60-
yaml=>operation: Start pull request with generated YAML
61-
merge=>operation: Wait pull request get merged
62-
build=>end: Add to website and build pipeline
63-
64-
form->yaml
65-
yaml->merge
66-
merge->build
75+
form=>operation: Fill the package form
76+
pr=>operation: Start a pull request
77+
ci=>operation: Wait the CI
78+
79+
form->pr
80+
pr->ci
6781
@flowend
6882

6983
## Troubleshooting
7084

71-
### Handling Different Folder Structures
72-
73-
There're three typical folder structures of repository.
74-
75-
- Pure upm package
76-
- Upm package at a sub-folder
77-
- Upm package at a sub-folder with upm branch
78-
79-
#### Pure Upm Package
80-
81-
The `package.json` is located at the root path of the master branch, and same for other git tags. This is the simplest case and will just work fine.
82-
83-
```yaml
84-
# repository branch
85-
repoBranch: master
86-
# parent folder of package.json file
87-
packageFolder: ''
88-
```
89-
90-
#### Upm Package at a Sub-folder
91-
92-
The repository is an unity project (with Assets folder). The `package.json` is located at a sub-folder, for example `Assets/package-name` or `Packages/com.namespace.package-name`. The folder structure is same for git tags. You need provide the package folder to make the build pipeline work.
93-
94-
```yaml
95-
# repository branch
96-
repoBranch: master
97-
# parent folder of package.json file
98-
packageFolder: 'Packages/com.namespace.package-name'
99-
```
100-
101-
#### Upm Package at a Sub-folder with Upm Branch
102-
103-
The repository is an unity project (with Assets folder). The `package.json` is located at a sub-folder, for example `Assets/package-name` or `Packages/com.namespace.package-name`. An upm branch is made from the subtree of the package folder, so it can be installed via git url by unity package manager.
104-
105-
Then you need double check the git tags, see if it was made from the upm branch or the master branch. Go to the release tab of the repository, find a release/tag, click on the hash link.
106-
107-
![finding git tags](./images/finding-git-tag.png)
108-
109-
Then tap the `Browse files` button.
110-
111-
![browse files](./images/git-browse-files.png)
112-
113-
114-
- If the git tag is made from upm branch, with a `package.json` file at the root path, then you can use upm as default branch and leave the package folder empty.
115-
```yaml
116-
# repository branch
117-
repoBranch: upm
118-
# parent folder of package.json file
119-
packageFolder: ''
120-
```
121-
- If the git tags is made from master branch, where `package.json` file is located at a sub-folder, then you need provide package folder.
122-
```yaml
123-
# repository branch
124-
repoBranch: master
125-
# parent folder of package.json file
126-
packageFolder: 'Packages/com.namespace.package-name'
127-
```
128-
129-
### Handling Repository without Releases
85+
### Handling the Repository without Git Tags
13086

131-
If a repository without valid git tags/releases. Then it can be only installed via git url. Please create an issue on the repository for making GitHub releases. The release name (git tag) need to be a valid semver. A common practice is naming the release name (git tag) as semver with prefix `v`. i.e. `v1.0.0` for version `1.0.0`.
87+
Please create an issue on the author's repository for making GitHub releases. The git tag should be a valid semver.
13288

133-
### Handling Custom Build Script
89+
### Handling the Custom Build Script
13490

135-
The build pipeline simply run `npm publish` on the package folder to bundle and publish package. If what you want is to exclude certain files from the package bundle, you can use `.npmigore` file at the same path of `package.json`. Learn more [here](https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package).
91+
Build pipelines simply detect the package folder, and run the `npm publish` command in that folder to publish a package. If what you want is to exclude certain files from the package bundle, you can use the `.npmigore` file at the same path of the `package.json` file. Learn more [here](https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package).
13692

137-
Custom build script is not supported at the moment. Though we trended to use the standard `npm build` command. We're looking for an example repository to work with to support custom build script. If your package requires one, please [create an issue](https://github.com/openupm/openupm/issues) to start a conversation.
93+
The custom build script is not supported at the moment. We're looking for an example repository to work with to support the custom build script. If your package do need the feature, please [create an issue](https://github.com/openupm/openupm/issues) to start a conversation.

0 commit comments

Comments
 (0)