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

feat: add template support, teardown & standalone #23117

Merged
merged 5 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 3 additions & 1 deletion npm/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/index.js",
"scripts": {
"prebuild": "rimraf dist",
"build": "tsc || echo 'built, with type errors'",
"build": "rollup -c rollup.config.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paired with Jordan on this, we fixed the Angular cleanup and needed to add @cypress/mount-utils for the cleanup. We needed to revert back to rollup so that the @cypress/mount-utils was internalized.

"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"check-ts": "tsc --noEmit"
Expand All @@ -15,6 +15,8 @@
"@angular/common": "^14.0.6",
"@angular/core": "^14.0.6",
"@angular/platform-browser-dynamic": "^14.0.6",
"@rollup/plugin-node-resolve": "^11.1.1",
"rollup-plugin-typescript2": "^0.29.0",
"typescript": "~4.2.3",
"zone.js": "~0.11.4"
},
Expand Down
61 changes: 61 additions & 0 deletions npm/angular/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import ts from 'rollup-plugin-typescript2'
import resolve from '@rollup/plugin-node-resolve'

import pkg from './package.json'

const banner = `
/**
* ${pkg.name} v${pkg.version}
* (c) ${new Date().getFullYear()} Cypress.io
* Released under the MIT License
*/
`

function createEntry () {
const input = 'src/index.ts'
const format = 'es'

const config = {
input,
external: [
'@angular/core',
'@angular/core/testing',
'@angular/common',
'@angular/platform-browser-dynamic/testing',
'zone.js',
'zone.js/testing',
],
plugins: [
resolve(),
],
output: {
banner,
name: 'CypressAngular',
file: pkg.module,
format,
exports: 'auto',
},
}

console.log(`Building ${format}: ${config.output.file}`)

config.plugins.push(
ts({
check: true,
tsconfigOverride: {
compilerOptions: {
declaration: true,
target: 'es6', // not sure what this should be?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we still unsure about this? What additional investigation is needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked into it, es5 or es6 is probably fine, we should update this - and also use a single common file for rollup config.

module: 'esnext',
},
exclude: [],
},
}),
)

return config
}

export default [
createEntry(),
]
Loading