diff --git a/package.json b/package.json index 94f0f3f2b0..d3d4a2b0f7 100644 --- a/package.json +++ b/package.json @@ -1,78 +1,79 @@ { - "name": "framer-motion", - "version": "0.0.1", - "private": true, - "main": "dist/framer-motion.js", - "types": "dist/framer-motion.d.ts", - "author": "Framer Motion", - "license": "MIT", - "scripts": { - "coverage": "jest --coverage", - "test": "jest", - "watch": "jest --watch", - "prettier": "prettier ./src/* --write", - "build": "rollup -c && yarn measure", - "measure": "gzip -c dist/framer-motion.js | wc -c" - }, - "peerDependencies": { - "react": "^16.7", - "react-dom": "^16.7" - }, - "devDependencies": { - "@types/jest": "^23.3.9", - "@types/node": "^10.12.9", - "@types/react": "^16.7.6", - "@types/react-dom": "^16.0.9", - "@types/styled-components": "^4.1.0", - "cache-loader": "^1.2.5", - "convert-tsconfig-paths-to-webpack-aliases": "^0.9.2", - "fork-ts-checker-webpack-plugin": "^0.4.15", - "husky": "^1.1.4", - "jest": "^23.6.0", - "jest-dom": "^2.1.1", - "lint-staged": "^8.0.4", - "prettier": "^1.15.2", - "progress-bar-webpack-plugin": "^1.11.0", - "react": "^16.7.0-alpha.2", - "react-dev-utils": "^6.1.1", - "react-dom": "^16.7.0-alpha.2", - "react-testing-library": "^5.3.0", - "rollup": "^0.67.3", - "rollup-plugin-node-resolve": "^3.4.0", - "rollup-plugin-replace": "^2.1.0", - "rollup-plugin-typescript2": "^0.18.0", - "rollup-plugin-uglify": "^6.0.0", - "styled-components": "^4.1.1", - "ts-jest": "^23.10.4", - "ts-loader": "^5.3.0", - "tslint": "^5.11.0", - "tslint-microsoft-contrib": "^5.2.1", - "typescript": "^3.1.6", - "webpack": "^4.25.1", - "webpack-cli": "^3.1.2", - "webpack-dev-server": "^3.1.10" - }, - "dependencies": { - "@popmotion/popcorn": "^0.2.0", - "hey-listen": "^1.0.5", - "popmotion": "8.5.3", - "style-value-types": "^3.0.7", - "stylefire": "^2.3.1" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" + "name": "framer-motion", + "version": "0.0.1", + "private": true, + "main": "dist/framer-motion.cjs.js", + "module": "dist/framer-motion.es.js", + "types": "dist/index.d.ts", + "author": "Framer Motion", + "license": "MIT", + "scripts": { + "coverage": "jest --coverage", + "test": "jest", + "watch": "jest --watch", + "prettier": "prettier ./src/* --write", + "build": "rollup -c && yarn measure", + "measure": "gzip -c dist/framer-motion.js | wc -c" + }, + "peerDependencies": { + "react": "^16.7", + "react-dom": "^16.7" + }, + "devDependencies": { + "@types/jest": "^23.3.9", + "@types/node": "^10.12.9", + "@types/react": "^16.7.6", + "@types/react-dom": "^16.0.9", + "@types/styled-components": "^4.1.0", + "cache-loader": "^1.2.5", + "convert-tsconfig-paths-to-webpack-aliases": "^0.9.2", + "fork-ts-checker-webpack-plugin": "^0.4.15", + "husky": "^1.1.4", + "jest": "^23.6.0", + "jest-dom": "^2.1.1", + "lint-staged": "^8.0.4", + "prettier": "^1.15.2", + "progress-bar-webpack-plugin": "^1.11.0", + "react": "^16.7.0-alpha.2", + "react-dev-utils": "^6.1.1", + "react-dom": "^16.7.0-alpha.2", + "react-testing-library": "^5.3.0", + "rollup": "^0.67.3", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-replace": "^2.1.0", + "rollup-plugin-typescript2": "^0.18.0", + "rollup-plugin-uglify": "^6.0.0", + "styled-components": "^4.1.1", + "ts-jest": "^23.10.4", + "ts-loader": "^5.3.0", + "tslint": "^5.11.0", + "tslint-microsoft-contrib": "^5.2.1", + "typescript": "^3.1.6", + "webpack": "^4.25.1", + "webpack-cli": "^3.1.2", + "webpack-dev-server": "^3.1.10" + }, + "dependencies": { + "@popmotion/popcorn": "^0.2.0", + "hey-listen": "^1.0.5", + "popmotion": "8.5.3", + "style-value-types": "^3.0.7", + "stylefire": "^2.3.1" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.{ts,tsx}": [ + "prettier --write", + "git add" + ] + }, + "jest": { + "preset": "ts-jest", + "rootDir": "src", + "setupTestFrameworkScriptFile": "/../jest.setup.ts" } - }, - "lint-staged": { - "*.{ts,tsx}": [ - "prettier --write", - "git add" - ] - }, - "jest": { - "preset": "ts-jest", - "rootDir": "src", - "setupTestFrameworkScriptFile": "/../jest.setup.ts" - } } diff --git a/rollup.config.js b/rollup.config.js index 3c7e60fcb4..f426d9b785 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,78 +1,78 @@ -import typescript from 'rollup-plugin-typescript2'; -import resolve from 'rollup-plugin-node-resolve'; -import { uglify } from 'rollup-plugin-uglify'; -import replace from 'rollup-plugin-replace'; -import pkg from './package.json'; +import typescript from "rollup-plugin-typescript2" +import resolve from "rollup-plugin-node-resolve" +import { uglify } from "rollup-plugin-uglify" +import replace from "rollup-plugin-replace" +import pkg from "./package.json" -const typescriptConfig = { cacheRoot: 'tmp/.rpt2_cache' }; +const typescriptConfig = { cacheRoot: "tmp/.rpt2_cache" } const noDeclarationConfig = Object.assign({}, typescriptConfig, { - tsconfigOverride: { compilerOptions: { declaration: false } } -}); + tsconfigOverride: { compilerOptions: { declaration: false } }, +}) const config = { - input: 'src/index.ts' -}; + input: "src/index.ts", +} const external = [ - 'react', - '@popmotion/popcorn', - 'framesync', - 'stylefire', - 'hey-listen', - 'popmotion', - 'style-value-types' -]; + "react", + "@popmotion/popcorn", + "framesync", + "stylefire", + "hey-listen", + "popmotion", + "style-value-types", +] const umd = Object.assign({}, config, { - output: { - file: `dist/${pkg.name}.dev.js`, - format: 'umd', - name: 'FramerMotion', - exports: 'named', - globals: { react: 'React' } - }, - external: ['react', 'react-dom'], - plugins: [ - typescript(noDeclarationConfig), - resolve(), - replace({ - 'process.env.NODE_ENV': JSON.stringify('development') - }) - ] -}); + output: { + file: `dist/${pkg.name}.dev.js`, + format: "umd", + name: "FramerMotion", + exports: "named", + globals: { react: "React" }, + }, + external: ["react", "react-dom"], + plugins: [ + typescript(noDeclarationConfig), + resolve(), + replace({ + "process.env.NODE_ENV": JSON.stringify("development"), + }), + ], +}) const umdProd = Object.assign({}, umd, { - output: Object.assign({}, umd.output, { - file: `dist/${pkg.name}.js` - }), - plugins: [ - typescript(noDeclarationConfig), - resolve(), - replace({ - 'process.env.NODE_ENV': JSON.stringify('production') + output: Object.assign({}, umd.output, { + file: `dist/${pkg.name}.js`, }), - uglify() - ] -}); + plugins: [ + typescript(noDeclarationConfig), + resolve(), + replace({ + "process.env.NODE_ENV": JSON.stringify("production"), + }), + uglify(), + ], +}) const cjs = Object.assign({}, config, { - output: { - file: 'lib/index.js', - format: 'cjs', - exports: 'named' - }, - plugins: [typescript(typescriptConfig)], - external -}); + output: { + file: `dist/${pkg.name}.cjs.js`, + format: "cjs", + exports: "named", + }, + plugins: [typescript(typescriptConfig)], + external, +}) const es = Object.assign({}, config, { - output: { - file: `dist/${pkg.name}.es.js`, - format: 'es', - exports: 'named' - }, - plugins: [typescript(noDeclarationConfig)], - external -}); + output: { + file: `dist/${pkg.name}.es.js`, + format: "es", + exports: "named", + }, + plugins: [typescript(noDeclarationConfig)], + external, +}) -export default [umd, umdProd, es, cjs]; +export default [umd, umdProd, es, cjs] diff --git a/tsconfig.json b/tsconfig.json index 6727b3e069..c18fcf16fa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,8 @@ "noLib": false, "preserveConstEnums": true, "suppressImplicitAnyIndexErrors": true, - "outDir": "build", + "rootDir": "src", + "outDir": "lib", "sourceMap": true, "baseUrl": "src", "paths": { @@ -30,6 +31,17 @@ }, "compileOnSave": false, "buildOnSave": false, - "exclude": ["node_modules", "build", "**/__tests__/*", "types", "dev/examples.framer", "test", "skins", "dist"], + "exclude": [ + "node_modules", + "build", + "**/__tests__/*", + "jest.setup.ts", + "dev", + "types", + "dev/examples.framer", + "test", + "skins", + "dist" + ], "filesGlob": ["./src/**/*.ts"] }