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

ignore unused inputs when checking validity and change build process #90

Merged
merged 6 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-shadow": ["error", { builtinGlobals: false, hoist: "all", allow: [] }],
"@typescript-eslint/no-unused-vars": ["warn", { args: "none", ignoreRestSiblings: true }],
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/no-var-requires": "off",
"curly": ["error", "multi-line", "consistent"],
"dot-notation": "error",
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
coverage
coverage-cypress
cypress/screenshots
dist
node_modules
npm-error.log
Expand Down
99 changes: 70 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Quantity Playground
# Quantity Playground (aka Diagram View)

## Development

Expand All @@ -19,17 +19,14 @@ Additional steps are required to run using HTTPS.
5. Run `npm run start:secure` to run `webpack-dev-server` in development mode with hot module replacement

Alternately, you can run secure without certificates in Chrome:

1. Enter `chrome://flags/#allow-insecure-localhost` in Chrome URL bar
2. Change flag from disabled to enabled
3. Run `npm run start:secure:no-certs` to run `webpack-dev-server` in development mode with hot module replacement

### Testing in CLUE and other projects

The diagram-view is used in CLUE in the diagram tile, and possibly other projects as well. As you're making changes to this library, it can be helpful to test those changes within client projects without deploying. For more on this, see README.md in the diagram-view directory.

### Building

If you want to build a local version run `npm build`, it will create the files in the `dist` folder.
If you want to build a local version run `npm run build`, it will create the files in the `dist` folder.
You *do not* need to build to deploy the code, that is automatic. See more info in the Deployment section below.

### Notes
Expand All @@ -38,15 +35,64 @@ You *do not* need to build to deploy the code, that is automatic. See more info
To ensure that you are open a TypeScript file in VSC and then click on the version number next to
`TypeScript React` in the status bar and select 'Use Workspace Version' in the popup menu.

## Testing

### Jest

Run `npm test` to run jest tests.

### Cypress

Run `npm run test:full` to run jest and Cypress tests.

#### Cypress Run Options

Inside of your `package.json` file:

1. `--browser browser-name`: define browser for running tests
2. `--group group-name`: assign a group name for tests running
3. `--spec`: define the spec files to run
4. `--headed`: show cypress test runner GUI while running test (will exit by default when done)
5. `--no-exit`: keep cypress test runner GUI open when done running
6. `--record`: decide whether or not tests will have video recordings
7. `--key`: specify your secret record key
8. `--reporter`: specify a mocha reporter

#### Cypress Run Examples

1. `cypress run --browser chrome` will run cypress in a chrome browser
2. `cypress run --headed --no-exit` will open cypress test runner when tests begin to run, and it will remain open when tests are finished running.
3. `cypress run --spec 'cypress/integration/examples/smoke-test.js'` will point to a smoke-test file rather than running all of the test files for a project.

### Testing in CLUE and other projects

The diagram-view is used in CLUE in the diagram tile, and possibly other projects as well. As you're making changes to this library, it can be helpful to test those changes within client projects without deploying. This can be done with yalc.

[yalc](https://www.npmjs.com/package/yalc) provides an alternative to `npm link`. It acts as a very simple local repository for locally developed packages that can be shared across a local environment. It provides a better workflow than `npm | yarn link` for package authors. There are scripts in package.json to make this easier.

To publish an in-development version of the diagram-view library, run:

`npm run yalc:publish`

To consume an in-development version of the diagram-view library, in the root directory of the client project:

`npx yalc add @concord-consortium/diagram-view`

To update all clients that are using the in-development version of diagram-view, in the diagram-view project:

`npm run yalc:publish`

`yalc` modifies the `package.json` of the client project with a link to the local `yalc` repository. _This is a good thing!_ as it makes it obvious when you're using an in-development version of a library and serves as a reminder to install a fully published version before pushing to GitHub, etc. It also means that running `npm install` in the client project will not break the setup.

## Deployment

Production releases to S3 are based on the contents of the /dist folder and are built automatically by GitHub Actions
for each branch and tag pushed to GitHub.

Branches are deployed to https://models-resources.concord.org/quantity-playground/branch/<name>.
Branches are deployed to <https://models-resources.concord.org/quantity-playground/branch/{name}>.
If the branch name starts or ends with a number this number is stripped off.

Tags are deployed to http://models-resources.concord.org/quantity-playground/version/<name>.
Tags are deployed to <http://models-resources.concord.org/quantity-playground/version/{name}>.

To deploy a production release:

Expand All @@ -66,27 +112,22 @@ To deploy a production release:
3. Type in the tag name you want to release for example `v1.2.3`. (Note this won't work until the PR has been merged to master)
4. Click the `Run Workflow` button.

### Testing

Run `npm test` to run jest tests. Run `npm run test:full` to run jest and Cypress tests.

##### Cypress Run Options

Inside of your `package.json` file:
1. `--browser browser-name`: define browser for running tests
2. `--group group-name`: assign a group name for tests running
3. `--spec`: define the spec files to run
4. `--headed`: show cypress test runner GUI while running test (will exit by default when done)
5. `--no-exit`: keep cypress test runner GUI open when done running
6. `--record`: decide whether or not tests will have video recordings
7. `--key`: specify your secret record key
8. `--reporter`: specify a mocha reporter

##### Cypress Run Examples

1. `cypress run --browser chrome` will run cypress in a chrome browser
2. `cypress run --headed --no-exit` will open cypress test runner when tests begin to run, and it will remain open when tests are finished running.
3. `cypress run --spec 'cypress/integration/examples/smoke-test.js'` will point to a smoke-test file rather than running all of the test files for a project.
## Publishing the library to NPM

1. Update the version number in `package.json` and `package-lock.json`
- `npm version --no-git-tag-version [patch|minor|major]`
1. Verify that everything builds correctly
- `npm run lint && npm run test && npm run tsc`
1. Commit and push the changes either directly or via GitHub pull request
1. Create/push a tag for the new version (e.g. v0.5.0) and a description (e.g. Release 0.5.0)
- This can be done in a local git client or on the releases page of the GitHub repository
1. Publish new release on releases page of GitHub repository
1. Test a dry-run of publishing the package to the npm repository
- `npm run publish:test`
1. Publish the package to the npm repository
- `npm run publish`

The updates should show up on NPM at <https://www.npmjs.com/package/@concord-consortium/diagram-view> .

## License

Expand Down
38 changes: 0 additions & 38 deletions diagram-view/README.md

This file was deleted.

Loading
Loading