Skip to content

Commit

Permalink
Refactor scripts and ditch gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert committed Aug 1, 2024
1 parent f731899 commit e54f678
Show file tree
Hide file tree
Showing 8 changed files with 3,121 additions and 11,339 deletions.
1 change: 1 addition & 0 deletions packages/apps-engine/deno-runtime/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 0 additions & 52 deletions packages/apps-engine/gulpfile.js

This file was deleted.

11,124 changes: 0 additions & 11,124 deletions packages/apps-engine/package-lock.json

This file was deleted.

54 changes: 23 additions & 31 deletions packages/apps-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@
"main": "index",
"typings": "index",
"scripts": {
"start": "gulp",
"test": "concurrently \"npm:test:node\" \"npm:test:deno\"",
"lint:eslint": "eslint .",
"lint:deno": "deno lint --ignore=deno-runtime/.deno deno-runtime/",
"lint": "concurrently \"npm:lint:eslint\" \"npm:lint:deno\"",
"start": "run-s .:build:clean .:build:watch",
"test": "run-p .:test:node .:test:deno",
".:test:node": "NODE_ENV=test ts-node ./tests/runner.ts",
".:test:deno": "cd deno-runtime && deno task test",
"lint": "run-p .:lint:eslint .:lint:deno",
".:lint:eslint": "eslint .",
".:lint:deno": "deno lint --ignore=deno-runtime/.deno deno-runtime/",
"fix-lint": "eslint . --fix",
"bundle": "gulp bundle",
"compile": "gulp compile",
"go-publish": "gulp publish",
"go-publish-beta": "gulp publish-beta",
"go-publish-alpha": "gulp publish-alpha",
"test:node": "NODE_ENV=test ts-node ./tests/runner.ts",
"test:deno": "cd deno-runtime && deno task test",
"build": "run-s .:build:clean .:build:default",
".:build:clean": "rimraf client definition server",
".:build:default": "tsc -p tsconfig.json",
".:build:watch": "yarn .:build:default -- --watch",
"typecheck": "tsc -p tsconfig.json --noEmit",
"bundle": "node scripts/bundle.js",
"gen-doc": "typedoc",
"prepack": "yarn bundle",
"postinstall": "node scripts/postinstall.js"
},
"repository": {
Expand All @@ -38,6 +40,9 @@
"scripts/**",
"server/**"
],
"publishConfig": {
"access": "public"
},
"author": {
"name": "Rocket.Chat",
"url": "https://rocket.chat/"
Expand All @@ -62,8 +67,8 @@
},
"homepage": "https://github.com/RocketChat/Rocket.Chat.Apps-engine#readme",
"devDependencies": {
"@rocket.chat/eslint-config": "~0.5.2",
"@rocket.chat/ui-kit": "^0.31.22",
"@rocket.chat/eslint-config": "workspace:~",
"@rocket.chat/ui-kit": "workspace:~",
"@types/adm-zip": "^0.5.0",
"@types/debug": "^4.1.12",
"@types/lodash.clonedeep": "^4.5.7",
Expand All @@ -76,19 +81,11 @@
"@typescript-eslint/parser": "~5.60.1",
"alsatian": "^2.4.0",
"browserify": "^16.5.2",
"concurrently": "^8.2.1",
"del": "^3.0.0",
"eslint": "~8.45.0",
"gulp": "^4.0.2",
"gulp-bump": "^3.2.0",
"gulp-shell": "^0.6.5",
"gulp-sourcemaps": "^2.6.5",
"gulp-typescript": "^4.0.2",
"http-server": "^0.12.3",
"merge2": "^1.4.1",
"nedb": "^1.8.0",
"npm-run-all": "^4.1.5",
"nyc": "^14.1.1",
"pre-push": "^0.1.2",
"rimraf": "^6.0.1",
"tap-bark": "^1.0.0",
"ts-node": "^6.2.0",
"typedoc": "~0.24.8",
Expand All @@ -110,7 +107,7 @@
"uuid": "~8.3.2"
},
"peerDependencies": {
"@rocket.chat/ui-kit": "next"
"@rocket.chat/ui-kit": "workspace:^"
},
"nyc": {
"include": [
Expand All @@ -127,12 +124,7 @@
],
"all": true
},
"pre-push": [
"lint",
"compile",
"test"
],
"volta": {
"node": "14.21.3"
"extends": "../../package.json"
}
}
35 changes: 35 additions & 0 deletions packages/apps-engine/scripts/bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const fs = require('fs');
const path = require('path');
const { Readable } = require('stream');

const browserify = require('browserify');
const { minify } = require('uglify-es');

const targetDir = path.join(__dirname, '..', 'client');

// browserify accepts either a stream or a file path
const glue = new Readable({
read() {
console.log('read');
this.push("window.AppsEngineUIClient = require('./AppsEngineUIClient').AppsEngineUIClient;");
this.push(null);
},
});

async function main() {
const bundle = await new Promise((resolve, reject) =>
browserify(glue, {
basedir: targetDir,
}).bundle((err, bundle) => {
if (err) return reject(err);

resolve(bundle.toString());
}),
);

const result = minify(bundle);

fs.writeFileSync(path.join(targetDir, 'AppsEngineUIClient.min.js'), result.code);
}

main();
5 changes: 5 additions & 0 deletions packages/apps-engine/scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// This file needs to be run everytime the apps-engine is installed
// which includes "production" installations (meant only to be used by apps)
// Since `ts-node` is a dev dependency and will not be installed by NPM on app
// projects, we need a JS file for this

const childProcess = require('child_process');
const path = require('path');

Expand Down
19 changes: 3 additions & 16 deletions packages/apps-engine/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"compileOnSave": false,
"compilerOptions": {
"sourceMap": true,
"target": "es6",
Expand All @@ -13,22 +12,10 @@
"moduleResolution": "node",
"types": ["node"],
"lib": ["es2017", "dom"],
"rootDir": "./src",
"outDir": ".",
"skipLibCheck": true
},
"exclude": [
"node_modules",
"server",
"client",
"definition",
"examples",
"deno-runtime"
],
"include": [
"src",
"tests"
],
"atom": {
"rewriteTsconfig": false
}
"exclude": ["deno-runtime"],
"include": ["./src/**/*"]
}
Loading

0 comments on commit e54f678

Please sign in to comment.