Skip to content

Commit

Permalink
Upgrades Lingo to v8
Browse files Browse the repository at this point in the history
  • Loading branch information
johnatawnclementawn committed Jul 1, 2024
1 parent c696479 commit aa439cb
Show file tree
Hide file tree
Showing 13 changed files with 1,529 additions and 840 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ repos:
name: eslint
entry: npm run eslint:fix
language: system
files: arches_lingo/src
- id: typescript
name: typescript
entry: npm run ts:check
Expand Down
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"singleAttributePerLine": true,
"tabWidth": 4
"singleAttributePerLine": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ define([
null,
function(){}
)
)
);
}).always(() => {
self.loading(false);
});
Expand Down
2 changes: 1 addition & 1 deletion arches_lingo/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Foo from "@/components/FooComponent.vue";
</script>

<template>
<Foo />
<Foo />
</template>
2 changes: 1 addition & 1 deletion arches_lingo/src/components/FooComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ console.log("hello world!");
</script>

<template>
<h1>Hello World!</h1>
<h1>Hello World!</h1>
</template>
2,120 changes: 1,347 additions & 773 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"vitest": "vitest --run --coverage"
},
"devDependencies": {
"arches-dev-dependencies": "archesproject/arches-dev-dependencies#dev/7.6.x"
"arches-dev-dependencies": "archesproject/arches-dev-dependencies#dev/8.0.x"
},
"dependencies": {
"arches": "archesproject/arches#dev/7.6.x"
"arches": "archesproject/arches#controlled-list-item-editor"
},
"nodeModulesPaths": {
},
Expand Down
43 changes: 43 additions & 0 deletions webpack/webpack-utils/build-css-filepath-lookup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const Path = require('path');
const fs = require('fs');

function buildCSSFilepathLookup(path, outerAcc, cssDirectoryPath) {
if (!fs.existsSync(path)) {
return;
}

return fs.readdirSync(path).reduce((acc, name) => {
const outerPath = cssDirectoryPath || path; // original `path` arg is persisted through recursion

if (fs.lstatSync(Path.join(path, name)).isDirectory() ) {
return buildCSSFilepathLookup(
Path.join(path, name),
acc,
outerPath
);
}
else {
let subPath = Path.join(path, name).split(/css(.*)/s)[1]; // splits only on first occurance
subPath = subPath.substring(1);
const parsedPath = Path.parse(subPath);

let pathName = parsedPath['name'];

if (parsedPath['dir']) {
pathName = Path.join(parsedPath['dir'], parsedPath['name']);
}

if (pathName.includes('.DS_Store')) {
return acc;
}
else {
return {
...acc,
[Path.join('css', pathName.replace(/\\/g, '/'))]: { 'import': Path.join(outerPath, subPath) }
};
}
}
}, outerAcc);
};

module.exports = { buildCSSFilepathLookup };
46 changes: 0 additions & 46 deletions webpack/webpack-utils/build-filepath-lookup.js

This file was deleted.

35 changes: 35 additions & 0 deletions webpack/webpack-utils/build-image-filepath-lookup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const Path = require('path');
const fs = require('fs');

const buildImageFilePathLookup = function(publicPath, path, outerAcc, imageDirectoryPath) {
if (!fs.existsSync(path)) {
return;
}

return fs.readdirSync(path).reduce((acc, name) => {
const outerPath = imageDirectoryPath || path; // original `path` arg is persisted through recursion

if (fs.lstatSync(Path.join(path, name)).isDirectory() ) {
return buildImageFilePathLookup(
publicPath,
Path.join(path, name),
acc,
outerPath
);
}
else {
let subPath = Path.join(path, name).split(/img(.*)/s)[1]; // splits only on first occurance
subPath = subPath.substring(1);

const parsedPath = Path.parse(subPath);
const filename = parsedPath['dir'] ? Path.join(parsedPath['dir'], parsedPath['base']) : parsedPath['base'];

return {
...acc,
[Path.join(publicPath, 'img', filename).replace(/\\/g, '/')]: Path.resolve(__dirname, Path.join(outerPath, subPath))
};
}
}, outerAcc);
};

module.exports = { buildImageFilePathLookup };
43 changes: 43 additions & 0 deletions webpack/webpack-utils/build-javascript-filepath-lookup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const Path = require('path');
const fs = require('fs');

function buildJavascriptFilepathLookup(path, outerAcc, javascriptDirectoryPath) {
if (!fs.existsSync(path)) {
return;
}

return fs.readdirSync(path).reduce((acc, name) => {
const outerPath = javascriptDirectoryPath || path; // original `path` arg is persisted through recursion

if (fs.lstatSync(Path.join(path, name)).isDirectory() ) {
return buildJavascriptFilepathLookup(
Path.join(path, name),
acc,
outerPath
);
}
else {
let subPath = Path.join(path, name).split(/js(.*)/s)[1]; // splits only on first occurance
subPath = subPath.substring(1);
const parsedPath = Path.parse(subPath);

let pathName = parsedPath['name'];

if (parsedPath['dir']) {
pathName = Path.join(parsedPath['dir'], parsedPath['name']);
}

if (pathName.includes('.DS_Store')) {
return acc;
}
else {
return {
...acc,
[pathName.replace(/\\/g, '/')]: { 'import': Path.join(outerPath, subPath), 'filename': Path.join('js', '[name].js') }
};
}
}
}, outerAcc);
};

module.exports = { buildJavascriptFilepathLookup };
39 changes: 39 additions & 0 deletions webpack/webpack-utils/build-template-filepath-lookup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const Path = require('path');
const fs = require('fs');

const buildTemplateFilePathLookup = function(path, outerAcc, templateDirectoryPath) {
if (!fs.existsSync(path)) {
return;
}

return fs.readdirSync(path).reduce((acc, name) => {
const outerPath = templateDirectoryPath || path; // original `path` arg is persisted through recursion

if (fs.lstatSync(Path.join(path, name)).isDirectory() ) {
return buildTemplateFilePathLookup(
Path.join(path, name),
acc,
outerPath
);
}
else {
let subPath = (Path.join(path, name)).split(/templates(.*)/s)[1]; // splits only on first occurance
subPath = subPath.substring(1);

const parsedPath = Path.parse(subPath);
const filename = parsedPath['dir'] ? Path.join(parsedPath['dir'], parsedPath['base']) : parsedPath['base'];

if (filename.includes('.DS_Store')) {
return acc;
}
else {
return {
...acc,
[Path.join('templates', filename).replace(/\\/g, '/')]: Path.resolve(__dirname, Path.join(outerPath, subPath))
};
}
}
}, outerAcc);
};

module.exports = { buildTemplateFilePathLookup };
29 changes: 16 additions & 13 deletions webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ const { spawn } = require("child_process");
const { VueLoaderPlugin } = require("vue-loader");

const { findFile } = require('./webpack-utils/find-file');
const { buildFilepathLookup } = require('./webpack-utils/build-filepath-lookup');
const { buildImageFilePathLookup } = require('./webpack-utils/build-image-filepath-lookup');
const { buildJavascriptFilepathLookup } = require('./webpack-utils/build-javascript-filepath-lookup');
const { buildTemplateFilePathLookup } = require('./webpack-utils/build-template-filepath-lookup');
const { buildCSSFilepathLookup } = require('./webpack-utils/build-css-filepath-lookup');

module.exports = () => {
return new Promise((resolve, _reject) => {
Expand All @@ -30,13 +33,13 @@ module.exports = () => {
// END workaround for handling node_modules paths in arches-core vs projects
// BEGIN create entry point configurations

const archesCoreEntryPointConfiguration = buildFilepathLookup(Path.resolve(__dirname, ROOT_DIR, 'app', 'media', 'js'));
const projectEntryPointConfiguration = buildFilepathLookup(Path.resolve(__dirname, APP_ROOT, 'media', 'js'));
const archesCoreEntryPointConfiguration = buildJavascriptFilepathLookup(Path.resolve(__dirname, ROOT_DIR, 'app', 'media', 'js'), {});
const projectEntryPointConfiguration = buildJavascriptFilepathLookup(Path.resolve(__dirname, APP_ROOT, 'media', 'js'), {});

const archesApplicationsEntrypointConfiguration = ARCHES_APPLICATIONS.reduce((acc, archesApplication) => {
return {
...acc,
...buildFilepathLookup(Path.resolve(__dirname, ARCHES_APPLICATIONS_PATHS[archesApplication], 'media', 'js'))
...buildJavascriptFilepathLookup(Path.resolve(__dirname, ARCHES_APPLICATIONS_PATHS[archesApplication], 'media', 'js'), {})
};
}, {});

Expand Down Expand Up @@ -153,13 +156,13 @@ module.exports = () => {
// END create node modules aliases
// BEGIN create template filepath lookup

const coreArchesTemplatePathConfiguration = buildFilepathLookup(Path.resolve(__dirname, ROOT_DIR, 'app', 'templates'));
const projectTemplatePathConfiguration = buildFilepathLookup(Path.resolve(__dirname, APP_ROOT, 'templates'));
const coreArchesTemplatePathConfiguration = buildTemplateFilePathLookup(Path.resolve(__dirname, ROOT_DIR, 'app', 'templates'), {});
const projectTemplatePathConfiguration = buildTemplateFilePathLookup(Path.resolve(__dirname, APP_ROOT, 'templates'), {});

const archesApplicationsTemplatePathConfiguration = ARCHES_APPLICATIONS.reduce((acc, archesApplication) => {
return {
...acc,
...buildFilepathLookup(Path.resolve(__dirname, ARCHES_APPLICATIONS_PATHS[archesApplication], 'templates'))
...buildTemplateFilePathLookup(Path.resolve(__dirname, ARCHES_APPLICATIONS_PATHS[archesApplication], 'templates'), {})
};
}, {});

Expand All @@ -173,13 +176,13 @@ module.exports = () => {
// END create template filepath lookup
// BEGIN create image filepath lookup

const coreArchesImagePathConfiguration = buildFilepathLookup(Path.resolve(__dirname, ROOT_DIR, 'app', 'media', 'img'), STATIC_URL);
const projectImagePathConfiguration = buildFilepathLookup(Path.resolve(__dirname, APP_ROOT, 'media', 'img'), STATIC_URL);
const coreArchesImagePathConfiguration = buildImageFilePathLookup(STATIC_URL, Path.resolve(__dirname, ROOT_DIR, 'app', 'media', 'img'), {});
const projectImagePathConfiguration = buildImageFilePathLookup(STATIC_URL, Path.resolve(__dirname, APP_ROOT, 'media', 'img'), {});

const archesApplicationsImagePathConfiguration = ARCHES_APPLICATIONS.reduce((acc, archesApplication) => {
return {
...acc,
...buildFilepathLookup(Path.resolve(__dirname, ARCHES_APPLICATIONS_PATHS[archesApplication], 'media', 'img'), STATIC_URL)
...buildImageFilePathLookup(STATIC_URL, Path.resolve(__dirname, ARCHES_APPLICATIONS_PATHS[archesApplication], 'media', 'img'), {})
};
}, {});

Expand All @@ -193,8 +196,8 @@ module.exports = () => {
// END create image filepath lookup
// BEGIN create CSS filepath lookup

const coreArchesCSSFilepathConfiguration = buildFilepathLookup(Path.resolve(__dirname, ROOT_DIR, 'app', 'media', 'css'));
const projectCSSFilepathConfiguration = buildFilepathLookup(Path.resolve(__dirname, APP_ROOT, 'media', 'css'));
const coreArchesCSSFilepathConfiguration = buildCSSFilepathLookup(Path.resolve(__dirname, ROOT_DIR, 'app', 'media', 'css'), {});
const projectCSSFilepathConfiguration = buildCSSFilepathLookup(Path.resolve(__dirname, APP_ROOT, 'media', 'css'), {});

const archesApplicationsCSSFilepaths = [];
const archesApplicationsCSSFilepathConfiguration = ARCHES_APPLICATIONS.reduce((acc, archesApplication) => {
Expand All @@ -203,7 +206,7 @@ module.exports = () => {

return {
...acc,
...buildFilepathLookup(path)
...buildCSSFilepathLookup(path, {})
};
}, {});

Expand Down

0 comments on commit aa439cb

Please sign in to comment.