Skip to content

Commit

Permalink
Merge pull request #9476 from camptocamp/project-no-typescript
Browse files Browse the repository at this point in the history
Be able to compile the project without typescript
  • Loading branch information
sbrunner authored Sep 19, 2024
2 parents fa9bc6f + 7f48601 commit 52d9f89
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 57 deletions.
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ repos:
|\.prettierignore
|examples/svg\.html
)$
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.0.3
hooks:
- id: editorconfig-checker
args:
- -disable-indentation
- -disable-max-line-length
exclude: |-
(?x)^(
secrets\.tar\.enc
)$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ check-examples-checker: $(CHECK_EXAMPLE_CHECKER)
check-examples: $(BUILD_EXAMPLES_CHECK_TIMESTAMP_FILES)

.PHONY: lint
lint: .build/eslint.timestamp .build/eslint-ts.timestamp eclint lint-extra
lint: .build/eslint.timestamp .build/eslint-ts.timestamp lint-extra

.PHONY: lint-extra
lint-extra:
Expand All @@ -127,10 +127,6 @@ lint-extra:
.PHONY: eslint
eslint: .build/eslint.timestamp .build/eslint-ts.timestamp

.PHONY: eclint
eclint: .build/node_modules.timestamp
npm run eclint

.PHONY: test
test: .build/node_modules.timestamp .build/build-dll.timestamp
TS_NODE_PROJECT=disable.json ./node_modules/karma/bin/karma start karma-conf.js --single-run
Expand Down
86 changes: 40 additions & 46 deletions buildtools/webpack.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,30 @@ module.exports = function (config) {
$: 'jquery',
});

const rules = [];

// Expose corejs-typeahead as window.Bloodhound
const typeaheadRule = {
rules.push({
test: require.resolve('corejs-typeahead'),
use: {
loader: 'expose-loader',
options: {
exposes: 'Bloodhound',
},
},
};
});

const jqueryRule = {
rules.push({
test: require.resolve('jquery'),
use: {
loader: 'expose-loader',
options: {
exposes: '$',
},
},
};
});

const gmfapiExpose = {
rules.push({
test: path.resolve(__dirname, '../srcapi/index.ts'),
use: {
loader: 'expose-loader',
Expand All @@ -79,57 +81,59 @@ module.exports = function (config) {
},
},
},
};

const jsRule = {
test: /MapillaryService\.js$/,
use: [
{
loader: 'magic-comments-loader',
},
],
};

const tsRule = {
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
},
{
loader: 'minify-html-literals-loader',
},
],
};
});

const cssRule = {
rules.push({
test: /\.css$/,
use: [{loader: 'style-loader'}, {loader: 'css-loader'}],
};
});

const sassRule = {
rules.push({
test: /\.s[ac]ss$/i,
use: [
{loader: 'style-loader'},
{loader: 'css-loader'},
{loader: 'sass-loader', options: {warnRuleAsWarning: false}},
],
};
});

const resourcesRule = {
rules.push({
test: /\.(jpeg|png|ico|eot|ttf|woff|woff2|svg|json)$/,
type: 'asset/resource',
};
});

const htmlRule = {
rules.push({
test: /\.html$/,
use: {
loader: 'ejs-loader',
options: {
esModule: false,
},
},
};
});

if (config.noTs != true) {
rules.push({
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
},
{
loader: 'minify-html-literals-loader',
},
],
});
}

rules.push({
test: /MapillaryService\.js$/,
use: [
{
loader: 'magic-comments-loader',
},
],
});

const plugins = [
providePlugin,
Expand All @@ -155,17 +159,7 @@ module.exports = function (config) {
path: path.resolve(__dirname, '../dist/'),
},
module: {
rules: [
typeaheadRule,
jqueryRule,
gmfapiExpose,
cssRule,
sassRule,
resourcesRule,
htmlRule,
tsRule,
jsRule,
],
rules: rules,
},
plugins: plugins,
resolve: {
Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"build-gmf-examples": "TARGET=gmf-examples webpack --mode=development --progress",
"build-gmf-apps": "TARGET=gmf-apps webpack --mode=development --progress",
"build-api": "webpack --config buildtools/webpack.api.js --mode=production --progress",
"eclint": "editorconfig-checker -disable-indentation -disable-max-line-length --exclude secrets.tar.enc",
"serve-ngeo-examples": "DEV_SERVER=1 TARGET=ngeo-examples webpack serve --open --server-type=https --server-options-cert=private.crt --server-options-key=private.key --port=3000 --mode=development --progress --watch",
"serve-gmf-examples": "DEV_SERVER=1 TARGET=gmf-examples webpack serve --open --server-type=https --server-options-cert=private.crt --server-options-key=private.key --port=3000 --mode=development --progress --watch",
"serve-gmf-apps": "DEV_SERVER=1 TARGET=gmf-apps webpack serve --open --server-type=https --server-options-cert=private.crt --server-options-key=private.key --port=3000 --mode=development --progress",
Expand Down Expand Up @@ -61,7 +60,7 @@
},
"dependencies": {
"@fortawesome/fontawesome-free": "5.15.4",
"@lit/reactive-element": "2.0.4",
"@sentry/browser": "8.29.0",
"@trevoreyre/autocomplete-js": "3.0.2",
"angular": "1.8.3",
"angular-animate": "1.8.3",
Expand Down Expand Up @@ -116,8 +115,6 @@
"@chromatic-com/storybook": "2.0.0",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.9.1",
"@popperjs/core": "2.11.8",
"@sentry/browser": "8.29.0",
"@sentry/types": "8.29.0",
"@storybook/addon-essentials": "8.2.9",
"@storybook/addon-links": "8.2.9",
Expand Down Expand Up @@ -154,7 +151,6 @@
"@typescript-eslint/eslint-plugin": "8.3.0",
"@typescript-eslint/parser": "8.3.0",
"angular-mocks": "1.8.3",
"chokidar": "3.6.0",
"chromatic": "11.7.1",
"commander": "12.1.0",
"copy-webpack-plugin": "12.0.2",
Expand All @@ -164,7 +160,6 @@
"cypress-browser-permissions": "1.1.0",
"cypress-real-events": "1.13.0",
"doctrine": "3.0.0",
"editorconfig-checker": "5.1.8",
"ejs-loader": "0.5.0",
"eslint": "9.9.1",
"eslint-plugin-jsdoc": "50.2.2",
Expand Down

0 comments on commit 52d9f89

Please sign in to comment.