Skip to content

Commit 41f0852

Browse files
committed
Merge branch 'feature/dnd-mx9-upgrade-and-a11y' into develop
2 parents 9a142eb + 4e06de7 commit 41f0852

25 files changed

+14700
-20878
lines changed

lerna-debug.log

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
0 silly argv {
2-
0 silly argv _: [ 'add' ],
3-
0 silly argv scope: 'draganddropwidget',
4-
0 silly argv globs: [],
2+
0 silly argv _: [ 'version' ],
3+
0 silly argv yes: true,
4+
0 silly argv y: true,
5+
0 silly argv 'conventional-commits': true,
6+
0 silly argv conventionalCommits: true,
7+
0 silly argv 'create-release': 'github',
8+
0 silly argv createRelease: 'github',
9+
0 silly argv message: 'chore(release): publish',
10+
0 silly argv m: 'chore(release): publish',
511
0 silly argv lernaVersion: '4.0.0',
6-
0 silly argv '$0': '/Users/ahwelgemoed/Documents/repos/app-services-components/node_modules/.bin/lerna',
7-
0 silly argv pkg: '@app-services-components/usedomlocation'
12+
0 silly argv '$0': 'node_modules/.bin/lerna'
813
0 silly argv }
914
1 notice cli v4.0.0
1015
2 verbose rootPath /Users/ahwelgemoed/Documents/repos/app-services-components
11-
3 info versioning independent
12-
4 error Error: 404 Not Found - GET https://registry.npmjs.org/@app-services-components%2fusedomlocation - Not found
13-
4 error at /Users/ahwelgemoed/Documents/repos/app-services-components/node_modules/npm-registry-fetch/check-response.js:123:15
16+
3 silly createGitHubClient
17+
4 error Error: A GH_TOKEN environment variable is required.
18+
4 error at createGitHubClient (/Users/ahwelgemoed/Documents/repos/app-services-components/node_modules/@lerna/github-client/lib/github-client.js:17:11)
19+
4 error at createReleaseClient (/Users/ahwelgemoed/Documents/repos/app-services-components/node_modules/@lerna/version/lib/create-release.js:20:14)
20+
4 error at VersionCommand.configureProperties (/Users/ahwelgemoed/Documents/repos/app-services-components/node_modules/@lerna/version/index.js:80:58)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
on: [push]
3+
jobs:
4+
build:
5+
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
6+
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
node: ['10.x', '12.x', '14.x']
11+
os: [ubuntu-latest, windows-latest, macOS-latest]
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v2
16+
17+
- name: Use Node ${{ matrix.node }}
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: ${{ matrix.node }}
21+
22+
- name: Install deps and build (with cache)
23+
uses: bahmutov/npm-install@v1
24+
25+
- name: Lint
26+
run: yarn lint
27+
28+
- name: Test
29+
run: yarn test --ci --coverage --maxWorkers=2
30+
31+
- name: Build
32+
run: yarn build
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: size
2+
on: [pull_request]
3+
jobs:
4+
size:
5+
runs-on: ubuntu-latest
6+
env:
7+
CI_JOB_NUMBER: 1
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: andresz1/size-limit-action@v1
11+
with:
12+
github_token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.log
2+
.DS_Store
3+
node_modules
4+
dist
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 ahwelgemoed
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# TSDX User Guide
2+
3+
Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
4+
5+
> This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`.
6+
7+
> If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript)
8+
9+
## Commands
10+
11+
TSDX scaffolds your new library inside `/src`.
12+
13+
To run TSDX, use:
14+
15+
```bash
16+
npm start # or yarn start
17+
```
18+
19+
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
20+
21+
To do a one-off build, use `npm run build` or `yarn build`.
22+
23+
To run tests, use `npm test` or `yarn test`.
24+
25+
## Configuration
26+
27+
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
28+
29+
### Jest
30+
31+
Jest tests are set up to run with `npm test` or `yarn test`.
32+
33+
### Bundle Analysis
34+
35+
[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.
36+
37+
#### Setup Files
38+
39+
This is the folder structure we set up for you:
40+
41+
```txt
42+
/src
43+
index.tsx # EDIT THIS
44+
/test
45+
blah.test.tsx # EDIT THIS
46+
.gitignore
47+
package.json
48+
README.md # EDIT THIS
49+
tsconfig.json
50+
```
51+
52+
### Rollup
53+
54+
TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
55+
56+
### TypeScript
57+
58+
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
59+
60+
## Continuous Integration
61+
62+
### GitHub Actions
63+
64+
Two actions are added by default:
65+
66+
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
67+
- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)
68+
69+
## Optimizations
70+
71+
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
72+
73+
```js
74+
// ./types/index.d.ts
75+
declare var __DEV__: boolean;
76+
77+
// inside your code...
78+
if (__DEV__) {
79+
console.log('foo');
80+
}
81+
```
82+
83+
You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
84+
85+
## Module Formats
86+
87+
CJS, ESModules, and UMD module formats are supported.
88+
89+
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
90+
91+
## Named Exports
92+
93+
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
94+
95+
## Including Styles
96+
97+
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
98+
99+
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
100+
101+
## Publishing to NPM
102+
103+
We recommend using [np](https://github.com/sindresorhus/np).
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"version": "0.1.0",
3+
"license": "MIT",
4+
"main": "dist/index.js",
5+
"typings": "dist/index.d.ts",
6+
"files": [
7+
"dist",
8+
"src"
9+
],
10+
"engines": {
11+
"node": ">=10"
12+
},
13+
"scripts": {
14+
"start": "tsdx watch",
15+
"build": "tsdx build",
16+
"test": "tsdx test",
17+
"lint": "tsdx lint",
18+
"prepare": "tsdx build",
19+
"size": "size-limit",
20+
"analyze": "size-limit --why"
21+
},
22+
"peerDependencies": {},
23+
"husky": {
24+
"hooks": {
25+
"pre-commit": "tsdx lint"
26+
}
27+
},
28+
"prettier": {
29+
"printWidth": 80,
30+
"semi": true,
31+
"singleQuote": true,
32+
"trailingComma": "es5"
33+
},
34+
"name": "@app-services-components/mendixhelpers",
35+
"author": "ahwelgemoed",
36+
"module": "dist/mendixhelpers.esm.js",
37+
"size-limit": [
38+
{
39+
"path": "dist/mendixhelpers.cjs.production.min.js",
40+
"limit": "10 KB"
41+
},
42+
{
43+
"path": "dist/mendixhelpers.esm.js",
44+
"limit": "10 KB"
45+
}
46+
],
47+
"devDependencies": {
48+
"@size-limit/preset-small-lib": "^5.0.1",
49+
"husky": "^7.0.1",
50+
"size-limit": "^5.0.1",
51+
"tsdx": "^0.14.1",
52+
"tslib": "^2.3.0",
53+
"typescript": "^4.3.5"
54+
},
55+
"dependencies": {
56+
"@types/semver": "^7.3.7",
57+
"semver": "^7.3.5"
58+
}
59+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import semver, { SemVer } from 'semver';
2+
interface CompareMedixVersion {
3+
minVersion: string;
4+
}
5+
export const greaterOrEqualToMendixVersion = ({
6+
minVersion,
7+
}: CompareMedixVersion): boolean => {
8+
const mxWindow = (window as any).mx;
9+
const parsedWindowsVersion = semver.valid(semver.coerce(mxWindow.version));
10+
const parsedMinVersion = semver.minVersion(minVersion);
11+
12+
const comparedVersion = semver.gte(
13+
parsedMinVersion as SemVer,
14+
parsedWindowsVersion as string
15+
);
16+
return comparedVersion;
17+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { sum } from '../src';
2+
3+
describe('blah', () => {
4+
it('works', () => {
5+
expect(sum(1, 1)).toEqual(2);
6+
});
7+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
3+
"include": ["src", "types"],
4+
"compilerOptions": {
5+
"module": "esnext",
6+
"lib": ["dom", "esnext"],
7+
"importHelpers": true,
8+
// output .d.ts declaration files for consumers
9+
"declaration": true,
10+
// output .js.map sourcemap files for consumers
11+
"sourceMap": true,
12+
// match output dir to input dir. e.g. dist/index instead of dist/src/index
13+
"rootDir": "./src",
14+
// stricter type-checking for stronger correctness. Recommended by TS
15+
"strict": true,
16+
// linter checks for common issues
17+
"noImplicitReturns": true,
18+
"noFallthroughCasesInSwitch": true,
19+
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
20+
"noUnusedLocals": true,
21+
"noUnusedParameters": true,
22+
// use Node's module resolution algorithm, instead of the legacy TS one
23+
"moduleResolution": "node",
24+
// transpile JSX to React.createElement
25+
"jsx": "react",
26+
// interop between ESM and CJS modules. Recommended by TS
27+
"esModuleInterop": true,
28+
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
29+
"skipLibCheck": true,
30+
// error out if import and file system have a casing mismatch. Recommended by TS
31+
"forceConsistentCasingInFileNames": true,
32+
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
33+
"noEmit": true,
34+
}
35+
}

0 commit comments

Comments
 (0)