web-standard
v1.1.3
Published
Standardize all DSC repos with files in this repository.
Downloads
13
Readme
Installing and Adding To a Repository
Within a repository's npm package.json
file, add
// add `web-standard` to {devDependencies}
"web-standard": "git+ssh://[email protected]/dollarshaveclub/web-standard"
Now, when developers run npm i
:
- Access is provided to template configuration files found here.
- Key commands can be used to standardize a repository: web-standarize (see:
scripts/standardize.js
)
To standardize, add a script
that standardizes the repository accordingly.
View the Project Type Arguments to write the appropriate npm script
.
It is recommended that the npm script be called standardize
.
// in example
// add `standardize` script to {script}
"standardize": "web-standard docker-ember private-git-dependencies"
The script nomenclature works as follows
# without arguments
web-standard
# with arguments
web-standard [project_type_args](#project-type-arguments)
Read more about setting up environments for new repositories.
Script Arguments
private-git-dependencies
Projects that use private GitHub dependencies and needs SSH keys.
docker-ember
Ember apps deployed with docker
react
Server-side rendered react apps. See https://github.com/dollarshaveclub/react-runtime for commands and configurations that are added.
node-server
Node microservices that are not Ember/React/etc.
node
Node scripts that aren't servers.
Standardized configuration files are important throughout a code base that uses many repositories so that the code is written in consistent patterns as much as possible. This is what Web Standard provides.
An example of a Web Standard configuration file is .eslintrc.js
.
- Web Standard provides a base
.eslintrc.js
that is consistent across repositories.
* Repository specific configuration can still be added by adding an additional .eslintrc.js
that extends or overwrites Web Standard configuration.
Scripts
The scripts
folder contains helper scripts
to do common DSC Web Standard Engineer tasks.
Update a repository with update-repo.sh
When this script is run, a specified repository dependency creates a pull request to update a specified dependent repository.
update-repo.sh
takes 2 arguments:
- A repository to be updated from
- A repository to be updated to
Running update-repo.sh
will:
- takes the 1st argument's (The repo that is being updated from) lastest tag
- makes a branch with the name the
update-[from]-[tag]
for 2nd argument's (The repo that is being updated to) - updates npm within that branch
- then, submits a pull request with the update
Code Example
Within the web-standard repo, run:
cd code web-standard; . scripts/update-repo.sh tracksuit face-assets