Merge pull request #6610 from keymanapp/chore/developer/remove-lerna

chore(developer): build web-environment during js build 🎡
This commit is contained in:
Marc Durdin 2022-05-27 08:49:22 +10:00 committed by GitHub
commit 785f302eee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 40 additions and 20 deletions

View file

@ -1,2 +1,5 @@
node_modules/
dist/
dist-tests/
tsconfig.tsbuildinfo
tests/tsconfig.tsbuildinfo

View file

@ -94,6 +94,8 @@ type npm >/dev/null ||\
if (( install_dependencies )) ; then
verify_npm_setup
# We need to build web-environment with a script for now
"$KEYMAN_ROOT/resources/web-environment/build.sh" || fail "Could not build web-environment"
fi
build || fail "Compilation failed."

View file

@ -10,7 +10,7 @@
],
"scripts": {
"build": "tsc -b",
"test": "mocha",
"test": "cd tests && tsc -b && cd .. && mocha",
"prepublishOnly": "npm run build"
},
"repository": {
@ -56,7 +56,6 @@
"ts-node": "^9.1.1"
},
"mocha": {
"require": "ts-node/register",
"spec": "tests/**/test-*.ts"
"spec": "dist-tests/**/test-*.js"
}
}

View file

@ -3,6 +3,8 @@ import { defaultApplyCasing,
defaultSearchTermToKey
} from "./model-defaults";
const KEYMAN_VERSION = require("@keymanapp/keyman-version");
/**
* Processes certain defined model behaviors in such a way that the needed closures
* may be safely compiled to a JS file and loaded within the LMLayer.

View file

@ -1,4 +1,4 @@
/// <reference path="../../node_modules/@keymanapp/models-types/index.d.ts" />
/// <reference path="../../../../common/web/lm-message-types/message.d.ts" />
/**
* Helpers and utilities for the Mocha tests.
@ -16,14 +16,14 @@ export interface CompilationResult {
/**
* Builds a path to the fixture with the given path components.
*
*
* e.g., makePathToFixture('example.qaa.trivial')
* e.g., makePathToFixture('example.qaa.trivial', 'model.ts')
*
*
* @param components One or more path components.
*/
export function makePathToFixture(...components: string[]): string {
return path.join(__dirname, '..', 'fixtures', ...components);
return path.join(__dirname, '..', '..', 'tests', 'fixtures', ...components);
}
/**
@ -132,7 +132,7 @@ export class LogHoarder {
clear() {
this.messages = [];
}
/**
* Hoards a log message for later perusal.
*/
@ -159,7 +159,7 @@ export class LogHoarder {
/**
* Overrides the global log handler, allowing one to browse log messages
* later.
*
*
* Remember to uninstall the log handler afterwards!
*/
install(): this {
@ -169,7 +169,7 @@ export class LogHoarder {
/**
* Return the log message handler to its default.
*
*
* Note: You MUST uninstall the hoarder after use!
* It's recommended you put this in an afterEach() callback.
*/

View file

@ -2,12 +2,12 @@ import LexicalModelCompiler from '../dist/lexical-model-compiler/lexical-model-c
import {assert} from 'chai';
import 'mocha';
import path = require('path');
import { compileModelSourceCode } from './helpers';
import { makePathToFixture } from './helpers';
describe('LexicalModelCompiler - pseudoclosure compilation + use', function () {
const MODEL_ID = 'example.qaa.trivial';
const PATH = path.join(__dirname, 'fixtures', MODEL_ID);
const PATH = makePathToFixture(MODEL_ID);
describe('specifying custom methods: applyCasing and searchTermToKey', function () {
let casingWithPrependedSymbols: CasingFunction = function(casingName: CasingForm, text: string, defaultApplyCasing: CasingFunction) {

View file

@ -1,6 +1,6 @@
var assert = require('chai').assert;
const defaultWordBreaker = require('@keymanapp/models-wordbreakers').wordBreakers['default'];
const defaultWordBreaker = require('../../../common/models/wordbreakers/build').wordBreakers['default'];
import {decorateWithJoin} from '../dist/lexical-model-compiler/join-word-breaker-decorator';

View file

@ -1,6 +1,6 @@
var assert = require('chai').assert;
const defaultWordBreaker = require('@keymanapp/models-wordbreakers').wordBreakers['default'];
const defaultWordBreaker = require('../../../common/models/wordbreakers/build').wordBreakers['default'];
import {decorateWithScriptOverrides} from '../dist/lexical-model-compiler/script-overrides-decorator';
const THIN_SPACE = "\u2009";

View file

@ -2,14 +2,14 @@ import LexicalModelCompiler from '../dist/lexical-model-compiler/lexical-model-c
import {assert} from 'chai';
import 'mocha';
import path = require('path');
import { compileModelSourceCode } from './helpers';
import { makePathToFixture } from './helpers';
describe('LexicalModelCompiler', function () {
describe('specifying punctuation', function () {
const MODEL_ID = 'example.qaa.trivial';
const PATH = path.join(__dirname, 'fixtures', MODEL_ID)
const PATH = makePathToFixture(MODEL_ID);
it('should compile punctuation into the generated code', function () {
let compiler = new LexicalModelCompiler;

View file

@ -1,10 +1,23 @@
{
"extends": "../../../tsconfig-base.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"sourceMap": true
"sourceMap": true,
"rootDir": "./",
"outDir": "../dist-tests/"
},
"include": [
"**/test-*.ts"
]
"**/test-*.ts",
"helpers/index.ts"
],
"references": [
{ "path": "../../../common/web/keyman-version" },
{ "path": "../../../common/models/types" },
{ "path": "../../../common/models/templates" },
{ "path": "../../../common/models/wordbreakers" },
{ "path": "../"}
]
}

View file

@ -2,11 +2,12 @@
"extends": "../../tsconfig-base.json",
"compilerOptions": {
//"module": "commonjs",
"module": "commonjs",
"target": "es2017",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist/",
"rootDir": "source/",
"declaration": true,
"alwaysStrict": true,
"noImplicitThis": true,