-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove use of alias #276
Merged
Merged
Remove use of alias #276
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ Note: When serving or building an existing app module that has dependencies on u | |
* [Background](#background) | ||
* [CLI Context](#cli-context) | ||
* [Platforms](#platforms) | ||
* [Aliases](#aliases) | ||
* [Workspaces](#workspaces) | ||
* [Development prerequisites](#development-prerequisites) | ||
* [App development](#app-development) | ||
* [Creating your app](#creating-your-app) | ||
|
@@ -152,15 +152,6 @@ Any supported command-line positional or option can be defined. For example: | |
} | ||
``` | ||
|
||
In addition to command-line options, aliases for Stripes UI modules are also supported. Aliases paths should be relative to the directory containing the `.stripesclirc` config file which defines the aliases. | ||
```json | ||
{ | ||
"aliases": { | ||
"@folio/users": "../ui-users" | ||
} | ||
} | ||
``` | ||
|
||
### Module export | ||
In addition to JSON, the CLI configuration may be authored as a JavaScript module export. This is useful for generating options dynamically or defining [CLI plugins](./dev-guide.md#plugins). When defining a JavaScript module export, be sure to use the `.js` file extension. | ||
|
||
|
@@ -216,17 +207,17 @@ Tip: Use the `status` command (optionally with a file and/or other config option | |
|
||
|
||
|
||
### Aliases | ||
### Workspaces | ||
|
||
Aliases are used to associate platform modules with local code repositories in a development environment. An alias is comprised of a key-value pair where the key is a module (`@folio/users`) and the value is the relative path to where the module can be found (`../ui-users`). Aliases are not limited to `@folio` scope modules. At build time, any defined aliases will be applied to the Webpack configuration as Webpack aliases. | ||
Workspaces are used to associate platform modules with local code repositories in a development environment. Workspaces are not limited to `@folio` scope modules. At build time, any defined modules will be linked by `yarn`. | ||
|
||
The initial goals of defining aliases was to facilitate serving an app in isolation, as well as eliminate the need for Yarn-linking modules for platform development. The latter can be mitigated by using Yarn workspaces for the platform developer, however, aliases can still provide some advantages. Aliases are easily added ad-hoc for debugging or testing. They can work with modules outside the workspace, or used to share across workspaces. | ||
There are two methods of adding workspaces in the CLI: | ||
|
||
There are two methods of adding aliases in the CLI: | ||
1) `workspace` command - This command will checkout from github any requested components into a workspace. See the [`workspace` command](./commands.md#workspace-command) for more detail. | ||
|
||
1) `alias` command - This command manages aliases in a global collection. Aliases defined with the `alias` command will be available for all commands, regardless of where they are run, until the alias is removed. This command is useful for adding aliases ad-hoc and sharing an alias across multiple apps, platforms, or workspaces. See the [`alias` command](./commands.md#alias-command) for more detail. | ||
2) Top-level `package.json` file - This file is auto-generated by the `workspace` command, but it can be created manually as well and `yarn` will respect it when calling `yarn install`. See [yarn workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/) for more information. | ||
|
||
1) `.stripesclirc` file - Any aliases defined in a CLI configuration file apply to commands run from the directory containing `.stripesclirc` file. Use the configuration file when adding aliases in bulk or looking for a consistent set of alias. See the [CLI configuration](#configuration) for more information. | ||
Note that in order for local code repositories to be used for a reference made in another module or platform `package.json` file, the local code repository version must fall in the requested version range. Otherwise, `yarn` will fetch from the remote repository instead. | ||
|
||
Comment on lines
+220
to
221
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an especially helpful note. Thanks for adding it! |
||
## Development prerequisites | ||
|
||
|
@@ -357,34 +348,42 @@ $ stripes serve --hasAllPerms | |
|
||
Now that our Hello World app is up and running on its own, we may want to bring in an existing app for testing or further development. The CLI makes this easy. The following will demonstrate how to add `ui-users`. | ||
|
||
From the directory above `ui-hello-world`, clone `ui-users` and install its dependencies. | ||
Create a new directory adjacent to `ui-hello-world`, call `stripes workspace` and select `ui-users` from the list. | ||
``` | ||
$ git clone https://github.com/folio-org/ui-users.git | ||
$ cd ui-users | ||
$ yarn install | ||
$ mkdir workspace-hello-world | ||
$ stripes workspace | ||
``` | ||
|
||
Now, move `ui-hello-world` into your new workspace | ||
``` | ||
$ mv ../ui-hello-world . | ||
``` | ||
|
||
or on Windows: | ||
``` | ||
$ move ..\ui-hello-world . | ||
``` | ||
|
||
We should now have the following directory structure: | ||
``` | ||
myDir | ||
├─ui-hello-world | ||
└─ui-users | ||
workspace-hello-world | ||
└─stripes | ||
├─ui-hello-world | ||
└─ui-users | ||
``` | ||
|
||
Next add an alias for ui-users. Provide a relative path to the ui-users directory. Given you're in /ui-hello-world: | ||
Next from the `stripes` directory, run: | ||
``` | ||
$ stripes alias add @folio/users ../ui-users | ||
$ yarn install | ||
``` | ||
|
||
Now simply start the app up again. From the ui-hello-world directory, run: | ||
This will ensure proper linking of dependencies. Now simply start the app up again. From the `ui-hello-world` directory, run: | ||
``` | ||
$ stripes serve | ||
``` | ||
|
||
The FOLIO platform generated will now include ui-users! The same procedure can be followed to include non-app modules as well such as `stripes-components` and `stripes-core`. | ||
|
||
Note: When adding an alias via the `alias add` command, the alias is considered global and will remain in effect for any command, run from any directory, until removed with `alias remove`. | ||
|
||
|
||
## Platform development | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes!!