Kaynağa Gözat

chore(server): Configure build for publishing npm package

Michael Bromley 7 yıl önce
ebeveyn
işleme
0e462c0c73

+ 11 - 0
server/gulpfile.js

@@ -0,0 +1,11 @@
+const gulp = require('gulp');
+
+gulp.task('copy-schemas', () => {
+    return gulp.src([
+        'src/**/*.graphql'
+    ]).pipe(
+        gulp.dest('dist')
+    );
+})
+
+gulp.task('default', gulp.series('copy-schemas'));

+ 8 - 11
server/package.json

@@ -7,20 +7,20 @@
   "scripts": {
   "scripts": {
     "format": "prettier --write \"modules/**/*.ts\"",
     "format": "prettier --write \"modules/**/*.ts\"",
     "populate": "ts-node -r tsconfig-paths/register mock-data/populate.ts",
     "populate": "ts-node -r tsconfig-paths/register mock-data/populate.ts",
-    "start": "ts-node -r tsconfig-paths/register src/main.ts",
-    "start:debug": "nodemon --config nodemon-debug.json",
-    "prestart:prod": "rimraf dist && tsc",
-    "start:prod": "node dist/main.js",
-    "start:hmr": "node dist/server",
+    "start:dev": "nodemon --config nodemon-debug.json",
     "lint": "tslint --type-check --project tsconfig.json -c tslint.json",
     "lint": "tslint --type-check --project tsconfig.json -c tslint.json",
     "test": "jest",
     "test": "jest",
     "test:watch": "jest --watch",
     "test:watch": "jest --watch",
     "test:cov": "jest --coverage",
     "test:cov": "jest --coverage",
     "test:e2e": "jest --config ./test/jest-e2e.json",
     "test:e2e": "jest --config ./test/jest-e2e.json",
-    "webpack": "webpack --config webpack.config.js",
+    "build": "rimraf dist && tsc -p tsconfig.build.json && gulp",
     "precommit": "lint-staged",
     "precommit": "lint-staged",
     "postcommit": "git update-index --again"
     "postcommit": "git update-index --again"
   },
   },
+  "main": "dist/index.js",
+  "files": [
+    "dist/**/*"
+  ],
   "lint-staged": {
   "lint-staged": {
     "*.ts": [
     "*.ts": [
       "yarn lint --fix",
       "yarn lint --fix",
@@ -60,6 +60,7 @@
     "@types/supertest": "^2.0.4",
     "@types/supertest": "^2.0.4",
     "faker": "^4.1.0",
     "faker": "^4.1.0",
     "graphql-request": "^1.6.0",
     "graphql-request": "^1.6.0",
+    "gulp": "^4.0.0",
     "husky": "^0.14.3",
     "husky": "^0.14.3",
     "jest": "^21.2.1",
     "jest": "^21.2.1",
     "lint-staged": "^7.1.3",
     "lint-staged": "^7.1.3",
@@ -68,13 +69,9 @@
     "rimraf": "^2.6.2",
     "rimraf": "^2.6.2",
     "supertest": "^3.0.0",
     "supertest": "^3.0.0",
     "ts-jest": "^21.2.4",
     "ts-jest": "^21.2.4",
-    "ts-loader": "^4.1.0",
     "ts-node": "^6.0.0",
     "ts-node": "^6.0.0",
     "tsconfig-paths": "^3.3.1",
     "tsconfig-paths": "^3.3.1",
-    "tslint": "5.3.2",
-    "webpack": "^4.2.0",
-    "webpack-cli": "^2.0.13",
-    "webpack-node-externals": "^1.6.0"
+    "tslint": "5.3.2"
   },
   },
   "jest": {
   "jest": {
     "moduleFileExtensions": [
     "moduleFileExtensions": [

+ 10 - 0
server/tsconfig.build.json

@@ -0,0 +1,10 @@
+{
+  "extends": "./tsconfig.json",
+  "compilerOptions": {
+    "outDir": "./dist",
+    "rootDir": "./src"
+  },
+  "include": [
+    "./src/**/*"
+  ]
+}

+ 0 - 1
server/tsconfig.json

@@ -14,7 +14,6 @@
     "strict": true,
     "strict": true,
     "strictPropertyInitialization": false,
     "strictPropertyInitialization": false,
     "sourceMap": true,
     "sourceMap": true,
-    "outDir": "./dist",
     "baseUrl": "./src"
     "baseUrl": "./src"
   }
   }
 }
 }

+ 1 - 1
server/tsconfig.spec.json

@@ -1,5 +1,5 @@
 {
 {
-  "extends": "server/tsconfig.json",
+  "extends": "./tsconfig.json",
   "compilerOptions": {
   "compilerOptions": {
     "types": ["jest", "node"],
     "types": ["jest", "node"],
     "lib": ["es2015"]
     "lib": ["es2015"]

+ 0 - 34
server/webpack.config.js

@@ -1,34 +0,0 @@
-const webpack = require('webpack');
-const path = require('path');
-const nodeExternals = require('webpack-node-externals');
-
-module.exports = {
-  entry: ['webpack/hot/poll?1000', './modules/core/main.hmr.ts'],
-  watch: true,
-  target: 'node',
-  externals: [
-    nodeExternals({
-      whitelist: ['webpack/hot/poll?1000'],
-    }),
-  ],
-  module: {
-    rules: [
-      {
-        test: /\.tsx?$/,
-        use: 'ts-loader',
-        exclude: /node_modules/,
-      },
-    ],
-  },
-  mode: "development",
-  resolve: {
-    extensions: ['.tsx', '.ts', '.js'],
-  },
-  plugins: [
-    new webpack.HotModuleReplacementPlugin(),
-  ],
-  output: {
-    path: path.join(__dirname, 'dist'),
-    filename: 'server.js',
-  },
-};

Dosya farkı çok büyük olduğundan ihmal edildi
+ 119 - 687
server/yarn.lock


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor