Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate dts generator for ace-code and ace-builds #5427

Merged
merged 41 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0b1d155
Update type definitions in various files and add a declaration generator
mkslanc Dec 14, 2023
a36f222
Update TypeScript configuration for ACE declaration generator
mkslanc Dec 14, 2023
362f238
correct types
mkslanc Dec 15, 2023
a911b4c
exclude src/mode (whole dit with files); correct final declaration fo…
mkslanc Dec 15, 2023
a57489b
move `for` static method under `Autocomplete` class; fix types
mkslanc Feb 5, 2024
0e4c470
remove private properties/methods from public API
mkslanc Feb 5, 2024
ee14196
remove unnecessary generated declaration; fix tsconfig.json
mkslanc Feb 5, 2024
3674429
update ace.d.ts
nightwing Apr 8, 2024
65d23ff
split modules by different context
mkslanc Apr 17, 2024
260acaa
separate libs from core modules
mkslanc Apr 17, 2024
a6df107
filter all nodes with `private` modifier
mkslanc Apr 18, 2024
b3db1c3
update ci script
nightwing Apr 18, 2024
ed40c51
set default d.ts format code settings
mkslanc Apr 18, 2024
48cac72
Merge branch 'refs/heads/master' into dts-generator
mkslanc Apr 18, 2024
7e8d9bf
re-generate after new changes
mkslanc Apr 18, 2024
da46e1f
add missing type
mkslanc Apr 18, 2024
bb9b63b
revert change to ace-modes
nightwing Apr 18, 2024
389e14e
add config options
mkslanc May 29, 2024
1ee5cae
Merge branch 'refs/heads/master' into dts-generator
mkslanc May 29, 2024
23b4948
resolve merge conflicts
mkslanc May 29, 2024
d94f658
Merge branch 'refs/heads/master' into dts-generator
mkslanc Jun 13, 2024
4770704
filter nodes tagged with @internal flag
mkslanc Jun 18, 2024
06e7190
Merge branch 'refs/heads/master' into dts-generator
mkslanc Jul 12, 2024
5797ae1
update types for typescript 5.5.3
mkslanc Jul 12, 2024
5a993f2
Merge branch 'refs/heads/master' into dts-generator
mkslanc Sep 9, 2024
05577d6
regenerate after code changes
mkslanc Sep 9, 2024
0ede0d8
add new events; improve EventEmitter method declarations; fix Config …
mkslanc Sep 30, 2024
d862604
add a test
nightwing Sep 30, 2024
6aca79a
improve types
mkslanc Oct 11, 2024
260aed8
Merge remote-tracking branch 'ace/master' into dts-generator
mkslanc Nov 6, 2024
fa6993c
update to new version
mkslanc Nov 7, 2024
17c3e18
fix the new test
nightwing Nov 13, 2024
9f1a005
further types improving
mkslanc Nov 11, 2024
fd90e44
update types; improve generation by removing undefined declarations
mkslanc Nov 13, 2024
d4be802
Merge branch 'master' into dts-generator
mkslanc Nov 18, 2024
b2f0316
update to last version
mkslanc Nov 18, 2024
44f7f07
remove duplicating types comments; move types to `types` directory
mkslanc Nov 19, 2024
2583e1c
corrects import statements
mkslanc Nov 19, 2024
6f05004
fix: create `type` dir, if it doesn't exist
mkslanc Nov 19, 2024
b0f9f2c
add auto generated header to type declarations
mkslanc Nov 20, 2024
a2122ec
Merge branch 'master' into dts-generator
mkslanc Nov 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ jobs:
fi
fi
# check types
- run: npm run update-types
- run: node_modules/.bin/tsc --noImplicitAny --strict --noUnusedLocals --noImplicitReturns --noUnusedParameters --noImplicitThis ace.d.ts
- run: npm run typecheck
- run: git diff --exit-code ./ace-modes.d.ts ./ace.d.ts
- run: |
set -x;
npx tsc -v;
npm run update-types;
git diff --color --exit-code ./ace*d.ts;
npm run typecheck;
node_modules/.bin/tsc --noImplicitAny --strict --noUnusedLocals --noImplicitReturns --noUnusedParameters --noImplicitThis ace.d.ts;
# upload to codecov
- uses: codecov/codecov-action@v3
with:
token: d8edca4b-8e97-41e5-b54e-34c7cf3b2d47
Expand Down
39 changes: 30 additions & 9 deletions Makefile.dryice.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
var path = require("path");
var copy = require('architect-build/copy');
var build = require('architect-build/build');
var {
updateDeclarationModuleNames,
generateDeclaration,
SEPARATE_MODULES
} = require('./tool/ace_declaration_generator');

var ACE_HOME = __dirname;
var BUILD_DIR = ACE_HOME + "/build";
Expand Down Expand Up @@ -174,20 +179,24 @@
}
}

function correctDeclarationsForBuild(path, additionalDeclarations) {
var definitions = fs.readFileSync(path, 'utf8');
var newDefinitions = updateDeclarationModuleNames(definitions);
if (additionalDeclarations) {
newDefinitions = newDefinitions + '\n' + additionalDeclarations;
}
fs.writeFileSync(path, newDefinitions);
}

function buildTypes() {
var aceCodeModeDefinitions = '/// <reference path="./ace-modes.d.ts" />';
var aceCodeExtensionDefinitions = '/// <reference path="./ace-extensions.d.ts" />';
// ace-builds package has different structure and can't use mode types defined for the ace-code.
// ace-builds modes are declared along with other modules in the ace-modules.d.ts file below.
var definitions = fs.readFileSync(ACE_HOME + '/ace.d.ts', 'utf8').replace(aceCodeModeDefinitions, '').replace(aceCodeExtensionDefinitions, '');
var paths = fs.readdirSync(BUILD_DIR + '/src-noconflict');
var moduleRef = '/// <reference path="./ace-modules.d.ts" />';

fs.readdirSync(BUILD_DIR + '/src-noconflict/snippets').forEach(function(path) {
paths.push("snippets/" + path);
});

var moduleNameRegex = /^(mode|theme|ext|keybinding)-|^snippets\//;
var moduleNameRegex = /^(keybinding)-/;

var pathModules = [
"declare module 'ace-builds/webpack-resolver';",
Expand All @@ -199,9 +208,21 @@
return "declare module 'ace-builds/src-noconflict/" + moduleName + "';";
}
}).filter(Boolean)).join("\n") + "\n";

fs.writeFileSync(BUILD_DIR + '/ace.d.ts', moduleRef + '\n' + definitions);
fs.writeFileSync(BUILD_DIR + '/ace-modules.d.ts', pathModules);

fs.copyFileSync(ACE_HOME + '/ace-internal.d.ts', BUILD_DIR + '/ace.d.ts');
generateDeclaration(BUILD_DIR + '/ace.d.ts');
fs.copyFileSync(ACE_HOME + '/ace-modes.d.ts', BUILD_DIR + '/ace-modes.d.ts');
correctDeclarationsForBuild(BUILD_DIR + '/ace.d.ts', pathModules);
correctDeclarationsForBuild(BUILD_DIR + '/ace-modes.d.ts');

let allModules = SEPARATE_MODULES;
allModules.push("modules"); // core modules
allModules.forEach(function (key) {
let fileName = '/ace-' + key + '.d.ts';
fs.copyFileSync(ACE_HOME + fileName, BUILD_DIR + fileName);
correctDeclarationsForBuild(BUILD_DIR + fileName);
});

var esmUrls = [];

var loader = paths.map(function(path) {
Expand Down Expand Up @@ -469,7 +490,7 @@
}

function buildAce(options, callback) {
var snippetFiles = jsFileList("lib/ace/snippets");

Check warning on line 493 in Makefile.dryice.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'snippetFiles' is assigned a value but never used
var modeNames = modeList();

buildCore(options, {outputFile: "ace.js"}, addCb());
Expand Down Expand Up @@ -855,7 +876,7 @@
});
}

function generateThemesModule(themes) {

Check warning on line 879 in Makefile.dryice.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'generateThemesModule' is defined but never used
var themelist = [
'define(function(require, exports, module) {',
'\n\nmodule.exports.themes = ' + JSON.stringify(themes, null, ' '),
Expand Down
Loading
Loading