Skip to content

Commit cde0652

Browse files
Merge branch 'main' into export-lodash-intersection-function
2 parents 0b27666 + 8ca5c8d commit cde0652

57 files changed

Lines changed: 5138 additions & 638 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ web_modules/
8282
# Nuxt.js build / generate output
8383
.nuxt
8484
dist
85+
dist-global
8586

8687
# Gatsby files
8788
.cache/

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ before_script:
99
script:
1010
- npm run build
1111
- npm run coverage
12+
- npm run test-cypress
1213
- codecov --disable=gcov
1314
notifications:
1415
slack:

.vscode/settings.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414
"csharp.format.enable": true,
1515
"editor.defaultFormatter": "esbenp.prettier-vscode",
1616
"editor.formatOnSave": true,
17-
"editor.rulers": [100],
17+
"editor.rulers": [
18+
100
19+
],
1820
"json.schemas": [
1921
{
20-
"fileMatch": ["cypress.json"],
22+
"fileMatch": [
23+
"cypress.json"
24+
],
2125
"url": "https://on.cypress.io/cypress.schema.json"
2226
}
2327
],
2428
"prettier.requireConfig": true,
2529
"trailing-spaces.trimOnSave": true,
2630
"typescript.preferences.quoteStyle": "double",
27-
"typescript.tsdk": "./frontend/node_modules/typescript/lib"
28-
}
31+
"typescript.tsdk": "./node_modules/typescript/lib"
32+
}

CONTRIBUTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
# How to Contribute
22

3-
Information on contributing to this repo is in the [Contributing Guide](https://github.com/AndcultureCode/AndcultureCode/blob/master/CONTRIBUTING.md) in the Home repo.
3+
## Considerations
4+
This repo is now distributing packages for both module loaded applications as well as global distribution for things such as websites. What this means is:
5+
6+
1. When adding new peer dependencies to this repo, please account for them in one of the following ways:
7+
- Bundle the dependency as part of this package. Add these dependencies by updating [dependency-externals.json](./dependency-externals.json).
8+
- Externalize the dependency. This forces the consumer to reference the dependency using `<script />` tags. Add these dependencies by updating [dependency-bundles.json](./dependency-bundles.json).
9+
2. When adding new external peer dependencies, please make sure to perform the following:
10+
- Add any new needed `<script />` peer dependency references to [test-global-distribution.html](./test-global-distribution.html). Please use a reliable CDN such as https://unpkg.com or https://cdnjs.cloudflare.com.
11+
- Add a small, quick example to test that peer dependency within [test-global-distribution.html](./test-global-distribution.html). You will need to run `npm run build` in order to regenerate the global package beforehand. Open up the HTML file in your browser and validate there are no javascript errors.
12+
3. We need to be careful of loosely adding new peer dependencies to this repo. Adding new peer dependencies to this repo means that the global package will slowly but surely increase in size with peer dependency code (if bundling) OR force consumers to pre-load the peer dependencies (if excluding from bundling). Neither of these approaches are ideal. When considering a new peer dependency, please consider adding an issue to the repo before hand so others can be involved early in the process.
13+
14+
### Automated Testing
15+
16+
This repo uses a simple Cypress test to open and test [test-global-distribution.html](./test-global-distribution.html) to validate there are no javascript errors. Also, any unhandled dependencies within `package.json/dependencies` will throw errors during the build process. Make sure you add them either as externals or bundles to prevent these build errors.
17+
18+
Additional information on contributing to this repo is in the [Contributing Guide](https://github.com/AndcultureCode/AndcultureCode/blob/master/CONTRIBUTING.md) in the Home repo.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ import {
2626
} from "andculturecode-javascript-core";
2727
```
2828

29+
You can also reference the global distribution package within a website which gives you access to the `AndcultureCode` namespace. See the example below
30+
31+
```html
32+
<script src="https://unpkg.com/browse/andculturecode-javascript-core@[version-number]/dist/global/index.js"></script>
33+
34+
<script>
35+
var myAuthObject = AndcultureCode.RouteUtils.queryStringToObject('#token=bada55cafe')
36+
</script>
37+
38+
```
39+
40+
**NOTE** - This source code relies on several peer dependencies, most of which are not included in this bundled global distribution. You will likely want to reference these in your website prior to referencing the `andculture-javascript-core` global package. See [test-global-distribution.html](./test-global-distribution.html) for the full list of dependencies. Also note that peer dependencies are only required if your code will be executing code paths that utilize any of those peer dependencies.
41+
2942
## Documentation
3043

3144
[Full API documentation](docs/README.md)

cypress.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"video": false
3+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference types="cypress" />
2+
3+
context('test-global-distribution.html', () => {
4+
it('when visiting then does not throw any errors', () => {
5+
6+
/*
7+
The following will load the given HTML file, read in any external dependencies via script
8+
tags, and proceed to execute various code paths to validate those external dependencies are
9+
properly loaded.
10+
*/
11+
12+
// Arrange, Act, Assert
13+
cy.visit('test-global-distribution.html');
14+
})
15+
})

cypress/plugins/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************************
3+
// This example plugins/index.js can be used to load plugins
4+
//
5+
// You can change the location of this file or turn off loading
6+
// the plugins file with the 'pluginsFile' configuration option.
7+
//
8+
// You can read more here:
9+
// https://on.cypress.io/plugins-guide
10+
// ***********************************************************
11+
12+
// This function is called when a project is opened or re-opened (e.g. due to
13+
// the project's config changing)
14+
15+
/**
16+
* @type {Cypress.PluginConfig}
17+
*/
18+
module.exports = (on, config) => {
19+
// `on` is used to hook into various events Cypress emits
20+
// `config` is the resolved Cypress config
21+
}

cypress/support/commands.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add("login", (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

cypress/support/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

0 commit comments

Comments
 (0)