Skip to content

Commit

Permalink
separate clean declaration files function
Browse files Browse the repository at this point in the history
  • Loading branch information
mkslanc committed Dec 17, 2024
1 parent 8a0fc52 commit a2cedcb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"interfaces.d.ts"
],
"scripts": {
"clean": "rimraf src/**/*.d.ts",
"clean:dts": "node -e \"require('./tool/fs_utilities').cleanDeclarationFiles()\"",
"start": "node static.js",
"test": "node src/test/all.js",
"cover": "istanbul cover src/test/all.js",
"lint": "eslint \"src/**/*.js\" \"*.js\"",
"fix": "npm run lint -- --fix",
"typecheck": "tsc -p tsconfig.json",
"typecheck": "npm run clean:dts && tsc -p tsconfig.json",
"update-types": "node ./tool/ace_declaration_generator.js",
"changelog": "standard-version",
"prepack": "node tool/esm_resolver_generator.js && node tool/ace_declaration_generator.js && node Makefile.dryice.js css --target build-styles && rm -rf styles && mv build-styles/css styles"
Expand Down
13 changes: 1 addition & 12 deletions tool/ace_declaration_generator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const ts = require('typescript');
const fs = require("fs");
const path = require("path");
var {getAllFiles} = require("./fs_utilities");
var {getAllFiles, cleanDeclarationFiles} = require("./fs_utilities");

const AUTO_GENERATED_HEADER = "/* This file is generated using `npm run update-types` */\n\n";

Expand Down Expand Up @@ -733,17 +733,6 @@ function updateDeclarationModuleNames(content) {
return output;
}

function cleanDeclarationFiles() {
const baseDir = path.resolve(__dirname, '../src');
const files = getAllFiles(baseDir);

files.forEach(file => {
if (file.endsWith('.d.ts')) {
fs.unlinkSync(file);
}
});
}

function bundleDtsFiles(buildPath) {
const aceNamespacePath = __dirname + "/../ace-internal.d.ts";
if (!buildPath) {
Expand Down
14 changes: 13 additions & 1 deletion tool/fs_utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,16 @@ function getAllFiles(dirPath) {
return files;
}

exports.getAllFiles = getAllFiles;
function cleanDeclarationFiles() {
const baseDir = path.resolve(__dirname, '../src');
const files = getAllFiles(baseDir);

files.forEach(file => {
if (file.endsWith('.d.ts')) {
fs.unlinkSync(file);
}
});
}

exports.getAllFiles = getAllFiles;
exports.cleanDeclarationFiles = cleanDeclarationFiles;

0 comments on commit a2cedcb

Please sign in to comment.