Giter VIP home page Giter VIP logo

sakho3600 / archifiltre Goto Github PK

View Code? Open in Web Editor NEW

This project forked from socialgouv/archifiltre-docs

0.0 0.0 0.0 10.84 MB

Aider les archivistes et les producteurs de documents bureautiques à appréhender des arborescences complètes de fichiers pour les traiter.

Home Page: https://archifiltre.fabrique.social.gouv.fr/

License: MIT License

JavaScript 2.03% CSS 0.07% HTML 0.03% TypeScript 97.57% Dockerfile 0.08% Shell 0.13% PowerShell 0.08%

archifiltre's Introduction

Archifiltre

Import script

Description

Archifiltre provides you with an export script that you can run directly on your file server. It allows you to generate a file that can be directly sent to an archivist. He will then be able to drop it into Archifiltre to analyze the file tree.

The generated file will contain the following information :

  • The absolute path of the exported folder on your file system
  • The filesystem on which the export was ran (unix or windows)
  • The absolute path of every file in the exported folder
  • The size of every file in the exported folder
  • The lastModificationDate of every file in the exported folder
  • The MD5 hash of every file in the exported folder

Usage

Windows

Get the powershell script in ./scripts/load-from-filesystem.ps1. Then, from a powershell command, run :

load-from-filesystem.ps1 path-to-the-exported-folder > file-to-export-to

An export file will be created at the file-to-export-to location.

Unix or MacOS

Get the bash script in ./scripts/load-filesystem.sh. Then, from a bash command, run :

./load-filesystem.sh path-to-the-exported-folder > file-to-export-to

An export file will be created at the file-to-export-to location.

If you encounter execution rights errors, run the following command to set the execution rights for the script :

chmod u+x ./load-filesystem.sh

Contributing

Launching the app

First install the dependencies

yarn

Then copy the example env file

cp .env.example .env

(Optionnal) Install the React Developper Tools in your chrome browser. Then, find the extension install path and add it to the .env file. More info here. You must provide the absolute path.

You should use autoreloading when developping, using

yarn dev

and in another terminal, to launch the electron app:

yarn dev-app

and then, reload your electron app with the refresh command (CMD + R on OS X)

You can make the app automatically load a specific folder by doing:

yarn dev --autoload /absolute/or/relative/path/to/folder

Writing code

  • Use JSDoc comments to document new functions.
  • Try to keep you methods simple using meaningful function names and variable names.

Comitting

For our commits message, we are following conventional commits.

e2e tests

You can run end-to-end tests by running

yarn e2e

E2E tests may fail after you installed new dependencies. You can fix it by doing

yarn install --force

Code state

  • We are migrating our data store from our custom framework to redux to make the code easier to apprehend by contributors.
  • We are reworking components to isolate business logic into redux operations. This will allow cleaner code structure to make the app more maintainable.
  • We are trying to change our components to functional components using hooks instead of class components.
  • We are migrating our code to typescript to make it easier to maintain.

Resource consuming tasks

When doing heavy resource consuming tasks, we use NodeJS childProcess.fork method to keep the UI reactive. To do so, we use webpack-fork-loader, which will wrap every *.fork.js or *.fork.ts file into a ChildProcess constructor that will build a nodeJS ChildProcess element.

We added some utility classes to adapt the ChildProcess API to the formerly used WebWorkers API which can be found in the src/util/async-worker-util.ts file.

A basic new ChildProcess would look like :

// child-process.controller.ts
import MyChildProcess from "./child-process.fork.ts";
import { createAsyncWorkerControllerClass, AsyncWorkerEvent } from "../util/async-worker-util";
import { MessageTypes } from "../util/batch-process/batch-process-util-types";

export const runMyChildProcess = () => {
  // We build a "newable" entity which is easier to use if you need to spawn mutliple process
  const AsyncProcess = createAsyncWorkerControllerClass(MyChildProcess);

  const asyncProcess = new AsyncProcess();

  asyncProcess.postMessage({ type: MessageTypes.INITIALIZE, data: "hello" });
  asyncProcess.addEventListener(AsyncWorkerEvent.MESSAGE, (message) => { console.log("messageReceived", message) });
}
// child-process.fork.ts
import {
  AsyncWorkerEvent,
  createAsyncWorkerForChildProcess,
  fakeChildProcess
} from "../util/async-worker-util";
import { MessageTypes } from "../util/batch-process/batch-process-util-types";

const asyncWorker = createAsyncWorkerForChildProcess();

asyncWorker.addEventListener(AsyncWorkerEvent.MESSAGE, ({ data, type }) => {
  if (type === MessageTypes.INITIALIZE) {
    asyncWorker.postMessage({ type: MessageTypes.RESULT, result: "hello" });
  }
});

// This export allows typescript compiler to not throw type errors. It will not really be used
// as it will be replaced by webpack-fork-loader
export default fakeChildProcess;

Translations

Translations are managed using i18n json files in src/translations/. To make it easier for translators to work, we created a script that allows to generate csv containing the english text (which is our reference) and another language translation. This will simplify identifying the missing translations. To do that, simply run :

yarn generate-translation-csv

You will then find your translations csv in the ./translations folder.

Once your translator filled the CSV, you can import it back. Assuming that the first column of the csv is the path, the second your reference language and the following columns the translated languages, you can do, for a file that contains french translation in the third column and german translation in the fourth:

yarn import-translation-csv ./translations/fr-de.csv fr de

CI

Pull requests

If you want to contribute, you must respect our linter specs. You can run yarn lint for compliance test.

You are welcome to open pull requests to add features to the project.

We are trying to improve our test coverage, so you are welcome to test the services you are adding.

Building/releasing the app.

First, prepare the build in production mode

yarn prepare-prod

Then you can package the app for the right platform:

yarn win32
yarn win64
yarn mac
yarn linux

Or you can prepare the build and build for all four platforms with one command:

yarn build-prod

Once built, production binaries are found in the dist folder, each in their corresponding platform's subfolder.

archifiltre's People

Contributors

cberthou avatar renovate-bot avatar renovate[bot] avatar jeanbaptisteassouad avatar emmanuelgautier1994 avatar alezco avatar tledoux avatar dependabot[bot] avatar douglasduteil avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.