Skip to content
This repository was archived by the owner on Dec 12, 2020. It is now read-only.

Commit b436203

Browse files
authored
chore: use typescript to build this package (#349)
1 parent 76431d2 commit b436203

File tree

8 files changed

+69
-727
lines changed

8 files changed

+69
-727
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,13 +726,16 @@ If you want to disable code coverage instrumentation and reporting, use `--env c
726726

727727
## Development
728728

729-
To see all local tests, install dependencies and open Cypress in GUI mode
729+
To see all local tests, install dependencies, build the code and open Cypress in GUI mode
730730

731731
```sh
732732
npm install
733+
npm run build
733734
npm run cy:open
734735
```
735736

737+
The build is done using `tsc` that transpiles all files from [src](src) to `dist` folder.
738+
736739
### Debugging
737740

738741
Run Cypress with environment variable

cypress/plugins/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference types="cypress" />
2-
const preprocessor = require('../../plugins/webpack')
2+
const preprocessor = require('../../dist/plugins/webpack')
33
module.exports = (on, config) => {
44
preprocessor(on, config)
55
return config

package-lock.json

Lines changed: 6 additions & 721 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
"url": "https://github.com/bahmutov/cypress-vue-unit-test.git"
2626
},
2727
"scripts": {
28-
"build": "babel src --ignore src/*spec.js --out-dir dist && babel preprocessor --out-dir dist/preprocessor && babel plugins --out-dir dist/plugins",
28+
"build": "tsc",
29+
"build:watch": "tsc --watch",
2930
"ban": "ban",
3031
"deps": "echo skip deps-ok && dependency-check --no-dev .",
3132
"issues": "git-issues",
3233
"license": "license-checker --production --onlyunknown --csv",
33-
"lint": "prettier --check '*.js' 'cypress/**/*.js' 'src/**/*.js' 'preprocessor/**/*.js' 'plugins/**/*.js'",
34+
"lint": "prettier --check '*.js' 'cypress/**/*.js' 'src/**/*.js'",
3435
"prelint": "npm run pretty",
3536
"pretest": "npm run lint && npm run build",
36-
"pretty": "prettier --write '*.js' 'cypress/**/*.js' 'src/**/*.js' 'preprocessor/**/*.js' 'plugins/**/*.js'",
37+
"pretty": "prettier --write '*.js' 'cypress/**/*.js' 'src/**/*.js'",
3738
"size": "npm pack --dry",
3839
"test": "npm run cy:run",
3940
"unit": "mocha src/*-spec.js",
@@ -52,7 +53,6 @@
5253
]
5354
},
5455
"devDependencies": {
55-
"@babel/cli": "7.8.4",
5656
"@babel/core": "7.9.0",
5757
"@babel/preset-env": "7.9.5",
5858
"axios": "0.19.2",
@@ -68,6 +68,7 @@
6868
"prettier": "2.0.5",
6969
"semantic-release": "17.1.1",
7070
"tailwindcss": "1.1.4",
71+
"typescript": "3.9.6",
7172
"vue": "2.6.11",
7273
"vue-i18n": "7.8.1",
7374
"vue-loader": "15.9.3",
File renamed without changes.
File renamed without changes.
File renamed without changes.

tsconfig.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"compilerOptions": {
3+
/* Basic Options */
4+
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */,
5+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
6+
"skipLibCheck": true,
7+
"lib": [
8+
"es2015",
9+
"dom"
10+
] /* Specify library files to be included in the compilation: */,
11+
"allowJs": true /* Allow javascript files to be compiled. */,
12+
// "checkJs": true, /* Report errors in .js files. */
13+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
14+
// "declaration": true, /* Generates corresponding '.d.ts' file. */
15+
// "sourceMap": true, /* Generates corresponding '.map' file. */
16+
// "outFile": "./", /* Concatenate and emit output to single file. */
17+
"outDir": "dist" /* Redirect output structure to the directory. */,
18+
// "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19+
// "removeComments": true, /* Do not emit comments to output. */
20+
// "noEmit": true, /* Do not emit outputs. */
21+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
22+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
23+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
24+
25+
/* Strict Type-Checking Options */
26+
"strict": true /* Enable all strict type-checking options. */,
27+
28+
/* Module Resolution Options */
29+
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
30+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
31+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
32+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
33+
// "typeRoots": [], /* List of folders to include type definitions from. */
34+
"types": [
35+
"cypress"
36+
] /* Type declaration files to be included in compilation. */,
37+
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
38+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
39+
40+
/* Source Map Options */
41+
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
42+
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
43+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
44+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
45+
46+
/* Experimental Options */
47+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
48+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
49+
"esModuleInterop": true
50+
},
51+
"include": ["src/**/*.*"],
52+
"exclude": ["src/**/*-spec.*"]
53+
}

0 commit comments

Comments
 (0)