-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11014 from keymanapp/feat/developer/kmc-generate
feat(developer): kmc generate
- Loading branch information
Showing
105 changed files
with
3,624 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
developer/src/common/web/utils/src/source-filename-patterns.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Keyman is copyright (C) SIL International. MIT License. | ||
* | ||
* Keyman Developer source filename regular expressions | ||
*/ | ||
|
||
/** | ||
* A keyboard package filename SHOULD adhere to this pattern (including file | ||
* extension), lower case alphanumeric and underscore only allowed (a-z, _ only | ||
* for first letter). | ||
*/ | ||
export const KEYBOARD_ID_PATTERN_PACKAGE = /^[a-z_][a-z0-9_]*\.(kps|kmp)$/; | ||
|
||
/** | ||
* A lexical model package filename SHOULD adhere to this pattern (including | ||
* file extension). There are three components to the filename: author, bcp47, | ||
* and uniq, separated by period. The filename ends in .model.kps or .model.kmp. | ||
* Each of the author, bcp47, and uniq sections may contain lowercase | ||
* alphanumeric, underscore characters, and the bcp47 section additionally may | ||
* contain hyphen. Digits are not permitted as first letter of each section. | ||
* | ||
* Despite including a bcp47 tag as part of the filename, it is informative only, | ||
* and is not regarded as part of the metadata for the lexical model. | ||
*/ | ||
// author .bcp47 .uniq | ||
export const MODEL_ID_PATTERN_PACKAGE = /^[a-z_][a-z0-9_]*\.[a-z_][a-z0-9_-]*\.[a-z_][a-z0-9_]*\.model\.(kps|kmp)$/; | ||
|
||
// const MODEL_ID_PATTERN_JS = /^[a-z_][a-z0-9_]*\.[a-z_][a-z0-9_-]*\.[a-z_][a-z0-9_]*\.model\.js$/; | ||
// const MODEL_ID_PATTERN_TS = /^[a-z_][a-z0-9_]*\.[a-z_][a-z0-9_-]*\.[a-z_][a-z0-9_]*\.model\.ts$/; | ||
// const MODEL_ID_PATTERN_PROJECT = /^[a-z_][a-z0-9_]*\.[a-z_][a-z0-9_-]*\.[a-z_][a-z0-9_]*\.model\.kpj$/; | ||
|
||
/** | ||
* Filenames of files contained in a package MAY adhere to this pattern for | ||
* optimum cross-platform compatibility. This is the basename portion of the | ||
* filename, and is case-insensitive. | ||
*/ | ||
export const CONTENT_FILE_BASENAME_PATTERN = /^[a-z0-9_+.-]+$/i; // base names can be case insensitive | ||
|
||
/** | ||
* Extensions of files contained in a package MAY adhere to this pattern for optimum | ||
* cross-platform compatibility. This is the extension portion of the filename, | ||
* and should be lower case, and may be empty. | ||
*/ | ||
export const CONTENT_FILE_EXTENSION_PATTERN = /^(\.[a-z0-9_-]+)?$/; // extensions should be lower-case or empty | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Keyman is copyright (C) SIL International. MIT License. | ||
* | ||
* tslint options for kmc-generate | ||
*/ | ||
|
||
module.exports = { | ||
parserOptions: { | ||
project: ["./tsconfig.json", "./test/tsconfig.json"], | ||
}, | ||
ignorePatterns: ["test/fixtures/**/*", "src/template/**/*"], | ||
overrides: [ | ||
{ | ||
files:"src/**/*.ts", | ||
extends: ["../../../common/tools/eslint/eslintNoNodeImports.js"], | ||
} | ||
], | ||
rules: { | ||
"prefer-const": 1, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Keyman is copyright (C) SIL International. MIT License. | ||
# | ||
## START STANDARD BUILD SCRIPT INCLUDE | ||
# adjust relative paths as necessary | ||
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" | ||
. "${THIS_SCRIPT%/*}/../../../resources/build/builder.inc.sh" | ||
## END STANDARD BUILD SCRIPT INCLUDE | ||
|
||
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh" | ||
. "$KEYMAN_ROOT/resources/build/build-utils-ci.inc.sh" | ||
|
||
builder_describe "Build Keyman kmc-generate module" \ | ||
"@/common/web/keyman-version" \ | ||
"@/common/web/types" \ | ||
"@/developer/src/common/web/test-helpers" \ | ||
clean configure build api test publish \ | ||
"--npm-publish+ For publish, do a npm publish, not npm pack (only for CI)" \ | ||
"--dry-run,-n don't actually publish, just dry run" | ||
|
||
builder_describe_outputs \ | ||
configure /node_modules \ | ||
build /developer/src/kmc-generate/build/src/main.js \ | ||
api /developer/build/api/kmc-generate.api.json | ||
|
||
builder_parse "$@" | ||
|
||
#------------------------------------------------------------------------------------------------------------------- | ||
|
||
do_build() { | ||
tsc --build | ||
rm -rf ./build/src/template | ||
mkdir -p ./build/src/template | ||
cp -R ./src/template/ ./build/src/ | ||
} | ||
|
||
do_test() { | ||
eslint . | ||
cd test | ||
tsc --build | ||
cd .. | ||
c8 --reporter=lcov --reporter=text mocha "${builder_extra_params[@]}" | ||
} | ||
|
||
builder_run_action clean rm -rf ./build/ ./tsconfig.tsbuildinfo | ||
builder_run_action configure verify_npm_setup | ||
builder_run_action build do_build | ||
builder_run_action api api-extractor run --local --verbose | ||
builder_run_action test do_test | ||
builder_run_action publish builder_publish_npm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Config file for API Extractor. For more info, please visit: https://api-extractor.com | ||
*/ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
"extends": "../../../config/api-extractor.base.json", | ||
"mainEntryPointFilePath": "<projectFolder>/build/src/main.d.ts", | ||
"docModel": { | ||
"enabled": true, | ||
"projectFolderUrl": "http://github.com/keymanapp/keyman/tree/master/developer/src/kmc-generate" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "@keymanapp/kmc-generate", | ||
"description": "Keyman Developer generate module", | ||
"keywords": [ | ||
"keyboard", | ||
"keyman", | ||
"ldml", | ||
"unicode" | ||
], | ||
"type": "module", | ||
"exports": { | ||
".": "./build/src/main.js" | ||
}, | ||
"files": [ | ||
"/build/src/" | ||
], | ||
"scripts": { | ||
"build": "gosh ./build.sh build", | ||
"lint": "eslint .", | ||
"test": "gosh ./build.sh test" | ||
}, | ||
"author": "Marc Durdin <[email protected]> (https://github.com/mcdurdin)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/keymanapp/keyman/issues" | ||
}, | ||
"dependencies": { | ||
"@keymanapp/common-types": "*", | ||
"@keymanapp/developer-utils": "*", | ||
"@keymanapp/keyman-version": "*" | ||
}, | ||
"devDependencies": { | ||
"@keymanapp/developer-test-helpers": "*", | ||
"@keymanapp/resources-gosh": "*", | ||
"@types/mocha": "^10.0.0", | ||
"@types/node": "^20.4.1", | ||
"@types/semver": "^7.3.12", | ||
"c8": "^7.12.0", | ||
"chalk": "^2.4.2", | ||
"mocha": "^10.0.0", | ||
"typescript": "^5.4.5" | ||
}, | ||
"mocha": { | ||
"spec": "build/test/**/test-*.js", | ||
"require": [ | ||
"source-map-support/register" | ||
] | ||
}, | ||
"c8": { | ||
"all": true, | ||
"src": [ | ||
"src/" | ||
], | ||
"exclude-after-remap": true, | ||
"exclude": [ | ||
"test/", | ||
"src/template/" | ||
] | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/keymanapp/keyman.git" | ||
} | ||
} |
Oops, something went wrong.