Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .githooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env sh

BLUE="\033[34m"
NOCOLOR="\033[0m"

echo -e "${BLUE}(post-checkout) Cleaning compiled files...${NOCOLOR}"
npm run clean
2 changes: 0 additions & 2 deletions docs/devGuide/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ You can run `npm run build:backend` in the root directory to compile the files,
1. Configure your IDE to perform automatic compilation on file change/save. (_Recommended for general development_)

Refer to your IDE's guides to set this up. For instance, here are the guides for [WebStorm](https://www.jetbrains.com/help/webstorm/compiling-typescript-to-javascript.html#ts_compiler_compile_code_automatically) and [Visual Studio Code](https://code.visualstudio.com/docs/typescript/typescript-compiling#_step-2-run-the-typescript-build).

Note that the TypeScript configuration used for development (`tsconfig_dev.json`) is different than the one for production (`tsconfig.json`), so you might need to modify your IDE's `tsc` command to include the option `-p tsconfig_dev.json`.

#### Editing frontend features

Expand Down
1,652 changes: 870 additions & 782 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
"name": "root",
"private": true,
"scripts": {
"build:backend": "npm run clean && tsc --build --verbose",
"prebuild:backend": "npm run clean",
"build:backend": "tsc --noEmitOnError",
"build:web": "cd packages/core-web && npm run build",
"build:dg": "cd docs && ../packages/cli/index.js build -s dg-site.json",
"build:ug": "cd docs && ../packages/cli/index.js build -s ug-site.json",
"deploy:dg": "cd docs && ../packages/cli/index.js deploy -s dg-site.json --ci",
"deploy:ug": "cd docs && ../packages/cli/index.js deploy -s ug-site.json --ci",
"clean": "tsc --build --clean",
"clean": "node ./scripts/clean.js",
"csslint": "stylelint **/*.css **/*.vue",
"csslintfix": "stylelint **/*.css **/*.vue --fix",
"dev": "tsc -p tsconfig_dev.json --watch",
"dev": "tsc --watch",
"install": "npm run install:hooks",
"install:hooks": "git config core.hooksPath .githooks",
"lint": "eslint . --ext .js,.ts,.vue && npm run csslint",
"lintfix": "eslint . --ext .js,.ts,.vue --fix && npm run csslintfix",
"setup": "npm ci && npm run clean && lerna clean --yes && lerna bootstrap --hoist",
Expand All @@ -30,6 +33,7 @@
"lerna": "^3.22.1",
"stylelint": "^12.0.0",
"stylelint-config-standard": "^19.0.0",
"typescript": "^4.6.2"
"typescript": "^4.6.2",
"walk-sync": "^2.0.2"
Comment thread
ryoarmanda marked this conversation as resolved.
}
}
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"access": "public"
},
"scripts": {
"clean": "tsc --build --clean",
"build": "npm run clean && tsc --build --verbose",
"compile": "tsc",
"build": "tsc --noEmitOnError",
"prepare": "npm run build",
"test": "jest --colors"
},
Expand Down
5 changes: 1 addition & 4 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": "../../tsconfig_base.json",
"compilerOptions": {
"composite": true
},
"include": ["src"]
"exclude": ["node_modules"]
}
49 changes: 49 additions & 0 deletions scripts/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Script for cleaning compiled TypeScript files
*
* This script is a manual substitute of the `tsc --build --clean`
* command which can handle the case where the TypeScript file
* that generated its associated compiled files has been removed
* prior to cleaning.
*
* The script assumes that the associated compiled files can be
* detected through the presence of sourcemap files (`.js.map`)
* instead.
*/

const fs = require('fs');
const path = require('path');
// eslint-disable-next-line import/no-extraneous-dependencies
const walkSync = require('walk-sync');

const JS_MAP_RE = /\.js\.map$/;
const COMPILED_FILES_EXTS = ['.d.ts', '.d.ts.map', '.js', '.js.map'];

const packagesDir = path.join(__dirname, '../packages');

const jsMapFiles = walkSync(packagesDir, {
globs: ['**/*.js.map'],
ignore: ['**/node_modules'],
directories: false,
includeBasePath: true,
});

function removeFile(file) {
try {
fs.rmSync(file);
} catch (err) {
// No need to error when file is not found
if (err.code === 'ENOENT') {
return;
}

throw err;
}
}

jsMapFiles.forEach((jsMapFile) => {
COMPILED_FILES_EXTS.forEach((ext) => {
const extFile = jsMapFile.replace(JS_MAP_RE, ext);
removeFile(extFile);
});
});
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": "./tsconfig_base.json",
"references": [
{ "path": "packages/core" }
],
"files": []
"exclude": ["**/node_modules"]
}
6 changes: 0 additions & 6 deletions tsconfig_dev.json

This file was deleted.