From 0ddd9281e68cd26abca3ce309d57e1e7e6240d35 Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Mon, 14 May 2018 14:12:46 +0300 Subject: [PATCH] chore(e2e): clean up webpack files (#5807) --- .gitignore | 76 +++++----- .../app/vendor-platform.android.ts | 9 -- .../app/vendor-platform.ios.ts | 4 - e2e/modal-navigation/app/vendor.ts | 10 -- e2e/modal-navigation/package.json | 21 +-- e2e/modal-navigation/webpack.config.js | 143 ------------------ 6 files changed, 41 insertions(+), 222 deletions(-) delete mode 100644 e2e/modal-navigation/app/vendor-platform.android.ts delete mode 100644 e2e/modal-navigation/app/vendor-platform.ios.ts delete mode 100644 e2e/modal-navigation/app/vendor.ts delete mode 100644 e2e/modal-navigation/webpack.config.js diff --git a/.gitignore b/.gitignore index e6feee844..f5c1f603a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,41 @@ -# generated files +# Folders +dist +hooks +libs +node_modules +package +platforms +reports +tags + +# Files +package-lock.json +.DS_Store +.nsbuildinfo + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# Appium files +e2e/**/*.trace/ +e2e/**/test-results.xml + +# Webpack configuration files +webpack.config.js + +# Generated files *.map *.tgz .baseDir.ts @@ -6,10 +43,7 @@ tscommand*.tmp.txt .tscache -node_modules/ -dist/ -package/ - +# Other *.js !tests/hooks/**/*.* !gruntfile.js @@ -19,44 +53,14 @@ package/ !fetch/**/*.* !apps/TelerikNEXT/lib/**/*.* !build/**/*.* -CrossPlatformModules.sln.ide/ -*.suo -CrossPlatformModules.suo -CrossPlatformModules.v14.suo -CrossPlatformModules.csproj.user -bin/ -obj/ .vs/ -.idea/ .baseDir.ts .ctags-exclude -tags TestRunResult.txt .testsapprun tns-core-modules.base.d.ts tns-core-modules.d.ts -tns-core-modules.es6.d.ts - -tests/platforms/ -tests/lib/ -*.log - -.DS_Store - -apps/platforms/ -apps/lib/ -apps/hooks/ -apps/node_modules/ - -e2e/**/platforms -!e2e/**/webpack.config.js -e2e/**/reports/ -e2e/**/*.trace/ -e2e/**/test-results.xml - -package-lock.json - -.nsbuildinfo +tns-core-modules.es6.d.ts \ No newline at end of file diff --git a/e2e/modal-navigation/app/vendor-platform.android.ts b/e2e/modal-navigation/app/vendor-platform.android.ts deleted file mode 100644 index 719f26498..000000000 --- a/e2e/modal-navigation/app/vendor-platform.android.ts +++ /dev/null @@ -1,9 +0,0 @@ -require("application"); -if (!global["__snapshot"]) { - // In case snapshot generation is enabled these modules will get into the bundle - // but will not be required/evaluated. - // The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. - // This way, they will be evaluated on app start as early as possible. - require("ui/frame"); - require("ui/frame/activity"); -} diff --git a/e2e/modal-navigation/app/vendor-platform.ios.ts b/e2e/modal-navigation/app/vendor-platform.ios.ts deleted file mode 100644 index 27c81aca4..000000000 --- a/e2e/modal-navigation/app/vendor-platform.ios.ts +++ /dev/null @@ -1,4 +0,0 @@ -// There is a bug in angular: https://github.com/angular/angular-cli/pull/8589/files -// Legendary stuff, its webpack plugin pretty much doesn't work with empty TypeScript files in v1.8.3 -// tslint:disable-next-line:no-unused-expression -void 0; diff --git a/e2e/modal-navigation/app/vendor.ts b/e2e/modal-navigation/app/vendor.ts deleted file mode 100644 index 8a3813746..000000000 --- a/e2e/modal-navigation/app/vendor.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Snapshot the ~/app.css and the theme -const application = require("application"); -require("ui/styling/style-scope"); -const appCssContext = require.context("~/", false, /^\.\/app\.(css|scss|less|sass)$/); -global.registerWebpackModules(appCssContext); -application.loadAppCss(); - -require("./vendor-platform"); - -require("bundle-entry-points"); diff --git a/e2e/modal-navigation/package.json b/e2e/modal-navigation/package.json index b2eed4ed4..fbdf1585f 100644 --- a/e2e/modal-navigation/package.json +++ b/e2e/modal-navigation/package.json @@ -17,28 +17,9 @@ "tns-core-modules": "next" }, "devDependencies": { - "awesome-typescript-loader": "~3.1.3", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "copy-webpack-plugin": "~4.3.0", - "css-loader": "~0.28.7", - "extract-text-webpack-plugin": "~3.0.2", - "lazy": "1.0.11", "nativescript-dev-appium": "next", "nativescript-dev-typescript": "next", - "nativescript-dev-webpack": "next", - "nativescript-worker-loader": "~0.8.1", - "raw-loader": "~0.5.1", - "resolve-url-loader": "~2.2.1", - "typescript": "~2.4.2", - "uglifyjs-webpack-plugin": "~1.1.6", - "webpack": "~3.10.0", - "webpack-bundle-analyzer": "^2.9.1", - "webpack-sources": "~1.1.0", - "@types/chai": "^4.0.2", - "@types/mocha": "^2.2.41", - "@types/node": "^7.0.5" + "nativescript-dev-webpack": "next" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts", diff --git a/e2e/modal-navigation/webpack.config.js b/e2e/modal-navigation/webpack.config.js deleted file mode 100644 index c0129d7b9..000000000 --- a/e2e/modal-navigation/webpack.config.js +++ /dev/null @@ -1,143 +0,0 @@ -const { resolve, join } = require("path"); - -const webpack = require("webpack"); -const nsWebpack = require("nativescript-dev-webpack"); -const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); -const CopyWebpackPlugin = require("copy-webpack-plugin"); -const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); -const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); -const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); - -module.exports = env => { - const platform = env && (env.android && "android" || env.ios && "ios"); - if (!platform) { - throw new Error("You need to provide a target platform!"); - } - const platforms = ["ios", "android"]; - const { snapshot, uglify, report } = env; - - const config = { - context: resolve("./app"), - target: nativescriptTarget, - entry: { - bundle: `./${nsWebpack.getEntryModule()}`, - vendor: "./vendor" - }, - output: { - pathinfo: true, - // Default destination inside platforms//... - path: resolve(nsWebpack.getAppPath(platform)), - libraryTarget: "commonjs2", - filename: "[name].js", - }, - resolve: { - extensions: [".ts", ".js", ".scss", ".css"], - // Resolve {N} system modules from tns-core-modules - modules: [ - "node_modules/tns-core-modules", - "node_modules", - ], - alias: { - '~': resolve("./app") - }, - // don't resolve symlinks to symlinked modules - symlinks: false - }, - resolveLoader: { - // don't resolve symlinks to symlinked loaders - symlinks: false - }, - node: { - // Disable node shims that conflict with NativeScript - "http": false, - "timers": false, - "setImmediate": false, - "fs": "empty", - }, - module: { - rules: [ - { test: /\.(html|xml)$/, use: "raw-loader" }, - - { - test: /\.css$/, - use: { loader: "css-loader", options: { minimize: false, url: false } } - }, - - { - test: /\.scss$/, - use: [ - { loader: "css-loader", options: { minimize: false, url: false } }, - "sass-loader" - ] - }, - - { test: /\.ts$/, use: "awesome-typescript-loader" } - ] - }, - plugins: [ - // Vendor libs go to the vendor.js chunk - new webpack.optimize.CommonsChunkPlugin({ - name: ["vendor"], - }), - // Define useful constants like TNS_WEBPACK - new webpack.DefinePlugin({ - "global.TNS_WEBPACK": "true", - }), - // Copy assets to out dir. Add your own globs as needed. - new CopyWebpackPlugin([ - { from: "App_Resources/**" }, - { from: "fonts/**" }, - { from: "**/*.jpg" }, - { from: "**/*.png" }, - { from: "**/*.xml" }, - ]), - // Generate a bundle starter script and activate it in package.json - new nsWebpack.GenerateBundleStarterPlugin([ - "./vendor", - "./bundle", - ]), - // Support for web workers since v3.2 - new NativeScriptWorkerPlugin(), - new nsWebpack.PlatformFSPlugin({ - platform, - platforms, - // ignore: ["App_Resources"] - }), - // Does IPC communication with the {N} CLI to notify events when running in watch mode. - new nsWebpack.WatchStateLoggerPlugin(), - ], - }; - if (report) { - // Generate report files for bundles content - config.plugins.push(new BundleAnalyzerPlugin({ - analyzerMode: "static", - openAnalyzer: false, - generateStatsFile: true, - reportFilename: join(__dirname, "report", `report.html`), - statsFilename: join(__dirname, "report", `stats.json`), - })); - } - if (snapshot) { - config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({ - chunk: "vendor", - projectRoot: __dirname, - webpackConfig: config, - targetArchs: ["arm", "arm64", "ia32"], - tnsJavaClassesOptions: { packages: ["tns-core-modules" ] }, - useLibs: false - })); - } - if (uglify) { - config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true })); - - // Work around an Android issue by setting compress = false - const compress = platform !== "android"; - config.plugins.push(new UglifyJsPlugin({ - uglifyOptions: { - mangle: { reserved: nsWebpack.uglifyMangleExcludes }, - compress, - } - })); - } - return config; -};