Skip to content

Commit

Permalink
Merge branch 'develop' into TR-701-run-events-interactive-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbreiding authored Apr 12, 2021
2 parents e3ea748 + dde2f22 commit 39c5a5a
Show file tree
Hide file tree
Showing 173 changed files with 11,284 additions and 5,324 deletions.
16 changes: 2 additions & 14 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1102,15 +1102,6 @@ jobs:
path: /tmp/artifacts
- store-npm-logs

run-launcher:
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: node index.js
working_directory: packages/launcher

npm-webpack-preprocessor:
<<: *defaults
steps:
Expand Down Expand Up @@ -1192,6 +1183,7 @@ jobs:

npm-vue:
<<: *defaults
parallelism: 3
steps:
- attach_workspace:
at: ~/
Expand All @@ -1200,7 +1192,7 @@ jobs:
command: yarn workspace @cypress/vue build
- run:
name: Run tests
command: yarn test --reporter cypress-circleci-reporter --reporter-options resultsDir=./test_results
command: yarn test-ci
working_directory: npm/vue
- store_test_results:
path: npm/vue/test_results
Expand Down Expand Up @@ -1846,9 +1838,6 @@ linux-workflow: &linux-workflow
- ui-components-integration-tests:
requires:
- build
- run-launcher:
requires:
- build

- npm-webpack-dev-server:
requires:
Expand Down Expand Up @@ -1898,7 +1887,6 @@ linux-workflow: &linux-workflow
- npm-rollup-dev-server
# - npm-vite-dev-server
- npm-webpack-dev-server
- run-launcher
- ui-components-integration-tests
- reporter-integration-tests
- Linux lint
Expand Down
2 changes: 1 addition & 1 deletion npm/create-cypress-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"mock-fs": "4.13.0",
"shx": "0.3.3",
"snap-shot-it": "7.9.3",
"typescript": "4.0.3"
"typescript": "^4.2.3"
},
"bin": {
"create-cypress-tests": "dist/src/index.js"
Expand Down
8 changes: 6 additions & 2 deletions npm/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@
"rollup-plugin-postcss-modules": "2.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"sass": "1.32.8",
"typescript": "4.0.3",
"vite": "2.1.3"
"sass-loader": "10.1.1",
"style-loader": "0.23.1",
"svg-url-loader": "3.0.3",
"typescript": "^4.2.3",
"vite": "2.1.3",
"webpack": "4.44.1"
},
"peerDependencies": {
"react": "^=16.x || ^=17.x",
Expand Down
25 changes: 25 additions & 0 deletions npm/lazy-compile-webpack-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

/demo
6 changes: 6 additions & 0 deletions npm/lazy-compile-webpack-plugin/.releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
...require('../../.releaserc.base'),
branches: [
{ name: 'master', channel: 'latest' },
],
}
21 changes: 21 additions & 0 deletions npm/lazy-compile-webpack-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 X.L

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions npm/lazy-compile-webpack-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<div align="center">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
<h1>Lazy Compile Webpack Plugin</h1>
<p>Plugin that saves a tremendous amount of time.</p>
</div>

## Fork from https://github.com/liximomo/lazy-compile-webpack-plugin/

To enable windows compatibility we forked this repo and fixed the windows issue.

## Why

Starting the development server is taking you a long time when the codebase is large. You have tried dynamic imports, it only does a load-on-demand, the whole project was still been compiled. We don't want to wait a couple of minutes for a simple modification. People don't waste time for the things they have never used!

## Install

```sh
# npm
npm i -D lazy-compile-webpack-plugin

# yarn
yarn add -D lazy-compile-webpack-plugin
```

## Usage

```js
const LazyCompilePlugin = require('lazy-compile-webpack-plugin');

module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
},
plugins: [new LazyCompilePlugin()],
};
```

## Options

| Name | Type | Default | Description |
| :-----------------------------------------------: | :---------------------: | :---------: | :------------------------------------------------------- |
| **[`refreshAfterCompile`](#refreshAfterCompile)** | `boolean` | `false` | Enable/Disable _page refresh_ when compilation is finish |
| **[`ignores`](#ignores)** | `RegExp[] \| Function[]` | `undefined` | Request to be ignored from lazy compiler |

### `refreshAfterCompile`

Type: `boolean`
Default: `false`

Set `false` for a seamless dev experience.

### `ignores`

Type: `RegExp[] | ((request: string, wpModule: object) => boolean)`
Default: `undefined`

Request to be ignored from lazy compiler, `html-webpack-plugin` is always ignored.

Specifically, an Angular app should enable this option like following:

```js
new LazyCompileWebpackPlugin({
ignores: [
/\b(html|raw|to-string)-loader\b/,
/\bexports-loader[^?]*\?exports\.toString\(\)/
],
});
```
1 change: 1 addition & 0 deletions npm/lazy-compile-webpack-plugin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./lib/plugin')
71 changes: 71 additions & 0 deletions npm/lazy-compile-webpack-plugin/lib/loaders/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/* eslint-env browser */
let isBrowser = typeof window !== 'undefined'

let GLOBAL_ANIMATION_KEY = '__lazyCompileWebpackPlugin'

function noop () {}

// modified from https://matthewrayfield.com/articles/animating-urls-with-javascript-and-emojis
let figures = [
'🕐',
'🕑',
'🕒',
'🕓',
'🕔',
'🕕',
'🕖',
'🕗',
'🕘',
'🕙',
'🕚',
'🕛',
]

function startAnimation () {
if (!isBrowser) return noop

if (window[GLOBAL_ANIMATION_KEY]) return noop

window[GLOBAL_ANIMATION_KEY] = true

let originTitle = document.title

let loopHandle

function animatioLoop () {
loopHandle = setTimeout(animatioLoop, 50)
document.title =
`Compiling ${ figures[Math.floor((Date.now() / 100) % figures.length)]}`
}
animatioLoop()

return () => {
window[GLOBAL_ANIMATION_KEY] = false
clearTimeout(loopHandle)
document.title = originTitle
}
}

function compile (endpoints, activationUrl) {
let ready
let prom = new Promise((resolve) => {
ready = resolve
if (!isBrowser) return

endpoints.forEach(function (endpoint) {
let img = new Image()

img.src = activationUrl.replace('{host}', endpoint)
})
})

prom.ready = ready

return prom
}

module.exports = {
isBrowser,
startAnimation,
compile,
}
20 changes: 20 additions & 0 deletions npm/lazy-compile-webpack-plugin/lib/loaders/entry-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const path = require('path')
const loaderUtils = require('loader-utils')
const apiPath = path.join(__dirname, 'api.js')

module.exports = function () {
const { activationUrl, ips } = loaderUtils.getOptions(this) || {}

return `
// @activationUrl ${activationUrl}
var api = require(${loaderUtils.stringifyRequest(this, `!!${apiPath}`)});
api.compile(${JSON.stringify(ips)}, '${activationUrl}');
if (api.isBrowser) {
setTimeout(function () {
window.location.reload()
}, 0)
}
`.trim()
}
59 changes: 59 additions & 0 deletions npm/lazy-compile-webpack-plugin/lib/loaders/module-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const path = require('path')
const loaderUtils = require('loader-utils')
const apiPath = path.join(__dirname, 'api.js')

module.exports = function () {
const { activationUrl, ips, hmr } = loaderUtils.getOptions(this) || {}
const hmrCode = `
if (module.hot) {
module.hot.dispose(function() {
stopAnimation();
// wait for the module to install
setTimeout(() => {
// depressed warning: "unexpected require from disposed module"
module.hot.active = true;
compilation.ready(__webpack_require__(module.id));
module.hot.active = false;
}, 0);
});
module.hot.accept(function() {
// error handle
});
}
`.trim()

const refreshCode = `
window.onbeforeunload = function() {
stopAnimation();
}
`.trim()

return `
//############################ NOTICE ############################//
// //
// This is a placeholder module generated by //
// lazy-compile-webpack-plugin. //
// https://github.com/liximomo/lazy-compile-webpack-plugin //
// //
// The real content is in the corresponding hot-update file. //
// You won't see this after the page refresh. //
// //
//################################################################//
// @activationUrl ${activationUrl}
// modified from https://matthewrayfield.com/articles/animating-urls-with-javascript-and-emojis
var api = require(${loaderUtils.stringifyRequest(this, `!!${apiPath}`)});
var stopAnimation = api.startAnimation();
var compilation = api.compile(${JSON.stringify(ips)}, '${activationUrl}');
${hmr ? hmrCode : refreshCode}
module.exports = {
then(resolve) {
resolve(compilation)
}
}
`.trim()
}
Loading

0 comments on commit 39c5a5a

Please sign in to comment.