Skip to content

Commit

Permalink
feat: build languages (#114)
Browse files Browse the repository at this point in the history
* feat: remove unused languages

* refactor: move all language contibutions to languages dir

* chore: remove useless scripts

* test: fix unit test script

* build: output esm version only
  • Loading branch information
HaydenOrz authored Apr 1, 2024
1 parent 206b0fd commit f6b34e5
Show file tree
Hide file tree
Showing 51 changed files with 116 additions and 4,486 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
/*.iml
/node_modules/
/out/
/esm/
/release/
.history
/docs/
.DS_Store
*.tgz
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"version": "0.12.0-beta.ng.2",
"description": "SQL languages for the Monaco Editor, based on monaco-languages.",
"scripts": {
"compile": "mrmdir ./out && tsc -p ./tsconfig.amd.json && tsc -p ./tsconfig.esm.json",
"build": "mrmdir ./esm && tsc -p ./tsconfig.esm.json",
"build-amd": "mrmdir ./out && tsc -p ./tsconfig.amd.json",
"watch-esm": "tsc -p ./tsconfig.esm.json --watch",
"test": "npm run compile && mocha ./test/all.js",
"prepublishOnly": "npm run compile",
"prettier": "prettier --write .",
"test": "npm run build-amd && mocha ./test/all.js",
"prepublishOnly": "npm run build",
"prettier": "prettier --write ./src",
"check-types": "tsc -p ./tsconfig.json",
"dev": "node --max_old_space_size=4092 & cd website && npm run dev",
"prod": "mrmdir ./docs && node --max_old_space_size=4092 & cd website && npm run build",
Expand All @@ -16,11 +17,11 @@
},
"author": "DTStack Corporation",
"license": "MIT",
"main": "out/esm/main.js",
"module": "out/esm/main.js",
"types": "out/esm/main.d.ts",
"main": "esm/main.js",
"module": "esm/main.js",
"types": "esm/main.d.ts",
"files": [
"out"
"esm"
],
"repository": {
"type": "git",
Expand Down
72 changes: 0 additions & 72 deletions scripts/bundle.js

This file was deleted.

17 changes: 0 additions & 17 deletions scripts/release.js

This file was deleted.

16 changes: 7 additions & 9 deletions src/all.contributions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import './flinksql/flinksql.contribution';
import './sparksql/sparksql.contribution';
import './hivesql/hivesql.contribution';
import './trinosql/trinosql.contribution';
import './sql/sql.contribution';
import './mysql/mysql.contribution';
import './plsql/plsql.contribution';
import './pgsql/pgsql.contribution';
import './impalasql/impalasql.contribution';
import './languages/flink/flink.contribution';
import './languages/spark/spark.contribution';
import './languages/hive/hive.contribution';
import './languages/trino/trino.contribution';
import './languages/mysql/mysql.contribution';
import './languages/pgsql/pgsql.contribution';
import './languages/impala/impala.contribution';
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { registerLanguage } from '../_.contribution';
import { setupLanguageFeatures } from '../setupLanguageFeatures';
import { LanguageIdEnum } from '../common/constants';
import { registerLanguage } from '../../_.contribution';
import { setupLanguageFeatures } from '../../setupLanguageFeatures';
import { LanguageIdEnum } from '../../common/constants';

registerLanguage({
id: LanguageIdEnum.FLINK,
extensions: ['.flinksql'],
aliases: ['FlinkSQL', 'flink', 'Flink'],
loader: () => import('./flinksql')
loader: () => import('./flink')
});

setupLanguageFeatures(LanguageIdEnum.FLINK, {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/flinksql/flinksql.ts → src/languages/flink/flink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import type { languages } from '../fillers/monaco-editor-core';
import { TokenClassConsts } from '../common/constants';
import type { languages } from '../../fillers/monaco-editor-core';
import { TokenClassConsts } from '../../common/constants';

export const conf: languages.LanguageConfiguration = {
comments: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js';
import { FLinkSQLWorker } from './flinkSQLWorker';
import { ICreateData } from '../baseSQLWorker';
import { FLinkSQLWorker } from './flinkWorker';
import { ICreateData } from '../../baseSQLWorker';

self.onmessage = () => {
// ignore the first message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import { FlinkSQL } from 'dt-sql-parser/dist/parser/flink';
import { BaseSQLWorker, ICreateData } from '../baseSQLWorker';
import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker';

export class FLinkSQLWorker extends BaseSQLWorker {
protected _ctx: worker.IWorkerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { registerLanguage } from '../_.contribution';
import { setupLanguageFeatures } from '../setupLanguageFeatures';
import { LanguageIdEnum } from '../common/constants';
import { registerLanguage } from '../../_.contribution';
import { setupLanguageFeatures } from '../../setupLanguageFeatures';
import { LanguageIdEnum } from '../../common/constants';

registerLanguage({
id: LanguageIdEnum.HIVE,
extensions: ['.hivesql'],
aliases: ['HiveSQL', 'hive', 'Hive'],
loader: () => import('./hivesql')
loader: () => import('./hive')
});

setupLanguageFeatures(LanguageIdEnum.HIVE, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { testTokenization } from '../test/testRunner';
import { TokenClassConsts, postfixTokenClass } from '../common/constants';
import { testTokenization } from '../../test/testRunner';
import { TokenClassConsts, postfixTokenClass } from '../../common/constants';

testTokenization('hivesql', [
// Comments
Expand Down
4 changes: 2 additions & 2 deletions src/hivesql/hivesql.ts → src/languages/hive/hive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import type { languages } from '../fillers/monaco-editor-core';
import { TokenClassConsts } from '../common/constants';
import type { languages } from '../../fillers/monaco-editor-core';
import { TokenClassConsts } from '../../common/constants';

export const conf: languages.LanguageConfiguration = {
comments: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js';
import { ICreateData } from '../baseSQLWorker';
import { HiveSQLWorker } from './hiveSQLWorker';
import { ICreateData } from '../../baseSQLWorker';
import { HiveSQLWorker } from './hiveWorker';

self.onmessage = () => {
// ignore the first message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import { HiveSQL } from 'dt-sql-parser/dist/parser/hive';
import { BaseSQLWorker, ICreateData } from '../baseSQLWorker';
import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker';

export class HiveSQLWorker extends BaseSQLWorker {
protected _ctx: worker.IWorkerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { registerLanguage } from '../_.contribution';
import { setupLanguageFeatures } from '../setupLanguageFeatures';
import { LanguageIdEnum } from '../common/constants';
import { registerLanguage } from '../../_.contribution';
import { setupLanguageFeatures } from '../../setupLanguageFeatures';
import { LanguageIdEnum } from '../../common/constants';

registerLanguage({
id: LanguageIdEnum.IMPALA,
extensions: ['.impalasql'],
aliases: ['impalaSQL', 'impala', 'Impala'],
loader: () => import('./impalasql')
loader: () => import('./impala')
});

setupLanguageFeatures(LanguageIdEnum.IMPALA, {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/impalasql/impalasql.ts → src/languages/impala/impala.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import type { languages } from '../fillers/monaco-editor-core';
import { TokenClassConsts } from '../common/constants';
import type { languages } from '../../fillers/monaco-editor-core';
import { TokenClassConsts } from '../../common/constants';

export const conf: languages.LanguageConfiguration = {
comments: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js';
import { ImpalaSQLWorker } from './impalaSQLWorker';
import { ICreateData } from '../baseSQLWorker';
import { ImpalaSQLWorker } from './impalaWorker';
import { ICreateData } from '../../baseSQLWorker';

self.onmessage = () => {
// ignore the first message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import { ImpalaSQL } from 'dt-sql-parser/dist/parser/impala';
import { BaseSQLWorker, ICreateData } from '../baseSQLWorker';
import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker';

export class ImpalaSQLWorker extends BaseSQLWorker {
protected _ctx: worker.IWorkerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { registerLanguage } from '../_.contribution';
import { setupLanguageFeatures } from '../setupLanguageFeatures';
import { LanguageIdEnum } from '../common/constants';
import { registerLanguage } from '../../_.contribution';
import { setupLanguageFeatures } from '../../setupLanguageFeatures';
import { LanguageIdEnum } from '../../common/constants';

registerLanguage({
id: LanguageIdEnum.MYSQL,
Expand Down
4 changes: 2 additions & 2 deletions src/mysql/mysql.test.ts → src/languages/mysql/mysql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { testTokenization } from '../test/testRunner';
import { TokenClassConsts, postfixTokenClass } from '../common/constants';
import { testTokenization } from '../../test/testRunner';
import { TokenClassConsts, postfixTokenClass } from '../../common/constants';

testTokenization('mysql', [
// Comments
Expand Down
4 changes: 2 additions & 2 deletions src/mysql/mysql.ts → src/languages/mysql/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { TokenClassConsts } from '../common/constants';
import type { languages } from '../fillers/monaco-editor-core';
import { TokenClassConsts } from '../../common/constants';
import type { languages } from '../../fillers/monaco-editor-core';

export const conf: languages.LanguageConfiguration = {
comments: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js';
import { ICreateData } from '../baseSQLWorker';
import { MySQLWorker } from './mySQLWorker';
import { ICreateData } from '../../baseSQLWorker';
import { MySQLWorker } from './mysqlWorker';

self.onmessage = () => {
// ignore the first message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import { MySQL } from 'dt-sql-parser/dist/parser/mysql';
import { BaseSQLWorker, ICreateData } from '../baseSQLWorker';
import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker';

export class MySQLWorker extends BaseSQLWorker {
protected _ctx: worker.IWorkerContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { worker } from '../fillers/monaco-editor-core';
import { worker } from '../../fillers/monaco-editor-core';
import { PostgreSQL } from 'dt-sql-parser/dist/parser/postgresql';
import { BaseSQLWorker, ICreateData } from '../baseSQLWorker';
import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker';

export class PgSQLWorker extends BaseSQLWorker {
protected _ctx: worker.IWorkerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { registerLanguage } from '../_.contribution';
import { setupLanguageFeatures } from '../setupLanguageFeatures';
import { LanguageIdEnum } from '../common/constants';
import { registerLanguage } from '../../_.contribution';
import { setupLanguageFeatures } from '../../setupLanguageFeatures';
import { LanguageIdEnum } from '../../common/constants';

registerLanguage({
id: LanguageIdEnum.PG,
Expand Down
Loading

0 comments on commit f6b34e5

Please sign in to comment.