Skip to content

Commit

Permalink
🚚 Remove package prefix and rename "core" to "common" (#353)
Browse files Browse the repository at this point in the history
* Remove `upswyng-` prefix from package names

* Rename package 'core' to 'common'

* Fix typos and bad auto-imports

* Fix package names

* Update lockfile
  • Loading branch information
rhinodavid authored May 9, 2020
1 parent a5fdedb commit cf34b32
Show file tree
Hide file tree
Showing 364 changed files with 255 additions and 239 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ packages/**/__sapper__/**
packages/**/coverage/**
packages/**/dist/**
packages/**/node_modules/**
packages/upswyng-server/cypress/**
packages/server/cypress/**
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ node_modules

# testing
/coverage
/cypress/screenshots/

# production
packages/upswyng-web/build
packages/upswyng-web/coverage
packages/web/build
packages/web/coverage
__sapper__
__build__
dist
Expand All @@ -31,7 +30,7 @@ config.ts
.mongodburi
.redispid
.redisuri
packages/upswyng-server/cypress/screenshots/**/*(failed).png
packages/server/cypress/screenshots/**/*(failed).png

# misc
.DS_Store
Expand Down
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ cache:
- ~/.cache
script:
- yarn install
- mv packages/upswyng-native/config.example.ts packages/upswyng-native/config.ts
- mv packages/native/config.example.ts packages/native/config.ts
- yarn build:local-packages
- yarn workspace @upswyng/upswyng-server build:bin
- yarn workspace @upswyng/server build:bin
- yarn lint:ci
- yarn test:ci
- yarn workspace @upswyng/upswyng-server build:server
- yarn workspace @upswyng/upswyng-server build:worker
- CI=false yarn workspace @upswyng/upswyng-web build
- yarn workspace @upswyng/server build:server
- yarn workspace @upswyng/server build:worker
- CI=false yarn workspace @upswyng/web build
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"jest.pathToJest": "npm run test -- --coverage",
"jest.pathToJest": "node_modules/.bin/jest",
"editor.formatOnSave": true,
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
{ "language": "typescript" },
{ "language": "typescriptreact" }
],
"eslint.enable": true,
"typescript.tsdk": "node_modules/typescript/lib",
Expand Down
47 changes: 31 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ UpSwyng is a [Code For Boulder](https://www.codeforboulder.org) project.

![Project Organization Diagram](./upswyng-project-layout.svg)

UpSwyng is a monorepo managed with [Yarn Workspaces](https://classic.yarnpkg.com/en/docs/workspaces/). It consists of five packages all in the `packages` directory: `upswyng-core` contains common libraries and utilities used across the other packages. `upswyng-types` holds the TypeScript definitions used across the project. `upswyng-server` is a [Sapper](https://sapper.svelte.dev/) application with two parts: an API server which provides data to the UpSwyng clients, and an admin web interface which uses the [Svelte](https://svelte.dev/) framework to create and modify data for the project. `upswyng-web` contains the [React](https://reactjs.org/) web client, and `upswyng-native` contains a work-in-progress [React Native](https://facebook.github.io/react-native/) cleint.
UpSwyng is a monorepo managed with [Yarn Workspaces](https://classic.yarnpkg.com/en/docs/workspaces/). It consists of five
packages all in the `packages` directory: `common` contains common libraries and utilities used across the other packages.
`types` holds the TypeScript definitions used across the project. `server` is a [Sapper](https://sapper.svelte.dev/)
application with two parts: an API server which provides data to the UpSwyng clients, and an admin web interface which uses
the [Svelte](https://svelte.dev/) framework to create and modify data for the project. `web` contains the
[React](https://reactjs.org/) web client, and `native` contains a work-in-progress
[React Native](https://facebook.github.io/react-native/) cleint.

## Working With Yarn Workspaces

To run a command in a specific package, use the `yarn workspace` command from the project root.
For example, to start the web package development server run:

```console
yarn workspace @upswyng/upswyng-web start
yarn workspace @upswyng/web start
```

To run the same command in _all_ workspaces, use `yarn workspaces`. For instance, to run `test` in all packages use:
Expand All @@ -33,14 +39,15 @@ yarn workspaces test
> or `.profile` to save time:
>
> ```console
> alias @uw="yarn workspace @upswyng/upswyng-web "
> alias @uw="yarn workspace @upswyng/web "
> ```
>
> Now you only need `@uw start` to start the web dev server.
## Getting Started
Install the Yarn package manager by following the instructions at [https://yarnpkg.com/lang/en/docs/install](https://yarnpkg.com/lang/en/docs/install)
Install the Yarn package manager by following the instructions at
[https://yarnpkg.com/lang/en/docs/install](https://yarnpkg.com/lang/en/docs/install)
Next, clone the repo:
Expand All @@ -60,9 +67,10 @@ and install the project dependencies by running
yarn
```
Note: the above command may fail if your `node` version is not 12.14.x. [nvm](https://itnext.io/nvm-the-easiest-way-to-switch-node-js-environments-on-your-machine-in-a-flash-17babb7d5f1b#d594) is one solution (among others) to manage `node` versions precisely.
Note: the above command may fail if your `node` version is not 12.14.x. [nvm](https://itnext.io/nvm-the-easiest-way-to-switch-node-js-environments-on-your-machine-in-a-flash-17babb7d5f1b#d594) is one solution
(among others) to manage `node` versions precisely.
Next, try starting up a development client by running `yarn workspace @upswyng/upswyng-web start`.
Next, try starting up a development client by running `yarn workspace @upswyng/web start`.
### Development Ports
Expand All @@ -75,12 +83,12 @@ Next, try starting up a development client by running `yarn workspace @upswyng/u
#### Type Errors
The packages `upswyng-native`, `upswyng-server`, and `upswyng-web` depend on `upswyng-core` and `upswyng-types`. If you edit
`upswyng-core` or `upswyng-types`, or pull a new commit which contains edits to those packages, they need to be rebuilt.
The packages `native`, `server`, and `web` depend on `common` and `types`. If you edit
`common` or `types`, or pull a new commit which contains edits to those packages, they need to be rebuilt.
If you do not rebuild, you may see a type error like:
```
upswyng/packages/upswyng-server/src/utility/slackbot.ts(76,23): semantic error TS2551:
upswyng/packages/server/src/utility/slackbot.ts(76,23): semantic error TS2551:
Property 'DraftApproved' does not exist on type '{ alert_live: any; draft_approved: any;
draft_created: any; draft_deleted: any; resource_issue_reopened: any; resource_issue_resolved: any;
user_permission_changed: any; }'. Did you mean 'draft_approved'?
Expand All @@ -94,35 +102,42 @@ yarn build:local-packages
### Next Steps
`cd` into the package you're interested in working on and run the appropriate script. Visit each package's `README` for more information about environment setup, scripts, and more.
`cd` into the package you're interested in working on and run the appropriate script. Visit each package's `README` for more
information about environment setup, scripts, and more.
## Contributing
Before contributing, please review and abide by the [code of conduct](CODE_OF_CONDUCT.md).
### 1. Find an Issue Pending Development, Needing Help, or Asking a Question
Want to develop? All issues that have been approved for development, but have not been started will be labelled as **Status: Pending**.
Want to develop? All issues that have been approved for development, but have not been started will be labelled
as **Status: Pending**.
We'd love your input on possible new features. Some issues aren't ready for development and won't have a status label. These issues may need more input before being approved and instead be labelled **Type: Help Wanted**.
We'd love your input on possible new features. Some issues aren't ready for development and won't have a status label.
These issues may need more input before being approved and instead be labelled **Type: Help Wanted**.
Maybe you have the answer to someone's question. Look through any issues labelled with **Type: Help Wanted** and comment with your answer.
### 2. Work on an Issue
Once you have have found an issue you feel comfortable working on, request to work on the issue and we'll label the issue as **Status: In Progress** to make sure others don't work on it as well.
Once you have have found an issue you feel comfortable working on, request to work on the issue and we'll label the issue
as **Status: In Progress** to make sure others don't work on it as well.
Then, create a new branch off the current `master`.
#### Branch Naming
All feature branch names should briefly describe what the branch addresses using [kebab-case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
All feature branch names should briefly describe what the branch addresses using
[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
For example, if you wanted to create a branch that update the way a service was displayed, you could name the branch **`update-service-display`**.
For example, if you wanted to create a branch that update the way a service was displayed, you could name the
branch **`update-service-display`**.
### 3. Create a Pull Request (PR)
Once you believe your feature is ready for production, create a PR and reference what issue this addresses in the PR's description.
Once you believe your feature is ready for production, create a PR and reference what issue this addresses in the PR's
description.
If there any updates requested, please make those updates on your local branch and re-push that branch to the repository.
Expand Down
8 changes: 4 additions & 4 deletions clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const fs = require("fs");
const glob = require("glob");

const foldersToDelete = [
"./packages/upswyng-types/dist",
"./packages/upswyng-core/dist",
"./packages/upswyng-server/__build__",
"./packages/upswyng-web/build",
"./packages/types/dist",
"./packages/common/dist",
"./packages/server/__build__",
"./packages/web/build",
];

const globsToDelete = ["./packages/**/tsconfig*.tsbuildinfo"];
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@
"name": "upswyng",
"private": true,
"scripts": {
"build:local-packages": "yarn workspace @upswyng/upswyng-types build && yarn workspace @upswyng/upswyng-core build",
"build:server": "yarn build:local-packages && yarn workspace @upswyng/upswyng-server build",
"build:web": "yarn build:local-packages && yarn workspace @upswyng/upswyng-web build",
"build:local-packages": "yarn workspace @upswyng/types build && yarn workspace @upswyng/common build",
"build:server": "yarn build:local-packages && yarn workspace @upswyng/server build",
"build:web": "yarn build:local-packages && yarn workspace @upswyng/web build",
"clean": "node clean.js",
"heroku-postbuild": "yarn workspace @upswyng/upswyng-core build && yarn workspace @upswyng/upswyng-server build",
"lint": "tsc --noEmit && eslint \"packages/upswyng-*/src/**/*.{js,jsx,ts,tsx}\" --fix",
"lint:ci": "tsc --noEmit && eslint \"packages/upswyng-*/src/**/*.{js,jsx,ts,tsx}\" --quiet",
"test": "concurrently -n core,server,web -c yellow,blue,cyan \"yarn workspace @upswyng/upswyng-core test\" \"yarn workspace @upswyng/upswyng-server test\" \"yarn workspace @upswyng/upswyng-web test\"",
"heroku-postbuild": "yarn workspace @upswyng/common build && yarn workspace @upswyng/server build",
"lint": "tsc --noEmit && eslint \"packages/**/src/**/*.{js,jsx,ts,tsx}\" --fix",
"lint:ci": "tsc --noEmit && eslint \"packages/**/src/**/*.{js,jsx,ts,tsx}\" --quiet",
"test": "concurrently -n common,server,web -c yellow,blue,cyan \"yarn workspace @upswyng/common test\" \"yarn workspace @upswyng/server test\" \"yarn workspace @upswyng/web test\"",
"test:ci": "yarn test --kill-others-on-fail"
},
"version": "0.1.0",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"author": "",
"dependencies": {
"bson": "^4.0.2",
"moment-timezone": "^0.5.27",
"rrule": "^2.6.2"
},
"description": "Core libraries and utilities used across the project",
"description": "Common libraries and utilities used across the project",
"devDependencies": {
"@rollup/plugin-commonjs": "11.0.2",
"@rollup/plugin-json": "^4.0.1",
Expand All @@ -21,7 +20,7 @@
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.es.js",
"name": "@upswyng/upswyng-core",
"name": "@upswyng/common",
"scripts": {
"build": "rollup --config",
"test": "jest"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
TResourceScheduleData,
TScheduleItemOpenClose,
TTimezoneName,
} from "@upswyng/upswyng-types";
} from "@upswyng/types";

import Time from "./Time";
import moment from "moment";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"include": ["src"],
"references": [
{
"path": "../upswyng-types/tsconfig.build.json"
"path": "../types/tsconfig.build.json"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit cf34b32

Please sign in to comment.