-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7a3e831
Showing
116 changed files
with
13,972 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
tmp |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
extends: 'eslint:recommended', | ||
root: true, | ||
env: { | ||
browser: false, | ||
node: true, | ||
commonjs: true, | ||
es6: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
}, | ||
rules: { | ||
'no-console': 'off', | ||
'no-return-await': 'error', | ||
}, | ||
|
||
overrides: [ | ||
{ | ||
files: ['**/__tests__/**/*.js', '**/__mocks__/**/*.js'], | ||
env: { | ||
jest: true, | ||
node: true, | ||
}, | ||
}, | ||
], | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
node_modules | ||
tmp | ||
context | ||
coverage | ||
hubspot.config.yml | ||
lerna-debug.log | ||
npm-debug.log | ||
npm-debug.log.* | ||
*.log | ||
.DS_Store | ||
coverage | ||
|
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Change Log | ||
========== | ||
|
||
## Next | ||
|
||
### CMS CLI | ||
|
||
* Added *modes* to specify if read/write commands should use either the `draft` or `publish` mode. | ||
* Added the `--mode` option for use with commands `upload`, `watch`, and `fetch`. | ||
* Added the `defaultMode` field for use in `hubspot.config.yml` files. | ||
* Set the fallback mode to `publish`. | ||
* Removed the `--portalId` option. The `--portal` option accepts both portal ids and config names. | ||
* Consolidated uploading of files and folders into the `upload` command. The `sync` command is no longer supported, use `upload` instead. | ||
|
||
## 0.0.21 | ||
|
||
### CMS CLI | ||
|
||
* Adjust `create` command and add ability to create templates | ||
* Improve fetching of files | ||
* Refine built-in help | ||
* Fix path handling in older versions of `node` | ||
|
||
## 0.0.13 | ||
|
||
### CMS CLI | ||
|
||
* Fix OAuth2 authentication flow when the config file is empty | ||
* Better handle paths when running `sync` and `upload` sub-commands | ||
|
||
## 0.0.12 | ||
|
||
### CMS CLI | ||
|
||
* Fix issues with using the tools on Windows when uploading files | ||
* Add `fetch` command to download assets from HubSpot | ||
* Add Apache 2.0 license | ||
|
||
## 0.0.11 | ||
|
||
### CMS CLI | ||
|
||
* Add ability to name portals in config and set a default portal | ||
|
||
## 0.0.10 | ||
|
||
Initial version |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Contributing | ||
## Setup | ||
|
||
* Install the dependencies | ||
|
||
```bash | ||
yarn | ||
``` | ||
|
||
* Bootstrap `lerna` | ||
|
||
In order to manage multiple npm packages in the same Github repos, we use [lerna](https://lerna.js.org/). | ||
|
||
```bash | ||
yarn lerna bootstrap | ||
```` | ||
|
||
* To test a command | ||
|
||
First, you will need to create a config for the portals that you want to be able to test using. | ||
|
||
Once the config is created, commands can be run by providing a path to the executable file: | ||
|
||
``` | ||
yarn hscms upload --portalId [src] [dest]` | ||
``` | ||
* To test a command when `@hubspot/cms-cli` is a dependency in another package like `cms-theme-boilerplate`. | ||
In order to test changes in another npm package that is using `@hubspot/cms-cli`, [yarn link](https://yarnpkg.com/lang/en/docs/cli/link/) can be used. | ||
```bash | ||
cd /path/to/other-npm-package | ||
yarn link @hubspot/cms-cli | ||
``` | ||
|
||
## Documentation | ||
|
||
- [Technical Design](./docs/TechnicalDesign.md) | ||
- [Publishing Releases](./docs/PublishingReleases.md) | ||
- [Debugging](./docs/Debugging.md) |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Copyright 2019 HubSpot, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# hubspot-cms-tools | ||
Node packages intended for HubSpot CMS developers to enable local development and advanced workflows like continuous deployment. | ||
|
||
## Getting Started | ||
|
||
See the `@hubspot/cms-cli` [README](./packages/cms-cli/README.md). | ||
|
||
|
||
## Contributing | ||
|
||
For more information on developing, see the [Contributing Guide](CONTRIBUTING.md). | ||
|
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Debugging | ||
======== | ||
|
||
It is possible to debug the CLI using the Chrome developer tools. | ||
|
||
1. Run command via `node --inspect-brk ./packages/cms-cli/bin/hscms.js` | ||
2. Open `about:inspect` in Chrome | ||
3. Click "Open dedicated DevTools for Node" |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[lerna]: https://github.com/lerna/lerna | ||
[from-package]: https://github.com/lerna/lerna/tree/master/commands/publish#bump-from-package | ||
|
||
Publishing Releases | ||
=================== | ||
|
||
We're using [lerna][lerna] to make managing multiple packages in the same repos easier. | ||
|
||
Before releasing a new version, it is a good idea to release a prerelease so that folks can test out the changes. | ||
|
||
## Publishing a new version | ||
|
||
1. Run `yarn publish-release`. The publish command will handle bumping the version, tagging via git, and publishing the packages to NPM. | ||
1. If there are publishing errors, you can run again via `yarn lerna publish from-package` ([Docs][from-package]). | ||
|
||
## Publishing a prerelease | ||
|
||
1. Run `yarn publish-prerelease`. The publish command will handle bumping the version, tagging via git, and publishing the packages to NPM under the `next` dist-tag. | ||
1. If there are publishing errors, you can run again via `yarn lerna publish from-package` ([Docs][from-package]). | ||
|
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Technical Design | ||
|
||
To provide CMS developers with a flexible and powerful set of tools, the technical design is as follows: | ||
|
||
1. The commands should follow Unix best practices in terms of composibility. See [Unix Philosophy](https://en.wikipedia.org/wiki/Unix_philosophy) | ||
|
||
``` | ||
Write programs that do one thing and do it well. | ||
Write programs to work together. | ||
Write programs to handle text streams, because that is a universal interface. | ||
``` | ||
|
||
2. Don't prescribe a particular node task runner (Gulp, Grunt, etc...). Instead work to separate the cli from the underlying functionality so that we can easily create a library separate from the CLI for use in the creation of tasks. | ||
|
||
3. Support multiple portals. It should be easy to run the commands against multiple portals. | ||
|
||
4. Minimize dependencies. | ||
|
||
5. Plan for the code to be open source. |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
projects: ['<rootDir>/packages/*'], | ||
collectCoverage: true, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "0.0.26" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "hubspot-cms-tools", | ||
"version": "1.0.0", | ||
"description": "Tooling for interacting with the HubSpot CMS", | ||
"repository": "https://github.com/HubSpot/hubspot-cms-tools", | ||
"devDependencies": { | ||
"eslint": "^6.5.1", | ||
"husky": "^1.3.1", | ||
"lerna": "^3.13.1", | ||
"lint-staged": "^8.1.4", | ||
"prettier": "^1.18.2" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"lint": "eslint . && prettier --list-different 'packages/**/*.{js,json}'", | ||
"prettier:write": "prettier --write 'packages/**/*.{js,json}'", | ||
"publish-release": "yarn lerna publish --conventional-graduate", | ||
"publish-prerelease": "yarn lerna publish prerelease --preid beta --dist-tag next", | ||
"test": "jest" | ||
}, | ||
"lint-staged": { | ||
"**/*.{js,scss,css}": [ | ||
"prettier -l", | ||
"eslint" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"dependencies": { | ||
"jest": "^24.8.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class HubSpotAuthError extends Error {} | ||
|
||
module.exports = { | ||
HubSpotAuthError, | ||
}; |
Oops, something went wrong.