Skip to content
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

Extracted url-utils package from Ghost core #114

Merged
merged 30 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c205777
Bootstrapped the project
naz Jun 5, 2019
b309aee
Copied utils file straigh to index
naz Jun 5, 2019
39dc4a0
Copied over unit test cases
naz Jun 5, 2019
075554e
Removed hello test
naz Jun 5, 2019
a649051
Added missing deps
naz Jun 5, 2019
380c8e8
Extracted config deps into init parameters
naz Jun 5, 2019
041ead1
Renamed utils test suite
naz Jun 5, 2019
e834f6a
Removed external dependencies from test suite
naz Jun 5, 2019
64dd428
Refactored replacePermalink method and gotten rid of settingsCache de…
naz Jun 5, 2019
2f90453
Renamed urlService.utils into urlUtils
naz Jun 5, 2019
5782bef
Fixed getProtectedSlugs unit tests
naz Jun 5, 2019
b774ea8
Fixed getSubdir tests
naz Jun 5, 2019
282375b
Replaced configUtils.set call with urlUtils.init equivalent
naz Jun 5, 2019
d2e75aa
Fixed tests for urlFor method
naz Jun 5, 2019
ef903f8
Fixed linting error
naz Jun 5, 2019
d534f2e
Fixed redirects test suites
naz Jun 5, 2019
4915b2c
Removed unneeded afterEach
naz Jun 5, 2019
db6e6b7
Removed unintended break
naz Jun 5, 2019
d2d1c8f
Cleanup
naz Jun 5, 2019
476e1d7
Corrected params documentation
naz Jun 5, 2019
1a2bab6
Cleanup and notes
naz Jun 5, 2019
d04f563
Reworked main method export to behave similarly to Admin API SDK
naz Jun 6, 2019
ec25bb7
Extracted replace-permalink to separate module
naz Jun 6, 2019
64a9ff4
Extracted deduplicate slashes method
naz Jun 6, 2019
433ea2f
Extracted isSSL module
naz Jun 6, 2019
91bcf4f
Made API and image content URL prefixes configurable
naz Jun 6, 2019
8b1d3ba
Corrected files exposed by package.json
naz Jun 6, 2019
c98ab69
Removed unused dependencies
naz Jun 6, 2019
a5458f2
Fixed cheerio version to match one used in Ghost core
naz Jun 12, 2019
7eb0bb4
Removed unused function initialization code
naz Jun 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/url-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: ['ghost'],
extends: [
'plugin:ghost/node',
]
};
21 changes: 21 additions & 0 deletions packages/url-utils/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Ghost Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions packages/url-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Url Utils

## Install

`npm install @tryghost/url-utils --save`

or

`yarn add @tryghost/url-utils`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License

Copyright (c) 2019 Ghost Foundation - Released under the [MIT license](LICENSE).
Empty file added packages/url-utils/index.js
Empty file.
5 changes: 5 additions & 0 deletions packages/url-utils/lib/deduplicate-slashes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function deduplicateDoubleSlashes(url) {
return url.replace(/\/\//g, '/');
}

module.exports = deduplicateDoubleSlashes;
Loading