Browse Source

Add simple way to test (#12)

Alex Dima 7 years ago
parent
commit
900e817512
8 changed files with 1225 additions and 23 deletions
  1. 2 0
      .gitignore
  2. 1 0
      .npmignore
  3. 1165 22
      package-lock.json
  4. 8 1
      package.json
  5. 13 0
      test/dist/index.html
  6. 7 0
      test/index.js
  7. 9 0
      test/package.json
  8. 20 0
      test/webpack.config.js

+ 2 - 0
.gitignore

@@ -1 +1,3 @@
 /node_modules/
+/test/node_modules/
+/test/dist/*.js

+ 1 - 0
.npmignore

@@ -0,0 +1 @@
+/test/

File diff suppressed because it is too large
+ 1165 - 22
package-lock.json


+ 8 - 1
package.json

@@ -24,6 +24,13 @@
   "homepage": "https://github.com/Microsoft/monaco-editor-webpack-plugin#readme",
   "peerDependencies": {
     "webpack": "^4.5.0",
-    "monaco-editor": "^0.12.0"
+    "monaco-editor": "^0.13.1"
+  },
+  "devDependencies": {
+    "css-loader": "^0.28.11",
+    "monaco-editor": "^0.13.1",
+    "style-loader": "^0.21.0",
+    "webpack": "^4.6.0",
+    "webpack-cli": "^2.0.14"
   }
 }

+ 13 - 0
test/dist/index.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+</head>
+<body>
+    <div id="container" style="width:800px;height:600px;border:1px solid #ccc"></div>
+    <script type="text/javascript" src="app.js"></script>
+</body>
+</html>

+ 7 - 0
test/index.js

@@ -0,0 +1,7 @@
+
+import * as monaco from 'monaco-editor';
+
+monaco.editor.create(document.getElementById('container'), {
+    value: 'console.log("Hello, world")',
+    language: 'javascript'
+});

+ 9 - 0
test/package.json

@@ -0,0 +1,9 @@
+{
+  "name": "monaco-webpack-test",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "test": "../node_modules/.bin/webpack --config webpack.config.js"
+  }
+}

+ 20 - 0
test/webpack.config.js

@@ -0,0 +1,20 @@
+const MonacoWebpackPlugin = require('../index.js');
+const path = require('path');
+
+module.exports = {
+    mode: 'development',
+    entry: './index.js',
+    output: {
+        path: path.resolve(__dirname, 'dist'),
+        filename: 'app.js'
+    },
+    module: {
+        rules: [{
+            test: /\.css$/,
+            use: ['style-loader', 'css-loader']
+        }]
+    },
+    plugins: [
+        new MonacoWebpackPlugin()
+    ]
+};

Some files were not shown because too many files changed in this diff